@membranehq/sdk 0.17.4 → 0.17.6

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 (72) hide show
  1. package/dist/bundle.d.ts +27 -7
  2. package/dist/bundle.js +5247 -5235
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/dts/accessors/action-instances-accessors.d.ts +1 -1
  5. package/dist/dts/accessors/actions-accessors.d.ts +1 -1
  6. package/dist/dts/accessors/app-data-schema-instances-accessors.d.ts +1 -1
  7. package/dist/dts/accessors/app-data-schemas-accessors.d.ts +1 -1
  8. package/dist/dts/accessors/app-event-subscriptions-accessors.d.ts +1 -1
  9. package/dist/dts/accessors/app-event-types-accessors.d.ts +1 -1
  10. package/dist/dts/accessors/connections-accessors.d.ts +6 -5
  11. package/dist/dts/accessors/customers-accessors.d.ts +1 -1
  12. package/dist/dts/accessors/data-link-table-instances-accessors.d.ts +1 -1
  13. package/dist/dts/accessors/data-link-tables-accessors.d.ts +1 -1
  14. package/dist/dts/accessors/data-sources-accessors.d.ts +1 -1
  15. package/dist/dts/accessors/external-event-subscriptions-accessors.d.ts +1 -1
  16. package/dist/dts/accessors/field-mapping-instances-accessors.d.ts +1 -1
  17. package/dist/dts/accessors/field-mappings-accessors.d.ts +1 -1
  18. package/dist/dts/accessors/flow-instances-accessors.d.ts +1 -1
  19. package/dist/dts/accessors/flows-accessors.d.ts +1 -1
  20. package/dist/dts/accessors/integrations-accessors.d.ts +6 -5
  21. package/dist/dts/accessors/scenarios-accessors.d.ts +1 -1
  22. package/dist/dts/accessors/screens-accessors.d.ts +1 -1
  23. package/dist/dts/agent/worker-contracts.d.ts +1 -0
  24. package/dist/dts/alerts/utils.d.ts +1 -1
  25. package/dist/dts/client.d.ts +1 -1
  26. package/dist/dts/data-filter/index.d.ts +1 -1
  27. package/dist/dts/formulas/base.d.ts +1 -1
  28. package/dist/dts/formulas/eval.d.ts +1 -1
  29. package/dist/dts/formulas/findAppRecordId.d.ts +1 -1
  30. package/dist/dts/formulas/findExternalRecordId.d.ts +1 -1
  31. package/dist/dts/formulas/index.d.ts +26 -4
  32. package/dist/dts/formulas/record.d.ts +1 -1
  33. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +2 -0
  34. package/dist/dts/workspace-elements/api/actions-api.d.ts +1 -1
  35. package/dist/dts/workspace-elements/api/connections-api.d.ts +17 -1
  36. package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +2 -1
  37. package/dist/dts/workspace-elements/api/data-sources-api.d.ts +4 -2
  38. package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +1 -0
  39. package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +1 -0
  40. package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +1 -0
  41. package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +1 -0
  42. package/dist/dts/workspace-elements/api/field-mapping-instances-api.d.ts +1 -1
  43. package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +3 -1
  44. package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +2 -0
  45. package/dist/dts/workspace-elements/api/flows-api.d.ts +3 -1
  46. package/dist/dts/workspace-elements/api/incoming-webhooks-api.d.ts +1 -0
  47. package/dist/dts/workspace-elements/api/integrations-api.d.ts +1 -0
  48. package/dist/dts/workspace-elements/base/actions/index.d.ts +2 -2
  49. package/dist/dts/workspace-elements/base/connection-requests/index.d.ts +2 -0
  50. package/dist/dts/workspace-elements/base/connections/index.d.ts +3 -0
  51. package/dist/dts/workspace-elements/base/connectors/auth.d.ts +1 -1
  52. package/dist/dts/workspace-elements/base/connectors/functions.d.ts +1 -1
  53. package/dist/dts/workspace-elements/base/connectors/operations/handlers.d.ts +1 -1
  54. package/dist/dts/workspace-elements/base/data-collections/data-locations/collections/events/methods.d.ts +1 -1
  55. package/dist/dts/workspace-elements/base/data-collections/schemas.d.ts +1 -1
  56. package/dist/dts/workspace-elements/base/data-collections/udm/index.d.ts +1 -1
  57. package/dist/dts/workspace-elements/base/data-collections/utils.d.ts +1 -1
  58. package/dist/dts/workspace-elements-catalog/index.d.ts +1 -0
  59. package/dist/dts/workspaces/compare.d.ts +1 -1
  60. package/dist/index.browser.d.mts +733 -691
  61. package/dist/index.browser.d.ts +733 -691
  62. package/dist/index.browser.js +1157 -1113
  63. package/dist/index.browser.js.map +1 -1
  64. package/dist/index.browser.mjs +1132 -1114
  65. package/dist/index.browser.mjs.map +1 -1
  66. package/dist/index.node.d.mts +733 -691
  67. package/dist/index.node.d.ts +733 -691
  68. package/dist/index.node.js +1157 -1113
  69. package/dist/index.node.js.map +1 -1
  70. package/dist/index.node.mjs +1132 -1114
  71. package/dist/index.node.mjs.map +1 -1
  72. package/package.json +1 -1
@@ -3959,6 +3959,7 @@ const CreateConnectionRequestPayload = z.z.object({
3959
3959
  integrationId: z.z.string().optional(),
3960
3960
  integrationKey: z.z.string().optional(),
3961
3961
  connectorId: z.z.string().optional(),
3962
+ connectorKey: z.z.string().optional(),
3962
3963
  connectorVersion: z.z.string().optional(),
3963
3964
  connectionId: z.z.string().optional(),
3964
3965
  name: z.z.string().optional(),
@@ -3972,6 +3973,7 @@ const ConnectionRequest = z.z.object({
3972
3973
  integrationId: z.z.string().optional(),
3973
3974
  integrationKey: z.z.string().optional(),
3974
3975
  connectorId: z.z.string().optional(),
3976
+ connectorKey: z.z.string().optional(),
3975
3977
  connectorVersion: z.z.string().optional(),
3976
3978
  connectionId: z.z.string().optional(),
3977
3979
  name: z.z.string().optional(),
@@ -3989,6 +3991,8 @@ const ConnectionEditableProperties = z.z.object({
3989
3991
  name: z.z.string().optional(),
3990
3992
  meta: z.z.record(z.z.string(), z.z.any()).optional(),
3991
3993
  authOptionKey: z.z.string().optional(),
3994
+ externalAppId: z.z.string().optional(),
3995
+ externalAppUuid: z.z.string().optional(),
3992
3996
  credentials: z.z.unknown().optional(),
3993
3997
  connectorParameters: z.z.unknown().optional(),
3994
3998
  input: z.z.unknown().optional(),
@@ -4003,6 +4007,7 @@ const BaseConnection = BaseWorkspaceElement.extend({
4003
4007
  error: ErrorDataSchema.optional(),
4004
4008
  integrationId: z.z.string().optional(),
4005
4009
  connectorId: z.z.string().optional(),
4010
+ externalAppId: z.z.string().optional(),
4006
4011
  connectorVersion: z.z.string().optional(),
4007
4012
  authOptionKey: z.z.string().optional(),
4008
4013
  createdAt: z.z.string(),
@@ -4023,6 +4028,97 @@ class ConnectionSpec {
4023
4028
  }
4024
4029
  }
4025
4030
 
4031
+ exports.FunctionType = void 0;
4032
+ (function (FunctionType) {
4033
+ FunctionType["mapping"] = "mapping";
4034
+ FunctionType["operationMapping"] = "operation-mapping";
4035
+ FunctionType["restApiMapping"] = "rest-api-mapping";
4036
+ FunctionType["graphqlApiMapping"] = "graphql-api-mapping";
4037
+ FunctionType["javascript"] = "javascript";
4038
+ })(exports.FunctionType || (exports.FunctionType = {}));
4039
+ const BaseFunctionDefinition = z.z.object({
4040
+ type: z.z.enum([
4041
+ exports.FunctionType.mapping,
4042
+ exports.FunctionType.operationMapping,
4043
+ exports.FunctionType.restApiMapping,
4044
+ exports.FunctionType.graphqlApiMapping,
4045
+ exports.FunctionType.javascript,
4046
+ ]),
4047
+ });
4048
+ const GenericFunctionDefinition = z.z
4049
+ .object({
4050
+ type: z.z.enum(['mapping', 'operation-mapping', 'rest-api-mapping', 'graphql-api-mapping', 'javascript']).optional(),
4051
+ })
4052
+ .loose();
4053
+
4054
+ const GraphQLFieldMappingSchema = z.z.lazy(() => z.z.object({
4055
+ field: z.z.string(),
4056
+ args: z.z.record(z.z.string(), z.z.any()).optional(),
4057
+ subFields: z.z.array(GraphQLFieldMappingSchema).optional(),
4058
+ }));
4059
+ const GraphQLApiMappingSchema = z.z.object({
4060
+ path: z.z.string(),
4061
+ operationType: z.z.enum(['query', 'mutation']),
4062
+ requestMapping: z.z.array(GraphQLFieldMappingSchema),
4063
+ responseMapping: z.z.any().optional(),
4064
+ });
4065
+ const GraphqlApiMappingFunction = z.z.object({
4066
+ type: z.z.literal(exports.FunctionType.graphqlApiMapping),
4067
+ mapping: GraphQLApiMappingSchema,
4068
+ });
4069
+
4070
+ const JavascriptFunction = z.z.object({
4071
+ type: z.z.literal(exports.FunctionType.javascript),
4072
+ code: z.z.string(),
4073
+ });
4074
+
4075
+ const MappingSchema = z.z.any();
4076
+ const MappingFunction = z.z.object({
4077
+ type: z.z.literal(exports.FunctionType.mapping),
4078
+ mapping: MappingSchema,
4079
+ });
4080
+
4081
+ const OperationMappingSchema = z.z.object({
4082
+ operationKey: z.z.string(),
4083
+ inputMapping: z.z.any().optional(),
4084
+ outputMapping: z.z.any().optional(),
4085
+ });
4086
+ const OperationMappingFunction = z.z.object({
4087
+ type: z.z.literal(exports.FunctionType.operationMapping),
4088
+ mapping: OperationMappingSchema,
4089
+ });
4090
+
4091
+ const RequestMappingSchema = z.z.object({
4092
+ pathParameters: z.z.any().optional(),
4093
+ query: z.z.any().optional(),
4094
+ data: z.z.any().optional(),
4095
+ headers: z.z.any().optional(),
4096
+ });
4097
+ const RestApiMappingSchema = z.z.object({
4098
+ path: z.z.string(),
4099
+ method: z.z.string(),
4100
+ requestMapping: RequestMappingSchema,
4101
+ responseMapping: z.z.any().optional(),
4102
+ });
4103
+ const OpenapiMappingSchema = z.z.object({
4104
+ path: z.z.string(),
4105
+ method: z.z.string(),
4106
+ requestMapping: RequestMappingSchema,
4107
+ responseMapping: z.z.any().optional(),
4108
+ });
4109
+ const RestApiMappingFunction = z.z.object({
4110
+ type: z.z.literal(exports.FunctionType.restApiMapping),
4111
+ mapping: RestApiMappingSchema,
4112
+ });
4113
+
4114
+ const FunctionDefinition = z.z.union([
4115
+ MappingFunction,
4116
+ OperationMappingFunction,
4117
+ RestApiMappingFunction,
4118
+ GraphqlApiMappingFunction,
4119
+ JavascriptFunction,
4120
+ ]);
4121
+
4026
4122
  exports.ConnectorMethodImplementationType = void 0;
4027
4123
  (function (ConnectorMethodImplementationType) {
4028
4124
  ConnectorMethodImplementationType["mapping"] = "mapping";
@@ -4419,97 +4515,6 @@ const REST_API_CLIENT_SCHEMA$1 = {
4419
4515
  },
4420
4516
  };
4421
4517
 
4422
- exports.FunctionType = void 0;
4423
- (function (FunctionType) {
4424
- FunctionType["mapping"] = "mapping";
4425
- FunctionType["operationMapping"] = "operation-mapping";
4426
- FunctionType["restApiMapping"] = "rest-api-mapping";
4427
- FunctionType["graphqlApiMapping"] = "graphql-api-mapping";
4428
- FunctionType["javascript"] = "javascript";
4429
- })(exports.FunctionType || (exports.FunctionType = {}));
4430
- const BaseFunctionDefinition = z.z.object({
4431
- type: z.z.enum([
4432
- exports.FunctionType.mapping,
4433
- exports.FunctionType.operationMapping,
4434
- exports.FunctionType.restApiMapping,
4435
- exports.FunctionType.graphqlApiMapping,
4436
- exports.FunctionType.javascript,
4437
- ]),
4438
- });
4439
- const GenericFunctionDefinition = z.z
4440
- .object({
4441
- type: z.z.enum(['mapping', 'operation-mapping', 'rest-api-mapping', 'graphql-api-mapping', 'javascript']).optional(),
4442
- })
4443
- .loose();
4444
-
4445
- const GraphQLFieldMappingSchema = z.z.lazy(() => z.z.object({
4446
- field: z.z.string(),
4447
- args: z.z.record(z.z.string(), z.z.any()).optional(),
4448
- subFields: z.z.array(GraphQLFieldMappingSchema).optional(),
4449
- }));
4450
- const GraphQLApiMappingSchema = z.z.object({
4451
- path: z.z.string(),
4452
- operationType: z.z.enum(['query', 'mutation']),
4453
- requestMapping: z.z.array(GraphQLFieldMappingSchema),
4454
- responseMapping: z.z.any().optional(),
4455
- });
4456
- const GraphqlApiMappingFunction = z.z.object({
4457
- type: z.z.literal(exports.FunctionType.graphqlApiMapping),
4458
- mapping: GraphQLApiMappingSchema,
4459
- });
4460
-
4461
- const JavascriptFunction = z.z.object({
4462
- type: z.z.literal(exports.FunctionType.javascript),
4463
- code: z.z.string(),
4464
- });
4465
-
4466
- const MappingSchema = z.z.any();
4467
- const MappingFunction = z.z.object({
4468
- type: z.z.literal(exports.FunctionType.mapping),
4469
- mapping: MappingSchema,
4470
- });
4471
-
4472
- const OperationMappingSchema = z.z.object({
4473
- operationKey: z.z.string(),
4474
- inputMapping: z.z.any().optional(),
4475
- outputMapping: z.z.any().optional(),
4476
- });
4477
- const OperationMappingFunction = z.z.object({
4478
- type: z.z.literal(exports.FunctionType.operationMapping),
4479
- mapping: OperationMappingSchema,
4480
- });
4481
-
4482
- const RequestMappingSchema = z.z.object({
4483
- pathParameters: z.z.any().optional(),
4484
- query: z.z.any().optional(),
4485
- data: z.z.any().optional(),
4486
- headers: z.z.any().optional(),
4487
- });
4488
- const RestApiMappingSchema = z.z.object({
4489
- path: z.z.string(),
4490
- method: z.z.string(),
4491
- requestMapping: RequestMappingSchema,
4492
- responseMapping: z.z.any().optional(),
4493
- });
4494
- const OpenapiMappingSchema = z.z.object({
4495
- path: z.z.string(),
4496
- method: z.z.string(),
4497
- requestMapping: RequestMappingSchema,
4498
- responseMapping: z.z.any().optional(),
4499
- });
4500
- const RestApiMappingFunction = z.z.object({
4501
- type: z.z.literal(exports.FunctionType.restApiMapping),
4502
- mapping: RestApiMappingSchema,
4503
- });
4504
-
4505
- const FunctionDefinition = z.z.union([
4506
- MappingFunction,
4507
- OperationMappingFunction,
4508
- RestApiMappingFunction,
4509
- GraphqlApiMappingFunction,
4510
- JavascriptFunction,
4511
- ]);
4512
-
4513
4518
  const CONNECTOR_DATA_DIR = 'data';
4514
4519
  const CONNECTOR_OPERATIONS_DIR = 'operations';
4515
4520
  const CONNECTOR_DOCS_DIR = 'docs';
@@ -4685,369 +4690,528 @@ exports.DataCollectionEventType = void 0;
4685
4690
  DataCollectionEventType["DELETED"] = "deleted";
4686
4691
  })(exports.DataCollectionEventType || (exports.DataCollectionEventType = {}));
4687
4692
 
4688
- const DataLocationMethodImplementationTypes = [
4689
- exports.ConnectorMethodImplementationType.operationMapping,
4690
- exports.ConnectorMethodImplementationType.restApiMapping,
4691
- exports.ConnectorMethodImplementationType.graphqlApiMapping,
4692
- exports.ConnectorMethodImplementationType.javascript,
4693
- exports.ConnectorMethodImplementationType.notSupported,
4694
- ];
4693
+ const structuredClone$1 = (structuredClonePolyfill === null || structuredClonePolyfill === void 0 ? void 0 : structuredClonePolyfill.default) || structuredClonePolyfill;
4694
+ function isNil(value) {
4695
+ return value == null;
4696
+ }
4697
+ function omitBy(obj, check) {
4698
+ obj = { ...obj };
4699
+ Object.entries(obj).forEach(([key, value]) => check(value) && delete obj[key]);
4700
+ return obj;
4701
+ }
4702
+ function isEmptyValue(value) {
4703
+ if (isNil(value)) {
4704
+ return true;
4705
+ }
4706
+ if (typeof value === 'symbol') {
4707
+ return true;
4708
+ }
4709
+ if (typeof value === 'boolean') {
4710
+ return false;
4711
+ }
4712
+ if (typeof value === 'number') {
4713
+ return isNaN(value);
4714
+ }
4715
+ if (typeof value === 'string') {
4716
+ return value.trim().length === 0;
4717
+ }
4718
+ const tag = value.toString();
4719
+ if (tag === '[object Map]' || tag === '[object Set]') {
4720
+ return !value.size;
4721
+ }
4722
+ return typeof value === 'object' && Object.keys(value).length === 0;
4723
+ }
4724
+ const simpleUniqueId = () => {
4725
+ return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)
4726
+ .toString(36)
4727
+ .padStart(11, '0')
4728
+ .substring(0, 11);
4729
+ };
4695
4730
 
4696
- const DataCollectionMethodCreate = {
4697
- name: 'Create',
4698
- description: 'Create a new data record in the collection',
4699
- getConfigSchema: ({ collectionSpec }) => {
4700
- var _a, _b;
4701
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4702
- return {
4703
- type: 'object',
4704
- properties: {
4705
- fields: {
4706
- type: 'array',
4707
- items: { type: 'string', enum: fields },
4708
- },
4709
- excludedFields: {
4710
- type: 'array',
4711
- items: { type: 'string', enum: fields },
4712
- },
4713
- },
4714
- };
4715
- },
4716
- getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
4717
- var _a;
4718
- let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
4719
- if (method === null || method === void 0 ? void 0 : method.fields) {
4720
- fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
4721
- }
4722
- if (method === null || method === void 0 ? void 0 : method.excludedFields) {
4723
- fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
4731
+ function getDataLocationMethodPath(locationKey, methodKey) {
4732
+ return `data/${locationKey}/${jsConvertCase.toKebabCase(methodKey)}`;
4733
+ }
4734
+ function dataLocationParametersMatch({ locationParameters, targetParameters, }) {
4735
+ targetParameters = typeof targetParameters === 'object' && targetParameters ? targetParameters : {};
4736
+ locationParameters = typeof locationParameters === 'object' && locationParameters ? locationParameters : {};
4737
+ for (const [key, value] of Object.entries(targetParameters)) {
4738
+ if (locationParameters[key] !== value) {
4739
+ return false;
4740
+ }
4741
+ }
4742
+ return true;
4743
+ }
4744
+ function parseDataLocationPath(path) {
4745
+ if (!path) {
4746
+ return undefined;
4747
+ }
4748
+ if (path.startsWith('/')) {
4749
+ path = path.slice(1);
4750
+ }
4751
+ if (!path.startsWith('data/')) {
4752
+ throw new Error(`Invalid data location path: ${path}. It should start with "data/"`);
4753
+ }
4754
+ path = path.slice(5);
4755
+ const [key, query] = path.split('?');
4756
+ const parameters = Object.fromEntries(new URLSearchParams(query).entries());
4757
+ return { key, parameters };
4758
+ }
4759
+ function makeDataLocationPath(pointer) {
4760
+ var _a;
4761
+ const normalizedPointer = normalizePointer(pointer);
4762
+ if (normalizedPointer === null || normalizedPointer === void 0 ? void 0 : normalizedPointer.key) {
4763
+ let path = `/data/${normalizedPointer.key}`;
4764
+ const parameters = omitBy((_a = normalizedPointer.parameters) !== null && _a !== void 0 ? _a : {}, isNil);
4765
+ if (Object.keys(parameters).length > 0) {
4766
+ path += `?${new URLSearchParams(parameters).toString()}`;
4724
4767
  }
4768
+ return path;
4769
+ }
4770
+ else {
4771
+ return undefined;
4772
+ }
4773
+ }
4774
+ function normalizePointer(pointer) {
4775
+ if (typeof pointer === 'string' && pointer.startsWith('/data/')) {
4725
4776
  return {
4726
- type: 'object',
4727
- properties: nonEmptyObjectProperties({
4728
- fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
4729
- type: 'object',
4730
- },
4731
- credentials: credentialsSchema,
4732
- }),
4777
+ key: pointer.slice(6),
4733
4778
  };
4734
- },
4735
- getOutputSchema: ({}) => ({
4736
- type: 'object',
4737
- properties: {
4738
- id: { type: 'string' },
4739
- },
4740
- }),
4741
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4742
- };
4779
+ }
4780
+ return pointer;
4781
+ }
4782
+ function makeDataLocationOperationPath(collectionPath, operation) {
4783
+ const [path, query] = (collectionPath !== null && collectionPath !== void 0 ? collectionPath : '').split('?');
4784
+ return urljoin(path, operation, query ? `?${query}` : '');
4785
+ }
4786
+ function isSameDataLocation(location1, location2) {
4787
+ if (location1.key !== location2.key) {
4788
+ return false;
4789
+ }
4790
+ const cleanParameters1 = location1.parameters && Object.keys(location1.parameters).length > 0 ? location1.parameters : undefined;
4791
+ const cleanParameters2 = location2.parameters && Object.keys(location2.parameters).length > 0 ? location2.parameters : undefined;
4792
+ if (!deepEqual(cleanParameters1, cleanParameters2)) {
4793
+ return false;
4794
+ }
4795
+ return true;
4796
+ }
4797
+ function isDataLocationMethodSupported(location, methodKey) {
4798
+ var _a;
4799
+ const method = (_a = location === null || location === void 0 ? void 0 : location.methods) === null || _a === void 0 ? void 0 : _a[methodKey];
4800
+ return method && method.implementationType !== exports.ConnectorMethodImplementationType.notSupported;
4801
+ }
4802
+ function getDataCollectionCreateFields(spec) {
4803
+ if (!spec)
4804
+ return undefined;
4805
+ if (!spec.fieldsSchema)
4806
+ return undefined;
4807
+ if (!spec.create)
4808
+ return undefined;
4809
+ let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
4810
+ if (spec.create.fields) {
4811
+ schema = pickFieldsFromSchema(schema, spec.create.fields);
4812
+ }
4813
+ if (spec.create.excludedFields) {
4814
+ schema = excludeFieldsFromSchema(schema, spec.create.excludedFields);
4815
+ }
4816
+ return schema;
4817
+ }
4818
+ function getDataCollectionUpdateFields(spec) {
4819
+ if (!spec)
4820
+ return undefined;
4821
+ if (!spec.fieldsSchema)
4822
+ return undefined;
4823
+ if (!spec.update)
4824
+ return undefined;
4825
+ let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
4826
+ if (spec.update.fields) {
4827
+ schema = pickFieldsFromSchema(schema, spec.update.fields);
4828
+ }
4829
+ if (spec.update.excludedFields) {
4830
+ schema = excludeFieldsFromSchema(schema, spec.update.excludedFields);
4831
+ }
4832
+ return schema;
4833
+ }
4834
+ function getWritableFieldsSchema(spec) {
4835
+ if (!spec)
4836
+ return undefined;
4837
+ if (!spec.fieldsSchema)
4838
+ return undefined;
4839
+ return mergeSchemas([getDataCollectionCreateFields(spec), getDataCollectionUpdateFields(spec)]);
4840
+ }
4841
+ function getReferenceCollectionPointerForSchema(schema) {
4842
+ if ((schema === null || schema === void 0 ? void 0 : schema.referenceCollection) && schema.referenceCollection.key) {
4843
+ return schema.referenceCollection;
4844
+ }
4845
+ else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionPath) {
4846
+ return parseDataLocationPath(schema.referenceCollectionPath);
4847
+ }
4848
+ else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionUri) {
4849
+ return parseDataLocationPath(schema.referenceCollectionUri);
4850
+ }
4851
+ else {
4852
+ return undefined;
4853
+ }
4854
+ }
4855
+ function getReferenceCollectionPathForSchema(schema) {
4856
+ const pointer = getReferenceCollectionPointerForSchema(schema);
4857
+ return makeDataLocationPath(pointer);
4858
+ }
4743
4859
 
4744
- const DataCollectionMethodDelete = {
4745
- name: 'Delete',
4746
- description: 'Delete a data record from the collection by id',
4747
- getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => {
4748
- return {
4749
- type: 'object',
4750
- properties: nonEmptyObjectProperties({
4751
- id: {
4752
- type: 'string',
4753
- referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
4860
+ const FIELDS_SCHEMA$G = {
4861
+ type: 'object',
4862
+ properties: {
4863
+ id: { type: 'string', readOnly: true },
4864
+ title: { type: 'string' },
4865
+ description: { type: 'string' },
4866
+ type: { type: 'string' },
4867
+ durationSeconds: { type: 'number' },
4868
+ location: { type: 'string' },
4869
+ isRecurrent: { type: 'boolean' },
4870
+ participants: {
4871
+ type: 'array',
4872
+ items: {
4873
+ type: 'object',
4874
+ properties: {
4875
+ userId: { type: 'string' },
4876
+ contactId: { type: 'string' },
4754
4877
  },
4755
- credentials: credentialsSchema,
4756
- }),
4757
- };
4878
+ },
4879
+ },
4880
+ status: { type: 'string' },
4881
+ contactId: {
4882
+ type: 'string',
4883
+ referenceUdm: 'contacts',
4884
+ },
4885
+ companyId: {
4886
+ type: 'string',
4887
+ referenceUdm: 'companies',
4888
+ },
4889
+ dealId: {
4890
+ type: 'string',
4891
+ referenceUdm: 'deals',
4892
+ },
4893
+ leadId: {
4894
+ type: 'string',
4895
+ referenceUdm: 'leads',
4896
+ },
4897
+ ownerId: {
4898
+ type: 'string',
4899
+ referenceUdm: 'users',
4900
+ },
4901
+ startTime: {
4902
+ type: 'string',
4903
+ format: 'date-time',
4904
+ },
4905
+ endTime: {
4906
+ type: 'string',
4907
+ format: 'date-time',
4908
+ },
4909
+ dueTime: {
4910
+ type: 'string',
4911
+ format: 'date-time',
4912
+ },
4913
+ createdTime: {
4914
+ type: 'string',
4915
+ format: 'date-time',
4916
+ readOnly: true,
4917
+ },
4918
+ createdBy: {
4919
+ type: 'string',
4920
+ referenceUdm: 'users',
4921
+ readOnly: true,
4922
+ },
4923
+ updatedTime: {
4924
+ type: 'string',
4925
+ format: 'date-time',
4926
+ readOnly: true,
4927
+ },
4928
+ updatedBy: {
4929
+ type: 'string',
4930
+ referenceUdm: 'users',
4931
+ readOnly: true,
4932
+ },
4758
4933
  },
4759
- getOutputSchema: () => null,
4760
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4761
4934
  };
4762
-
4763
- const DataCollectionMethodFind = {
4764
- isDeprecated: true,
4765
- name: 'Find',
4766
- description: 'Find a list of data records in the collection',
4767
- getConfigSchema: ({ collectionSpec }) => {
4768
- var _a, _b;
4769
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4770
- return {
4771
- type: 'object',
4772
- properties: {
4773
- queryFields: {
4774
- type: 'array',
4775
- items: { type: 'string', enum: fields },
4776
- },
4777
- },
4778
- };
4935
+ const FallbackFieldsMap = {
4936
+ fromActivitiesToTasks: {
4937
+ subject: {
4938
+ $var: 'title',
4939
+ },
4940
+ content: {
4941
+ $var: 'description',
4942
+ },
4779
4943
  },
4780
- getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
4781
- const queryFieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.queryFields);
4782
- const schema = {
4783
- type: 'object',
4784
- properties: nonEmptyObjectProperties({
4785
- cursor: { type: 'string' },
4786
- credentials: credentialsSchema,
4787
- }),
4788
- };
4789
- if (queryFieldsSchema === null || queryFieldsSchema === void 0 ? void 0 : queryFieldsSchema.properties) {
4790
- schema.properties = {
4791
- ...schema.properties,
4792
- query: transformVariablesWith(queryFieldsSchema, (locator) => `query.${locatorToField(locator)}`),
4793
- };
4794
- }
4795
- return schema;
4944
+ fromTasksToActivities: {
4945
+ title: {
4946
+ $var: 'subject',
4947
+ },
4948
+ description: {
4949
+ $var: 'content',
4950
+ },
4796
4951
  },
4797
- getOutputSchema: ({ collectionSpec }) => {
4798
- var _a;
4799
- return ({
4800
- type: 'object',
4801
- properties: {
4802
- records: {
4803
- type: 'array',
4804
- items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4805
- },
4806
- cursor: {
4807
- type: 'string',
4808
- },
4809
- },
4810
- });
4952
+ fromActivitiesToNotes: {
4953
+ content: {
4954
+ $var: 'description',
4955
+ },
4956
+ },
4957
+ fromNotesToActivities: {
4958
+ description: {
4959
+ $var: 'content',
4960
+ },
4961
+ },
4962
+ fromActivitiesToEmails: {
4963
+ subject: {
4964
+ $var: 'title',
4965
+ },
4966
+ body: {
4967
+ $var: 'description',
4968
+ },
4969
+ },
4970
+ fromEmailsToActivities: {
4971
+ title: {
4972
+ $var: 'subject',
4973
+ },
4974
+ description: {
4975
+ $var: 'body',
4976
+ },
4811
4977
  },
4812
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4813
4978
  };
4814
-
4815
- const DataCollectionMethodFindById = {
4816
- name: 'Find by ID',
4817
- description: 'Find a single data record in the collection by its id',
4818
- getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => ({
4819
- type: 'object',
4820
- properties: nonEmptyObjectProperties({
4821
- id: {
4822
- type: 'string',
4823
- referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
4824
- },
4825
- credentials: credentialsSchema,
4826
- }),
4827
- }),
4828
- getOutputSchema: ({ collectionSpec }) => {
4829
- var _a;
4830
- return ({
4831
- type: 'object',
4832
- properties: {
4833
- record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4834
- },
4835
- });
4979
+ const udm$G = {
4980
+ singularName: 'activity',
4981
+ pluralName: 'activities',
4982
+ fieldsSchema: FIELDS_SCHEMA$G,
4983
+ list: {
4984
+ filterFields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
4836
4985
  },
4837
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4986
+ match: {
4987
+ fields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
4988
+ },
4989
+ populateFields,
4990
+ udmFallbacks: [
4991
+ {
4992
+ udm: 'tasks',
4993
+ importFields: FallbackFieldsMap.fromTasksToActivities,
4994
+ exportFields: FallbackFieldsMap.fromActivitiesToTasks,
4995
+ },
4996
+ {
4997
+ udm: 'meetings',
4998
+ },
4999
+ {
5000
+ udm: 'notes',
5001
+ importFields: FallbackFieldsMap.fromNotesToActivities,
5002
+ exportFields: FallbackFieldsMap.fromActivitiesToNotes,
5003
+ },
5004
+ {
5005
+ udm: 'emails',
5006
+ importFields: FallbackFieldsMap.fromEmailsToActivities,
5007
+ exportFields: FallbackFieldsMap.fromActivitiesToEmails,
5008
+ },
5009
+ ],
4838
5010
  };
5011
+ function populateFields(fields) {
5012
+ const result = JSON.parse(JSON.stringify(fields));
5013
+ if (!result.dueTime) {
5014
+ result.dueTime = result.endTime || result.startTime;
5015
+ }
5016
+ if (!result.startTime) {
5017
+ result.startTime = result.dueTime || result.endTime;
5018
+ }
5019
+ if (!result.endTime) {
5020
+ result.endTime = result.dueTime || result.startTime;
5021
+ }
5022
+ return result;
5023
+ }
4839
5024
 
4840
- const DataCollectionMethodList = {
4841
- name: 'List',
4842
- description: 'Return all data records from the collection',
4843
- getConfigSchema: ({ collectionSpec }) => {
4844
- var _a, _b;
4845
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4846
- return {
4847
- type: 'object',
4848
- properties: {
4849
- filterFields: {
4850
- type: 'array',
4851
- items: { type: 'string', enum: fields },
5025
+ const FIELDS_SCHEMA$F = {
5026
+ type: 'object',
5027
+ properties: {
5028
+ id: { type: 'string', readOnly: true },
5029
+ number: { type: 'string' },
5030
+ name: { type: 'string' },
5031
+ memo: { type: 'string' },
5032
+ status: { type: 'string' },
5033
+ paymentMethod: { type: 'string' },
5034
+ supplierId: { type: 'string', referenceUdm: 'suppliers' },
5035
+ currency: { type: 'string' },
5036
+ payments: {
5037
+ type: 'array',
5038
+ items: {
5039
+ type: 'string',
5040
+ referenceUdm: 'payments',
5041
+ },
5042
+ },
5043
+ lineItems: {
5044
+ type: 'array',
5045
+ items: {
5046
+ type: 'object',
5047
+ properties: {
5048
+ id: { type: 'string' },
5049
+ itemName: { type: 'string' },
5050
+ description: { type: 'string' },
5051
+ code: { type: 'string' },
5052
+ type: { type: 'string' },
5053
+ companyId: { type: 'string', referenceUdm: 'companies' },
5054
+ ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5055
+ quantity: { type: 'number' },
5056
+ unitPrice: { type: 'number' },
5057
+ unitOfMeasure: { type: 'string' },
5058
+ purchasePrice: { type: 'number' },
5059
+ salesPrice: { type: 'number' },
5060
+ taxable: { type: 'boolean' },
5061
+ taxAmount: { type: 'number' },
5062
+ totalAmount: { type: 'number' },
4852
5063
  },
4853
5064
  },
4854
- };
5065
+ },
5066
+ totalAmount: { type: 'number' },
5067
+ totalTax: { type: 'number' },
5068
+ exchangeRate: { type: 'number' },
5069
+ totalDiscount: { type: 'number' },
5070
+ subTotal: { type: 'number' },
5071
+ balance: { type: 'number' },
5072
+ ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5073
+ issueDate: {
5074
+ type: 'string',
5075
+ format: 'date-time',
5076
+ },
5077
+ dueDate: {
5078
+ type: 'string',
5079
+ format: 'date-time',
5080
+ },
5081
+ paidOnDate: {
5082
+ type: 'string',
5083
+ format: 'date-time',
5084
+ },
5085
+ createdTime: { type: 'string', format: 'date-time', readOnly: true },
5086
+ createdBy: { type: 'string', referenceUdm: 'users', readOnly: true },
5087
+ updatedTime: { type: 'string', format: 'date-time', readOnly: true },
5088
+ updatedBy: { type: 'string', referenceUdm: 'users', readOnly: true },
4855
5089
  },
4856
- getInputSchema: ({ method, collectionSpec, credentialsSchema }) => {
4857
- const fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
4858
- let filterSchema;
4859
- if (method === null || method === void 0 ? void 0 : method.filterFields) {
4860
- filterSchema = pickFieldsFromSchema(fieldsSchema, method.filterFields);
4861
- }
4862
- return {
4863
- type: 'object',
4864
- properties: nonEmptyObjectProperties({
4865
- filter: filterSchema,
4866
- cursor: {
4867
- type: 'string',
4868
- description: 'Cursor returned in response to the previous "list" request',
4869
- },
4870
- credentials: credentialsSchema,
4871
- }),
4872
- };
5090
+ };
5091
+ const udm$F = {
5092
+ singularName: 'bill',
5093
+ pluralName: 'bills',
5094
+ fieldsSchema: FIELDS_SCHEMA$F,
5095
+ list: {
5096
+ filterFields: ['name', 'number', 'status', 'supplierId'],
4873
5097
  },
4874
- getOutputSchema: ({ collectionSpec }) => {
4875
- var _a;
4876
- return ({
4877
- type: 'object',
4878
- properties: {
4879
- records: {
4880
- type: 'array',
4881
- items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4882
- },
4883
- cursor: {
4884
- type: 'string',
4885
- description: 'Cursor to request the next page of results',
4886
- },
4887
- },
4888
- });
5098
+ match: {
5099
+ fields: ['name', 'number', 'status', 'supplierId'],
4889
5100
  },
4890
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4891
5101
  };
4892
5102
 
4893
- const DataCollectionMethodMatch = {
4894
- name: 'Match',
4895
- description: 'Find a single matching record in a data collection by a set of fields',
4896
- getConfigSchema: ({ collectionSpec }) => {
4897
- var _a, _b;
4898
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4899
- return {
4900
- type: 'object',
4901
- properties: {
4902
- fields: {
4903
- type: 'array',
4904
- items: { type: 'string', enum: fields },
4905
- },
4906
- },
4907
- };
4908
- },
4909
- getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
4910
- const fieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.fields);
4911
- return {
4912
- type: 'object',
4913
- properties: nonEmptyObjectProperties({
4914
- query: transformVariablesWith(fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : {}, (locator) => `query.${locatorToField(locator)}`),
4915
- credentials: credentialsSchema,
4916
- }),
4917
- };
4918
- },
4919
- getOutputSchema: ({ collectionSpec }) => {
4920
- var _a;
4921
- return ({
4922
- type: 'object',
4923
- properties: {
4924
- record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4925
- },
4926
- });
4927
- },
4928
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4929
- };
4930
-
4931
- const DataCollectionMethodSearch = {
4932
- name: 'Search',
4933
- description: 'Find data records in a collection by a string query',
4934
- getInputSchema: ({ credentialsSchema }) => ({
4935
- type: 'object',
4936
- properties: nonEmptyObjectProperties({
4937
- query: { type: 'string' },
4938
- cursor: { type: 'string' },
4939
- credentials: credentialsSchema,
4940
- }),
4941
- }),
4942
- getOutputSchema: ({ collectionSpec }) => {
4943
- var _a;
4944
- return ({
4945
- type: 'object',
4946
- properties: {
4947
- records: {
4948
- type: 'array',
4949
- items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4950
- },
4951
- cursor: { type: 'string' },
4952
- },
4953
- });
5103
+ const FIELDS_SCHEMA$E = {
5104
+ type: 'object',
5105
+ properties: {
5106
+ id: { type: 'string', readOnly: true },
5107
+ fullName: { type: 'string' },
5108
+ firstName: { type: 'string' },
5109
+ lastName: { type: 'string' },
5110
+ primaryEmail: { type: 'string' },
5111
+ campaignId: {
5112
+ type: 'string',
5113
+ referenceUdm: 'campaigns',
5114
+ },
5115
+ contactId: {
5116
+ type: 'string',
5117
+ referenceUdm: 'contacts',
5118
+ },
5119
+ leadId: {
5120
+ type: 'string',
5121
+ referenceUdm: 'leads',
5122
+ },
5123
+ source: { type: 'string' },
5124
+ status: { type: 'string' },
5125
+ companyId: {
5126
+ type: 'string',
5127
+ referenceUdm: 'companies',
5128
+ },
5129
+ jobTitle: { type: 'string' },
5130
+ hasOptedOutOfEmail: { type: 'boolean' },
5131
+ createdTime: {
5132
+ type: 'string',
5133
+ format: 'date-time',
5134
+ },
5135
+ createdBy: {
5136
+ type: 'string',
5137
+ readOnly: true,
5138
+ referenceUdm: 'users',
5139
+ },
5140
+ updatedTime: {
5141
+ type: 'string',
5142
+ readOnly: true,
5143
+ format: 'date-time',
5144
+ },
5145
+ updatedBy: {
5146
+ type: 'string',
5147
+ readOnly: true,
5148
+ referenceUdm: 'users',
5149
+ },
4954
5150
  },
4955
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4956
5151
  };
4957
-
4958
- const DataCollectionMethodUpdate = {
4959
- name: 'Update',
4960
- description: 'Update one data record in the collection by its id',
4961
- getConfigSchema: ({ collectionSpec }) => {
4962
- var _a, _b;
4963
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4964
- return {
4965
- type: 'object',
4966
- properties: {
4967
- fields: {
4968
- type: 'array',
4969
- items: { type: 'string', enum: fields },
4970
- },
4971
- excludedFields: {
4972
- type: 'array',
4973
- items: { type: 'string', enum: fields },
4974
- },
4975
- },
4976
- };
5152
+ const udm$E = {
5153
+ singularName: 'campaign-member',
5154
+ pluralName: 'campaign-members',
5155
+ fieldsSchema: FIELDS_SCHEMA$E,
5156
+ list: {
5157
+ filterFields: [
5158
+ 'primaryEmail',
5159
+ 'fullName',
5160
+ 'firstName',
5161
+ 'lastName',
5162
+ 'campaignId',
5163
+ 'contactId',
5164
+ 'leadId',
5165
+ 'companyId',
5166
+ ],
4977
5167
  },
4978
- getInputSchema: ({ collectionSpec, collectionHandler, credentialsSchema, method, parameters }) => {
4979
- var _a;
4980
- let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
4981
- if (method === null || method === void 0 ? void 0 : method.fields) {
4982
- fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
4983
- }
4984
- if (method === null || method === void 0 ? void 0 : method.excludedFields) {
4985
- fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
4986
- }
4987
- return {
4988
- type: 'object',
4989
- properties: nonEmptyObjectProperties({
4990
- id: {
4991
- type: 'string',
4992
- referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
4993
- },
4994
- fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
4995
- type: 'object',
4996
- },
4997
- credentials: credentialsSchema,
4998
- }),
4999
- };
5168
+ match: {
5169
+ fields: ['primaryEmail', 'fullName', 'firstName', 'lastName', 'campaignId', 'contactId', 'leadId', 'companyId'],
5000
5170
  },
5001
- getOutputSchema: ({}) => ({
5002
- type: 'object',
5003
- properties: {
5004
- id: { type: 'string' },
5005
- },
5006
- }),
5007
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
5008
5171
  };
5009
5172
 
5010
- const FIELDS_SCHEMA$G = {
5173
+ const FIELDS_SCHEMA$D = {
5011
5174
  type: 'object',
5012
5175
  properties: {
5013
5176
  id: { type: 'string', readOnly: true },
5014
- title: { type: 'string' },
5015
- description: { type: 'string' },
5016
- type: { type: 'string' },
5017
- durationSeconds: { type: 'number' },
5018
- location: { type: 'string' },
5019
- isRecurrent: { type: 'boolean' },
5020
- participants: {
5021
- type: 'array',
5022
- items: {
5023
- type: 'object',
5024
- properties: {
5025
- userId: { type: 'string' },
5026
- contactId: { type: 'string' },
5027
- },
5028
- },
5177
+ name: {
5178
+ type: 'string',
5029
5179
  },
5030
- status: { type: 'string' },
5031
- contactId: {
5180
+ cost: {
5181
+ type: 'number',
5182
+ },
5183
+ description: {
5032
5184
  type: 'string',
5033
- referenceUdm: 'contacts',
5034
5185
  },
5035
- companyId: {
5186
+ source: {
5036
5187
  type: 'string',
5037
- referenceUdm: 'companies',
5038
5188
  },
5039
- dealId: {
5189
+ stage: {
5040
5190
  type: 'string',
5041
- referenceUdm: 'deals',
5042
5191
  },
5043
- leadId: {
5192
+ type: {
5044
5193
  type: 'string',
5045
- referenceUdm: 'leads',
5046
5194
  },
5047
5195
  ownerId: {
5048
5196
  type: 'string',
5049
5197
  referenceUdm: 'users',
5050
5198
  },
5199
+ sentCount: {
5200
+ type: 'number',
5201
+ readOnly: true,
5202
+ },
5203
+ replyCount: {
5204
+ type: 'number',
5205
+ readOnly: true,
5206
+ },
5207
+ openCount: {
5208
+ type: 'number',
5209
+ readOnly: true,
5210
+ },
5211
+ clickCount: {
5212
+ type: 'number',
5213
+ readOnly: true,
5214
+ },
5051
5215
  startTime: {
5052
5216
  type: 'string',
5053
5217
  format: 'date-time',
@@ -5056,10 +5220,6 @@ const FIELDS_SCHEMA$G = {
5056
5220
  type: 'string',
5057
5221
  format: 'date-time',
5058
5222
  },
5059
- dueTime: {
5060
- type: 'string',
5061
- format: 'date-time',
5062
- },
5063
5223
  createdTime: {
5064
5224
  type: 'string',
5065
5225
  format: 'date-time',
@@ -5080,477 +5240,167 @@ const FIELDS_SCHEMA$G = {
5080
5240
  referenceUdm: 'users',
5081
5241
  readOnly: true,
5082
5242
  },
5243
+ lastActivityTime: {
5244
+ type: 'string',
5245
+ format: 'date-time',
5246
+ readOnly: true,
5247
+ },
5083
5248
  },
5084
5249
  };
5085
- const FallbackFieldsMap = {
5086
- fromActivitiesToTasks: {
5087
- subject: {
5088
- $var: 'title',
5089
- },
5090
- content: {
5091
- $var: 'description',
5092
- },
5250
+ const MODIFIABLE_FIELDS$2 = ['name', 'description', 'ownerId', 'startTime', 'endTime', 'cost', 'source', 'stage', 'type'];
5251
+ const udm$D = {
5252
+ singularName: 'campaign',
5253
+ pluralName: 'campaigns',
5254
+ fieldsSchema: FIELDS_SCHEMA$D,
5255
+ categories: ['Marketing Automation', 'Sales', 'CRM', 'Ads'],
5256
+ list: {
5257
+ filterFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5093
5258
  },
5094
- fromTasksToActivities: {
5095
- title: {
5096
- $var: 'subject',
5097
- },
5098
- description: {
5099
- $var: 'content',
5100
- },
5259
+ find: {
5260
+ queryFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5101
5261
  },
5102
- fromActivitiesToNotes: {
5103
- content: {
5104
- $var: 'description',
5105
- },
5262
+ match: {
5263
+ fields: ['name', 'source', 'stage', 'type', 'ownerId'],
5106
5264
  },
5107
- fromNotesToActivities: {
5108
- description: {
5109
- $var: 'content',
5110
- },
5111
- },
5112
- fromActivitiesToEmails: {
5113
- subject: {
5114
- $var: 'title',
5115
- },
5116
- body: {
5117
- $var: 'description',
5118
- },
5265
+ create: {
5266
+ fields: MODIFIABLE_FIELDS$2,
5119
5267
  },
5120
- fromEmailsToActivities: {
5121
- title: {
5122
- $var: 'subject',
5123
- },
5124
- description: {
5125
- $var: 'body',
5126
- },
5268
+ update: {
5269
+ fields: MODIFIABLE_FIELDS$2,
5127
5270
  },
5128
5271
  };
5129
- const udm$G = {
5130
- singularName: 'activity',
5131
- pluralName: 'activities',
5132
- fieldsSchema: FIELDS_SCHEMA$G,
5133
- list: {
5134
- filterFields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
5272
+
5273
+ const AddressSchema = {
5274
+ type: 'object',
5275
+ properties: {
5276
+ type: { type: 'string' },
5277
+ full: { type: 'string' },
5278
+ street: { type: 'string' },
5279
+ city: { type: 'string' },
5280
+ state: { type: 'string' },
5281
+ country: { type: 'string' },
5282
+ zip: { type: 'string' },
5135
5283
  },
5136
- match: {
5137
- fields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
5284
+ };
5285
+ const PhoneEmailSchema = {
5286
+ type: 'object',
5287
+ properties: {
5288
+ value: { type: 'string' },
5289
+ type: { type: 'string' },
5138
5290
  },
5139
- populateFields,
5140
- udmFallbacks: [
5141
- {
5142
- udm: 'tasks',
5143
- importFields: FallbackFieldsMap.fromTasksToActivities,
5144
- exportFields: FallbackFieldsMap.fromActivitiesToTasks,
5145
- },
5146
- {
5147
- udm: 'meetings',
5148
- },
5149
- {
5150
- udm: 'notes',
5151
- importFields: FallbackFieldsMap.fromNotesToActivities,
5152
- exportFields: FallbackFieldsMap.fromActivitiesToNotes,
5153
- },
5154
- {
5155
- udm: 'emails',
5156
- importFields: FallbackFieldsMap.fromEmailsToActivities,
5157
- exportFields: FallbackFieldsMap.fromActivitiesToEmails,
5158
- },
5159
- ],
5160
5291
  };
5161
- function populateFields(fields) {
5162
- const result = JSON.parse(JSON.stringify(fields));
5163
- if (!result.dueTime) {
5164
- result.dueTime = result.endTime || result.startTime;
5165
- }
5166
- if (!result.startTime) {
5167
- result.startTime = result.dueTime || result.endTime;
5168
- }
5169
- if (!result.endTime) {
5170
- result.endTime = result.dueTime || result.startTime;
5171
- }
5172
- return result;
5173
- }
5174
5292
 
5175
- const FIELDS_SCHEMA$F = {
5293
+ const FIELDS_SCHEMA$C = {
5176
5294
  type: 'object',
5177
5295
  properties: {
5178
5296
  id: { type: 'string', readOnly: true },
5179
- number: { type: 'string' },
5180
- name: { type: 'string' },
5181
- memo: { type: 'string' },
5182
- status: { type: 'string' },
5183
- paymentMethod: { type: 'string' },
5184
- supplierId: { type: 'string', referenceUdm: 'suppliers' },
5185
- currency: { type: 'string' },
5186
- payments: {
5187
- type: 'array',
5188
- items: {
5189
- type: 'string',
5190
- referenceUdm: 'payments',
5191
- },
5297
+ name: {
5298
+ type: 'string',
5192
5299
  },
5193
- lineItems: {
5300
+ websiteUrl: {
5301
+ type: 'string',
5302
+ },
5303
+ phones: {
5194
5304
  type: 'array',
5195
- items: {
5196
- type: 'object',
5197
- properties: {
5198
- id: { type: 'string' },
5199
- itemName: { type: 'string' },
5200
- description: { type: 'string' },
5201
- code: { type: 'string' },
5202
- type: { type: 'string' },
5203
- companyId: { type: 'string', referenceUdm: 'companies' },
5204
- ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5205
- quantity: { type: 'number' },
5206
- unitPrice: { type: 'number' },
5207
- unitOfMeasure: { type: 'string' },
5208
- purchasePrice: { type: 'number' },
5209
- salesPrice: { type: 'number' },
5210
- taxable: { type: 'boolean' },
5211
- taxAmount: { type: 'number' },
5212
- totalAmount: { type: 'number' },
5213
- },
5214
- },
5305
+ items: PhoneEmailSchema,
5215
5306
  },
5216
- totalAmount: { type: 'number' },
5217
- totalTax: { type: 'number' },
5218
- exchangeRate: { type: 'number' },
5219
- totalDiscount: { type: 'number' },
5220
- subTotal: { type: 'number' },
5221
- balance: { type: 'number' },
5222
- ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5223
- issueDate: {
5307
+ primaryPhone: {
5224
5308
  type: 'string',
5225
- format: 'date-time',
5226
5309
  },
5227
- dueDate: {
5310
+ description: {
5228
5311
  type: 'string',
5229
- format: 'date-time',
5230
5312
  },
5231
- paidOnDate: {
5313
+ currency: {
5232
5314
  type: 'string',
5233
- format: 'date-time',
5234
5315
  },
5235
- createdTime: { type: 'string', format: 'date-time', readOnly: true },
5236
- createdBy: { type: 'string', referenceUdm: 'users', readOnly: true },
5237
- updatedTime: { type: 'string', format: 'date-time', readOnly: true },
5238
- updatedBy: { type: 'string', referenceUdm: 'users', readOnly: true },
5239
- },
5240
- };
5241
- const udm$F = {
5242
- singularName: 'bill',
5243
- pluralName: 'bills',
5244
- fieldsSchema: FIELDS_SCHEMA$F,
5245
- list: {
5246
- filterFields: ['name', 'number', 'status', 'supplierId'],
5247
- },
5248
- match: {
5249
- fields: ['name', 'number', 'status', 'supplierId'],
5250
- },
5251
- };
5252
-
5253
- const FIELDS_SCHEMA$E = {
5254
- type: 'object',
5255
- properties: {
5256
- id: { type: 'string', readOnly: true },
5257
- fullName: { type: 'string' },
5258
- firstName: { type: 'string' },
5259
- lastName: { type: 'string' },
5260
- primaryEmail: { type: 'string' },
5261
- campaignId: {
5316
+ industry: {
5262
5317
  type: 'string',
5263
- referenceUdm: 'campaigns',
5264
5318
  },
5265
- contactId: {
5319
+ ownerId: {
5266
5320
  type: 'string',
5267
- referenceUdm: 'contacts',
5321
+ referenceUdm: 'users',
5268
5322
  },
5269
- leadId: {
5270
- type: 'string',
5271
- referenceUdm: 'leads',
5323
+ primaryAddress: AddressSchema,
5324
+ addresses: {
5325
+ type: 'array',
5326
+ items: AddressSchema,
5272
5327
  },
5273
- source: { type: 'string' },
5274
- status: { type: 'string' },
5275
- companyId: {
5276
- type: 'string',
5277
- referenceUdm: 'companies',
5328
+ numberOfEmployees: {
5329
+ type: 'number',
5278
5330
  },
5279
- jobTitle: { type: 'string' },
5280
- hasOptedOutOfEmail: { type: 'boolean' },
5281
5331
  createdTime: {
5282
5332
  type: 'string',
5283
5333
  format: 'date-time',
5284
5334
  },
5285
5335
  createdBy: {
5286
5336
  type: 'string',
5287
- readOnly: true,
5288
5337
  referenceUdm: 'users',
5338
+ readOnly: true,
5289
5339
  },
5290
5340
  updatedTime: {
5291
5341
  type: 'string',
5292
- readOnly: true,
5293
5342
  format: 'date-time',
5343
+ readOnly: true,
5294
5344
  },
5295
5345
  updatedBy: {
5296
5346
  type: 'string',
5297
- readOnly: true,
5298
5347
  referenceUdm: 'users',
5348
+ readOnly: true,
5349
+ },
5350
+ lastActivityTime: {
5351
+ type: 'string',
5352
+ format: 'date-time',
5353
+ readOnly: true,
5299
5354
  },
5300
5355
  },
5301
5356
  };
5302
- const udm$E = {
5303
- singularName: 'campaign-member',
5304
- pluralName: 'campaign-members',
5305
- fieldsSchema: FIELDS_SCHEMA$E,
5357
+ const udm$C = {
5358
+ singularName: 'company',
5359
+ pluralName: 'companies',
5360
+ fieldsSchema: FIELDS_SCHEMA$C,
5306
5361
  list: {
5307
- filterFields: [
5308
- 'primaryEmail',
5309
- 'fullName',
5310
- 'firstName',
5311
- 'lastName',
5312
- 'campaignId',
5313
- 'contactId',
5314
- 'leadId',
5315
- 'companyId',
5316
- ],
5362
+ filterFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5363
+ },
5364
+ find: {
5365
+ queryFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5317
5366
  },
5318
5367
  match: {
5319
- fields: ['primaryEmail', 'fullName', 'firstName', 'lastName', 'campaignId', 'contactId', 'leadId', 'companyId'],
5368
+ fields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5369
+ },
5370
+ fieldFallbacks: {
5371
+ 'primaryAddress.full': [
5372
+ {
5373
+ $concat: {
5374
+ values: [
5375
+ { $var: 'primaryAddress.street' },
5376
+ { $var: 'primaryAddress.city' },
5377
+ { $var: 'primaryAddress.state' },
5378
+ { $var: 'primaryAddress.zip' },
5379
+ { $var: 'primaryAddress.country' },
5380
+ ],
5381
+ delimiter: ', ',
5382
+ },
5383
+ },
5384
+ ],
5320
5385
  },
5321
5386
  };
5322
5387
 
5323
- const FIELDS_SCHEMA$D = {
5388
+ const FIELDS_SCHEMA$B = {
5324
5389
  type: 'object',
5325
5390
  properties: {
5326
5391
  id: { type: 'string', readOnly: true },
5327
- name: {
5392
+ name: { type: 'string' },
5393
+ description: { type: 'string' },
5394
+ source: { type: 'string' },
5395
+ type: { type: 'string' },
5396
+ ownerId: {
5328
5397
  type: 'string',
5398
+ referenceUdm: 'users',
5329
5399
  },
5330
- cost: {
5331
- type: 'number',
5332
- },
5333
- description: {
5400
+ createdTime: {
5334
5401
  type: 'string',
5335
- },
5336
- source: {
5337
- type: 'string',
5338
- },
5339
- stage: {
5340
- type: 'string',
5341
- },
5342
- type: {
5343
- type: 'string',
5344
- },
5345
- ownerId: {
5346
- type: 'string',
5347
- referenceUdm: 'users',
5348
- },
5349
- sentCount: {
5350
- type: 'number',
5351
- readOnly: true,
5352
- },
5353
- replyCount: {
5354
- type: 'number',
5355
- readOnly: true,
5356
- },
5357
- openCount: {
5358
- type: 'number',
5359
- readOnly: true,
5360
- },
5361
- clickCount: {
5362
- type: 'number',
5363
- readOnly: true,
5364
- },
5365
- startTime: {
5366
- type: 'string',
5367
- format: 'date-time',
5368
- },
5369
- endTime: {
5370
- type: 'string',
5371
- format: 'date-time',
5372
- },
5373
- createdTime: {
5374
- type: 'string',
5375
- format: 'date-time',
5376
- readOnly: true,
5377
- },
5378
- createdBy: {
5379
- type: 'string',
5380
- referenceUdm: 'users',
5381
- readOnly: true,
5382
- },
5383
- updatedTime: {
5384
- type: 'string',
5385
- format: 'date-time',
5386
- readOnly: true,
5387
- },
5388
- updatedBy: {
5389
- type: 'string',
5390
- referenceUdm: 'users',
5391
- readOnly: true,
5392
- },
5393
- lastActivityTime: {
5394
- type: 'string',
5395
- format: 'date-time',
5396
- readOnly: true,
5397
- },
5398
- },
5399
- };
5400
- const MODIFIABLE_FIELDS$2 = ['name', 'description', 'ownerId', 'startTime', 'endTime', 'cost', 'source', 'stage', 'type'];
5401
- const udm$D = {
5402
- singularName: 'campaign',
5403
- pluralName: 'campaigns',
5404
- fieldsSchema: FIELDS_SCHEMA$D,
5405
- categories: ['Marketing Automation', 'Sales', 'CRM', 'Ads'],
5406
- list: {
5407
- filterFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5408
- },
5409
- find: {
5410
- queryFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5411
- },
5412
- match: {
5413
- fields: ['name', 'source', 'stage', 'type', 'ownerId'],
5414
- },
5415
- create: {
5416
- fields: MODIFIABLE_FIELDS$2,
5417
- },
5418
- update: {
5419
- fields: MODIFIABLE_FIELDS$2,
5420
- },
5421
- };
5422
-
5423
- const AddressSchema = {
5424
- type: 'object',
5425
- properties: {
5426
- type: { type: 'string' },
5427
- full: { type: 'string' },
5428
- street: { type: 'string' },
5429
- city: { type: 'string' },
5430
- state: { type: 'string' },
5431
- country: { type: 'string' },
5432
- zip: { type: 'string' },
5433
- },
5434
- };
5435
- const PhoneEmailSchema = {
5436
- type: 'object',
5437
- properties: {
5438
- value: { type: 'string' },
5439
- type: { type: 'string' },
5440
- },
5441
- };
5442
-
5443
- const FIELDS_SCHEMA$C = {
5444
- type: 'object',
5445
- properties: {
5446
- id: { type: 'string', readOnly: true },
5447
- name: {
5448
- type: 'string',
5449
- },
5450
- websiteUrl: {
5451
- type: 'string',
5452
- },
5453
- phones: {
5454
- type: 'array',
5455
- items: PhoneEmailSchema,
5456
- },
5457
- primaryPhone: {
5458
- type: 'string',
5459
- },
5460
- description: {
5461
- type: 'string',
5462
- },
5463
- currency: {
5464
- type: 'string',
5465
- },
5466
- industry: {
5467
- type: 'string',
5468
- },
5469
- ownerId: {
5470
- type: 'string',
5471
- referenceUdm: 'users',
5472
- },
5473
- primaryAddress: AddressSchema,
5474
- addresses: {
5475
- type: 'array',
5476
- items: AddressSchema,
5477
- },
5478
- numberOfEmployees: {
5479
- type: 'number',
5480
- },
5481
- createdTime: {
5482
- type: 'string',
5483
- format: 'date-time',
5484
- },
5485
- createdBy: {
5486
- type: 'string',
5487
- referenceUdm: 'users',
5488
- readOnly: true,
5489
- },
5490
- updatedTime: {
5491
- type: 'string',
5492
- format: 'date-time',
5493
- readOnly: true,
5494
- },
5495
- updatedBy: {
5496
- type: 'string',
5497
- referenceUdm: 'users',
5498
- readOnly: true,
5499
- },
5500
- lastActivityTime: {
5501
- type: 'string',
5502
- format: 'date-time',
5503
- readOnly: true,
5504
- },
5505
- },
5506
- };
5507
- const udm$C = {
5508
- singularName: 'company',
5509
- pluralName: 'companies',
5510
- fieldsSchema: FIELDS_SCHEMA$C,
5511
- list: {
5512
- filterFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5513
- },
5514
- find: {
5515
- queryFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5516
- },
5517
- match: {
5518
- fields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5519
- },
5520
- fieldFallbacks: {
5521
- 'primaryAddress.full': [
5522
- {
5523
- $concat: {
5524
- values: [
5525
- { $var: 'primaryAddress.street' },
5526
- { $var: 'primaryAddress.city' },
5527
- { $var: 'primaryAddress.state' },
5528
- { $var: 'primaryAddress.zip' },
5529
- { $var: 'primaryAddress.country' },
5530
- ],
5531
- delimiter: ', ',
5532
- },
5533
- },
5534
- ],
5535
- },
5536
- };
5537
-
5538
- const FIELDS_SCHEMA$B = {
5539
- type: 'object',
5540
- properties: {
5541
- id: { type: 'string', readOnly: true },
5542
- name: { type: 'string' },
5543
- description: { type: 'string' },
5544
- source: { type: 'string' },
5545
- type: { type: 'string' },
5546
- ownerId: {
5547
- type: 'string',
5548
- referenceUdm: 'users',
5549
- },
5550
- createdTime: {
5551
- type: 'string',
5552
- format: 'date-time',
5553
- readOnly: true,
5402
+ format: 'date-time',
5403
+ readOnly: true,
5554
5404
  },
5555
5405
  createdBy: {
5556
5406
  type: 'string',
@@ -7968,173 +7818,6 @@ const udm = {
7968
7818
  },
7969
7819
  };
7970
7820
 
7971
- const structuredClone$1 = (structuredClonePolyfill === null || structuredClonePolyfill === void 0 ? void 0 : structuredClonePolyfill.default) || structuredClonePolyfill;
7972
- function isNil(value) {
7973
- return value == null;
7974
- }
7975
- function omitBy(obj, check) {
7976
- obj = { ...obj };
7977
- Object.entries(obj).forEach(([key, value]) => check(value) && delete obj[key]);
7978
- return obj;
7979
- }
7980
- function isEmptyValue(value) {
7981
- if (isNil(value)) {
7982
- return true;
7983
- }
7984
- if (typeof value === 'symbol') {
7985
- return true;
7986
- }
7987
- if (typeof value === 'boolean') {
7988
- return false;
7989
- }
7990
- if (typeof value === 'number') {
7991
- return isNaN(value);
7992
- }
7993
- if (typeof value === 'string') {
7994
- return value.trim().length === 0;
7995
- }
7996
- const tag = value.toString();
7997
- if (tag === '[object Map]' || tag === '[object Set]') {
7998
- return !value.size;
7999
- }
8000
- return typeof value === 'object' && Object.keys(value).length === 0;
8001
- }
8002
- const simpleUniqueId = () => {
8003
- return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)
8004
- .toString(36)
8005
- .padStart(11, '0')
8006
- .substring(0, 11);
8007
- };
8008
-
8009
- function getDataLocationMethodPath(locationKey, methodKey) {
8010
- return `data/${locationKey}/${jsConvertCase.toKebabCase(methodKey)}`;
8011
- }
8012
- function dataLocationParametersMatch({ locationParameters, targetParameters, }) {
8013
- targetParameters = typeof targetParameters === 'object' && targetParameters ? targetParameters : {};
8014
- locationParameters = typeof locationParameters === 'object' && locationParameters ? locationParameters : {};
8015
- for (const [key, value] of Object.entries(targetParameters)) {
8016
- if (locationParameters[key] !== value) {
8017
- return false;
8018
- }
8019
- }
8020
- return true;
8021
- }
8022
- function parseDataLocationPath(path) {
8023
- if (!path) {
8024
- return undefined;
8025
- }
8026
- if (path.startsWith('/')) {
8027
- path = path.slice(1);
8028
- }
8029
- if (!path.startsWith('data/')) {
8030
- throw new Error(`Invalid data location path: ${path}. It should start with "data/"`);
8031
- }
8032
- path = path.slice(5);
8033
- const [key, query] = path.split('?');
8034
- const parameters = Object.fromEntries(new URLSearchParams(query).entries());
8035
- return { key, parameters };
8036
- }
8037
- function makeDataLocationPath(pointer) {
8038
- var _a;
8039
- const normalizedPointer = normalizePointer(pointer);
8040
- if (normalizedPointer === null || normalizedPointer === void 0 ? void 0 : normalizedPointer.key) {
8041
- let path = `/data/${normalizedPointer.key}`;
8042
- const parameters = omitBy((_a = normalizedPointer.parameters) !== null && _a !== void 0 ? _a : {}, isNil);
8043
- if (Object.keys(parameters).length > 0) {
8044
- path += `?${new URLSearchParams(parameters).toString()}`;
8045
- }
8046
- return path;
8047
- }
8048
- else {
8049
- return undefined;
8050
- }
8051
- }
8052
- function normalizePointer(pointer) {
8053
- if (typeof pointer === 'string' && pointer.startsWith('/data/')) {
8054
- return {
8055
- key: pointer.slice(6),
8056
- };
8057
- }
8058
- return pointer;
8059
- }
8060
- function makeDataLocationOperationPath(collectionPath, operation) {
8061
- const [path, query] = (collectionPath !== null && collectionPath !== void 0 ? collectionPath : '').split('?');
8062
- return urljoin(path, operation, query ? `?${query}` : '');
8063
- }
8064
- function isSameDataLocation(location1, location2) {
8065
- if (location1.key !== location2.key) {
8066
- return false;
8067
- }
8068
- const cleanParameters1 = location1.parameters && Object.keys(location1.parameters).length > 0 ? location1.parameters : undefined;
8069
- const cleanParameters2 = location2.parameters && Object.keys(location2.parameters).length > 0 ? location2.parameters : undefined;
8070
- if (!deepEqual(cleanParameters1, cleanParameters2)) {
8071
- return false;
8072
- }
8073
- return true;
8074
- }
8075
- function isDataLocationMethodSupported(location, methodKey) {
8076
- var _a;
8077
- const method = (_a = location === null || location === void 0 ? void 0 : location.methods) === null || _a === void 0 ? void 0 : _a[methodKey];
8078
- return method && method.implementationType !== exports.ConnectorMethodImplementationType.notSupported;
8079
- }
8080
- function getDataCollectionCreateFields(spec) {
8081
- if (!spec)
8082
- return undefined;
8083
- if (!spec.fieldsSchema)
8084
- return undefined;
8085
- if (!spec.create)
8086
- return undefined;
8087
- let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
8088
- if (spec.create.fields) {
8089
- schema = pickFieldsFromSchema(schema, spec.create.fields);
8090
- }
8091
- if (spec.create.excludedFields) {
8092
- schema = excludeFieldsFromSchema(schema, spec.create.excludedFields);
8093
- }
8094
- return schema;
8095
- }
8096
- function getDataCollectionUpdateFields(spec) {
8097
- if (!spec)
8098
- return undefined;
8099
- if (!spec.fieldsSchema)
8100
- return undefined;
8101
- if (!spec.update)
8102
- return undefined;
8103
- let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
8104
- if (spec.update.fields) {
8105
- schema = pickFieldsFromSchema(schema, spec.update.fields);
8106
- }
8107
- if (spec.update.excludedFields) {
8108
- schema = excludeFieldsFromSchema(schema, spec.update.excludedFields);
8109
- }
8110
- return schema;
8111
- }
8112
- function getWritableFieldsSchema(spec) {
8113
- if (!spec)
8114
- return undefined;
8115
- if (!spec.fieldsSchema)
8116
- return undefined;
8117
- return mergeSchemas([getDataCollectionCreateFields(spec), getDataCollectionUpdateFields(spec)]);
8118
- }
8119
- function getReferenceCollectionPointerForSchema(schema) {
8120
- if ((schema === null || schema === void 0 ? void 0 : schema.referenceCollection) && schema.referenceCollection.key) {
8121
- return schema.referenceCollection;
8122
- }
8123
- else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionPath) {
8124
- return parseDataLocationPath(schema.referenceCollectionPath);
8125
- }
8126
- else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionUri) {
8127
- return parseDataLocationPath(schema.referenceCollectionUri);
8128
- }
8129
- else {
8130
- return undefined;
8131
- }
8132
- }
8133
- function getReferenceCollectionPathForSchema(schema) {
8134
- const pointer = getReferenceCollectionPointerForSchema(schema);
8135
- return makeDataLocationPath(pointer);
8136
- }
8137
-
8138
7821
  exports.UDM = void 0;
8139
7822
  (function (UDM) {
8140
7823
  UDM["ACTIVITIES"] = "activities";
@@ -8269,113 +7952,435 @@ function findUdmDefaultCollection(spec, udm, useFallback = true) {
8269
7952
  }
8270
7953
  if ((_h = (_g = (_f = (_e = spec.udm) === null || _e === void 0 ? void 0 : _e[udm]) === null || _f === void 0 ? void 0 : _f.collectionMappings) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.key) {
8271
7954
  return {
8272
- key: spec.udm[udm].collectionMappings[0].key,
7955
+ key: spec.udm[udm].collectionMappings[0].key,
7956
+ };
7957
+ }
7958
+ const udmSpec = UNIFIED_DATA_MODELS[udm];
7959
+ if (!udmSpec) {
7960
+ throw new BadRequestError(`Unknown UDM: ${udm}`);
7961
+ }
7962
+ if (useFallback) {
7963
+ for (const fallback of (_j = udmSpec.udmFallbacks) !== null && _j !== void 0 ? _j : []) {
7964
+ const pointer = findUdmDefaultCollection(spec, fallback.udm, false);
7965
+ if (pointer) {
7966
+ return pointer;
7967
+ }
7968
+ }
7969
+ }
7970
+ return undefined;
7971
+ }
7972
+ function addUdmFallbackFields(fields, udm) {
7973
+ if (!udm) {
7974
+ return fields;
7975
+ }
7976
+ const udmSpec = UNIFIED_DATA_MODELS[udm];
7977
+ if (!udmSpec) {
7978
+ throw new BadRequestError(`Unknown UDM: ${udm}`);
7979
+ }
7980
+ if (!udmSpec.fieldFallbacks) {
7981
+ return fields;
7982
+ }
7983
+ let result = structuredClone$1(fields);
7984
+ for (const fieldKeyWithFallbacks of Object.keys(udmSpec.fieldFallbacks)) {
7985
+ const currentValue = getValueAtLocator(fields, fieldKeyWithFallbacks);
7986
+ if (currentValue !== undefined)
7987
+ continue;
7988
+ for (const fallbackValue of udmSpec.fieldFallbacks[fieldKeyWithFallbacks]) {
7989
+ const varFormulaLocators = getVariableLocators(fallbackValue);
7990
+ const varLocators = [];
7991
+ for (const varFormulaLocator of varFormulaLocators) {
7992
+ const formula = exports.getFormula(getValueAtLocator(fallbackValue, varFormulaLocator));
7993
+ varLocators.push(formula.locator);
7994
+ }
7995
+ const fallbackValueHasDependencies = varLocators.some((locator) => getValueAtLocator(fields, locator) !== undefined);
7996
+ if (fallbackValueHasDependencies) {
7997
+ result = setValueAtLocator(result, fieldKeyWithFallbacks, transformVars(fallbackValue, fields));
7998
+ break;
7999
+ }
8000
+ }
8001
+ }
8002
+ return result;
8003
+ }
8004
+
8005
+ const DATA_RECORD_SCHEMA = {
8006
+ type: 'object',
8007
+ properties: {
8008
+ id: {
8009
+ type: 'string',
8010
+ },
8011
+ name: {
8012
+ type: 'string',
8013
+ },
8014
+ uri: {
8015
+ type: 'string',
8016
+ format: 'url',
8017
+ },
8018
+ createdTime: {
8019
+ type: 'string',
8020
+ format: 'datetime',
8021
+ },
8022
+ updatedTime: {
8023
+ type: 'string',
8024
+ format: 'datetime',
8025
+ },
8026
+ deletedTime: {
8027
+ type: 'string',
8028
+ format: 'datetime',
8029
+ },
8030
+ createdById: {
8031
+ type: 'string',
8032
+ },
8033
+ updatedById: {
8034
+ type: 'string',
8035
+ },
8036
+ },
8037
+ };
8038
+ function makeDataRecordSchema({ fieldsSchema, udm, rawFieldsSchema, }) {
8039
+ var _a, _b, _c;
8040
+ const schema = structuredClone$1(DATA_RECORD_SCHEMA);
8041
+ schema.properties = {
8042
+ ...((_a = schema.properties) !== null && _a !== void 0 ? _a : {}),
8043
+ fields: fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : { type: 'object' },
8044
+ };
8045
+ if (udm) {
8046
+ const unifiedModel = UNIFIED_DATA_MODELS[udm];
8047
+ if (unifiedModel === null || unifiedModel === void 0 ? void 0 : unifiedModel.fieldsSchema) {
8048
+ schema.properties = {
8049
+ ...((_b = schema.properties) !== null && _b !== void 0 ? _b : {}),
8050
+ unifiedFields: unifiedModel.fieldsSchema,
8051
+ };
8052
+ }
8053
+ }
8054
+ if (rawFieldsSchema) {
8055
+ schema.properties = {
8056
+ ...((_c = schema.properties) !== null && _c !== void 0 ? _c : {}),
8057
+ rawFields: rawFieldsSchema,
8058
+ };
8059
+ }
8060
+ return schema;
8061
+ }
8062
+
8063
+ const DataLocationMethodImplementationTypes = [
8064
+ exports.ConnectorMethodImplementationType.operationMapping,
8065
+ exports.ConnectorMethodImplementationType.restApiMapping,
8066
+ exports.ConnectorMethodImplementationType.graphqlApiMapping,
8067
+ exports.ConnectorMethodImplementationType.javascript,
8068
+ exports.ConnectorMethodImplementationType.notSupported,
8069
+ ];
8070
+
8071
+ const DataCollectionMethodCreate = {
8072
+ name: 'Create',
8073
+ description: 'Create a new data record in the collection',
8074
+ getConfigSchema: ({ collectionSpec }) => {
8075
+ var _a, _b;
8076
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8077
+ return {
8078
+ type: 'object',
8079
+ properties: {
8080
+ fields: {
8081
+ type: 'array',
8082
+ items: { type: 'string', enum: fields },
8083
+ },
8084
+ excludedFields: {
8085
+ type: 'array',
8086
+ items: { type: 'string', enum: fields },
8087
+ },
8088
+ },
8089
+ };
8090
+ },
8091
+ getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
8092
+ var _a;
8093
+ let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
8094
+ if (method === null || method === void 0 ? void 0 : method.fields) {
8095
+ fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
8096
+ }
8097
+ if (method === null || method === void 0 ? void 0 : method.excludedFields) {
8098
+ fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
8099
+ }
8100
+ return {
8101
+ type: 'object',
8102
+ properties: nonEmptyObjectProperties({
8103
+ fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
8104
+ type: 'object',
8105
+ },
8106
+ credentials: credentialsSchema,
8107
+ }),
8108
+ };
8109
+ },
8110
+ getOutputSchema: ({}) => ({
8111
+ type: 'object',
8112
+ properties: {
8113
+ id: { type: 'string' },
8114
+ },
8115
+ }),
8116
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8117
+ };
8118
+
8119
+ const DataCollectionMethodDelete = {
8120
+ name: 'Delete',
8121
+ description: 'Delete a data record from the collection by id',
8122
+ getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => {
8123
+ return {
8124
+ type: 'object',
8125
+ properties: nonEmptyObjectProperties({
8126
+ id: {
8127
+ type: 'string',
8128
+ referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
8129
+ },
8130
+ credentials: credentialsSchema,
8131
+ }),
8132
+ };
8133
+ },
8134
+ getOutputSchema: () => null,
8135
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8136
+ };
8137
+
8138
+ const DataCollectionMethodFind = {
8139
+ isDeprecated: true,
8140
+ name: 'Find',
8141
+ description: 'Find a list of data records in the collection',
8142
+ getConfigSchema: ({ collectionSpec }) => {
8143
+ var _a, _b;
8144
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8145
+ return {
8146
+ type: 'object',
8147
+ properties: {
8148
+ queryFields: {
8149
+ type: 'array',
8150
+ items: { type: 'string', enum: fields },
8151
+ },
8152
+ },
8153
+ };
8154
+ },
8155
+ getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
8156
+ const queryFieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.queryFields);
8157
+ const schema = {
8158
+ type: 'object',
8159
+ properties: nonEmptyObjectProperties({
8160
+ cursor: { type: 'string' },
8161
+ credentials: credentialsSchema,
8162
+ }),
8163
+ };
8164
+ if (queryFieldsSchema === null || queryFieldsSchema === void 0 ? void 0 : queryFieldsSchema.properties) {
8165
+ schema.properties = {
8166
+ ...schema.properties,
8167
+ query: transformVariablesWith(queryFieldsSchema, (locator) => `query.${locatorToField(locator)}`),
8168
+ };
8169
+ }
8170
+ return schema;
8171
+ },
8172
+ getOutputSchema: ({ collectionSpec }) => {
8173
+ var _a;
8174
+ return ({
8175
+ type: 'object',
8176
+ properties: {
8177
+ records: {
8178
+ type: 'array',
8179
+ items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8180
+ },
8181
+ cursor: {
8182
+ type: 'string',
8183
+ },
8184
+ },
8185
+ });
8186
+ },
8187
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8188
+ };
8189
+
8190
+ const DataCollectionMethodFindById = {
8191
+ name: 'Find by ID',
8192
+ description: 'Find a single data record in the collection by its id',
8193
+ getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => ({
8194
+ type: 'object',
8195
+ properties: nonEmptyObjectProperties({
8196
+ id: {
8197
+ type: 'string',
8198
+ referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
8199
+ },
8200
+ credentials: credentialsSchema,
8201
+ }),
8202
+ }),
8203
+ getOutputSchema: ({ collectionSpec }) => {
8204
+ var _a;
8205
+ return ({
8206
+ type: 'object',
8207
+ properties: {
8208
+ record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8209
+ },
8210
+ });
8211
+ },
8212
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8213
+ };
8214
+
8215
+ const DataCollectionMethodList = {
8216
+ name: 'List',
8217
+ description: 'Return all data records from the collection',
8218
+ getConfigSchema: ({ collectionSpec }) => {
8219
+ var _a, _b;
8220
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8221
+ return {
8222
+ type: 'object',
8223
+ properties: {
8224
+ filterFields: {
8225
+ type: 'array',
8226
+ items: { type: 'string', enum: fields },
8227
+ },
8228
+ },
8229
+ };
8230
+ },
8231
+ getInputSchema: ({ method, collectionSpec, credentialsSchema }) => {
8232
+ const fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
8233
+ let filterSchema;
8234
+ if (method === null || method === void 0 ? void 0 : method.filterFields) {
8235
+ filterSchema = pickFieldsFromSchema(fieldsSchema, method.filterFields);
8236
+ }
8237
+ return {
8238
+ type: 'object',
8239
+ properties: nonEmptyObjectProperties({
8240
+ filter: filterSchema,
8241
+ cursor: {
8242
+ type: 'string',
8243
+ description: 'Cursor returned in response to the previous "list" request',
8244
+ },
8245
+ credentials: credentialsSchema,
8246
+ }),
8247
+ };
8248
+ },
8249
+ getOutputSchema: ({ collectionSpec }) => {
8250
+ var _a;
8251
+ return ({
8252
+ type: 'object',
8253
+ properties: {
8254
+ records: {
8255
+ type: 'array',
8256
+ items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8257
+ },
8258
+ cursor: {
8259
+ type: 'string',
8260
+ description: 'Cursor to request the next page of results',
8261
+ },
8262
+ },
8263
+ });
8264
+ },
8265
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8266
+ };
8267
+
8268
+ const DataCollectionMethodMatch = {
8269
+ name: 'Match',
8270
+ description: 'Find a single matching record in a data collection by a set of fields',
8271
+ getConfigSchema: ({ collectionSpec }) => {
8272
+ var _a, _b;
8273
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8274
+ return {
8275
+ type: 'object',
8276
+ properties: {
8277
+ fields: {
8278
+ type: 'array',
8279
+ items: { type: 'string', enum: fields },
8280
+ },
8281
+ },
8273
8282
  };
8274
- }
8275
- const udmSpec = UNIFIED_DATA_MODELS[udm];
8276
- if (!udmSpec) {
8277
- throw new BadRequestError(`Unknown UDM: ${udm}`);
8278
- }
8279
- if (useFallback) {
8280
- for (const fallback of (_j = udmSpec.udmFallbacks) !== null && _j !== void 0 ? _j : []) {
8281
- const pointer = findUdmDefaultCollection(spec, fallback.udm, false);
8282
- if (pointer) {
8283
- return pointer;
8284
- }
8285
- }
8286
- }
8287
- return undefined;
8288
- }
8289
- function addUdmFallbackFields(fields, udm) {
8290
- if (!udm) {
8291
- return fields;
8292
- }
8293
- const udmSpec = UNIFIED_DATA_MODELS[udm];
8294
- if (!udmSpec) {
8295
- throw new BadRequestError(`Unknown UDM: ${udm}`);
8296
- }
8297
- if (!udmSpec.fieldFallbacks) {
8298
- return fields;
8299
- }
8300
- let result = structuredClone$1(fields);
8301
- for (const fieldKeyWithFallbacks of Object.keys(udmSpec.fieldFallbacks)) {
8302
- const currentValue = getValueAtLocator(fields, fieldKeyWithFallbacks);
8303
- if (currentValue !== undefined)
8304
- continue;
8305
- for (const fallbackValue of udmSpec.fieldFallbacks[fieldKeyWithFallbacks]) {
8306
- const varFormulaLocators = getVariableLocators(fallbackValue);
8307
- const varLocators = [];
8308
- for (const varFormulaLocator of varFormulaLocators) {
8309
- const formula = exports.getFormula(getValueAtLocator(fallbackValue, varFormulaLocator));
8310
- varLocators.push(formula.locator);
8311
- }
8312
- const fallbackValueHasDependencies = varLocators.some((locator) => getValueAtLocator(fields, locator) !== undefined);
8313
- if (fallbackValueHasDependencies) {
8314
- result = setValueAtLocator(result, fieldKeyWithFallbacks, transformVars(fallbackValue, fields));
8315
- break;
8316
- }
8317
- }
8318
- }
8319
- return result;
8320
- }
8283
+ },
8284
+ getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
8285
+ const fieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.fields);
8286
+ return {
8287
+ type: 'object',
8288
+ properties: nonEmptyObjectProperties({
8289
+ query: transformVariablesWith(fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : {}, (locator) => `query.${locatorToField(locator)}`),
8290
+ credentials: credentialsSchema,
8291
+ }),
8292
+ };
8293
+ },
8294
+ getOutputSchema: ({ collectionSpec }) => {
8295
+ var _a;
8296
+ return ({
8297
+ type: 'object',
8298
+ properties: {
8299
+ record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8300
+ },
8301
+ });
8302
+ },
8303
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8304
+ };
8321
8305
 
8322
- const DATA_RECORD_SCHEMA = {
8323
- type: 'object',
8324
- properties: {
8325
- id: {
8326
- type: 'string',
8327
- },
8328
- name: {
8329
- type: 'string',
8330
- },
8331
- uri: {
8332
- type: 'string',
8333
- format: 'url',
8334
- },
8335
- createdTime: {
8336
- type: 'string',
8337
- format: 'datetime',
8338
- },
8339
- updatedTime: {
8340
- type: 'string',
8341
- format: 'datetime',
8342
- },
8343
- deletedTime: {
8344
- type: 'string',
8345
- format: 'datetime',
8346
- },
8347
- createdById: {
8348
- type: 'string',
8349
- },
8350
- updatedById: {
8351
- type: 'string',
8352
- },
8306
+ const DataCollectionMethodSearch = {
8307
+ name: 'Search',
8308
+ description: 'Find data records in a collection by a string query',
8309
+ getInputSchema: ({ credentialsSchema }) => ({
8310
+ type: 'object',
8311
+ properties: nonEmptyObjectProperties({
8312
+ query: { type: 'string' },
8313
+ cursor: { type: 'string' },
8314
+ credentials: credentialsSchema,
8315
+ }),
8316
+ }),
8317
+ getOutputSchema: ({ collectionSpec }) => {
8318
+ var _a;
8319
+ return ({
8320
+ type: 'object',
8321
+ properties: {
8322
+ records: {
8323
+ type: 'array',
8324
+ items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8325
+ },
8326
+ cursor: { type: 'string' },
8327
+ },
8328
+ });
8353
8329
  },
8330
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8354
8331
  };
8355
- function makeDataRecordSchema({ fieldsSchema, udm, rawFieldsSchema, }) {
8356
- var _a, _b, _c;
8357
- const schema = structuredClone$1(DATA_RECORD_SCHEMA);
8358
- schema.properties = {
8359
- ...((_a = schema.properties) !== null && _a !== void 0 ? _a : {}),
8360
- fields: fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : { type: 'object' },
8361
- };
8362
- if (udm) {
8363
- const unifiedModel = UNIFIED_DATA_MODELS[udm];
8364
- if (unifiedModel === null || unifiedModel === void 0 ? void 0 : unifiedModel.fieldsSchema) {
8365
- schema.properties = {
8366
- ...((_b = schema.properties) !== null && _b !== void 0 ? _b : {}),
8367
- unifiedFields: unifiedModel.fieldsSchema,
8368
- };
8332
+
8333
+ const DataCollectionMethodUpdate = {
8334
+ name: 'Update',
8335
+ description: 'Update one data record in the collection by its id',
8336
+ getConfigSchema: ({ collectionSpec }) => {
8337
+ var _a, _b;
8338
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8339
+ return {
8340
+ type: 'object',
8341
+ properties: {
8342
+ fields: {
8343
+ type: 'array',
8344
+ items: { type: 'string', enum: fields },
8345
+ },
8346
+ excludedFields: {
8347
+ type: 'array',
8348
+ items: { type: 'string', enum: fields },
8349
+ },
8350
+ },
8351
+ };
8352
+ },
8353
+ getInputSchema: ({ collectionSpec, collectionHandler, credentialsSchema, method, parameters }) => {
8354
+ var _a;
8355
+ let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
8356
+ if (method === null || method === void 0 ? void 0 : method.fields) {
8357
+ fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
8369
8358
  }
8370
- }
8371
- if (rawFieldsSchema) {
8372
- schema.properties = {
8373
- ...((_c = schema.properties) !== null && _c !== void 0 ? _c : {}),
8374
- rawFields: rawFieldsSchema,
8359
+ if (method === null || method === void 0 ? void 0 : method.excludedFields) {
8360
+ fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
8361
+ }
8362
+ return {
8363
+ type: 'object',
8364
+ properties: nonEmptyObjectProperties({
8365
+ id: {
8366
+ type: 'string',
8367
+ referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
8368
+ },
8369
+ fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
8370
+ type: 'object',
8371
+ },
8372
+ credentials: credentialsSchema,
8373
+ }),
8375
8374
  };
8376
- }
8377
- return schema;
8378
- }
8375
+ },
8376
+ getOutputSchema: ({}) => ({
8377
+ type: 'object',
8378
+ properties: {
8379
+ id: { type: 'string' },
8380
+ },
8381
+ }),
8382
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8383
+ };
8379
8384
 
8380
8385
  const GetEventConfig = {
8381
8386
  fileKey: 'connector-event-get-event-config',
@@ -10336,6 +10341,10 @@ const FindConnectionsQuery = PaginationQuery.merge(SearchQuery)
10336
10341
  .string()
10337
10342
  .optional()
10338
10343
  .meta({ hidden: true }),
10344
+ externalAppId: z.z.string().optional().meta({
10345
+ filterTitle: 'External App',
10346
+ referenceElementType: exports.WorkspaceElementType.App,
10347
+ }),
10339
10348
  integrationKey: z.z
10340
10349
  .string()
10341
10350
  .optional()
@@ -10346,9 +10355,12 @@ const FindConnectionsQuery = PaginationQuery.merge(SearchQuery)
10346
10355
  });
10347
10356
  const CreateConnectionRequest = ConnectionEditableProperties.extend({
10348
10357
  integrationId: z.z.string().optional(),
10358
+ integrationUuid: z.z.string().optional(),
10359
+ integrationKey: z.z.string().optional(),
10349
10360
  connectorId: z.z.string().optional(),
10361
+ connectorUuid: z.z.string().optional(),
10362
+ connectorKey: z.z.string().optional(),
10350
10363
  connectorVersion: z.z.string().optional(),
10351
- externalAppId: z.z.string().optional(),
10352
10364
  });
10353
10365
  const UpdateConnectionRequest = ConnectionEditableProperties;
10354
10366
  const ConnectionExportProperties = ConnectionEditableProperties.omit({
@@ -10411,6 +10423,7 @@ const GenerateOptionsRequest = z.z.object({
10411
10423
  integrationId: z.z.string().optional(),
10412
10424
  integrationKey: z.z.string().optional(),
10413
10425
  connectorId: z.z.string().optional(),
10426
+ connectorKey: z.z.string().optional(),
10414
10427
  connectionId: z.z.string().optional(),
10415
10428
  connectorParameters: z.z.any().optional(),
10416
10429
  connectorVersion: z.z.string().optional(),
@@ -10420,6 +10433,7 @@ const ConnectPayload = z.z.object({
10420
10433
  integrationKey: z.z.string().optional(),
10421
10434
  integrationId: z.z.string().optional(),
10422
10435
  connectorId: z.z.string().optional(),
10436
+ connectorKey: z.z.string().optional(),
10423
10437
  connectorVersion: z.z.string().optional(),
10424
10438
  connectionId: z.z.string().optional(),
10425
10439
  name: z.z.string().optional(),
@@ -11709,6 +11723,7 @@ const WorkspaceElementSpecs = {
11709
11723
  name: 'App',
11710
11724
  namePlural: 'Apps',
11711
11725
  hasKey: true,
11726
+ hasPublicLayer: true,
11712
11727
  },
11713
11728
  [exports.WorkspaceElementType.Integration]: {
11714
11729
  type: exports.WorkspaceElementType.Integration,
@@ -11726,6 +11741,7 @@ const WorkspaceElementSpecs = {
11726
11741
  namePlural: 'Connectors',
11727
11742
  exportPropertiesSchema: ConnectorExportProperties,
11728
11743
  hasKey: true,
11744
+ hasPublicLayer: true,
11729
11745
  },
11730
11746
  [exports.WorkspaceElementType.Connection]: {
11731
11747
  type: exports.WorkspaceElementType.Connection,
@@ -11749,6 +11765,7 @@ const WorkspaceElementSpecs = {
11749
11765
  isIntegrationLevel: true,
11750
11766
  hasKey: true,
11751
11767
  hasParentChildRelationship: true,
11768
+ hasPublicLayer: true,
11752
11769
  isProOnly: true,
11753
11770
  },
11754
11771
  [exports.WorkspaceElementType.ActionInstance]: {
@@ -11775,6 +11792,7 @@ const WorkspaceElementSpecs = {
11775
11792
  canBeAddedToPackage: true,
11776
11793
  hasParentChildRelationship: true,
11777
11794
  hasKey: true,
11795
+ hasPublicLayer: true,
11778
11796
  },
11779
11797
  [exports.WorkspaceElementType.ActionRunLogRecord]: {
11780
11798
  type: exports.WorkspaceElementType.ActionRunLogRecord,
@@ -15477,25 +15495,6 @@ const CreateClusterRequest = z.z.object({
15477
15495
  });
15478
15496
  const ListClustersQuery = PaginationQuery;
15479
15497
 
15480
- class UI {
15481
- constructor(client) {
15482
- this.client = client;
15483
- }
15484
- async connect(options = {}) {
15485
- const { url, postData } = await this.client.getScreensPostData('connect', {
15486
- ...options,
15487
- allowMultipleConnections: options.allowMultipleConnections ? '1' : '',
15488
- connectorParameters: options.connectorParameters ? JSON.stringify(options.connectorParameters) : undefined,
15489
- });
15490
- return new Promise((resolve) => {
15491
- return openIframeWithPost(url, postData, {
15492
- onClose: () => resolve(null),
15493
- onSuccess: (connection) => resolve(connection),
15494
- });
15495
- });
15496
- }
15497
- }
15498
-
15499
15498
  const API_VERSIONS = {
15500
15499
  LEGACY: 'legacy',
15501
15500
  '2025-10-21': '2025-10-21',
@@ -15747,6 +15746,25 @@ class MembraneApiClient {
15747
15746
  }
15748
15747
  }
15749
15748
 
15749
+ class UI {
15750
+ constructor(client) {
15751
+ this.client = client;
15752
+ }
15753
+ async connect(options = {}) {
15754
+ const { url, postData } = await this.client.getScreensPostData('connect', {
15755
+ ...options,
15756
+ allowMultipleConnections: options.allowMultipleConnections ? '1' : '',
15757
+ connectorParameters: options.connectorParameters ? JSON.stringify(options.connectorParameters) : undefined,
15758
+ });
15759
+ return new Promise((resolve) => {
15760
+ return openIframeWithPost(url, postData, {
15761
+ onClose: () => resolve(null),
15762
+ onSuccess: (connection) => resolve(connection),
15763
+ });
15764
+ });
15765
+ }
15766
+ }
15767
+
15750
15768
  class MembraneClient extends MembraneApiClient {
15751
15769
  constructor(options) {
15752
15770
  super(options);
@@ -16121,6 +16139,7 @@ exports.Alert = Alert;
16121
16139
  exports.AlertDeliverySettingsSchema = AlertDeliverySettingsSchema;
16122
16140
  exports.AlertSchema = AlertSchema;
16123
16141
  exports.AlertTypeDeliverySettingsSchema = AlertTypeDeliverySettingsSchema;
16142
+ exports.And = And;
16124
16143
  exports.ApiRequestSpec = ApiRequestSpec;
16125
16144
  exports.AppDataSchemaAccessor = AppDataSchemaAccessor;
16126
16145
  exports.AppDataSchemaApiResponse = AppDataSchemaApiResponse;
@@ -16318,6 +16337,23 @@ exports.DEFAULT_ALERT_DELIVERY_SETTINGS = DEFAULT_ALERT_DELIVERY_SETTINGS;
16318
16337
  exports.DEFAULT_ALERT_TYPE_DELIVERY_SETTINGS = DEFAULT_ALERT_TYPE_DELIVERY_SETTINGS;
16319
16338
  exports.DEFAULT_FULL_SYNC_INTERVAL_SECONDS = DEFAULT_FULL_SYNC_INTERVAL_SECONDS;
16320
16339
  exports.DEFAULT_PULL_UPDATES_INTERVAL_SECONDS = DEFAULT_PULL_UPDATES_INTERVAL_SECONDS;
16340
+ exports.DataBuilderFormulaBase = DataBuilderFormulaBase;
16341
+ exports.DataBuilderFormulaCase = DataBuilderFormulaCase;
16342
+ exports.DataBuilderFormulaConcat = DataBuilderFormulaConcat;
16343
+ exports.DataBuilderFormulaCopy = DataBuilderFormulaCopy;
16344
+ exports.DataBuilderFormulaExtractDate = DataBuilderFormulaExtractDate;
16345
+ exports.DataBuilderFormulaExtractTime = DataBuilderFormulaExtractTime;
16346
+ exports.DataBuilderFormulaFindAppRecordId = DataBuilderFormulaFindAppRecordId;
16347
+ exports.DataBuilderFormulaFindExternalRecordId = DataBuilderFormulaFindExternalRecordId;
16348
+ exports.DataBuilderFormulaFirstName = DataBuilderFormulaFirstName;
16349
+ exports.DataBuilderFormulaIterate = DataBuilderFormulaIterate;
16350
+ exports.DataBuilderFormulaLastName = DataBuilderFormulaLastName;
16351
+ exports.DataBuilderFormulaLookup = DataBuilderFormulaLookup;
16352
+ exports.DataBuilderFormulaMap = DataBuilderFormulaMap;
16353
+ exports.DataBuilderFormulaPlain = DataBuilderFormulaPlain;
16354
+ exports.DataBuilderFormulaRecord = DataBuilderFormulaRecord;
16355
+ exports.DataBuilderFormulaTpl = DataBuilderFormulaTpl;
16356
+ exports.DataBuilderFormulaVar = DataBuilderFormulaVar;
16321
16357
  exports.DataCollectionCreateRequest = DataCollectionCreateRequest;
16322
16358
  exports.DataCollectionCreateResponse = DataCollectionCreateResponse;
16323
16359
  exports.DataCollectionCreateSpec = DataCollectionCreateSpec;
@@ -16371,6 +16407,7 @@ exports.DataLocatorStepArrayItem = DataLocatorStepArrayItem;
16371
16407
  exports.DataLocatorStepObjectProperty = DataLocatorStepObjectProperty;
16372
16408
  exports.DataRecordSchema = DataRecordSchema;
16373
16409
  exports.DataSchema = DataSchema;
16410
+ exports.DataSchemaRef = DataSchemaRef;
16374
16411
  exports.DataSourceAccessor = DataSourceAccessor;
16375
16412
  exports.DataSourceApiResponse = DataSourceApiResponse;
16376
16413
  exports.DataSourceEditableProperties = DataSourceEditableProperties;
@@ -16382,6 +16419,7 @@ exports.DataSourceUnitConfig = DataSourceUnitConfig;
16382
16419
  exports.DataSourcesAccessor = DataSourcesAccessor;
16383
16420
  exports.DbBackedCountsSchema = DbBackedCountsSchema;
16384
16421
  exports.DependencyError = DependencyError;
16422
+ exports.DomainFromEmail = DomainFromEmail;
16385
16423
  exports.DownstreamFlowNodeRunSchema = DownstreamFlowNodeRunSchema;
16386
16424
  exports.EDITABLE_LIMITS = EDITABLE_LIMITS;
16387
16425
  exports.ElementAccessor = ElementAccessor;
@@ -16393,6 +16431,7 @@ exports.EngineCreditsProjectionResponse = EngineCreditsProjectionResponse;
16393
16431
  exports.EngineWorkspaceSettingsSchema = EngineWorkspaceSettingsSchema;
16394
16432
  exports.ErrorData = ErrorData;
16395
16433
  exports.ErrorDataSchema = ErrorDataSchema;
16434
+ exports.Eval = Eval;
16396
16435
  exports.ExternalApiLogApiResponse = ExternalApiLogApiResponse;
16397
16436
  exports.ExternalEvent = ExternalEvent;
16398
16437
  exports.ExternalEventLogRecordApiResponse = ExternalEventLogRecordApiResponse;
@@ -16450,6 +16489,7 @@ exports.FindOrgWorkspacesQuery = FindOrgWorkspacesQuery;
16450
16489
  exports.FindOrgsQuery = FindOrgsQuery;
16451
16490
  exports.FindPackagesQuery = FindPackagesQuery;
16452
16491
  exports.FindScreensQuery = FindScreensQuery;
16492
+ exports.FirstNotEmpty = FirstNotEmpty;
16453
16493
  exports.FlowAccessor = FlowAccessor;
16454
16494
  exports.FlowApiResponse = FlowApiResponse;
16455
16495
  exports.FlowEditableProperties = FlowEditableProperties;
@@ -16478,6 +16518,7 @@ exports.FlowRunsAccessor = FlowRunsAccessor;
16478
16518
  exports.FlowRunsStatsQuery = FlowRunsStatsQuery;
16479
16519
  exports.FlowsAccessor = FlowsAccessor;
16480
16520
  exports.Formula = Formula;
16521
+ exports.FormulaFormula = FormulaFormula;
16481
16522
  exports.FullOrgUser = FullOrgUser;
16482
16523
  exports.FullPlatformUser = FullPlatformUser;
16483
16524
  exports.FunctionDefinition = FunctionDefinition;
@@ -16518,6 +16559,7 @@ exports.IntegrationsAccessor = IntegrationsAccessor;
16518
16559
  exports.InternalError = InternalError;
16519
16560
  exports.InvalidLocatorError = InvalidLocatorError;
16520
16561
  exports.JavascriptFunction = JavascriptFunction;
16562
+ exports.JsonataFormula = JsonataFormula;
16521
16563
  exports.ListActionInstancesForConnectionQuery = ListActionInstancesForConnectionQuery;
16522
16564
  exports.ListAppEventLogRecordsQuery = ListAppEventLogRecordsQuery;
16523
16565
  exports.ListClustersQuery = ListClustersQuery;
@@ -16543,6 +16585,7 @@ exports.MembraneClient = MembraneClient;
16543
16585
  exports.MembraneConfigLoader = MembraneConfigLoader;
16544
16586
  exports.MembraneElementLayer = MembraneElementLayer;
16545
16587
  exports.MembraneError = MembraneError;
16588
+ exports.MergeObjects = MergeObjects;
16546
16589
  exports.MinimalConnector = MinimalConnector;
16547
16590
  exports.NotAuthenticatedError = NotAuthenticatedError;
16548
16591
  exports.NotFoundError = NotFoundError;
@@ -16556,6 +16599,7 @@ exports.OpenRouterNotConfiguredError = OpenRouterNotConfiguredError;
16556
16599
  exports.OpenapiMappingSchema = OpenapiMappingSchema;
16557
16600
  exports.OperationMappingFunction = OperationMappingFunction;
16558
16601
  exports.OperationMappingSchema = OperationMappingSchema;
16602
+ exports.Or = Or;
16559
16603
  exports.Org = Org;
16560
16604
  exports.OrgInvitation = OrgInvitation;
16561
16605
  exports.OrgLimits = OrgLimits;