@lilremark/n8n-nodes-twenty-dynamic 2.2.10

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 (64) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +290 -0
  3. package/dist/credentials/TwentyApi.credentials.d.ts +8 -0
  4. package/dist/credentials/TwentyApi.credentials.js +49 -0
  5. package/dist/credentials/TwentyApi.credentials.js.map +1 -0
  6. package/dist/nodes/Twenty/ComplexFieldDetection.d.ts +8 -0
  7. package/dist/nodes/Twenty/ComplexFieldDetection.js +27 -0
  8. package/dist/nodes/Twenty/ComplexFieldDetection.js.map +1 -0
  9. package/dist/nodes/Twenty/FieldParameters.d.ts +11 -0
  10. package/dist/nodes/Twenty/FieldParameters.js +211 -0
  11. package/dist/nodes/Twenty/FieldParameters.js.map +1 -0
  12. package/dist/nodes/Twenty/FieldTransformation.d.ts +30 -0
  13. package/dist/nodes/Twenty/FieldTransformation.js +168 -0
  14. package/dist/nodes/Twenty/FieldTransformation.js.map +1 -0
  15. package/dist/nodes/Twenty/Twenty.node.d.ts +22 -0
  16. package/dist/nodes/Twenty/Twenty.node.js +1629 -0
  17. package/dist/nodes/Twenty/Twenty.node.js.map +1 -0
  18. package/dist/nodes/Twenty/Twenty.node.json +30 -0
  19. package/dist/nodes/Twenty/TwentyApi.client.d.ts +82 -0
  20. package/dist/nodes/Twenty/TwentyApi.client.js +654 -0
  21. package/dist/nodes/Twenty/TwentyApi.client.js.map +1 -0
  22. package/dist/nodes/Twenty/introspection/fieldIntrospection.d.ts +15 -0
  23. package/dist/nodes/Twenty/introspection/fieldIntrospection.js +135 -0
  24. package/dist/nodes/Twenty/introspection/fieldIntrospection.js.map +1 -0
  25. package/dist/nodes/Twenty/operations/create.operation.d.ts +7 -0
  26. package/dist/nodes/Twenty/operations/create.operation.js +20 -0
  27. package/dist/nodes/Twenty/operations/create.operation.js.map +1 -0
  28. package/dist/nodes/Twenty/operations/createMany.operation.d.ts +11 -0
  29. package/dist/nodes/Twenty/operations/createMany.operation.js +72 -0
  30. package/dist/nodes/Twenty/operations/createMany.operation.js.map +1 -0
  31. package/dist/nodes/Twenty/operations/delete.operation.d.ts +7 -0
  32. package/dist/nodes/Twenty/operations/delete.operation.js +18 -0
  33. package/dist/nodes/Twenty/operations/delete.operation.js.map +1 -0
  34. package/dist/nodes/Twenty/operations/deleteMany.operation.d.ts +7 -0
  35. package/dist/nodes/Twenty/operations/deleteMany.operation.js +39 -0
  36. package/dist/nodes/Twenty/operations/deleteMany.operation.js.map +1 -0
  37. package/dist/nodes/Twenty/operations/get.operation.d.ts +7 -0
  38. package/dist/nodes/Twenty/operations/get.operation.js +25 -0
  39. package/dist/nodes/Twenty/operations/get.operation.js.map +1 -0
  40. package/dist/nodes/Twenty/operations/getMany.operation.d.ts +8 -0
  41. package/dist/nodes/Twenty/operations/getMany.operation.js +37 -0
  42. package/dist/nodes/Twenty/operations/getMany.operation.js.map +1 -0
  43. package/dist/nodes/Twenty/operations/index.d.ts +11 -0
  44. package/dist/nodes/Twenty/operations/index.js +26 -0
  45. package/dist/nodes/Twenty/operations/index.js.map +1 -0
  46. package/dist/nodes/Twenty/operations/list.operation.d.ts +7 -0
  47. package/dist/nodes/Twenty/operations/list.operation.js +25 -0
  48. package/dist/nodes/Twenty/operations/list.operation.js.map +1 -0
  49. package/dist/nodes/Twenty/operations/update.operation.d.ts +7 -0
  50. package/dist/nodes/Twenty/operations/update.operation.js +21 -0
  51. package/dist/nodes/Twenty/operations/update.operation.js.map +1 -0
  52. package/dist/nodes/Twenty/operations/updateMany.operation.d.ts +19 -0
  53. package/dist/nodes/Twenty/operations/updateMany.operation.js +75 -0
  54. package/dist/nodes/Twenty/operations/updateMany.operation.js.map +1 -0
  55. package/dist/nodes/Twenty/operations/upsert.operation.d.ts +12 -0
  56. package/dist/nodes/Twenty/operations/upsert.operation.js +122 -0
  57. package/dist/nodes/Twenty/operations/upsert.operation.js.map +1 -0
  58. package/dist/nodes/Twenty/operations/upsertMany.operation.d.ts +13 -0
  59. package/dist/nodes/Twenty/operations/upsertMany.operation.js +120 -0
  60. package/dist/nodes/Twenty/operations/upsertMany.operation.js.map +1 -0
  61. package/dist/nodes/Twenty/twenty.svg +12 -0
  62. package/dist/package.json +81 -0
  63. package/dist/tsconfig.tsbuildinfo +1 -0
  64. package/package.json +81 -0
@@ -0,0 +1,15 @@
1
+ import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow';
2
+ type TwentyApiContext = IExecuteFunctions | ILoadOptionsFunctions;
3
+ export interface IGraphQLField {
4
+ name: string;
5
+ typeName: string;
6
+ typeKind: string;
7
+ isConnection: boolean;
8
+ isScalar: boolean;
9
+ isEnum: boolean;
10
+ isObject: boolean;
11
+ }
12
+ export declare function introspectType(context: TwentyApiContext, typeName: string): Promise<IGraphQLField[]>;
13
+ export declare function buildComprehensiveFieldSelections(context: TwentyApiContext, typeName: string): Promise<string>;
14
+ export declare function buildBasicFieldSelections(objectMetadata: any): string;
15
+ export {};
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.introspectType = introspectType;
4
+ exports.buildComprehensiveFieldSelections = buildComprehensiveFieldSelections;
5
+ exports.buildBasicFieldSelections = buildBasicFieldSelections;
6
+ const TwentyApi_client_1 = require("../TwentyApi.client");
7
+ const COMPLEX_TYPE_SUBFIELDS = {
8
+ 'Links': `primaryLinkUrl
9
+ primaryLinkLabel
10
+ secondaryLinks`,
11
+ 'Address': `addressStreet1
12
+ addressStreet2
13
+ addressCity
14
+ addressState
15
+ addressCountry
16
+ addressPostcode
17
+ addressLat
18
+ addressLng`,
19
+ 'Currency': `amountMicros
20
+ currencyCode`,
21
+ 'Actor': `source
22
+ workspaceMemberId
23
+ name`,
24
+ 'WorkspaceMember': `id
25
+ name {
26
+ firstName
27
+ lastName
28
+ }
29
+ userEmail`,
30
+ 'FullName': `firstName
31
+ lastName`,
32
+ 'Emails': `primaryEmail
33
+ additionalEmails`,
34
+ 'Phones': `primaryPhoneNumber
35
+ primaryPhoneCountryCode
36
+ primaryPhoneCallingCode
37
+ additionalPhones`,
38
+ 'RichText': `markdown
39
+ blocknote`,
40
+ };
41
+ async function introspectType(context, typeName) {
42
+ var _a;
43
+ const introspectionQuery = `
44
+ query IntrospectType {
45
+ __type(name: "${typeName}") {
46
+ name
47
+ fields {
48
+ name
49
+ type {
50
+ name
51
+ kind
52
+ ofType {
53
+ name
54
+ kind
55
+ ofType {
56
+ name
57
+ kind
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ `;
65
+ const response = await TwentyApi_client_1.twentyApiRequest.call(context, 'graphql', introspectionQuery);
66
+ if (!((_a = response.__type) === null || _a === void 0 ? void 0 : _a.fields)) {
67
+ return [];
68
+ }
69
+ const fields = [];
70
+ for (const field of response.__type.fields) {
71
+ if (field.name === '__typename')
72
+ continue;
73
+ const fieldType = field.type;
74
+ let currentType = fieldType;
75
+ let unwrappedType = currentType;
76
+ while (currentType && (currentType.kind === 'NON_NULL' || currentType.kind === 'LIST')) {
77
+ unwrappedType = currentType.ofType;
78
+ currentType = unwrappedType;
79
+ }
80
+ const typeName = (unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.name) || 'Unknown';
81
+ const typeKind = (unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) || 'Unknown';
82
+ const isConnection = (typeName === null || typeName === void 0 ? void 0 : typeName.endsWith('Connection')) || false;
83
+ const isScalar = typeKind === 'SCALAR' ||
84
+ ['ID', 'String', 'Int', 'Float', 'Boolean', 'DateTime', 'Date', 'Time', 'UUID'].includes(typeName);
85
+ const isEnum = typeKind === 'ENUM';
86
+ const isObject = (typeKind === 'OBJECT' || typeKind === 'INPUT_OBJECT') && !isConnection;
87
+ fields.push({
88
+ name: field.name,
89
+ typeName: typeName,
90
+ typeKind: typeKind,
91
+ isConnection,
92
+ isScalar,
93
+ isEnum,
94
+ isObject,
95
+ });
96
+ }
97
+ return fields;
98
+ }
99
+ async function buildComprehensiveFieldSelections(context, typeName) {
100
+ const fields = await introspectType(context, typeName);
101
+ if (fields.length === 0) {
102
+ const nameField = typeName === 'Person'
103
+ ? `name {\n\t\t\t\t\tfirstName\n\t\t\t\t\tlastName\n\t\t\t\t}`
104
+ : 'name';
105
+ return `id\n\t\t\t\tcreatedAt\n\t\t\t\tupdatedAt\n\t\t\t\tdeletedAt\n\t\t\t\t${nameField}`;
106
+ }
107
+ const fieldSelections = [];
108
+ for (const field of fields) {
109
+ if (field.isConnection)
110
+ continue;
111
+ if (field.isScalar || field.isEnum) {
112
+ fieldSelections.push(field.name);
113
+ }
114
+ else if (field.isObject && COMPLEX_TYPE_SUBFIELDS[field.typeName]) {
115
+ fieldSelections.push(`${field.name} {\n\t\t\t\t\t${COMPLEX_TYPE_SUBFIELDS[field.typeName]}\n\t\t\t\t}`);
116
+ }
117
+ }
118
+ return fieldSelections.join('\n\t\t\t\t');
119
+ }
120
+ function buildBasicFieldSelections(objectMetadata) {
121
+ const scalarTypes = ['TEXT', 'NUMBER', 'BOOLEAN', 'UUID', 'DATE_TIME', 'DATE', 'TIME', 'PHONE', 'EMAIL', 'SELECT', 'RAW_JSON'];
122
+ const metadataFields = objectMetadata.fields
123
+ .filter((field) => {
124
+ if (scalarTypes.includes(field.type))
125
+ return true;
126
+ if (field.name === 'id' || field.name.endsWith('Id'))
127
+ return true;
128
+ return false;
129
+ })
130
+ .map((field) => field.name);
131
+ const essentialFields = ['id', 'createdAt', 'updatedAt', 'deletedAt', 'name', 'position', 'searchVector'];
132
+ const allFields = [...new Set([...essentialFields, ...metadataFields])];
133
+ return allFields.join('\n\t\t\t\t');
134
+ }
135
+ //# sourceMappingURL=fieldIntrospection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldIntrospection.js","sourceRoot":"","sources":["../../../../nodes/Twenty/introspection/fieldIntrospection.ts"],"names":[],"mappings":";;AAgEA,wCA2EC;AAWD,8EAoC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AAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,eAAe,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow';
2
+ type TwentyApiContext = IExecuteFunctions | ILoadOptionsFunctions;
3
+ export declare function buildCreateMutation(context: TwentyApiContext, objectNameSingular: string, fieldsData: Record<string, any>, objectMetadata: any): Promise<{
4
+ query: string;
5
+ variables: Record<string, any>;
6
+ }>;
7
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildCreateMutation = buildCreateMutation;
4
+ const fieldIntrospection_1 = require("../introspection/fieldIntrospection");
5
+ async function buildCreateMutation(context, objectNameSingular, fieldsData, objectMetadata) {
6
+ const capitalizedObjectName = objectNameSingular.charAt(0).toUpperCase() + objectNameSingular.slice(1);
7
+ const fieldSelections = await (0, fieldIntrospection_1.buildComprehensiveFieldSelections)(context, capitalizedObjectName);
8
+ const query = `
9
+ mutation Create${objectMetadata.labelSingular.replace(/\s+/g, '')}($data: ${capitalizedObjectName}CreateInput!) {
10
+ create${capitalizedObjectName}(data: $data) {
11
+ ${fieldSelections}
12
+ }
13
+ }
14
+ `;
15
+ const variables = {
16
+ data: fieldsData,
17
+ };
18
+ return { query, variables };
19
+ }
20
+ //# sourceMappingURL=create.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.operation.js","sourceRoot":"","sources":["../../../../nodes/Twenty/operations/create.operation.ts"],"names":[],"mappings":";;AAeA,kDA2BC;AAzCD,4EAAwF;AAcjF,KAAK,UAAU,mBAAmB,CACxC,OAAyB,EACzB,kBAA0B,EAC1B,UAA+B,EAC/B,cAAmB;IAGnB,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAGvG,MAAM,eAAe,GAAG,MAAM,IAAA,sDAAiC,EAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAGhG,MAAM,KAAK,GAAG;mBACI,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,qBAAqB;WACxF,qBAAqB;MAC1B,eAAe;;;EAGnB,CAAC;IAGF,MAAM,SAAS,GAAG;QACjB,IAAI,EAAE,UAAU;KAChB,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function buildCreateManyMutations(context: IExecuteFunctions, objectNameSingular: string, recordsData: Array<Record<string, any>>, objectMetadata: any): Promise<Array<{
3
+ query: string;
4
+ variables: Record<string, any>;
5
+ }>>;
6
+ export declare function executeCreateMany(context: IExecuteFunctions, resource: string, recordsData: Array<Record<string, any>>, objectMetadata: any): Promise<Array<{
7
+ success: boolean;
8
+ record?: any;
9
+ error?: string;
10
+ index: number;
11
+ }>>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.buildCreateManyMutations = buildCreateManyMutations;
27
+ exports.executeCreateMany = executeCreateMany;
28
+ const fieldIntrospection_1 = require("../introspection/fieldIntrospection");
29
+ async function buildCreateManyMutations(context, objectNameSingular, recordsData, objectMetadata) {
30
+ const capitalizedObjectName = objectNameSingular.charAt(0).toUpperCase() + objectNameSingular.slice(1);
31
+ const fieldSelections = await (0, fieldIntrospection_1.buildComprehensiveFieldSelections)(context, capitalizedObjectName);
32
+ return recordsData.map((fieldsData, index) => {
33
+ const query = `
34
+ mutation CreateMany${objectMetadata.labelSingular.replace(/\s+/g, '')}_${index}($data: ${capitalizedObjectName}CreateInput!) {
35
+ create${capitalizedObjectName}(data: $data) {
36
+ ${fieldSelections}
37
+ }
38
+ }
39
+ `;
40
+ const variables = {
41
+ data: fieldsData,
42
+ };
43
+ return { query, variables };
44
+ });
45
+ }
46
+ async function executeCreateMany(context, resource, recordsData, objectMetadata) {
47
+ const { twentyApiRequest } = await Promise.resolve().then(() => __importStar(require('../TwentyApi.client')));
48
+ const mutations = await buildCreateManyMutations(context, resource, recordsData, objectMetadata);
49
+ const results = await Promise.allSettled(mutations.map(async ({ query, variables }, index) => {
50
+ const response = await twentyApiRequest.call(context, 'graphql', query, variables);
51
+ const operationName = `create${resource.charAt(0).toUpperCase() + resource.slice(1)}`;
52
+ return {
53
+ success: true,
54
+ record: response[operationName],
55
+ index,
56
+ };
57
+ }));
58
+ return results.map((result, index) => {
59
+ var _a;
60
+ if (result.status === 'fulfilled') {
61
+ return result.value;
62
+ }
63
+ else {
64
+ return {
65
+ success: false,
66
+ error: ((_a = result.reason) === null || _a === void 0 ? void 0 : _a.message) || String(result.reason),
67
+ index,
68
+ };
69
+ }
70
+ });
71
+ }
72
+ //# sourceMappingURL=createMany.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMany.operation.js","sourceRoot":"","sources":["../../../../nodes/Twenty/operations/createMany.operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaA,4DA4BC;AAYD,8CA+CC;AAnGD,4EAAwF;AAYjF,KAAK,UAAU,wBAAwB,CAC7C,OAA0B,EAC1B,kBAA0B,EAC1B,WAAuC,EACvC,cAAmB;IAGnB,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAGvG,MAAM,eAAe,GAAG,MAAM,IAAA,sDAAiC,EAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAGhG,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;QAC5C,MAAM,KAAK,GAAG;wBACQ,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,KAAK,WAAW,qBAAqB;YACrG,qBAAqB;OAC1B,eAAe;;;GAGnB,CAAC;QAEF,MAAM,SAAS,GAAG;YACjB,IAAI,EAAE,UAAU;SAChB,CAAC;QAEF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC;AACJ,CAAC;AAYM,KAAK,UAAU,iBAAiB,CACtC,OAA0B,EAC1B,QAAgB,EAChB,WAAuC,EACvC,cAAmB;IAEnB,MAAM,EAAE,gBAAgB,EAAE,GAAG,wDAAa,qBAAqB,GAAC,CAAC;IAGjE,MAAM,SAAS,GAAG,MAAM,wBAAwB,CAC/C,OAAO,EACP,QAAQ,EACR,WAAW,EACX,cAAc,CACd,CAAC;IAGF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CACvC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE;QACnD,MAAM,QAAQ,GAAQ,MAAM,gBAAgB,CAAC,IAAI,CAChD,OAAO,EACP,SAAS,EACT,KAAK,EACL,SAAS,CACT,CAAC;QAEF,MAAM,aAAa,GAAG,SAAS,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACtF,OAAO;YACN,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,QAAQ,CAAC,aAAa,CAAC;YAC/B,KAAK;SACL,CAAC;IACH,CAAC,CAAC,CACF,CAAC;IAGF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;;QACpC,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YACnC,OAAO,MAAM,CAAC,KAAK,CAAC;QACrB,CAAC;aAAM,CAAC;YACP,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,CAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,KAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;gBACtD,KAAK;aACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow';
2
+ type TwentyApiContext = IExecuteFunctions | ILoadOptionsFunctions;
3
+ export declare function buildDeleteMutation(context: TwentyApiContext, objectNameSingular: string, recordId: string, objectMetadata: any): Promise<{
4
+ query: string;
5
+ variables: Record<string, any>;
6
+ }>;
7
+ export {};
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildDeleteMutation = buildDeleteMutation;
4
+ async function buildDeleteMutation(context, objectNameSingular, recordId, objectMetadata) {
5
+ const capitalizedObjectName = objectNameSingular.charAt(0).toUpperCase() + objectNameSingular.slice(1);
6
+ const mutation = `
7
+ mutation Delete${objectMetadata.labelSingular.replace(/\s+/g, '')}($id: UUID!) {
8
+ delete${capitalizedObjectName}(id: $id) {
9
+ id
10
+ }
11
+ }
12
+ `;
13
+ const variables = {
14
+ id: recordId,
15
+ };
16
+ return { query: mutation, variables };
17
+ }
18
+ //# sourceMappingURL=delete.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.operation.js","sourceRoot":"","sources":["../../../../nodes/Twenty/operations/delete.operation.ts"],"names":[],"mappings":";;AAaA,kDAwBC;AAxBM,KAAK,UAAU,mBAAmB,CACxC,OAAyB,EACzB,kBAA0B,EAC1B,QAAgB,EAChB,cAAmB;IAGnB,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAGvG,MAAM,QAAQ,GAAG;mBACC,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;WACxD,qBAAqB;;;;EAI9B,CAAC;IAGF,MAAM,SAAS,GAAG;QACjB,EAAE,EAAE,QAAQ;KACZ,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function executeDeleteMany(context: IExecuteFunctions, resource: string, recordIds: string[], objectMetadata: any): Promise<Array<{
3
+ success: boolean;
4
+ id: string;
5
+ error?: string;
6
+ index: number;
7
+ }>>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeDeleteMany = executeDeleteMany;
4
+ const TwentyApi_client_1 = require("../TwentyApi.client");
5
+ async function executeDeleteMany(context, resource, recordIds, objectMetadata) {
6
+ const pluralName = objectMetadata.namePlural;
7
+ const results = await Promise.allSettled(recordIds.map(async (recordId, index) => {
8
+ const restPath = `/${pluralName}/${recordId}`;
9
+ const response = await TwentyApi_client_1.twentyRestApiRequest.call(context, 'DELETE', restPath);
10
+ let deletedRecord;
11
+ if (response.data) {
12
+ deletedRecord = response.data[resource] || response.data[objectMetadata.nameSingular] || response.data;
13
+ }
14
+ else {
15
+ deletedRecord = response;
16
+ }
17
+ const resultId = (deletedRecord === null || deletedRecord === void 0 ? void 0 : deletedRecord.id) || recordId;
18
+ return {
19
+ success: true,
20
+ id: resultId,
21
+ index,
22
+ };
23
+ }));
24
+ return results.map((result, index) => {
25
+ var _a;
26
+ if (result.status === 'fulfilled') {
27
+ return result.value;
28
+ }
29
+ else {
30
+ return {
31
+ success: false,
32
+ error: ((_a = result.reason) === null || _a === void 0 ? void 0 : _a.message) || String(result.reason),
33
+ id: recordIds[index],
34
+ index,
35
+ };
36
+ }
37
+ });
38
+ }
39
+ //# sourceMappingURL=deleteMany.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteMany.operation.js","sourceRoot":"","sources":["../../../../nodes/Twenty/operations/deleteMany.operation.ts"],"names":[],"mappings":";;AAaA,8CAsDC;AAlED,0DAA2D;AAYpD,KAAK,UAAU,iBAAiB,CACtC,OAA0B,EAC1B,QAAgB,EAChB,SAAmB,EACnB,cAAmB;IAEnB,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;IAG7C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CACvC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;QACvC,MAAM,QAAQ,GAAG,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;QAE9C,MAAM,QAAQ,GAAQ,MAAM,uCAAoB,CAAC,IAAI,CACpD,OAAO,EACP,QAAQ,EACR,QAAQ,CACR,CAAC;QAGF,IAAI,aAAa,CAAC;QAElB,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;YAEnB,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC;QACxG,CAAC;aAAM,CAAC;YAEP,aAAa,GAAG,QAAQ,CAAC;QAC1B,CAAC;QAGD,MAAM,QAAQ,GAAG,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,EAAE,KAAI,QAAQ,CAAC;QAE/C,OAAO;YACN,OAAO,EAAE,IAAI;YACb,EAAE,EAAE,QAAQ;YACZ,KAAK;SACL,CAAC;IACH,CAAC,CAAC,CACF,CAAC;IAGF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;;QACpC,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YACnC,OAAO,MAAM,CAAC,KAAK,CAAC;QACrB,CAAC;aAAM,CAAC;YACP,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,CAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,KAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;gBACtD,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC;gBACpB,KAAK;aACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow';
2
+ type TwentyApiContext = IExecuteFunctions | ILoadOptionsFunctions;
3
+ export declare function buildGetQuery(context: TwentyApiContext, objectNameSingular: string, recordId: string, objectMetadata: any): Promise<{
4
+ query: string;
5
+ variables: Record<string, any>;
6
+ }>;
7
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildGetQuery = buildGetQuery;
4
+ const fieldIntrospection_1 = require("../introspection/fieldIntrospection");
5
+ async function buildGetQuery(context, objectNameSingular, recordId, objectMetadata) {
6
+ const capitalizedObjectName = objectNameSingular.charAt(0).toUpperCase() + objectNameSingular.slice(1);
7
+ const fieldSelections = await (0, fieldIntrospection_1.buildComprehensiveFieldSelections)(context, capitalizedObjectName);
8
+ const pluralName = objectMetadata.namePlural;
9
+ const query = `
10
+ query Get${objectMetadata.labelSingular.replace(/\s+/g, '')}($id: UUID!) {
11
+ ${pluralName}(filter: { id: { eq: $id } }) {
12
+ edges {
13
+ node {
14
+ ${fieldSelections}
15
+ }
16
+ }
17
+ }
18
+ }
19
+ `;
20
+ const variables = {
21
+ id: recordId,
22
+ };
23
+ return { query, variables };
24
+ }
25
+ //# sourceMappingURL=get.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.operation.js","sourceRoot":"","sources":["../../../../nodes/Twenty/operations/get.operation.ts"],"names":[],"mappings":";;AAeA,sCAiCC;AA/CD,4EAAwF;AAcjF,KAAK,UAAU,aAAa,CAClC,OAAyB,EACzB,kBAA0B,EAC1B,QAAgB,EAChB,cAAmB;IAGnB,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAGvG,MAAM,eAAe,GAAG,MAAM,IAAA,sDAAiC,EAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAIhG,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;IAC7C,MAAM,KAAK,GAAG;aACF,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;KACxD,UAAU;;;QAGP,eAAe;;;;;EAKrB,CAAC;IAGF,MAAM,SAAS,GAAG;QACjB,EAAE,EAAE,QAAQ;KACZ,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function executeGetMany(context: IExecuteFunctions, resource: string, recordIds: string[], objectMetadata: any): Promise<Array<{
3
+ success: boolean;
4
+ record?: any;
5
+ error?: string;
6
+ id: string;
7
+ index: number;
8
+ }>>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeGetMany = executeGetMany;
4
+ const TwentyApi_client_1 = require("../TwentyApi.client");
5
+ async function executeGetMany(context, resource, recordIds, objectMetadata) {
6
+ const pluralName = objectMetadata.namePlural;
7
+ const results = await Promise.allSettled(recordIds.map(async (recordId, index) => {
8
+ var _a;
9
+ const restPath = `/${pluralName}/${recordId}`;
10
+ const response = await TwentyApi_client_1.twentyRestApiRequest.call(context, 'GET', restPath);
11
+ const record = (_a = response.data) === null || _a === void 0 ? void 0 : _a[resource];
12
+ if (!record) {
13
+ throw new Error(`Record with ID "${recordId}" not found`);
14
+ }
15
+ return {
16
+ success: true,
17
+ record,
18
+ id: recordId,
19
+ index,
20
+ };
21
+ }));
22
+ return results.map((result, index) => {
23
+ var _a;
24
+ if (result.status === 'fulfilled') {
25
+ return result.value;
26
+ }
27
+ else {
28
+ return {
29
+ success: false,
30
+ error: ((_a = result.reason) === null || _a === void 0 ? void 0 : _a.message) || String(result.reason),
31
+ id: recordIds[index],
32
+ index,
33
+ };
34
+ }
35
+ });
36
+ }
37
+ //# sourceMappingURL=getMany.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMany.operation.js","sourceRoot":"","sources":["../../../../nodes/Twenty/operations/getMany.operation.ts"],"names":[],"mappings":";;AAaA,wCAgDC;AA5DD,0DAA2D;AAYpD,KAAK,UAAU,cAAc,CACnC,OAA0B,EAC1B,QAAgB,EAChB,SAAmB,EACnB,cAAmB;IAEnB,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;IAG7C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CACvC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;;QACvC,MAAM,QAAQ,GAAG,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;QAE9C,MAAM,QAAQ,GAAQ,MAAM,uCAAoB,CAAC,IAAI,CACpD,OAAO,EACP,KAAK,EACL,QAAQ,CACR,CAAC;QAGF,MAAM,MAAM,GAAG,MAAA,QAAQ,CAAC,IAAI,0CAAG,QAAQ,CAAC,CAAC;QAEzC,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,aAAa,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO;YACN,OAAO,EAAE,IAAI;YACb,MAAM;YACN,EAAE,EAAE,QAAQ;YACZ,KAAK;SACL,CAAC;IACH,CAAC,CAAC,CACF,CAAC;IAGF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;;QACpC,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YACnC,OAAO,MAAM,CAAC,KAAK,CAAC;QACrB,CAAC;aAAM,CAAC;YACP,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,CAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,KAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;gBACtD,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC;gBACpB,KAAK;aACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { buildGetQuery } from './get.operation';
2
+ export { buildListQuery } from './list.operation';
3
+ export { buildCreateMutation } from './create.operation';
4
+ export { buildUpdateMutation } from './update.operation';
5
+ export { buildDeleteMutation } from './delete.operation';
6
+ export { executeUpsert } from './upsert.operation';
7
+ export { executeCreateMany } from './createMany.operation';
8
+ export { executeGetMany } from './getMany.operation';
9
+ export { executeUpdateMany } from './updateMany.operation';
10
+ export { executeDeleteMany } from './deleteMany.operation';
11
+ export { executeUpsertMany } from './upsertMany.operation';
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeUpsertMany = exports.executeDeleteMany = exports.executeUpdateMany = exports.executeGetMany = exports.executeCreateMany = exports.executeUpsert = exports.buildDeleteMutation = exports.buildUpdateMutation = exports.buildCreateMutation = exports.buildListQuery = exports.buildGetQuery = void 0;
4
+ var get_operation_1 = require("./get.operation");
5
+ Object.defineProperty(exports, "buildGetQuery", { enumerable: true, get: function () { return get_operation_1.buildGetQuery; } });
6
+ var list_operation_1 = require("./list.operation");
7
+ Object.defineProperty(exports, "buildListQuery", { enumerable: true, get: function () { return list_operation_1.buildListQuery; } });
8
+ var create_operation_1 = require("./create.operation");
9
+ Object.defineProperty(exports, "buildCreateMutation", { enumerable: true, get: function () { return create_operation_1.buildCreateMutation; } });
10
+ var update_operation_1 = require("./update.operation");
11
+ Object.defineProperty(exports, "buildUpdateMutation", { enumerable: true, get: function () { return update_operation_1.buildUpdateMutation; } });
12
+ var delete_operation_1 = require("./delete.operation");
13
+ Object.defineProperty(exports, "buildDeleteMutation", { enumerable: true, get: function () { return delete_operation_1.buildDeleteMutation; } });
14
+ var upsert_operation_1 = require("./upsert.operation");
15
+ Object.defineProperty(exports, "executeUpsert", { enumerable: true, get: function () { return upsert_operation_1.executeUpsert; } });
16
+ var createMany_operation_1 = require("./createMany.operation");
17
+ Object.defineProperty(exports, "executeCreateMany", { enumerable: true, get: function () { return createMany_operation_1.executeCreateMany; } });
18
+ var getMany_operation_1 = require("./getMany.operation");
19
+ Object.defineProperty(exports, "executeGetMany", { enumerable: true, get: function () { return getMany_operation_1.executeGetMany; } });
20
+ var updateMany_operation_1 = require("./updateMany.operation");
21
+ Object.defineProperty(exports, "executeUpdateMany", { enumerable: true, get: function () { return updateMany_operation_1.executeUpdateMany; } });
22
+ var deleteMany_operation_1 = require("./deleteMany.operation");
23
+ Object.defineProperty(exports, "executeDeleteMany", { enumerable: true, get: function () { return deleteMany_operation_1.executeDeleteMany; } });
24
+ var upsertMany_operation_1 = require("./upsertMany.operation");
25
+ Object.defineProperty(exports, "executeUpsertMany", { enumerable: true, get: function () { return upsertMany_operation_1.executeUpsertMany; } });
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/Twenty/operations/index.ts"],"names":[],"mappings":";;;AAOA,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,uDAAyD;AAAhD,uHAAA,mBAAmB,OAAA;AAC5B,uDAAyD;AAAhD,uHAAA,mBAAmB,OAAA;AAC5B,uDAAyD;AAAhD,uHAAA,mBAAmB,OAAA;AAC5B,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AAGtB,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,yDAAqD;AAA5C,mHAAA,cAAc,OAAA;AACvB,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA"}
@@ -0,0 +1,7 @@
1
+ import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow';
2
+ type TwentyApiContext = IExecuteFunctions | ILoadOptionsFunctions;
3
+ export declare function buildListQuery(context: TwentyApiContext, objectNameSingular: string, limit: number, objectMetadata: any): Promise<{
4
+ query: string;
5
+ variables: Record<string, any>;
6
+ }>;
7
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildListQuery = buildListQuery;
4
+ const fieldIntrospection_1 = require("../introspection/fieldIntrospection");
5
+ async function buildListQuery(context, objectNameSingular, limit, objectMetadata) {
6
+ const capitalizedObjectName = objectNameSingular.charAt(0).toUpperCase() + objectNameSingular.slice(1);
7
+ const fieldSelections = await (0, fieldIntrospection_1.buildComprehensiveFieldSelections)(context, capitalizedObjectName);
8
+ const pluralName = objectMetadata.namePlural;
9
+ const query = `
10
+ query List${objectMetadata.labelPlural.replace(/\s+/g, '')}($limit: Int!) {
11
+ ${pluralName}(first: $limit) {
12
+ edges {
13
+ node {
14
+ ${fieldSelections}
15
+ }
16
+ }
17
+ }
18
+ }
19
+ `;
20
+ const variables = {
21
+ limit,
22
+ };
23
+ return { query, variables };
24
+ }
25
+ //# sourceMappingURL=list.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.operation.js","sourceRoot":"","sources":["../../../../nodes/Twenty/operations/list.operation.ts"],"names":[],"mappings":";;AAeA,wCAmCC;AAjDD,4EAAwF;AAcjF,KAAK,UAAU,cAAc,CACnC,OAAyB,EACzB,kBAA0B,EAC1B,KAAa,EACb,cAAmB;IAGnB,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAGvG,MAAM,eAAe,GAAG,MAAM,IAAA,sDAAiC,EAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAGhG,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;IAI7C,MAAM,KAAK,GAAG;cACD,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;KACvD,UAAU;;;QAGP,eAAe;;;;;EAKrB,CAAC;IAGF,MAAM,SAAS,GAAG;QACjB,KAAK;KACL,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow';
2
+ type TwentyApiContext = IExecuteFunctions | ILoadOptionsFunctions;
3
+ export declare function buildUpdateMutation(context: TwentyApiContext, objectNameSingular: string, recordId: string, fieldsData: Record<string, any>, objectMetadata: any): Promise<{
4
+ query: string;
5
+ variables: Record<string, any>;
6
+ }>;
7
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildUpdateMutation = buildUpdateMutation;
4
+ const fieldIntrospection_1 = require("../introspection/fieldIntrospection");
5
+ async function buildUpdateMutation(context, objectNameSingular, recordId, fieldsData, objectMetadata) {
6
+ const capitalizedObjectName = objectNameSingular.charAt(0).toUpperCase() + objectNameSingular.slice(1);
7
+ const fieldSelections = await (0, fieldIntrospection_1.buildComprehensiveFieldSelections)(context, capitalizedObjectName);
8
+ const mutation = `
9
+ mutation Update${objectMetadata.labelSingular.replace(/\s+/g, '')}($id: UUID!, $data: ${capitalizedObjectName}UpdateInput!) {
10
+ update${capitalizedObjectName}(id: $id, data: $data) {
11
+ ${fieldSelections}
12
+ }
13
+ }
14
+ `;
15
+ const variables = {
16
+ id: recordId,
17
+ data: fieldsData,
18
+ };
19
+ return { query: mutation, variables };
20
+ }
21
+ //# sourceMappingURL=update.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.operation.js","sourceRoot":"","sources":["../../../../nodes/Twenty/operations/update.operation.ts"],"names":[],"mappings":";;AAiBA,kDA6BC;AA7CD,4EAAwF;AAgBjF,KAAK,UAAU,mBAAmB,CACxC,OAAyB,EACzB,kBAA0B,EAC1B,QAAgB,EAChB,UAA+B,EAC/B,cAAmB;IAGnB,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAGvG,MAAM,eAAe,GAAG,MAAM,IAAA,sDAAiC,EAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAGhG,MAAM,QAAQ,GAAG;mBACC,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,uBAAuB,qBAAqB;WACpG,qBAAqB;MAC1B,eAAe;;;EAGnB,CAAC;IAGF,MAAM,SAAS,GAAG;QACjB,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,UAAU;KAChB,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ export declare function buildUpdateManyMutations(context: IExecuteFunctions, objectNameSingular: string, updates: Array<{
3
+ id: string;
4
+ fieldsData: Record<string, any>;
5
+ }>, objectMetadata: any): Promise<Array<{
6
+ query: string;
7
+ variables: Record<string, any>;
8
+ id: string;
9
+ }>>;
10
+ export declare function executeUpdateMany(context: IExecuteFunctions, resource: string, updates: Array<{
11
+ id: string;
12
+ fieldsData: Record<string, any>;
13
+ }>, objectMetadata: any): Promise<Array<{
14
+ success: boolean;
15
+ record?: any;
16
+ error?: string;
17
+ id: string;
18
+ index: number;
19
+ }>>;