n8n-nodes-ms-dataverse 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/README.md +134 -0
  2. package/dist/credentials/MicrosoftDataverseOAuth2Api.credentials.d.ts +11 -0
  3. package/dist/credentials/MicrosoftDataverseOAuth2Api.credentials.js +80 -0
  4. package/dist/credentials/MicrosoftDataverseOAuth2Api.credentials.js.map +1 -0
  5. package/dist/nodes/MicrosoftDataverse/GenericFunctions.d.ts +12 -0
  6. package/dist/nodes/MicrosoftDataverse/GenericFunctions.js +101 -0
  7. package/dist/nodes/MicrosoftDataverse/GenericFunctions.js.map +1 -0
  8. package/dist/nodes/MicrosoftDataverse/MicrosoftDataverse.node.d.ts +11 -0
  9. package/dist/nodes/MicrosoftDataverse/MicrosoftDataverse.node.js +118 -0
  10. package/dist/nodes/MicrosoftDataverse/MicrosoftDataverse.node.js.map +1 -0
  11. package/dist/nodes/MicrosoftDataverse/MicrosoftDataverse.node.json +19 -0
  12. package/dist/nodes/MicrosoftDataverse/dataverse.svg +8 -0
  13. package/dist/nodes/MicrosoftDataverse/descriptions.d.ts +8 -0
  14. package/dist/nodes/MicrosoftDataverse/descriptions.js +386 -0
  15. package/dist/nodes/MicrosoftDataverse/descriptions.js.map +1 -0
  16. package/dist/nodes/MicrosoftDataverse/operations/RecordOperations.d.ts +6 -0
  17. package/dist/nodes/MicrosoftDataverse/operations/RecordOperations.js +77 -0
  18. package/dist/nodes/MicrosoftDataverse/operations/RecordOperations.js.map +1 -0
  19. package/dist/nodes/MicrosoftDataverse/types.d.ts +35 -0
  20. package/dist/nodes/MicrosoftDataverse/types.js +3 -0
  21. package/dist/nodes/MicrosoftDataverse/types.js.map +1 -0
  22. package/dist/package.json +54 -0
  23. package/dist/tsconfig.tsbuildinfo +1 -0
  24. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # n8n-nodes-ms-dataverse
2
+
3
+ This is an n8n community node that lets you interact with Microsoft Dataverse (Power Platform) in your n8n workflows.
4
+
5
+ Microsoft Dataverse is a cloud-based data storage service that provides a secure and scalable way to store and manage business data. It's the underlying data platform for Power Apps, Power Automate, and Dynamics 365.
6
+
7
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
8
+
9
+ [Installation](#installation)
10
+ [Operations](#operations)
11
+ [Credentials](#credentials)
12
+ [Compatibility](#compatibility)
13
+ [Usage](#usage)
14
+ [Resources](#resources)
15
+
16
+ ## Installation
17
+
18
+ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
19
+
20
+ ### Community Node Installation
21
+
22
+ 1. Go to **Settings > Community Nodes** in your n8n instance
23
+ 2. Select **Install**
24
+ 3. Enter `n8n-nodes-ms-dataverse` in the **Enter npm package name** field
25
+ 4. Agree to the risks and select **Install**
26
+
27
+ ## Operations
28
+
29
+ This node supports the following operations on Dataverse records:
30
+
31
+ ### Record Operations
32
+
33
+ - **Create**: Create a new record in a table
34
+ - **Delete**: Delete a record by ID
35
+ - **Get**: Retrieve a single record by ID or alternate key
36
+ - **Get Many**: Retrieve multiple records using OData queries or FetchXML
37
+ - **Update**: Update an existing record
38
+
39
+ ### Features
40
+
41
+ - **Dynamic Table Discovery**: Automatically loads available tables from your Dataverse environment using the OData metadata endpoint
42
+ - **OData Support**: Use OData query syntax for filtering, sorting, and selecting fields
43
+ - **FetchXML Support**: Execute complex queries using FetchXML
44
+ - **Alternate Keys**: Retrieve records using alternate keys instead of GUIDs
45
+ - **Field Selection**: Choose specific fields to return in queries
46
+
47
+ ## Credentials
48
+
49
+ This node uses Microsoft OAuth2 authentication to connect to Dataverse.
50
+
51
+ ### Prerequisites
52
+
53
+ 1. A Microsoft Dataverse environment (part of Power Platform or Dynamics 365)
54
+ 2. An Azure AD app registration with appropriate permissions
55
+
56
+ ### Setting up Azure AD App Registration
57
+
58
+ 1. Go to the [Azure Portal](https://portal.azure.com)
59
+ 2. Navigate to **Azure Active Directory > App registrations**
60
+ 3. Click **New registration**
61
+ 4. Enter a name (e.g., "n8n Dataverse Integration")
62
+ 5. Set **Redirect URI** to: `https://your-n8n-instance.com/rest/oauth2-credential/callback`
63
+ 6. Click **Register**
64
+ 7. Note the **Application (client) ID**
65
+ 8. Go to **Certificates & secrets** and create a new client secret
66
+ 9. Note the secret value (you won't be able to see it again)
67
+ 10. Go to **API permissions** and add:
68
+ - **Dynamics CRM > user_impersonation** (Delegated)
69
+ 11. Grant admin consent if required
70
+
71
+ ### Configuring Credentials in n8n
72
+
73
+ 1. In n8n, create new credentials of type **Microsoft Dataverse OAuth2 API**
74
+ 2. Enter your **Environment URL** (e.g., `https://yourorg.crm.dynamics.com`)
75
+ 3. Enter the **Client ID** from your Azure app registration
76
+ 4. Enter the **Client Secret** from your Azure app registration
77
+ 5. Click **Connect my account** and authorize the application
78
+ 6. Test the connection
79
+
80
+ ## Compatibility
81
+
82
+ - Minimum n8n version: 1.0.0
83
+ - Tested with n8n version: 1.0.0+
84
+ - Dataverse API version: 9.2
85
+
86
+ ## Usage
87
+
88
+ ### Creating a Record
89
+
90
+ 1. Select **Create** operation
91
+ 2. Choose your table from the dropdown (or enter manually)
92
+ 3. Add fields and their values
93
+ 4. Execute the workflow
94
+
95
+ ### Retrieving Records with OData
96
+
97
+ 1. Select **Get Many** operation
98
+ 2. Choose **OData** as query type
99
+ 3. Use the filter field to add OData filters (e.g., `name eq 'Contoso'`)
100
+ 4. Optionally add ordering and field selection
101
+ 5. Set the limit for maximum records to return
102
+
103
+ ### Retrieving Records with FetchXML
104
+
105
+ 1. Select **Get Many** operation
106
+ 2. Choose **FetchXML** as query type
107
+ 3. Enter your complete FetchXML query
108
+ 4. Execute the workflow
109
+
110
+ ### Using Alternate Keys
111
+
112
+ 1. Select **Get** operation
113
+ 2. Choose **Alternate Key** as Record ID Type
114
+ 3. Add your alternate key name-value pairs
115
+ 4. Execute the workflow
116
+
117
+ ### Example: Get Account by Email
118
+
119
+ ```
120
+ Operation: Get
121
+ Table: accounts
122
+ Record ID Type: Alternate Key
123
+ Alternate Keys:
124
+ - Key Name: emailaddress1
125
+ - Key Value: contact@example.com
126
+ ```
127
+
128
+ ## Resources
129
+
130
+ - [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
131
+ - [Microsoft Dataverse Web API Reference](https://docs.microsoft.com/en-us/power-apps/developer/data-platform/webapi/overview)
132
+ - [OData Query Options](https://docs.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query-data-web-api)
133
+ - [FetchXML Reference](https://docs.microsoft.com/en-us/power-apps/developer/data-platform/fetchxml/overview)
134
+ - [Authenticate with OAuth](https://docs.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-oauth)
@@ -0,0 +1,11 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class MicrosoftDataverseOAuth2Api implements ICredentialType {
3
+ name: string;
4
+ extends: string[];
5
+ displayName: string;
6
+ icon: "file:microsoft.svg";
7
+ documentationUrl: string;
8
+ properties: INodeProperties[];
9
+ authenticate: IAuthenticateGeneric;
10
+ test: ICredentialTestRequest;
11
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MicrosoftDataverseOAuth2Api = void 0;
4
+ class MicrosoftDataverseOAuth2Api {
5
+ constructor() {
6
+ this.name = 'microsoftDataverseOAuth2Api';
7
+ this.extends = ['microsoftOAuth2Api'];
8
+ this.displayName = 'Microsoft Dataverse OAuth2 API';
9
+ this.icon = 'file:microsoft.svg';
10
+ this.documentationUrl = 'https://docs.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-oauth';
11
+ this.properties = [
12
+ {
13
+ displayName: 'Environment URL',
14
+ name: 'environmentUrl',
15
+ type: 'string',
16
+ default: '',
17
+ placeholder: 'https://org.crm.dynamics.com',
18
+ description: 'The URL of your Dataverse environment (e.g., https://yourorg.crm.dynamics.com)',
19
+ required: true,
20
+ },
21
+ {
22
+ displayName: 'Grant Type',
23
+ name: 'grantType',
24
+ type: 'hidden',
25
+ default: 'authorizationCode',
26
+ },
27
+ {
28
+ displayName: 'Authorization URL',
29
+ name: 'authUrl',
30
+ type: 'hidden',
31
+ default: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
32
+ required: true,
33
+ },
34
+ {
35
+ displayName: 'Access Token URL',
36
+ name: 'accessTokenUrl',
37
+ type: 'hidden',
38
+ default: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
39
+ required: true,
40
+ },
41
+ {
42
+ displayName: 'Scope',
43
+ name: 'scope',
44
+ type: 'hidden',
45
+ default: '={{$self["environmentUrl"]}}/.default offline_access',
46
+ },
47
+ {
48
+ displayName: 'Auth URI Query Parameters',
49
+ name: 'authQueryParameters',
50
+ type: 'hidden',
51
+ default: 'response_mode=query',
52
+ },
53
+ {
54
+ displayName: 'Authentication',
55
+ name: 'authentication',
56
+ type: 'hidden',
57
+ default: 'body',
58
+ },
59
+ ];
60
+ this.authenticate = {
61
+ type: 'generic',
62
+ properties: {
63
+ headers: {
64
+ Accept: 'application/json',
65
+ 'Content-Type': 'application/json',
66
+ Prefer: 'return=representation',
67
+ },
68
+ },
69
+ };
70
+ this.test = {
71
+ request: {
72
+ baseURL: '={{$credentials.environmentUrl}}',
73
+ url: '/api/data/v9.2/WhoAmI',
74
+ method: 'GET',
75
+ },
76
+ };
77
+ }
78
+ }
79
+ exports.MicrosoftDataverseOAuth2Api = MicrosoftDataverseOAuth2Api;
80
+ //# sourceMappingURL=MicrosoftDataverseOAuth2Api.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MicrosoftDataverseOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/MicrosoftDataverseOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,2BAA2B;IAAxC;QACC,SAAI,GAAG,6BAA6B,CAA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kB;oBAC1B,cAAc,EAAE,kBAAkB;oBAClC,MAAM,EAAE,uBAAuB;iBAC/B;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,kCAAkC;gBAC3C,GAAG,EAAE,uBAAuB;gBAC5B,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AA/ED,kEA+EC"}
@@ -0,0 +1,12 @@
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, IDataObject, IHttpRequestMethods, INodeListSearchResult } from 'n8n-workflow';
2
+ export declare function dataverseApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<IDataObject>;
3
+ export declare function searchTables(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
4
+ export declare function buildRecordIdentifier(recordIdType: string, recordId?: string, alternateKeys?: Array<{
5
+ name: string;
6
+ value: string;
7
+ }>): string;
8
+ export declare function fieldsToObject(fields: Array<{
9
+ name: string;
10
+ value: string;
11
+ }>): IDataObject;
12
+ export declare function buildODataQuery(filter?: string, orderBy?: string, selectFields?: string, limit?: number): IDataObject;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataverseApiRequest = dataverseApiRequest;
4
+ exports.searchTables = searchTables;
5
+ exports.buildRecordIdentifier = buildRecordIdentifier;
6
+ exports.fieldsToObject = fieldsToObject;
7
+ exports.buildODataQuery = buildODataQuery;
8
+ const n8n_workflow_1 = require("n8n-workflow");
9
+ async function dataverseApiRequest(method, endpoint, body, qs) {
10
+ const credentials = await this.getCredentials('microsoftDataverseOAuth2Api');
11
+ const environmentUrl = credentials.environmentUrl;
12
+ const options = {
13
+ method,
14
+ url: `${environmentUrl}/api/data/v9.2${endpoint}`,
15
+ headers: {
16
+ Accept: 'application/json',
17
+ 'Content-Type': 'application/json',
18
+ },
19
+ qs,
20
+ body,
21
+ json: true,
22
+ };
23
+ if (method === 'POST' || method === 'PATCH') {
24
+ options.headers.Prefer = 'return=representation';
25
+ }
26
+ try {
27
+ return await this.helpers.httpRequestWithAuthentication.call(this, 'microsoftDataverseOAuth2Api', options);
28
+ }
29
+ catch (error) {
30
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
31
+ }
32
+ }
33
+ async function searchTables(filter) {
34
+ var _a, _b;
35
+ const returnData = [];
36
+ try {
37
+ const response = (await dataverseApiRequest.call(this, 'GET', '/EntityDefinitions', undefined, {
38
+ $select: 'LogicalName,EntitySetName,DisplayName',
39
+ $filter: 'IsValidForAdvancedFind eq true',
40
+ }));
41
+ const entities = (response.value || []);
42
+ for (const entity of entities) {
43
+ const name = ((_b = (_a = entity.DisplayName) === null || _a === void 0 ? void 0 : _a.UserLocalizedLabel) === null || _b === void 0 ? void 0 : _b.Label) || entity.LogicalName;
44
+ const value = entity.EntitySetName || entity.LogicalName;
45
+ if (filter) {
46
+ if (name.toLowerCase().includes(filter.toLowerCase()) ||
47
+ value.toLowerCase().includes(filter.toLowerCase())) {
48
+ returnData.push({ name, value });
49
+ }
50
+ }
51
+ else {
52
+ returnData.push({ name, value });
53
+ }
54
+ }
55
+ returnData.sort((a, b) => {
56
+ if (a.name < b.name)
57
+ return -1;
58
+ if (a.name > b.name)
59
+ return 1;
60
+ return 0;
61
+ });
62
+ return { results: returnData };
63
+ }
64
+ catch (error) {
65
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to load tables: ${error.message}`);
66
+ }
67
+ }
68
+ function buildRecordIdentifier(recordIdType, recordId, alternateKeys) {
69
+ if (recordIdType === 'id' && recordId) {
70
+ return recordId;
71
+ }
72
+ if (recordIdType === 'alternateKey' && alternateKeys) {
73
+ const keyPairs = alternateKeys.map((key) => `${key.name}='${key.value}'`);
74
+ return keyPairs.join(',');
75
+ }
76
+ throw new Error('Invalid record identifier configuration');
77
+ }
78
+ function fieldsToObject(fields) {
79
+ const body = {};
80
+ for (const field of fields) {
81
+ body[field.name] = field.value;
82
+ }
83
+ return body;
84
+ }
85
+ function buildODataQuery(filter, orderBy, selectFields, limit) {
86
+ const qs = {};
87
+ if (filter) {
88
+ qs.$filter = filter;
89
+ }
90
+ if (orderBy) {
91
+ qs.$orderby = orderBy;
92
+ }
93
+ if (selectFields) {
94
+ qs.$select = selectFields;
95
+ }
96
+ if (limit) {
97
+ qs.$top = limit;
98
+ }
99
+ return qs;
100
+ }
101
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/MicrosoftDataverse/GenericFunctions.ts"],"names":[],"mappings":";;AAeA,kDAmCC;AAKD,oCA8CC;AAKD,sDAeC;AAKD,wCAMC;AAKD,0CAsBC;AAtJD,+CAAkD;AAM3C,KAAK,UAAU,mBAAmB,CAExC,MAA2B,EAC3B,QAAgB,EAChB,IAAkB,EAClB,EAAgB;IAEhB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,6BAA6B,CAAC,CAAC;IAC7E,MAAM,cAAc,GAAG,WAAW,CAAC,cAAwB,CAAC;IAE5D,MAAM,OAAO,GAAwB;QACpC,MAAM;QACN,GAAG,EAAE,GAAG,cAAc,iBAAiB,QAAQ,EAAE;QACjD,OAAO,EAAE;YACR,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;SAClC;QACD,EAAE;QACF,IAAI;QACJ,IAAI,EAAE,IAAI;KACV,CAAC;IAEF,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QAC7C,OAAO,CAAC,OAAQ,CAAC,MAAM,GAAG,uBAAuB,CAAC;IACnD,CAAC;IAED,IAAI,CAAC;QACJ,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAC3D,IAAI,EACJ,6BAA6B,EAC7B,OAAO,CACP,CAAC;IACH,CA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E,GAAgB,EAAE,CAAC;IAE3B,IAAI,MAAM,EAAE,CAAC;QACZ,EAAE,CAAC,OAAO,GAAG,MAAM,CAAC;IACrB,CAAC;IACD,IAAI,OAAO,EAAE,CAAC;QACb,EAAE,CAAC,QAAQ,GAAG,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,YAAY,EAAE,CAAC;QAClB,EAAE,CAAC,OAAO,GAAG,YAAY,CAAC;IAC3B,CAAC;IACD,IAAI,KAAK,EAAE,CAAC;QACX,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,EAAE,CAAC;AACX,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ import { searchTables } from './GenericFunctions';
3
+ export declare class MicrosoftDataverse implements INodeType {
4
+ description: INodeTypeDescription;
5
+ methods: {
6
+ listSearch: {
7
+ searchTables: typeof searchTables;
8
+ };
9
+ };
10
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
11
+ }
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MicrosoftDataverse = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const GenericFunctions_1 = require("./GenericFunctions");
6
+ const descriptions_1 = require("./descriptions");
7
+ const RecordOperations_1 = require("./operations/RecordOperations");
8
+ class MicrosoftDataverse {
9
+ constructor() {
10
+ this.description = {
11
+ displayName: 'Microsoft Dataverse',
12
+ name: 'microsoftDataverse',
13
+ icon: 'file:dataverse.svg',
14
+ group: ['transform'],
15
+ version: 1,
16
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
17
+ description: 'Interact with Microsoft Dataverse (Power Platform)',
18
+ defaults: {
19
+ name: 'Microsoft Dataverse',
20
+ },
21
+ inputs: ['main'],
22
+ outputs: ['main'],
23
+ usableAsTool: true,
24
+ credentials: [
25
+ {
26
+ name: 'microsoftDataverseOAuth2Api',
27
+ required: true,
28
+ },
29
+ ],
30
+ requestDefaults: {
31
+ baseURL: '={{$credentials.environmentUrl}}',
32
+ headers: {
33
+ Accept: 'application/json',
34
+ 'Content-Type': 'application/json',
35
+ },
36
+ },
37
+ properties: [
38
+ descriptions_1.resourceDescription,
39
+ descriptions_1.operationDescription,
40
+ descriptions_1.tableDescription,
41
+ ...descriptions_1.createOperationFields,
42
+ ...descriptions_1.getOperationFields,
43
+ ...descriptions_1.updateOperationFields,
44
+ ...descriptions_1.getManyOperationFields,
45
+ ],
46
+ };
47
+ this.methods = {
48
+ listSearch: {
49
+ searchTables: GenericFunctions_1.searchTables,
50
+ },
51
+ };
52
+ }
53
+ async execute() {
54
+ const items = this.getInputData();
55
+ const returnData = [];
56
+ const resource = this.getNodeParameter('resource', 0);
57
+ const operation = this.getNodeParameter('operation', 0);
58
+ for (let i = 0; i < items.length; i++) {
59
+ try {
60
+ if (resource === 'record') {
61
+ const table = this.getNodeParameter('table', i, '', { extractValue: true });
62
+ let result;
63
+ switch (operation) {
64
+ case 'create': {
65
+ const createResult = await RecordOperations_1.createRecord.call(this, table, i);
66
+ result = { json: createResult, pairedItem: { item: i } };
67
+ break;
68
+ }
69
+ case 'get': {
70
+ const getResult = await RecordOperations_1.getRecord.call(this, table, i);
71
+ result = { json: getResult, pairedItem: { item: i } };
72
+ break;
73
+ }
74
+ case 'getMany': {
75
+ result = await RecordOperations_1.getManyRecords.call(this, table, i);
76
+ break;
77
+ }
78
+ case 'update': {
79
+ const updateResult = await RecordOperations_1.updateRecord.call(this, table, i);
80
+ result = { json: updateResult, pairedItem: { item: i } };
81
+ break;
82
+ }
83
+ case 'delete': {
84
+ const deleteResult = await RecordOperations_1.deleteRecord.call(this, table, i);
85
+ result = { json: deleteResult, pairedItem: { item: i } };
86
+ break;
87
+ }
88
+ default:
89
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not supported`);
90
+ }
91
+ if (Array.isArray(result)) {
92
+ returnData.push(...result);
93
+ }
94
+ else {
95
+ returnData.push(result);
96
+ }
97
+ }
98
+ }
99
+ catch (error) {
100
+ if (this.continueOnFail()) {
101
+ returnData.push({
102
+ json: {
103
+ error: error.message,
104
+ },
105
+ pairedItem: { item: i },
106
+ });
107
+ continue;
108
+ }
109
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
110
+ itemIndex: i,
111
+ });
112
+ }
113
+ }
114
+ return [returnData];
115
+ }
116
+ }
117
+ exports.MicrosoftDataverse = MicrosoftDataverse;
118
+ //# sourceMappingURL=MicrosoftDataverse.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MicrosoftDataverse.node.js","sourceRoot":"","sources":["../../../nodes/MicrosoftDataverse/MicrosoftDataverse.node.ts"],"names":[],"mappings":";;;AAMA,+CAAkD;AAElD,yDAAkD;AAClD,iDAQwB;AACxB,oEAMuC;AAGvC,MAAa,kBAAkB;IAA/B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE;gBACT,IAAI,EAAE,qBAAqB;aAC3B;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,6BAA6B;oBACnC,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,eAAe,EAAE;gBAChB,OAAO,EAAE,kCAAkC;gBAC3C,OAAO,EAAE;oBACR,MAAM,EAAE,kBAAkB;oBAC1B,cAAc,EAAE,kBAAkB;iBAClC;aACD;YACD,UAAU,EAAE;gBACX,kCAAmB;gBACnB,mCAAoB;gBACpB,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AE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE;4BACL,KAAK,EAAE,KAAK,CAAC,OAAO;yBACpB;wBACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE;oBACnD,SAAS,EAAE,CAAC;iBACZ,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAtHD,gDAsHC"}
@@ -0,0 +1,19 @@
1
+ {
2
+ "node": "n8n-nodes-ms-dataverse.microsoftDataverse",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Data & Storage", "Productivity"],
6
+ "resources": {
7
+ "credentialDocumentation": [
8
+ {
9
+ "url": "https://docs.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-oauth"
10
+ }
11
+ ],
12
+ "primaryDocumentation": [
13
+ {
14
+ "url": "https://docs.microsoft.com/en-us/power-apps/developer/data-platform/webapi/overview"
15
+ }
16
+ ]
17
+ },
18
+ "alias": ["Power Platform", "Dynamics 365", "Common Data Service"]
19
+ }
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
+ <rect width="64" height="64" rx="8" fill="#742774"/>
3
+ <path d="M16 20h32v4H16zm0 8h32v4H16zm0 8h32v4H16zm0 8h32v4H16z" fill="#fff"/>
4
+ <circle cx="20" cy="22" r="1.5" fill="#742774"/>
5
+ <circle cx="20" cy="30" r="1.5" fill="#742774"/>
6
+ <circle cx="20" cy="38" r="1.5" fill="#742774"/>
7
+ <circle cx="20" cy="46" r="1.5" fill="#742774"/>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const resourceDescription: INodeProperties;
3
+ export declare const operationDescription: INodeProperties;
4
+ export declare const tableDescription: INodeProperties;
5
+ export declare const createOperationFields: INodeProperties[];
6
+ export declare const getOperationFields: INodeProperties[];
7
+ export declare const updateOperationFields: INodeProperties[];
8
+ export declare const getManyOperationFields: INodeProperties[];