diff --git a/packages/pieces/community/microsoft-excel-365/package.json b/packages/pieces/community/microsoft-excel-365/package.json index d308e050b4f..5d43c515123 100644 --- a/packages/pieces/community/microsoft-excel-365/package.json +++ b/packages/pieces/community/microsoft-excel-365/package.json @@ -1,6 +1,6 @@ { "name": "@activepieces/piece-microsoft-excel-365", - "version": "0.3.3", + "version": "0.3.4", "dependencies": { "@microsoft/microsoft-graph-client": "3.0.7", "@microsoft/microsoft-graph-types": "2.40.0" diff --git a/packages/pieces/community/microsoft-excel-365/src/index.ts b/packages/pieces/community/microsoft-excel-365/src/index.ts index d2534669c39..aff48d2a0c1 100644 --- a/packages/pieces/community/microsoft-excel-365/src/index.ts +++ b/packages/pieces/community/microsoft-excel-365/src/index.ts @@ -43,6 +43,7 @@ import { updatedRowTrigger } from './lib/trigger/updated-row'; import { appendMultipleRowsAction } from './lib/actions/append-multiple-rows'; import { excelCommon } from './lib/common/common'; import { getWorksheetColumnsAction } from './lib/actions/get-wroksheet-columns'; +import { findWorkbookAction } from './lib/actions/find-workbooks'; const authDesc = ` 1. Sign in to [Microsoft Azure Portal](https://portal.azure.com/). @@ -113,6 +114,7 @@ export const microsoftExcel = createPiece({ clearRowAction, createWorksheetAction, findRowAction, + findWorkbookAction, getRangeAction, getRowAction, getWorksheetAction, diff --git a/packages/pieces/community/microsoft-excel-365/src/lib/actions/find-workbooks.ts b/packages/pieces/community/microsoft-excel-365/src/lib/actions/find-workbooks.ts new file mode 100644 index 00000000000..4bb38de3863 --- /dev/null +++ b/packages/pieces/community/microsoft-excel-365/src/lib/actions/find-workbooks.ts @@ -0,0 +1,44 @@ +import { excelAuth } from '../../index'; +import { createAction, Property } from "@activepieces/pieces-framework"; +import { excelCommon } from '../common/common'; +import { AuthenticationType, httpClient, HttpMethod, HttpRequest } from '@activepieces/pieces-common'; + +export const findWorkbookAction = createAction({ + auth: excelAuth, + name: 'find-workbook', + displayName: 'Find Workbook', + description: 'Finds an existing workbook by name.', + props: { + fileName: Property.ShortText({ + displayName: 'File Name', + description: 'Excel File name to search for without extension.', + required: true + }) + }, + async run(context) { + const { fileName } = context.propsValue; + const fileNameWithExtension = fileName.endsWith('.xlsx') ? fileName : `${fileName}.xlsx`; + + const request: HttpRequest = { + method: HttpMethod.GET, + url: `${excelCommon.baseUrl}/items/root/search(q='.xlsx')?$select=id,name,lastModifiedDateTime,parentReference`, + authentication: { + type: AuthenticationType.BEARER_TOKEN, + token: context.auth.access_token + } + } + + const response = await httpClient.sendRequest<{ value: Array<{ id: string, name: string }> }>(request); + + const result = response.body.value.filter(item => item.name === fileNameWithExtension); + + + + return { + found: result.length > 0, + data: result + } + + + } +}) \ No newline at end of file diff --git a/packages/server/api/src/app/tables/field/field.controller.ts b/packages/server/api/src/app/tables/field/field.controller.ts index 1e646ae1e1d..8a1e8ded5e7 100644 --- a/packages/server/api/src/app/tables/field/field.controller.ts +++ b/packages/server/api/src/app/tables/field/field.controller.ts @@ -49,7 +49,7 @@ export const fieldController: FastifyPluginAsyncTypebox = async (fastify) => { } const CreateRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], undefined, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], undefined, { type: ProjectResourceType.TABLE, tableName: TableEntity, entitySourceType: EntitySourceType.BODY, @@ -69,7 +69,7 @@ const CreateRequest = { const GetFieldByIdRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], undefined, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], undefined, { type: ProjectResourceType.TABLE, tableName: FieldEntity, }), @@ -97,7 +97,7 @@ const DeleteFieldRequest = { const GetFieldsRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], undefined, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], undefined, { type: ProjectResourceType.TABLE, tableName: TableEntity, entitySourceType: EntitySourceType.QUERY, @@ -114,7 +114,7 @@ const GetFieldsRequest = { const UpdateRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], undefined, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], undefined, { type: ProjectResourceType.TABLE, tableName: FieldEntity, }), diff --git a/packages/server/api/src/app/tables/record/record.controller.ts b/packages/server/api/src/app/tables/record/record.controller.ts index ad24fde308a..3eaec3c12c4 100644 --- a/packages/server/api/src/app/tables/record/record.controller.ts +++ b/packages/server/api/src/app/tables/record/record.controller.ts @@ -94,7 +94,7 @@ export const recordController: FastifyPluginAsyncTypebox = async (fastify) => { const CreateRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], undefined, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], undefined, { type: ProjectResourceType.TABLE, tableName: TableEntity, entitySourceType: EntitySourceType.BODY, @@ -114,7 +114,7 @@ const CreateRequest = { const GetRecordByIdRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], undefined, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], undefined, { type: ProjectResourceType.TABLE, tableName: RecordEntity, }), @@ -132,7 +132,7 @@ const GetRecordByIdRequest = { const UpdateRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.WRITE_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.WRITE_TABLE, { type: ProjectResourceType.TABLE, tableName: RecordEntity, }), @@ -154,7 +154,7 @@ const UpdateRequest = { const DeleteRecordRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.WRITE_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.WRITE_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity, entitySourceType: EntitySourceType.BODY, @@ -177,7 +177,7 @@ const DeleteRecordRequest = { const ListRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.READ_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.READ_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity, entitySourceType: EntitySourceType.QUERY, diff --git a/packages/server/api/src/app/tables/table/table.controller.ts b/packages/server/api/src/app/tables/table/table.controller.ts index 34c09aa1061..1443a368ce2 100644 --- a/packages/server/api/src/app/tables/table/table.controller.ts +++ b/packages/server/api/src/app/tables/table/table.controller.ts @@ -120,7 +120,7 @@ export const tablesController: FastifyPluginAsyncTypebox = async (fastify) => { const CreateRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.WRITE_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.WRITE_TABLE, { type: ProjectResourceType.BODY, }), }, @@ -134,7 +134,7 @@ const CreateRequest = { const GetTablesRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.READ_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.READ_TABLE, { type: ProjectResourceType.QUERY, }), }, @@ -151,7 +151,7 @@ const GetTablesRequest = { const DeleteRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.WRITE_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.WRITE_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity, }), @@ -172,7 +172,7 @@ const DeleteRequest = { const GetTableByIdRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.READ_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.READ_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity, }), @@ -192,7 +192,7 @@ const GetTableByIdRequest = { const ExportTableRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.READ_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.READ_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity, }), @@ -212,7 +212,7 @@ const ExportTableRequest = { const CreateTableWebhook = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.WRITE_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.WRITE_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity, }), @@ -230,7 +230,7 @@ const CreateTableWebhook = { const DeleteTableWebhook = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.WRITE_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.WRITE_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity, }), @@ -248,7 +248,7 @@ const DeleteTableWebhook = { const UpdateRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.WRITE_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.WRITE_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity, }), @@ -266,7 +266,7 @@ const UpdateRequest = { const ClearTableRequest = { config: { - security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE], Permission.WRITE_TABLE, { + security: securityAccess.project([PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.WRITE_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity, }), @@ -287,7 +287,7 @@ const ClearTableRequest = { const GetTableTemplateRequestOptions = { config: { security: securityAccess.project( - [PrincipalType.USER, PrincipalType.SERVICE], + [PrincipalType.USER, PrincipalType.ENGINE, PrincipalType.SERVICE], Permission.READ_TABLE, { type: ProjectResourceType.TABLE, tableName: TableEntity,