@membranehq/sdk 0.17.5 → 0.18.0

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 (79) hide show
  1. package/dist/bundle.d.ts +21 -10
  2. package/dist/bundle.js +5198 -5182
  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 +5 -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 +5 -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/session.d.ts +2 -0
  24. package/dist/dts/alerts/utils.d.ts +1 -1
  25. package/dist/dts/client-tokens/types.d.ts +5 -5
  26. package/dist/dts/client.d.ts +1 -1
  27. package/dist/dts/data-filter/index.d.ts +1 -1
  28. package/dist/dts/formulas/base.d.ts +1 -1
  29. package/dist/dts/formulas/eval.d.ts +1 -1
  30. package/dist/dts/formulas/findAppRecordId.d.ts +1 -1
  31. package/dist/dts/formulas/findExternalRecordId.d.ts +1 -1
  32. package/dist/dts/formulas/record.d.ts +1 -1
  33. package/dist/dts/stats/index.d.ts +8 -5
  34. package/dist/dts/ui.d.ts +5 -0
  35. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +3 -0
  36. package/dist/dts/workspace-elements/api/actions-api.d.ts +1 -1
  37. package/dist/dts/workspace-elements/api/connected-products-api.d.ts +2 -1
  38. package/dist/dts/workspace-elements/api/connections-api.d.ts +1 -1
  39. package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +1 -1
  40. package/dist/dts/workspace-elements/api/data-sources-api.d.ts +4 -4
  41. package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +2 -0
  42. package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +2 -0
  43. package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +2 -0
  44. package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +1 -0
  45. package/dist/dts/workspace-elements/api/external-events-api.d.ts +1 -0
  46. package/dist/dts/workspace-elements/api/field-mapping-instances-api.d.ts +1 -1
  47. package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +3 -3
  48. package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +3 -0
  49. package/dist/dts/workspace-elements/api/flows-api.d.ts +2 -2
  50. package/dist/dts/workspace-elements/api/incoming-webhooks-api.d.ts +2 -0
  51. package/dist/dts/workspace-elements/base/action-run-log-records/index.d.ts +1 -0
  52. package/dist/dts/workspace-elements/base/actions/index.d.ts +2 -2
  53. package/dist/dts/workspace-elements/base/connectors/auth.d.ts +1 -1
  54. package/dist/dts/workspace-elements/base/connectors/functions.d.ts +1 -1
  55. package/dist/dts/workspace-elements/base/connectors/index.d.ts +1 -0
  56. package/dist/dts/workspace-elements/base/connectors/operations/handlers.d.ts +1 -1
  57. package/dist/dts/workspace-elements/base/data-collections/data-locations/collections/events/methods.d.ts +1 -1
  58. package/dist/dts/workspace-elements/base/data-collections/schemas.d.ts +1 -1
  59. package/dist/dts/workspace-elements/base/data-collections/udm/index.d.ts +1 -1
  60. package/dist/dts/workspace-elements/base/data-collections/utils.d.ts +1 -1
  61. package/dist/dts/workspace-elements/base/external-event-log-records/index.d.ts +1 -0
  62. package/dist/dts/workspace-elements/base/external-event-pulls/index.d.ts +1 -0
  63. package/dist/dts/workspace-elements/base/flow-runs/index.d.ts +1 -0
  64. package/dist/dts/workspace-elements/types.d.ts +3 -0
  65. package/dist/dts/workspace-elements-catalog/index.d.ts +3 -0
  66. package/dist/dts/workspaces/compare.d.ts +1 -1
  67. package/dist/index.browser.d.mts +731 -694
  68. package/dist/index.browser.d.ts +731 -694
  69. package/dist/index.browser.js +1247 -1076
  70. package/dist/index.browser.js.map +1 -1
  71. package/dist/index.browser.mjs +1247 -1076
  72. package/dist/index.browser.mjs.map +1 -1
  73. package/dist/index.node.d.mts +731 -694
  74. package/dist/index.node.d.ts +731 -694
  75. package/dist/index.node.js +1247 -1076
  76. package/dist/index.node.js.map +1 -1
  77. package/dist/index.node.mjs +1247 -1076
  78. package/dist/index.node.mjs.map +1 -1
  79. package/package.json +1 -1
@@ -3473,6 +3473,8 @@ var WorkspaceElementType;
3473
3473
  WorkspaceElementType["ExternalEventPull"] = "external-event-pull";
3474
3474
  WorkspaceElementType["Screen"] = "screen";
3475
3475
  WorkspaceElementType["ActionRunLogRecord"] = "action-run-log-record";
3476
+ WorkspaceElementType["ExternalApiLogRecord"] = "external-api-log-record";
3477
+ WorkspaceElementType["IncomingWebhookLogRecord"] = "incoming-webhook-log-record";
3476
3478
  WorkspaceElementType["ConnectedProduct"] = "connected-product";
3477
3479
  })(WorkspaceElementType || (WorkspaceElementType = {}));
3478
3480
  var WorkspaceEventType;
@@ -3671,6 +3673,7 @@ const ActivityLogRecord = TenantLayerElement.extend({
3671
3673
  id: z.string(),
3672
3674
  integrationId: z.string().optional(),
3673
3675
  connectionId: z.string().optional(),
3676
+ externalAppId: z.string().optional(),
3674
3677
  });
3675
3678
  const WorkspaceElementSearchQuery = z.object({
3676
3679
  q: z.string().min(1).max(200),
@@ -4005,6 +4008,97 @@ class ConnectionSpec {
4005
4008
  }
4006
4009
  }
4007
4010
 
4011
+ var FunctionType;
4012
+ (function (FunctionType) {
4013
+ FunctionType["mapping"] = "mapping";
4014
+ FunctionType["operationMapping"] = "operation-mapping";
4015
+ FunctionType["restApiMapping"] = "rest-api-mapping";
4016
+ FunctionType["graphqlApiMapping"] = "graphql-api-mapping";
4017
+ FunctionType["javascript"] = "javascript";
4018
+ })(FunctionType || (FunctionType = {}));
4019
+ const BaseFunctionDefinition = z.object({
4020
+ type: z.enum([
4021
+ FunctionType.mapping,
4022
+ FunctionType.operationMapping,
4023
+ FunctionType.restApiMapping,
4024
+ FunctionType.graphqlApiMapping,
4025
+ FunctionType.javascript,
4026
+ ]),
4027
+ });
4028
+ const GenericFunctionDefinition = z
4029
+ .object({
4030
+ type: z.enum(['mapping', 'operation-mapping', 'rest-api-mapping', 'graphql-api-mapping', 'javascript']).optional(),
4031
+ })
4032
+ .loose();
4033
+
4034
+ const GraphQLFieldMappingSchema = z.lazy(() => z.object({
4035
+ field: z.string(),
4036
+ args: z.record(z.string(), z.any()).optional(),
4037
+ subFields: z.array(GraphQLFieldMappingSchema).optional(),
4038
+ }));
4039
+ const GraphQLApiMappingSchema = z.object({
4040
+ path: z.string(),
4041
+ operationType: z.enum(['query', 'mutation']),
4042
+ requestMapping: z.array(GraphQLFieldMappingSchema),
4043
+ responseMapping: z.any().optional(),
4044
+ });
4045
+ const GraphqlApiMappingFunction = z.object({
4046
+ type: z.literal(FunctionType.graphqlApiMapping),
4047
+ mapping: GraphQLApiMappingSchema,
4048
+ });
4049
+
4050
+ const JavascriptFunction = z.object({
4051
+ type: z.literal(FunctionType.javascript),
4052
+ code: z.string(),
4053
+ });
4054
+
4055
+ const MappingSchema = z.any();
4056
+ const MappingFunction = z.object({
4057
+ type: z.literal(FunctionType.mapping),
4058
+ mapping: MappingSchema,
4059
+ });
4060
+
4061
+ const OperationMappingSchema = z.object({
4062
+ operationKey: z.string(),
4063
+ inputMapping: z.any().optional(),
4064
+ outputMapping: z.any().optional(),
4065
+ });
4066
+ const OperationMappingFunction = z.object({
4067
+ type: z.literal(FunctionType.operationMapping),
4068
+ mapping: OperationMappingSchema,
4069
+ });
4070
+
4071
+ const RequestMappingSchema = z.object({
4072
+ pathParameters: z.any().optional(),
4073
+ query: z.any().optional(),
4074
+ data: z.any().optional(),
4075
+ headers: z.any().optional(),
4076
+ });
4077
+ const RestApiMappingSchema = z.object({
4078
+ path: z.string(),
4079
+ method: z.string(),
4080
+ requestMapping: RequestMappingSchema,
4081
+ responseMapping: z.any().optional(),
4082
+ });
4083
+ const OpenapiMappingSchema = z.object({
4084
+ path: z.string(),
4085
+ method: z.string(),
4086
+ requestMapping: RequestMappingSchema,
4087
+ responseMapping: z.any().optional(),
4088
+ });
4089
+ const RestApiMappingFunction = z.object({
4090
+ type: z.literal(FunctionType.restApiMapping),
4091
+ mapping: RestApiMappingSchema,
4092
+ });
4093
+
4094
+ const FunctionDefinition = z.union([
4095
+ MappingFunction,
4096
+ OperationMappingFunction,
4097
+ RestApiMappingFunction,
4098
+ GraphqlApiMappingFunction,
4099
+ JavascriptFunction,
4100
+ ]);
4101
+
4008
4102
  var ConnectorMethodImplementationType;
4009
4103
  (function (ConnectorMethodImplementationType) {
4010
4104
  ConnectorMethodImplementationType["mapping"] = "mapping";
@@ -4401,97 +4495,6 @@ const REST_API_CLIENT_SCHEMA$1 = {
4401
4495
  },
4402
4496
  };
4403
4497
 
4404
- var FunctionType;
4405
- (function (FunctionType) {
4406
- FunctionType["mapping"] = "mapping";
4407
- FunctionType["operationMapping"] = "operation-mapping";
4408
- FunctionType["restApiMapping"] = "rest-api-mapping";
4409
- FunctionType["graphqlApiMapping"] = "graphql-api-mapping";
4410
- FunctionType["javascript"] = "javascript";
4411
- })(FunctionType || (FunctionType = {}));
4412
- const BaseFunctionDefinition = z.object({
4413
- type: z.enum([
4414
- FunctionType.mapping,
4415
- FunctionType.operationMapping,
4416
- FunctionType.restApiMapping,
4417
- FunctionType.graphqlApiMapping,
4418
- FunctionType.javascript,
4419
- ]),
4420
- });
4421
- const GenericFunctionDefinition = z
4422
- .object({
4423
- type: z.enum(['mapping', 'operation-mapping', 'rest-api-mapping', 'graphql-api-mapping', 'javascript']).optional(),
4424
- })
4425
- .loose();
4426
-
4427
- const GraphQLFieldMappingSchema = z.lazy(() => z.object({
4428
- field: z.string(),
4429
- args: z.record(z.string(), z.any()).optional(),
4430
- subFields: z.array(GraphQLFieldMappingSchema).optional(),
4431
- }));
4432
- const GraphQLApiMappingSchema = z.object({
4433
- path: z.string(),
4434
- operationType: z.enum(['query', 'mutation']),
4435
- requestMapping: z.array(GraphQLFieldMappingSchema),
4436
- responseMapping: z.any().optional(),
4437
- });
4438
- const GraphqlApiMappingFunction = z.object({
4439
- type: z.literal(FunctionType.graphqlApiMapping),
4440
- mapping: GraphQLApiMappingSchema,
4441
- });
4442
-
4443
- const JavascriptFunction = z.object({
4444
- type: z.literal(FunctionType.javascript),
4445
- code: z.string(),
4446
- });
4447
-
4448
- const MappingSchema = z.any();
4449
- const MappingFunction = z.object({
4450
- type: z.literal(FunctionType.mapping),
4451
- mapping: MappingSchema,
4452
- });
4453
-
4454
- const OperationMappingSchema = z.object({
4455
- operationKey: z.string(),
4456
- inputMapping: z.any().optional(),
4457
- outputMapping: z.any().optional(),
4458
- });
4459
- const OperationMappingFunction = z.object({
4460
- type: z.literal(FunctionType.operationMapping),
4461
- mapping: OperationMappingSchema,
4462
- });
4463
-
4464
- const RequestMappingSchema = z.object({
4465
- pathParameters: z.any().optional(),
4466
- query: z.any().optional(),
4467
- data: z.any().optional(),
4468
- headers: z.any().optional(),
4469
- });
4470
- const RestApiMappingSchema = z.object({
4471
- path: z.string(),
4472
- method: z.string(),
4473
- requestMapping: RequestMappingSchema,
4474
- responseMapping: z.any().optional(),
4475
- });
4476
- const OpenapiMappingSchema = z.object({
4477
- path: z.string(),
4478
- method: z.string(),
4479
- requestMapping: RequestMappingSchema,
4480
- responseMapping: z.any().optional(),
4481
- });
4482
- const RestApiMappingFunction = z.object({
4483
- type: z.literal(FunctionType.restApiMapping),
4484
- mapping: RestApiMappingSchema,
4485
- });
4486
-
4487
- const FunctionDefinition = z.union([
4488
- MappingFunction,
4489
- OperationMappingFunction,
4490
- RestApiMappingFunction,
4491
- GraphqlApiMappingFunction,
4492
- JavascriptFunction,
4493
- ]);
4494
-
4495
4498
  const CONNECTOR_DATA_DIR = 'data';
4496
4499
  const CONNECTOR_OPERATIONS_DIR = 'operations';
4497
4500
  const CONNECTOR_DOCS_DIR = 'docs';
@@ -4667,369 +4670,528 @@ var DataCollectionEventType;
4667
4670
  DataCollectionEventType["DELETED"] = "deleted";
4668
4671
  })(DataCollectionEventType || (DataCollectionEventType = {}));
4669
4672
 
4670
- const DataLocationMethodImplementationTypes = [
4671
- ConnectorMethodImplementationType.operationMapping,
4672
- ConnectorMethodImplementationType.restApiMapping,
4673
- ConnectorMethodImplementationType.graphqlApiMapping,
4674
- ConnectorMethodImplementationType.javascript,
4675
- ConnectorMethodImplementationType.notSupported,
4676
- ];
4673
+ const structuredClone$1 = (structuredClonePolyfill === null || structuredClonePolyfill === void 0 ? void 0 : structuredClonePolyfill.default) || structuredClonePolyfill;
4674
+ function isNil(value) {
4675
+ return value == null;
4676
+ }
4677
+ function omitBy(obj, check) {
4678
+ obj = { ...obj };
4679
+ Object.entries(obj).forEach(([key, value]) => check(value) && delete obj[key]);
4680
+ return obj;
4681
+ }
4682
+ function isEmptyValue(value) {
4683
+ if (isNil(value)) {
4684
+ return true;
4685
+ }
4686
+ if (typeof value === 'symbol') {
4687
+ return true;
4688
+ }
4689
+ if (typeof value === 'boolean') {
4690
+ return false;
4691
+ }
4692
+ if (typeof value === 'number') {
4693
+ return isNaN(value);
4694
+ }
4695
+ if (typeof value === 'string') {
4696
+ return value.trim().length === 0;
4697
+ }
4698
+ const tag = value.toString();
4699
+ if (tag === '[object Map]' || tag === '[object Set]') {
4700
+ return !value.size;
4701
+ }
4702
+ return typeof value === 'object' && Object.keys(value).length === 0;
4703
+ }
4704
+ const simpleUniqueId = () => {
4705
+ return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)
4706
+ .toString(36)
4707
+ .padStart(11, '0')
4708
+ .substring(0, 11);
4709
+ };
4677
4710
 
4678
- const DataCollectionMethodCreate = {
4679
- name: 'Create',
4680
- description: 'Create a new data record in the collection',
4681
- getConfigSchema: ({ collectionSpec }) => {
4682
- var _a, _b;
4683
- 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);
4684
- return {
4685
- type: 'object',
4686
- properties: {
4687
- fields: {
4688
- type: 'array',
4689
- items: { type: 'string', enum: fields },
4690
- },
4691
- excludedFields: {
4692
- type: 'array',
4693
- items: { type: 'string', enum: fields },
4694
- },
4695
- },
4696
- };
4697
- },
4698
- getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
4699
- var _a;
4700
- let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
4701
- if (method === null || method === void 0 ? void 0 : method.fields) {
4702
- fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
4703
- }
4704
- if (method === null || method === void 0 ? void 0 : method.excludedFields) {
4705
- fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
4706
- }
4711
+ function getDataLocationMethodPath(locationKey, methodKey) {
4712
+ return `data/${locationKey}/${toKebabCase(methodKey)}`;
4713
+ }
4714
+ function dataLocationParametersMatch({ locationParameters, targetParameters, }) {
4715
+ targetParameters = typeof targetParameters === 'object' && targetParameters ? targetParameters : {};
4716
+ locationParameters = typeof locationParameters === 'object' && locationParameters ? locationParameters : {};
4717
+ for (const [key, value] of Object.entries(targetParameters)) {
4718
+ if (locationParameters[key] !== value) {
4719
+ return false;
4720
+ }
4721
+ }
4722
+ return true;
4723
+ }
4724
+ function parseDataLocationPath(path) {
4725
+ if (!path) {
4726
+ return undefined;
4727
+ }
4728
+ if (path.startsWith('/')) {
4729
+ path = path.slice(1);
4730
+ }
4731
+ if (!path.startsWith('data/')) {
4732
+ throw new Error(`Invalid data location path: ${path}. It should start with "data/"`);
4733
+ }
4734
+ path = path.slice(5);
4735
+ const [key, query] = path.split('?');
4736
+ const parameters = Object.fromEntries(new URLSearchParams(query).entries());
4737
+ return { key, parameters };
4738
+ }
4739
+ function makeDataLocationPath(pointer) {
4740
+ var _a;
4741
+ const normalizedPointer = normalizePointer(pointer);
4742
+ if (normalizedPointer === null || normalizedPointer === void 0 ? void 0 : normalizedPointer.key) {
4743
+ let path = `/data/${normalizedPointer.key}`;
4744
+ const parameters = omitBy((_a = normalizedPointer.parameters) !== null && _a !== void 0 ? _a : {}, isNil);
4745
+ if (Object.keys(parameters).length > 0) {
4746
+ path += `?${new URLSearchParams(parameters).toString()}`;
4747
+ }
4748
+ return path;
4749
+ }
4750
+ else {
4751
+ return undefined;
4752
+ }
4753
+ }
4754
+ function normalizePointer(pointer) {
4755
+ if (typeof pointer === 'string' && pointer.startsWith('/data/')) {
4707
4756
  return {
4708
- type: 'object',
4709
- properties: nonEmptyObjectProperties({
4710
- fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
4711
- type: 'object',
4712
- },
4713
- credentials: credentialsSchema,
4714
- }),
4757
+ key: pointer.slice(6),
4715
4758
  };
4716
- },
4717
- getOutputSchema: ({}) => ({
4718
- type: 'object',
4719
- properties: {
4720
- id: { type: 'string' },
4721
- },
4722
- }),
4723
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4724
- };
4759
+ }
4760
+ return pointer;
4761
+ }
4762
+ function makeDataLocationOperationPath(collectionPath, operation) {
4763
+ const [path, query] = (collectionPath !== null && collectionPath !== void 0 ? collectionPath : '').split('?');
4764
+ return urljoin(path, operation, query ? `?${query}` : '');
4765
+ }
4766
+ function isSameDataLocation(location1, location2) {
4767
+ if (location1.key !== location2.key) {
4768
+ return false;
4769
+ }
4770
+ const cleanParameters1 = location1.parameters && Object.keys(location1.parameters).length > 0 ? location1.parameters : undefined;
4771
+ const cleanParameters2 = location2.parameters && Object.keys(location2.parameters).length > 0 ? location2.parameters : undefined;
4772
+ if (!deepEqual(cleanParameters1, cleanParameters2)) {
4773
+ return false;
4774
+ }
4775
+ return true;
4776
+ }
4777
+ function isDataLocationMethodSupported(location, methodKey) {
4778
+ var _a;
4779
+ const method = (_a = location === null || location === void 0 ? void 0 : location.methods) === null || _a === void 0 ? void 0 : _a[methodKey];
4780
+ return method && method.implementationType !== ConnectorMethodImplementationType.notSupported;
4781
+ }
4782
+ function getDataCollectionCreateFields(spec) {
4783
+ if (!spec)
4784
+ return undefined;
4785
+ if (!spec.fieldsSchema)
4786
+ return undefined;
4787
+ if (!spec.create)
4788
+ return undefined;
4789
+ let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
4790
+ if (spec.create.fields) {
4791
+ schema = pickFieldsFromSchema(schema, spec.create.fields);
4792
+ }
4793
+ if (spec.create.excludedFields) {
4794
+ schema = excludeFieldsFromSchema(schema, spec.create.excludedFields);
4795
+ }
4796
+ return schema;
4797
+ }
4798
+ function getDataCollectionUpdateFields(spec) {
4799
+ if (!spec)
4800
+ return undefined;
4801
+ if (!spec.fieldsSchema)
4802
+ return undefined;
4803
+ if (!spec.update)
4804
+ return undefined;
4805
+ let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
4806
+ if (spec.update.fields) {
4807
+ schema = pickFieldsFromSchema(schema, spec.update.fields);
4808
+ }
4809
+ if (spec.update.excludedFields) {
4810
+ schema = excludeFieldsFromSchema(schema, spec.update.excludedFields);
4811
+ }
4812
+ return schema;
4813
+ }
4814
+ function getWritableFieldsSchema(spec) {
4815
+ if (!spec)
4816
+ return undefined;
4817
+ if (!spec.fieldsSchema)
4818
+ return undefined;
4819
+ return mergeSchemas([getDataCollectionCreateFields(spec), getDataCollectionUpdateFields(spec)]);
4820
+ }
4821
+ function getReferenceCollectionPointerForSchema(schema) {
4822
+ if ((schema === null || schema === void 0 ? void 0 : schema.referenceCollection) && schema.referenceCollection.key) {
4823
+ return schema.referenceCollection;
4824
+ }
4825
+ else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionPath) {
4826
+ return parseDataLocationPath(schema.referenceCollectionPath);
4827
+ }
4828
+ else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionUri) {
4829
+ return parseDataLocationPath(schema.referenceCollectionUri);
4830
+ }
4831
+ else {
4832
+ return undefined;
4833
+ }
4834
+ }
4835
+ function getReferenceCollectionPathForSchema(schema) {
4836
+ const pointer = getReferenceCollectionPointerForSchema(schema);
4837
+ return makeDataLocationPath(pointer);
4838
+ }
4725
4839
 
4726
- const DataCollectionMethodDelete = {
4727
- name: 'Delete',
4728
- description: 'Delete a data record from the collection by id',
4729
- getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => {
4730
- return {
4731
- type: 'object',
4732
- properties: nonEmptyObjectProperties({
4733
- id: {
4734
- type: 'string',
4735
- referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
4840
+ const FIELDS_SCHEMA$G = {
4841
+ type: 'object',
4842
+ properties: {
4843
+ id: { type: 'string', readOnly: true },
4844
+ title: { type: 'string' },
4845
+ description: { type: 'string' },
4846
+ type: { type: 'string' },
4847
+ durationSeconds: { type: 'number' },
4848
+ location: { type: 'string' },
4849
+ isRecurrent: { type: 'boolean' },
4850
+ participants: {
4851
+ type: 'array',
4852
+ items: {
4853
+ type: 'object',
4854
+ properties: {
4855
+ userId: { type: 'string' },
4856
+ contactId: { type: 'string' },
4736
4857
  },
4737
- credentials: credentialsSchema,
4738
- }),
4739
- };
4858
+ },
4859
+ },
4860
+ status: { type: 'string' },
4861
+ contactId: {
4862
+ type: 'string',
4863
+ referenceUdm: 'contacts',
4864
+ },
4865
+ companyId: {
4866
+ type: 'string',
4867
+ referenceUdm: 'companies',
4868
+ },
4869
+ dealId: {
4870
+ type: 'string',
4871
+ referenceUdm: 'deals',
4872
+ },
4873
+ leadId: {
4874
+ type: 'string',
4875
+ referenceUdm: 'leads',
4876
+ },
4877
+ ownerId: {
4878
+ type: 'string',
4879
+ referenceUdm: 'users',
4880
+ },
4881
+ startTime: {
4882
+ type: 'string',
4883
+ format: 'date-time',
4884
+ },
4885
+ endTime: {
4886
+ type: 'string',
4887
+ format: 'date-time',
4888
+ },
4889
+ dueTime: {
4890
+ type: 'string',
4891
+ format: 'date-time',
4892
+ },
4893
+ createdTime: {
4894
+ type: 'string',
4895
+ format: 'date-time',
4896
+ readOnly: true,
4897
+ },
4898
+ createdBy: {
4899
+ type: 'string',
4900
+ referenceUdm: 'users',
4901
+ readOnly: true,
4902
+ },
4903
+ updatedTime: {
4904
+ type: 'string',
4905
+ format: 'date-time',
4906
+ readOnly: true,
4907
+ },
4908
+ updatedBy: {
4909
+ type: 'string',
4910
+ referenceUdm: 'users',
4911
+ readOnly: true,
4912
+ },
4740
4913
  },
4741
- getOutputSchema: () => null,
4742
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4743
4914
  };
4744
-
4745
- const DataCollectionMethodFind = {
4746
- isDeprecated: true,
4747
- name: 'Find',
4748
- description: 'Find a list of data records in the collection',
4749
- getConfigSchema: ({ collectionSpec }) => {
4750
- var _a, _b;
4751
- 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);
4752
- return {
4753
- type: 'object',
4754
- properties: {
4755
- queryFields: {
4756
- type: 'array',
4757
- items: { type: 'string', enum: fields },
4758
- },
4759
- },
4760
- };
4915
+ const FallbackFieldsMap = {
4916
+ fromActivitiesToTasks: {
4917
+ subject: {
4918
+ $var: 'title',
4919
+ },
4920
+ content: {
4921
+ $var: 'description',
4922
+ },
4761
4923
  },
4762
- getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
4763
- const queryFieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.queryFields);
4764
- const schema = {
4765
- type: 'object',
4766
- properties: nonEmptyObjectProperties({
4767
- cursor: { type: 'string' },
4768
- credentials: credentialsSchema,
4769
- }),
4770
- };
4771
- if (queryFieldsSchema === null || queryFieldsSchema === void 0 ? void 0 : queryFieldsSchema.properties) {
4772
- schema.properties = {
4773
- ...schema.properties,
4774
- query: transformVariablesWith(queryFieldsSchema, (locator) => `query.${locatorToField(locator)}`),
4775
- };
4776
- }
4777
- return schema;
4924
+ fromTasksToActivities: {
4925
+ title: {
4926
+ $var: 'subject',
4927
+ },
4928
+ description: {
4929
+ $var: 'content',
4930
+ },
4778
4931
  },
4779
- getOutputSchema: ({ collectionSpec }) => {
4780
- var _a;
4781
- return ({
4782
- type: 'object',
4783
- properties: {
4784
- records: {
4785
- type: 'array',
4786
- items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4787
- },
4788
- cursor: {
4789
- type: 'string',
4790
- },
4791
- },
4792
- });
4932
+ fromActivitiesToNotes: {
4933
+ content: {
4934
+ $var: 'description',
4935
+ },
4936
+ },
4937
+ fromNotesToActivities: {
4938
+ description: {
4939
+ $var: 'content',
4940
+ },
4941
+ },
4942
+ fromActivitiesToEmails: {
4943
+ subject: {
4944
+ $var: 'title',
4945
+ },
4946
+ body: {
4947
+ $var: 'description',
4948
+ },
4949
+ },
4950
+ fromEmailsToActivities: {
4951
+ title: {
4952
+ $var: 'subject',
4953
+ },
4954
+ description: {
4955
+ $var: 'body',
4956
+ },
4793
4957
  },
4794
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4795
4958
  };
4796
-
4797
- const DataCollectionMethodFindById = {
4798
- name: 'Find by ID',
4799
- description: 'Find a single data record in the collection by its id',
4800
- getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => ({
4801
- type: 'object',
4802
- properties: nonEmptyObjectProperties({
4803
- id: {
4804
- type: 'string',
4805
- referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
4806
- },
4807
- credentials: credentialsSchema,
4808
- }),
4809
- }),
4810
- getOutputSchema: ({ collectionSpec }) => {
4811
- var _a;
4812
- return ({
4813
- type: 'object',
4814
- properties: {
4815
- record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4816
- },
4817
- });
4959
+ const udm$G = {
4960
+ singularName: 'activity',
4961
+ pluralName: 'activities',
4962
+ fieldsSchema: FIELDS_SCHEMA$G,
4963
+ list: {
4964
+ filterFields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
4818
4965
  },
4819
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4966
+ match: {
4967
+ fields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
4968
+ },
4969
+ populateFields,
4970
+ udmFallbacks: [
4971
+ {
4972
+ udm: 'tasks',
4973
+ importFields: FallbackFieldsMap.fromTasksToActivities,
4974
+ exportFields: FallbackFieldsMap.fromActivitiesToTasks,
4975
+ },
4976
+ {
4977
+ udm: 'meetings',
4978
+ },
4979
+ {
4980
+ udm: 'notes',
4981
+ importFields: FallbackFieldsMap.fromNotesToActivities,
4982
+ exportFields: FallbackFieldsMap.fromActivitiesToNotes,
4983
+ },
4984
+ {
4985
+ udm: 'emails',
4986
+ importFields: FallbackFieldsMap.fromEmailsToActivities,
4987
+ exportFields: FallbackFieldsMap.fromActivitiesToEmails,
4988
+ },
4989
+ ],
4820
4990
  };
4991
+ function populateFields(fields) {
4992
+ const result = JSON.parse(JSON.stringify(fields));
4993
+ if (!result.dueTime) {
4994
+ result.dueTime = result.endTime || result.startTime;
4995
+ }
4996
+ if (!result.startTime) {
4997
+ result.startTime = result.dueTime || result.endTime;
4998
+ }
4999
+ if (!result.endTime) {
5000
+ result.endTime = result.dueTime || result.startTime;
5001
+ }
5002
+ return result;
5003
+ }
4821
5004
 
4822
- const DataCollectionMethodList = {
4823
- name: 'List',
4824
- description: 'Return all data records from the collection',
4825
- getConfigSchema: ({ collectionSpec }) => {
4826
- var _a, _b;
4827
- 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);
4828
- return {
4829
- type: 'object',
4830
- properties: {
4831
- filterFields: {
4832
- type: 'array',
4833
- items: { type: 'string', enum: fields },
5005
+ const FIELDS_SCHEMA$F = {
5006
+ type: 'object',
5007
+ properties: {
5008
+ id: { type: 'string', readOnly: true },
5009
+ number: { type: 'string' },
5010
+ name: { type: 'string' },
5011
+ memo: { type: 'string' },
5012
+ status: { type: 'string' },
5013
+ paymentMethod: { type: 'string' },
5014
+ supplierId: { type: 'string', referenceUdm: 'suppliers' },
5015
+ currency: { type: 'string' },
5016
+ payments: {
5017
+ type: 'array',
5018
+ items: {
5019
+ type: 'string',
5020
+ referenceUdm: 'payments',
5021
+ },
5022
+ },
5023
+ lineItems: {
5024
+ type: 'array',
5025
+ items: {
5026
+ type: 'object',
5027
+ properties: {
5028
+ id: { type: 'string' },
5029
+ itemName: { type: 'string' },
5030
+ description: { type: 'string' },
5031
+ code: { type: 'string' },
5032
+ type: { type: 'string' },
5033
+ companyId: { type: 'string', referenceUdm: 'companies' },
5034
+ ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5035
+ quantity: { type: 'number' },
5036
+ unitPrice: { type: 'number' },
5037
+ unitOfMeasure: { type: 'string' },
5038
+ purchasePrice: { type: 'number' },
5039
+ salesPrice: { type: 'number' },
5040
+ taxable: { type: 'boolean' },
5041
+ taxAmount: { type: 'number' },
5042
+ totalAmount: { type: 'number' },
4834
5043
  },
4835
5044
  },
4836
- };
5045
+ },
5046
+ totalAmount: { type: 'number' },
5047
+ totalTax: { type: 'number' },
5048
+ exchangeRate: { type: 'number' },
5049
+ totalDiscount: { type: 'number' },
5050
+ subTotal: { type: 'number' },
5051
+ balance: { type: 'number' },
5052
+ ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5053
+ issueDate: {
5054
+ type: 'string',
5055
+ format: 'date-time',
5056
+ },
5057
+ dueDate: {
5058
+ type: 'string',
5059
+ format: 'date-time',
5060
+ },
5061
+ paidOnDate: {
5062
+ type: 'string',
5063
+ format: 'date-time',
5064
+ },
5065
+ createdTime: { type: 'string', format: 'date-time', readOnly: true },
5066
+ createdBy: { type: 'string', referenceUdm: 'users', readOnly: true },
5067
+ updatedTime: { type: 'string', format: 'date-time', readOnly: true },
5068
+ updatedBy: { type: 'string', referenceUdm: 'users', readOnly: true },
4837
5069
  },
4838
- getInputSchema: ({ method, collectionSpec, credentialsSchema }) => {
4839
- const fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
4840
- let filterSchema;
4841
- if (method === null || method === void 0 ? void 0 : method.filterFields) {
4842
- filterSchema = pickFieldsFromSchema(fieldsSchema, method.filterFields);
4843
- }
4844
- return {
4845
- type: 'object',
4846
- properties: nonEmptyObjectProperties({
4847
- filter: filterSchema,
4848
- cursor: {
4849
- type: 'string',
4850
- description: 'Cursor returned in response to the previous "list" request',
4851
- },
4852
- credentials: credentialsSchema,
4853
- }),
4854
- };
5070
+ };
5071
+ const udm$F = {
5072
+ singularName: 'bill',
5073
+ pluralName: 'bills',
5074
+ fieldsSchema: FIELDS_SCHEMA$F,
5075
+ list: {
5076
+ filterFields: ['name', 'number', 'status', 'supplierId'],
4855
5077
  },
4856
- getOutputSchema: ({ collectionSpec }) => {
4857
- var _a;
4858
- return ({
4859
- type: 'object',
4860
- properties: {
4861
- records: {
4862
- type: 'array',
4863
- items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4864
- },
4865
- cursor: {
4866
- type: 'string',
4867
- description: 'Cursor to request the next page of results',
4868
- },
4869
- },
4870
- });
5078
+ match: {
5079
+ fields: ['name', 'number', 'status', 'supplierId'],
4871
5080
  },
4872
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4873
5081
  };
4874
5082
 
4875
- const DataCollectionMethodMatch = {
4876
- name: 'Match',
4877
- description: 'Find a single matching record in a data collection by a set of fields',
4878
- getConfigSchema: ({ collectionSpec }) => {
4879
- var _a, _b;
4880
- 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);
4881
- return {
4882
- type: 'object',
4883
- properties: {
4884
- fields: {
4885
- type: 'array',
4886
- items: { type: 'string', enum: fields },
4887
- },
4888
- },
4889
- };
4890
- },
4891
- getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
4892
- const fieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.fields);
4893
- return {
4894
- type: 'object',
4895
- properties: nonEmptyObjectProperties({
4896
- query: transformVariablesWith(fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : {}, (locator) => `query.${locatorToField(locator)}`),
4897
- credentials: credentialsSchema,
4898
- }),
4899
- };
4900
- },
4901
- getOutputSchema: ({ collectionSpec }) => {
4902
- var _a;
4903
- return ({
4904
- type: 'object',
4905
- properties: {
4906
- record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4907
- },
4908
- });
4909
- },
4910
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4911
- };
4912
-
4913
- const DataCollectionMethodSearch = {
4914
- name: 'Search',
4915
- description: 'Find data records in a collection by a string query',
4916
- getInputSchema: ({ credentialsSchema }) => ({
4917
- type: 'object',
4918
- properties: nonEmptyObjectProperties({
4919
- query: { type: 'string' },
4920
- cursor: { type: 'string' },
4921
- credentials: credentialsSchema,
4922
- }),
4923
- }),
4924
- getOutputSchema: ({ collectionSpec }) => {
4925
- var _a;
4926
- return ({
4927
- type: 'object',
4928
- properties: {
4929
- records: {
4930
- type: 'array',
4931
- items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4932
- },
4933
- cursor: { type: 'string' },
4934
- },
4935
- });
5083
+ const FIELDS_SCHEMA$E = {
5084
+ type: 'object',
5085
+ properties: {
5086
+ id: { type: 'string', readOnly: true },
5087
+ fullName: { type: 'string' },
5088
+ firstName: { type: 'string' },
5089
+ lastName: { type: 'string' },
5090
+ primaryEmail: { type: 'string' },
5091
+ campaignId: {
5092
+ type: 'string',
5093
+ referenceUdm: 'campaigns',
5094
+ },
5095
+ contactId: {
5096
+ type: 'string',
5097
+ referenceUdm: 'contacts',
5098
+ },
5099
+ leadId: {
5100
+ type: 'string',
5101
+ referenceUdm: 'leads',
5102
+ },
5103
+ source: { type: 'string' },
5104
+ status: { type: 'string' },
5105
+ companyId: {
5106
+ type: 'string',
5107
+ referenceUdm: 'companies',
5108
+ },
5109
+ jobTitle: { type: 'string' },
5110
+ hasOptedOutOfEmail: { type: 'boolean' },
5111
+ createdTime: {
5112
+ type: 'string',
5113
+ format: 'date-time',
5114
+ },
5115
+ createdBy: {
5116
+ type: 'string',
5117
+ readOnly: true,
5118
+ referenceUdm: 'users',
5119
+ },
5120
+ updatedTime: {
5121
+ type: 'string',
5122
+ readOnly: true,
5123
+ format: 'date-time',
5124
+ },
5125
+ updatedBy: {
5126
+ type: 'string',
5127
+ readOnly: true,
5128
+ referenceUdm: 'users',
5129
+ },
4936
5130
  },
4937
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4938
5131
  };
4939
-
4940
- const DataCollectionMethodUpdate = {
4941
- name: 'Update',
4942
- description: 'Update one data record in the collection by its id',
4943
- getConfigSchema: ({ collectionSpec }) => {
4944
- var _a, _b;
4945
- 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);
4946
- return {
4947
- type: 'object',
4948
- properties: {
4949
- fields: {
4950
- type: 'array',
4951
- items: { type: 'string', enum: fields },
4952
- },
4953
- excludedFields: {
4954
- type: 'array',
4955
- items: { type: 'string', enum: fields },
4956
- },
4957
- },
4958
- };
5132
+ const udm$E = {
5133
+ singularName: 'campaign-member',
5134
+ pluralName: 'campaign-members',
5135
+ fieldsSchema: FIELDS_SCHEMA$E,
5136
+ list: {
5137
+ filterFields: [
5138
+ 'primaryEmail',
5139
+ 'fullName',
5140
+ 'firstName',
5141
+ 'lastName',
5142
+ 'campaignId',
5143
+ 'contactId',
5144
+ 'leadId',
5145
+ 'companyId',
5146
+ ],
4959
5147
  },
4960
- getInputSchema: ({ collectionSpec, collectionHandler, credentialsSchema, method, parameters }) => {
4961
- var _a;
4962
- let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
4963
- if (method === null || method === void 0 ? void 0 : method.fields) {
4964
- fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
4965
- }
4966
- if (method === null || method === void 0 ? void 0 : method.excludedFields) {
4967
- fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
4968
- }
4969
- return {
4970
- type: 'object',
4971
- properties: nonEmptyObjectProperties({
4972
- id: {
4973
- type: 'string',
4974
- referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
4975
- },
4976
- fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
4977
- type: 'object',
4978
- },
4979
- credentials: credentialsSchema,
4980
- }),
4981
- };
5148
+ match: {
5149
+ fields: ['primaryEmail', 'fullName', 'firstName', 'lastName', 'campaignId', 'contactId', 'leadId', 'companyId'],
4982
5150
  },
4983
- getOutputSchema: ({}) => ({
4984
- type: 'object',
4985
- properties: {
4986
- id: { type: 'string' },
4987
- },
4988
- }),
4989
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4990
5151
  };
4991
5152
 
4992
- const FIELDS_SCHEMA$G = {
5153
+ const FIELDS_SCHEMA$D = {
4993
5154
  type: 'object',
4994
5155
  properties: {
4995
5156
  id: { type: 'string', readOnly: true },
4996
- title: { type: 'string' },
4997
- description: { type: 'string' },
4998
- type: { type: 'string' },
4999
- durationSeconds: { type: 'number' },
5000
- location: { type: 'string' },
5001
- isRecurrent: { type: 'boolean' },
5002
- participants: {
5003
- type: 'array',
5004
- items: {
5005
- type: 'object',
5006
- properties: {
5007
- userId: { type: 'string' },
5008
- contactId: { type: 'string' },
5009
- },
5010
- },
5157
+ name: {
5158
+ type: 'string',
5011
5159
  },
5012
- status: { type: 'string' },
5013
- contactId: {
5160
+ cost: {
5161
+ type: 'number',
5162
+ },
5163
+ description: {
5014
5164
  type: 'string',
5015
- referenceUdm: 'contacts',
5016
5165
  },
5017
- companyId: {
5166
+ source: {
5018
5167
  type: 'string',
5019
- referenceUdm: 'companies',
5020
5168
  },
5021
- dealId: {
5169
+ stage: {
5022
5170
  type: 'string',
5023
- referenceUdm: 'deals',
5024
5171
  },
5025
- leadId: {
5172
+ type: {
5026
5173
  type: 'string',
5027
- referenceUdm: 'leads',
5028
5174
  },
5029
5175
  ownerId: {
5030
5176
  type: 'string',
5031
5177
  referenceUdm: 'users',
5032
5178
  },
5179
+ sentCount: {
5180
+ type: 'number',
5181
+ readOnly: true,
5182
+ },
5183
+ replyCount: {
5184
+ type: 'number',
5185
+ readOnly: true,
5186
+ },
5187
+ openCount: {
5188
+ type: 'number',
5189
+ readOnly: true,
5190
+ },
5191
+ clickCount: {
5192
+ type: 'number',
5193
+ readOnly: true,
5194
+ },
5033
5195
  startTime: {
5034
5196
  type: 'string',
5035
5197
  format: 'date-time',
@@ -5038,10 +5200,6 @@ const FIELDS_SCHEMA$G = {
5038
5200
  type: 'string',
5039
5201
  format: 'date-time',
5040
5202
  },
5041
- dueTime: {
5042
- type: 'string',
5043
- format: 'date-time',
5044
- },
5045
5203
  createdTime: {
5046
5204
  type: 'string',
5047
5205
  format: 'date-time',
@@ -5062,477 +5220,167 @@ const FIELDS_SCHEMA$G = {
5062
5220
  referenceUdm: 'users',
5063
5221
  readOnly: true,
5064
5222
  },
5223
+ lastActivityTime: {
5224
+ type: 'string',
5225
+ format: 'date-time',
5226
+ readOnly: true,
5227
+ },
5065
5228
  },
5066
5229
  };
5067
- const FallbackFieldsMap = {
5068
- fromActivitiesToTasks: {
5069
- subject: {
5070
- $var: 'title',
5071
- },
5072
- content: {
5073
- $var: 'description',
5074
- },
5230
+ const MODIFIABLE_FIELDS$2 = ['name', 'description', 'ownerId', 'startTime', 'endTime', 'cost', 'source', 'stage', 'type'];
5231
+ const udm$D = {
5232
+ singularName: 'campaign',
5233
+ pluralName: 'campaigns',
5234
+ fieldsSchema: FIELDS_SCHEMA$D,
5235
+ categories: ['Marketing Automation', 'Sales', 'CRM', 'Ads'],
5236
+ list: {
5237
+ filterFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5075
5238
  },
5076
- fromTasksToActivities: {
5077
- title: {
5078
- $var: 'subject',
5079
- },
5080
- description: {
5081
- $var: 'content',
5082
- },
5239
+ find: {
5240
+ queryFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5083
5241
  },
5084
- fromActivitiesToNotes: {
5085
- content: {
5086
- $var: 'description',
5087
- },
5242
+ match: {
5243
+ fields: ['name', 'source', 'stage', 'type', 'ownerId'],
5088
5244
  },
5089
- fromNotesToActivities: {
5090
- description: {
5091
- $var: 'content',
5092
- },
5093
- },
5094
- fromActivitiesToEmails: {
5095
- subject: {
5096
- $var: 'title',
5097
- },
5098
- body: {
5099
- $var: 'description',
5100
- },
5245
+ create: {
5246
+ fields: MODIFIABLE_FIELDS$2,
5101
5247
  },
5102
- fromEmailsToActivities: {
5103
- title: {
5104
- $var: 'subject',
5105
- },
5106
- description: {
5107
- $var: 'body',
5108
- },
5248
+ update: {
5249
+ fields: MODIFIABLE_FIELDS$2,
5109
5250
  },
5110
5251
  };
5111
- const udm$G = {
5112
- singularName: 'activity',
5113
- pluralName: 'activities',
5114
- fieldsSchema: FIELDS_SCHEMA$G,
5115
- list: {
5116
- filterFields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
5252
+
5253
+ const AddressSchema = {
5254
+ type: 'object',
5255
+ properties: {
5256
+ type: { type: 'string' },
5257
+ full: { type: 'string' },
5258
+ street: { type: 'string' },
5259
+ city: { type: 'string' },
5260
+ state: { type: 'string' },
5261
+ country: { type: 'string' },
5262
+ zip: { type: 'string' },
5117
5263
  },
5118
- match: {
5119
- fields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
5264
+ };
5265
+ const PhoneEmailSchema = {
5266
+ type: 'object',
5267
+ properties: {
5268
+ value: { type: 'string' },
5269
+ type: { type: 'string' },
5120
5270
  },
5121
- populateFields,
5122
- udmFallbacks: [
5123
- {
5124
- udm: 'tasks',
5125
- importFields: FallbackFieldsMap.fromTasksToActivities,
5126
- exportFields: FallbackFieldsMap.fromActivitiesToTasks,
5127
- },
5128
- {
5129
- udm: 'meetings',
5130
- },
5131
- {
5132
- udm: 'notes',
5133
- importFields: FallbackFieldsMap.fromNotesToActivities,
5134
- exportFields: FallbackFieldsMap.fromActivitiesToNotes,
5135
- },
5136
- {
5137
- udm: 'emails',
5138
- importFields: FallbackFieldsMap.fromEmailsToActivities,
5139
- exportFields: FallbackFieldsMap.fromActivitiesToEmails,
5140
- },
5141
- ],
5142
5271
  };
5143
- function populateFields(fields) {
5144
- const result = JSON.parse(JSON.stringify(fields));
5145
- if (!result.dueTime) {
5146
- result.dueTime = result.endTime || result.startTime;
5147
- }
5148
- if (!result.startTime) {
5149
- result.startTime = result.dueTime || result.endTime;
5150
- }
5151
- if (!result.endTime) {
5152
- result.endTime = result.dueTime || result.startTime;
5153
- }
5154
- return result;
5155
- }
5156
5272
 
5157
- const FIELDS_SCHEMA$F = {
5273
+ const FIELDS_SCHEMA$C = {
5158
5274
  type: 'object',
5159
5275
  properties: {
5160
5276
  id: { type: 'string', readOnly: true },
5161
- number: { type: 'string' },
5162
- name: { type: 'string' },
5163
- memo: { type: 'string' },
5164
- status: { type: 'string' },
5165
- paymentMethod: { type: 'string' },
5166
- supplierId: { type: 'string', referenceUdm: 'suppliers' },
5167
- currency: { type: 'string' },
5168
- payments: {
5169
- type: 'array',
5170
- items: {
5171
- type: 'string',
5172
- referenceUdm: 'payments',
5173
- },
5277
+ name: {
5278
+ type: 'string',
5174
5279
  },
5175
- lineItems: {
5280
+ websiteUrl: {
5281
+ type: 'string',
5282
+ },
5283
+ phones: {
5176
5284
  type: 'array',
5177
- items: {
5178
- type: 'object',
5179
- properties: {
5180
- id: { type: 'string' },
5181
- itemName: { type: 'string' },
5182
- description: { type: 'string' },
5183
- code: { type: 'string' },
5184
- type: { type: 'string' },
5185
- companyId: { type: 'string', referenceUdm: 'companies' },
5186
- ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5187
- quantity: { type: 'number' },
5188
- unitPrice: { type: 'number' },
5189
- unitOfMeasure: { type: 'string' },
5190
- purchasePrice: { type: 'number' },
5191
- salesPrice: { type: 'number' },
5192
- taxable: { type: 'boolean' },
5193
- taxAmount: { type: 'number' },
5194
- totalAmount: { type: 'number' },
5195
- },
5196
- },
5285
+ items: PhoneEmailSchema,
5197
5286
  },
5198
- totalAmount: { type: 'number' },
5199
- totalTax: { type: 'number' },
5200
- exchangeRate: { type: 'number' },
5201
- totalDiscount: { type: 'number' },
5202
- subTotal: { type: 'number' },
5203
- balance: { type: 'number' },
5204
- ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5205
- issueDate: {
5287
+ primaryPhone: {
5206
5288
  type: 'string',
5207
- format: 'date-time',
5208
5289
  },
5209
- dueDate: {
5290
+ description: {
5210
5291
  type: 'string',
5211
- format: 'date-time',
5212
5292
  },
5213
- paidOnDate: {
5293
+ currency: {
5214
5294
  type: 'string',
5215
- format: 'date-time',
5216
5295
  },
5217
- createdTime: { type: 'string', format: 'date-time', readOnly: true },
5218
- createdBy: { type: 'string', referenceUdm: 'users', readOnly: true },
5219
- updatedTime: { type: 'string', format: 'date-time', readOnly: true },
5220
- updatedBy: { type: 'string', referenceUdm: 'users', readOnly: true },
5221
- },
5222
- };
5223
- const udm$F = {
5224
- singularName: 'bill',
5225
- pluralName: 'bills',
5226
- fieldsSchema: FIELDS_SCHEMA$F,
5227
- list: {
5228
- filterFields: ['name', 'number', 'status', 'supplierId'],
5229
- },
5230
- match: {
5231
- fields: ['name', 'number', 'status', 'supplierId'],
5232
- },
5233
- };
5234
-
5235
- const FIELDS_SCHEMA$E = {
5236
- type: 'object',
5237
- properties: {
5238
- id: { type: 'string', readOnly: true },
5239
- fullName: { type: 'string' },
5240
- firstName: { type: 'string' },
5241
- lastName: { type: 'string' },
5242
- primaryEmail: { type: 'string' },
5243
- campaignId: {
5296
+ industry: {
5244
5297
  type: 'string',
5245
- referenceUdm: 'campaigns',
5246
5298
  },
5247
- contactId: {
5299
+ ownerId: {
5248
5300
  type: 'string',
5249
- referenceUdm: 'contacts',
5301
+ referenceUdm: 'users',
5250
5302
  },
5251
- leadId: {
5252
- type: 'string',
5253
- referenceUdm: 'leads',
5303
+ primaryAddress: AddressSchema,
5304
+ addresses: {
5305
+ type: 'array',
5306
+ items: AddressSchema,
5254
5307
  },
5255
- source: { type: 'string' },
5256
- status: { type: 'string' },
5257
- companyId: {
5258
- type: 'string',
5259
- referenceUdm: 'companies',
5308
+ numberOfEmployees: {
5309
+ type: 'number',
5260
5310
  },
5261
- jobTitle: { type: 'string' },
5262
- hasOptedOutOfEmail: { type: 'boolean' },
5263
5311
  createdTime: {
5264
5312
  type: 'string',
5265
5313
  format: 'date-time',
5266
5314
  },
5267
5315
  createdBy: {
5268
5316
  type: 'string',
5269
- readOnly: true,
5270
5317
  referenceUdm: 'users',
5318
+ readOnly: true,
5271
5319
  },
5272
5320
  updatedTime: {
5273
5321
  type: 'string',
5274
- readOnly: true,
5275
5322
  format: 'date-time',
5323
+ readOnly: true,
5276
5324
  },
5277
5325
  updatedBy: {
5278
5326
  type: 'string',
5279
- readOnly: true,
5280
5327
  referenceUdm: 'users',
5328
+ readOnly: true,
5329
+ },
5330
+ lastActivityTime: {
5331
+ type: 'string',
5332
+ format: 'date-time',
5333
+ readOnly: true,
5281
5334
  },
5282
5335
  },
5283
5336
  };
5284
- const udm$E = {
5285
- singularName: 'campaign-member',
5286
- pluralName: 'campaign-members',
5287
- fieldsSchema: FIELDS_SCHEMA$E,
5337
+ const udm$C = {
5338
+ singularName: 'company',
5339
+ pluralName: 'companies',
5340
+ fieldsSchema: FIELDS_SCHEMA$C,
5288
5341
  list: {
5289
- filterFields: [
5290
- 'primaryEmail',
5291
- 'fullName',
5292
- 'firstName',
5293
- 'lastName',
5294
- 'campaignId',
5295
- 'contactId',
5296
- 'leadId',
5297
- 'companyId',
5298
- ],
5342
+ filterFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5343
+ },
5344
+ find: {
5345
+ queryFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5299
5346
  },
5300
5347
  match: {
5301
- fields: ['primaryEmail', 'fullName', 'firstName', 'lastName', 'campaignId', 'contactId', 'leadId', 'companyId'],
5348
+ fields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5349
+ },
5350
+ fieldFallbacks: {
5351
+ 'primaryAddress.full': [
5352
+ {
5353
+ $concat: {
5354
+ values: [
5355
+ { $var: 'primaryAddress.street' },
5356
+ { $var: 'primaryAddress.city' },
5357
+ { $var: 'primaryAddress.state' },
5358
+ { $var: 'primaryAddress.zip' },
5359
+ { $var: 'primaryAddress.country' },
5360
+ ],
5361
+ delimiter: ', ',
5362
+ },
5363
+ },
5364
+ ],
5302
5365
  },
5303
5366
  };
5304
5367
 
5305
- const FIELDS_SCHEMA$D = {
5368
+ const FIELDS_SCHEMA$B = {
5306
5369
  type: 'object',
5307
5370
  properties: {
5308
5371
  id: { type: 'string', readOnly: true },
5309
- name: {
5372
+ name: { type: 'string' },
5373
+ description: { type: 'string' },
5374
+ source: { type: 'string' },
5375
+ type: { type: 'string' },
5376
+ ownerId: {
5310
5377
  type: 'string',
5378
+ referenceUdm: 'users',
5311
5379
  },
5312
- cost: {
5313
- type: 'number',
5314
- },
5315
- description: {
5380
+ createdTime: {
5316
5381
  type: 'string',
5317
- },
5318
- source: {
5319
- type: 'string',
5320
- },
5321
- stage: {
5322
- type: 'string',
5323
- },
5324
- type: {
5325
- type: 'string',
5326
- },
5327
- ownerId: {
5328
- type: 'string',
5329
- referenceUdm: 'users',
5330
- },
5331
- sentCount: {
5332
- type: 'number',
5333
- readOnly: true,
5334
- },
5335
- replyCount: {
5336
- type: 'number',
5337
- readOnly: true,
5338
- },
5339
- openCount: {
5340
- type: 'number',
5341
- readOnly: true,
5342
- },
5343
- clickCount: {
5344
- type: 'number',
5345
- readOnly: true,
5346
- },
5347
- startTime: {
5348
- type: 'string',
5349
- format: 'date-time',
5350
- },
5351
- endTime: {
5352
- type: 'string',
5353
- format: 'date-time',
5354
- },
5355
- createdTime: {
5356
- type: 'string',
5357
- format: 'date-time',
5358
- readOnly: true,
5359
- },
5360
- createdBy: {
5361
- type: 'string',
5362
- referenceUdm: 'users',
5363
- readOnly: true,
5364
- },
5365
- updatedTime: {
5366
- type: 'string',
5367
- format: 'date-time',
5368
- readOnly: true,
5369
- },
5370
- updatedBy: {
5371
- type: 'string',
5372
- referenceUdm: 'users',
5373
- readOnly: true,
5374
- },
5375
- lastActivityTime: {
5376
- type: 'string',
5377
- format: 'date-time',
5378
- readOnly: true,
5379
- },
5380
- },
5381
- };
5382
- const MODIFIABLE_FIELDS$2 = ['name', 'description', 'ownerId', 'startTime', 'endTime', 'cost', 'source', 'stage', 'type'];
5383
- const udm$D = {
5384
- singularName: 'campaign',
5385
- pluralName: 'campaigns',
5386
- fieldsSchema: FIELDS_SCHEMA$D,
5387
- categories: ['Marketing Automation', 'Sales', 'CRM', 'Ads'],
5388
- list: {
5389
- filterFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5390
- },
5391
- find: {
5392
- queryFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5393
- },
5394
- match: {
5395
- fields: ['name', 'source', 'stage', 'type', 'ownerId'],
5396
- },
5397
- create: {
5398
- fields: MODIFIABLE_FIELDS$2,
5399
- },
5400
- update: {
5401
- fields: MODIFIABLE_FIELDS$2,
5402
- },
5403
- };
5404
-
5405
- const AddressSchema = {
5406
- type: 'object',
5407
- properties: {
5408
- type: { type: 'string' },
5409
- full: { type: 'string' },
5410
- street: { type: 'string' },
5411
- city: { type: 'string' },
5412
- state: { type: 'string' },
5413
- country: { type: 'string' },
5414
- zip: { type: 'string' },
5415
- },
5416
- };
5417
- const PhoneEmailSchema = {
5418
- type: 'object',
5419
- properties: {
5420
- value: { type: 'string' },
5421
- type: { type: 'string' },
5422
- },
5423
- };
5424
-
5425
- const FIELDS_SCHEMA$C = {
5426
- type: 'object',
5427
- properties: {
5428
- id: { type: 'string', readOnly: true },
5429
- name: {
5430
- type: 'string',
5431
- },
5432
- websiteUrl: {
5433
- type: 'string',
5434
- },
5435
- phones: {
5436
- type: 'array',
5437
- items: PhoneEmailSchema,
5438
- },
5439
- primaryPhone: {
5440
- type: 'string',
5441
- },
5442
- description: {
5443
- type: 'string',
5444
- },
5445
- currency: {
5446
- type: 'string',
5447
- },
5448
- industry: {
5449
- type: 'string',
5450
- },
5451
- ownerId: {
5452
- type: 'string',
5453
- referenceUdm: 'users',
5454
- },
5455
- primaryAddress: AddressSchema,
5456
- addresses: {
5457
- type: 'array',
5458
- items: AddressSchema,
5459
- },
5460
- numberOfEmployees: {
5461
- type: 'number',
5462
- },
5463
- createdTime: {
5464
- type: 'string',
5465
- format: 'date-time',
5466
- },
5467
- createdBy: {
5468
- type: 'string',
5469
- referenceUdm: 'users',
5470
- readOnly: true,
5471
- },
5472
- updatedTime: {
5473
- type: 'string',
5474
- format: 'date-time',
5475
- readOnly: true,
5476
- },
5477
- updatedBy: {
5478
- type: 'string',
5479
- referenceUdm: 'users',
5480
- readOnly: true,
5481
- },
5482
- lastActivityTime: {
5483
- type: 'string',
5484
- format: 'date-time',
5485
- readOnly: true,
5486
- },
5487
- },
5488
- };
5489
- const udm$C = {
5490
- singularName: 'company',
5491
- pluralName: 'companies',
5492
- fieldsSchema: FIELDS_SCHEMA$C,
5493
- list: {
5494
- filterFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5495
- },
5496
- find: {
5497
- queryFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5498
- },
5499
- match: {
5500
- fields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5501
- },
5502
- fieldFallbacks: {
5503
- 'primaryAddress.full': [
5504
- {
5505
- $concat: {
5506
- values: [
5507
- { $var: 'primaryAddress.street' },
5508
- { $var: 'primaryAddress.city' },
5509
- { $var: 'primaryAddress.state' },
5510
- { $var: 'primaryAddress.zip' },
5511
- { $var: 'primaryAddress.country' },
5512
- ],
5513
- delimiter: ', ',
5514
- },
5515
- },
5516
- ],
5517
- },
5518
- };
5519
-
5520
- const FIELDS_SCHEMA$B = {
5521
- type: 'object',
5522
- properties: {
5523
- id: { type: 'string', readOnly: true },
5524
- name: { type: 'string' },
5525
- description: { type: 'string' },
5526
- source: { type: 'string' },
5527
- type: { type: 'string' },
5528
- ownerId: {
5529
- type: 'string',
5530
- referenceUdm: 'users',
5531
- },
5532
- createdTime: {
5533
- type: 'string',
5534
- format: 'date-time',
5535
- readOnly: true,
5382
+ format: 'date-time',
5383
+ readOnly: true,
5536
5384
  },
5537
5385
  createdBy: {
5538
5386
  type: 'string',
@@ -7950,173 +7798,6 @@ const udm = {
7950
7798
  },
7951
7799
  };
7952
7800
 
7953
- const structuredClone$1 = (structuredClonePolyfill === null || structuredClonePolyfill === void 0 ? void 0 : structuredClonePolyfill.default) || structuredClonePolyfill;
7954
- function isNil(value) {
7955
- return value == null;
7956
- }
7957
- function omitBy(obj, check) {
7958
- obj = { ...obj };
7959
- Object.entries(obj).forEach(([key, value]) => check(value) && delete obj[key]);
7960
- return obj;
7961
- }
7962
- function isEmptyValue(value) {
7963
- if (isNil(value)) {
7964
- return true;
7965
- }
7966
- if (typeof value === 'symbol') {
7967
- return true;
7968
- }
7969
- if (typeof value === 'boolean') {
7970
- return false;
7971
- }
7972
- if (typeof value === 'number') {
7973
- return isNaN(value);
7974
- }
7975
- if (typeof value === 'string') {
7976
- return value.trim().length === 0;
7977
- }
7978
- const tag = value.toString();
7979
- if (tag === '[object Map]' || tag === '[object Set]') {
7980
- return !value.size;
7981
- }
7982
- return typeof value === 'object' && Object.keys(value).length === 0;
7983
- }
7984
- const simpleUniqueId = () => {
7985
- return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)
7986
- .toString(36)
7987
- .padStart(11, '0')
7988
- .substring(0, 11);
7989
- };
7990
-
7991
- function getDataLocationMethodPath(locationKey, methodKey) {
7992
- return `data/${locationKey}/${toKebabCase(methodKey)}`;
7993
- }
7994
- function dataLocationParametersMatch({ locationParameters, targetParameters, }) {
7995
- targetParameters = typeof targetParameters === 'object' && targetParameters ? targetParameters : {};
7996
- locationParameters = typeof locationParameters === 'object' && locationParameters ? locationParameters : {};
7997
- for (const [key, value] of Object.entries(targetParameters)) {
7998
- if (locationParameters[key] !== value) {
7999
- return false;
8000
- }
8001
- }
8002
- return true;
8003
- }
8004
- function parseDataLocationPath(path) {
8005
- if (!path) {
8006
- return undefined;
8007
- }
8008
- if (path.startsWith('/')) {
8009
- path = path.slice(1);
8010
- }
8011
- if (!path.startsWith('data/')) {
8012
- throw new Error(`Invalid data location path: ${path}. It should start with "data/"`);
8013
- }
8014
- path = path.slice(5);
8015
- const [key, query] = path.split('?');
8016
- const parameters = Object.fromEntries(new URLSearchParams(query).entries());
8017
- return { key, parameters };
8018
- }
8019
- function makeDataLocationPath(pointer) {
8020
- var _a;
8021
- const normalizedPointer = normalizePointer(pointer);
8022
- if (normalizedPointer === null || normalizedPointer === void 0 ? void 0 : normalizedPointer.key) {
8023
- let path = `/data/${normalizedPointer.key}`;
8024
- const parameters = omitBy((_a = normalizedPointer.parameters) !== null && _a !== void 0 ? _a : {}, isNil);
8025
- if (Object.keys(parameters).length > 0) {
8026
- path += `?${new URLSearchParams(parameters).toString()}`;
8027
- }
8028
- return path;
8029
- }
8030
- else {
8031
- return undefined;
8032
- }
8033
- }
8034
- function normalizePointer(pointer) {
8035
- if (typeof pointer === 'string' && pointer.startsWith('/data/')) {
8036
- return {
8037
- key: pointer.slice(6),
8038
- };
8039
- }
8040
- return pointer;
8041
- }
8042
- function makeDataLocationOperationPath(collectionPath, operation) {
8043
- const [path, query] = (collectionPath !== null && collectionPath !== void 0 ? collectionPath : '').split('?');
8044
- return urljoin(path, operation, query ? `?${query}` : '');
8045
- }
8046
- function isSameDataLocation(location1, location2) {
8047
- if (location1.key !== location2.key) {
8048
- return false;
8049
- }
8050
- const cleanParameters1 = location1.parameters && Object.keys(location1.parameters).length > 0 ? location1.parameters : undefined;
8051
- const cleanParameters2 = location2.parameters && Object.keys(location2.parameters).length > 0 ? location2.parameters : undefined;
8052
- if (!deepEqual(cleanParameters1, cleanParameters2)) {
8053
- return false;
8054
- }
8055
- return true;
8056
- }
8057
- function isDataLocationMethodSupported(location, methodKey) {
8058
- var _a;
8059
- const method = (_a = location === null || location === void 0 ? void 0 : location.methods) === null || _a === void 0 ? void 0 : _a[methodKey];
8060
- return method && method.implementationType !== ConnectorMethodImplementationType.notSupported;
8061
- }
8062
- function getDataCollectionCreateFields(spec) {
8063
- if (!spec)
8064
- return undefined;
8065
- if (!spec.fieldsSchema)
8066
- return undefined;
8067
- if (!spec.create)
8068
- return undefined;
8069
- let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
8070
- if (spec.create.fields) {
8071
- schema = pickFieldsFromSchema(schema, spec.create.fields);
8072
- }
8073
- if (spec.create.excludedFields) {
8074
- schema = excludeFieldsFromSchema(schema, spec.create.excludedFields);
8075
- }
8076
- return schema;
8077
- }
8078
- function getDataCollectionUpdateFields(spec) {
8079
- if (!spec)
8080
- return undefined;
8081
- if (!spec.fieldsSchema)
8082
- return undefined;
8083
- if (!spec.update)
8084
- return undefined;
8085
- let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
8086
- if (spec.update.fields) {
8087
- schema = pickFieldsFromSchema(schema, spec.update.fields);
8088
- }
8089
- if (spec.update.excludedFields) {
8090
- schema = excludeFieldsFromSchema(schema, spec.update.excludedFields);
8091
- }
8092
- return schema;
8093
- }
8094
- function getWritableFieldsSchema(spec) {
8095
- if (!spec)
8096
- return undefined;
8097
- if (!spec.fieldsSchema)
8098
- return undefined;
8099
- return mergeSchemas([getDataCollectionCreateFields(spec), getDataCollectionUpdateFields(spec)]);
8100
- }
8101
- function getReferenceCollectionPointerForSchema(schema) {
8102
- if ((schema === null || schema === void 0 ? void 0 : schema.referenceCollection) && schema.referenceCollection.key) {
8103
- return schema.referenceCollection;
8104
- }
8105
- else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionPath) {
8106
- return parseDataLocationPath(schema.referenceCollectionPath);
8107
- }
8108
- else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionUri) {
8109
- return parseDataLocationPath(schema.referenceCollectionUri);
8110
- }
8111
- else {
8112
- return undefined;
8113
- }
8114
- }
8115
- function getReferenceCollectionPathForSchema(schema) {
8116
- const pointer = getReferenceCollectionPointerForSchema(schema);
8117
- return makeDataLocationPath(pointer);
8118
- }
8119
-
8120
7801
  var UDM;
8121
7802
  (function (UDM) {
8122
7803
  UDM["ACTIVITIES"] = "activities";
@@ -8301,63 +7982,385 @@ function addUdmFallbackFields(fields, udm) {
8301
7982
  return result;
8302
7983
  }
8303
7984
 
8304
- const DATA_RECORD_SCHEMA = {
8305
- type: 'object',
8306
- properties: {
8307
- id: {
8308
- type: 'string',
8309
- },
8310
- name: {
8311
- type: 'string',
8312
- },
8313
- uri: {
8314
- type: 'string',
8315
- format: 'url',
8316
- },
8317
- createdTime: {
8318
- type: 'string',
8319
- format: 'datetime',
8320
- },
8321
- updatedTime: {
8322
- type: 'string',
8323
- format: 'datetime',
8324
- },
8325
- deletedTime: {
8326
- type: 'string',
8327
- format: 'datetime',
8328
- },
8329
- createdById: {
8330
- type: 'string',
8331
- },
8332
- updatedById: {
8333
- type: 'string',
8334
- },
7985
+ const DATA_RECORD_SCHEMA = {
7986
+ type: 'object',
7987
+ properties: {
7988
+ id: {
7989
+ type: 'string',
7990
+ },
7991
+ name: {
7992
+ type: 'string',
7993
+ },
7994
+ uri: {
7995
+ type: 'string',
7996
+ format: 'url',
7997
+ },
7998
+ createdTime: {
7999
+ type: 'string',
8000
+ format: 'datetime',
8001
+ },
8002
+ updatedTime: {
8003
+ type: 'string',
8004
+ format: 'datetime',
8005
+ },
8006
+ deletedTime: {
8007
+ type: 'string',
8008
+ format: 'datetime',
8009
+ },
8010
+ createdById: {
8011
+ type: 'string',
8012
+ },
8013
+ updatedById: {
8014
+ type: 'string',
8015
+ },
8016
+ },
8017
+ };
8018
+ function makeDataRecordSchema({ fieldsSchema, udm, rawFieldsSchema, }) {
8019
+ var _a, _b, _c;
8020
+ const schema = structuredClone$1(DATA_RECORD_SCHEMA);
8021
+ schema.properties = {
8022
+ ...((_a = schema.properties) !== null && _a !== void 0 ? _a : {}),
8023
+ fields: fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : { type: 'object' },
8024
+ };
8025
+ if (udm) {
8026
+ const unifiedModel = UNIFIED_DATA_MODELS[udm];
8027
+ if (unifiedModel === null || unifiedModel === void 0 ? void 0 : unifiedModel.fieldsSchema) {
8028
+ schema.properties = {
8029
+ ...((_b = schema.properties) !== null && _b !== void 0 ? _b : {}),
8030
+ unifiedFields: unifiedModel.fieldsSchema,
8031
+ };
8032
+ }
8033
+ }
8034
+ if (rawFieldsSchema) {
8035
+ schema.properties = {
8036
+ ...((_c = schema.properties) !== null && _c !== void 0 ? _c : {}),
8037
+ rawFields: rawFieldsSchema,
8038
+ };
8039
+ }
8040
+ return schema;
8041
+ }
8042
+
8043
+ const DataLocationMethodImplementationTypes = [
8044
+ ConnectorMethodImplementationType.operationMapping,
8045
+ ConnectorMethodImplementationType.restApiMapping,
8046
+ ConnectorMethodImplementationType.graphqlApiMapping,
8047
+ ConnectorMethodImplementationType.javascript,
8048
+ ConnectorMethodImplementationType.notSupported,
8049
+ ];
8050
+
8051
+ const DataCollectionMethodCreate = {
8052
+ name: 'Create',
8053
+ description: 'Create a new data record in the collection',
8054
+ getConfigSchema: ({ collectionSpec }) => {
8055
+ var _a, _b;
8056
+ 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);
8057
+ return {
8058
+ type: 'object',
8059
+ properties: {
8060
+ fields: {
8061
+ type: 'array',
8062
+ items: { type: 'string', enum: fields },
8063
+ },
8064
+ excludedFields: {
8065
+ type: 'array',
8066
+ items: { type: 'string', enum: fields },
8067
+ },
8068
+ },
8069
+ };
8070
+ },
8071
+ getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
8072
+ var _a;
8073
+ let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
8074
+ if (method === null || method === void 0 ? void 0 : method.fields) {
8075
+ fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
8076
+ }
8077
+ if (method === null || method === void 0 ? void 0 : method.excludedFields) {
8078
+ fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
8079
+ }
8080
+ return {
8081
+ type: 'object',
8082
+ properties: nonEmptyObjectProperties({
8083
+ fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
8084
+ type: 'object',
8085
+ },
8086
+ credentials: credentialsSchema,
8087
+ }),
8088
+ };
8089
+ },
8090
+ getOutputSchema: ({}) => ({
8091
+ type: 'object',
8092
+ properties: {
8093
+ id: { type: 'string' },
8094
+ },
8095
+ }),
8096
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8097
+ };
8098
+
8099
+ const DataCollectionMethodDelete = {
8100
+ name: 'Delete',
8101
+ description: 'Delete a data record from the collection by id',
8102
+ getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => {
8103
+ return {
8104
+ type: 'object',
8105
+ properties: nonEmptyObjectProperties({
8106
+ id: {
8107
+ type: 'string',
8108
+ referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
8109
+ },
8110
+ credentials: credentialsSchema,
8111
+ }),
8112
+ };
8113
+ },
8114
+ getOutputSchema: () => null,
8115
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8116
+ };
8117
+
8118
+ const DataCollectionMethodFind = {
8119
+ isDeprecated: true,
8120
+ name: 'Find',
8121
+ description: 'Find a list of data records in the collection',
8122
+ getConfigSchema: ({ collectionSpec }) => {
8123
+ var _a, _b;
8124
+ 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);
8125
+ return {
8126
+ type: 'object',
8127
+ properties: {
8128
+ queryFields: {
8129
+ type: 'array',
8130
+ items: { type: 'string', enum: fields },
8131
+ },
8132
+ },
8133
+ };
8134
+ },
8135
+ getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
8136
+ const queryFieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.queryFields);
8137
+ const schema = {
8138
+ type: 'object',
8139
+ properties: nonEmptyObjectProperties({
8140
+ cursor: { type: 'string' },
8141
+ credentials: credentialsSchema,
8142
+ }),
8143
+ };
8144
+ if (queryFieldsSchema === null || queryFieldsSchema === void 0 ? void 0 : queryFieldsSchema.properties) {
8145
+ schema.properties = {
8146
+ ...schema.properties,
8147
+ query: transformVariablesWith(queryFieldsSchema, (locator) => `query.${locatorToField(locator)}`),
8148
+ };
8149
+ }
8150
+ return schema;
8151
+ },
8152
+ getOutputSchema: ({ collectionSpec }) => {
8153
+ var _a;
8154
+ return ({
8155
+ type: 'object',
8156
+ properties: {
8157
+ records: {
8158
+ type: 'array',
8159
+ items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8160
+ },
8161
+ cursor: {
8162
+ type: 'string',
8163
+ },
8164
+ },
8165
+ });
8166
+ },
8167
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8168
+ };
8169
+
8170
+ const DataCollectionMethodFindById = {
8171
+ name: 'Find by ID',
8172
+ description: 'Find a single data record in the collection by its id',
8173
+ getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => ({
8174
+ type: 'object',
8175
+ properties: nonEmptyObjectProperties({
8176
+ id: {
8177
+ type: 'string',
8178
+ referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
8179
+ },
8180
+ credentials: credentialsSchema,
8181
+ }),
8182
+ }),
8183
+ getOutputSchema: ({ collectionSpec }) => {
8184
+ var _a;
8185
+ return ({
8186
+ type: 'object',
8187
+ properties: {
8188
+ record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8189
+ },
8190
+ });
8191
+ },
8192
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8193
+ };
8194
+
8195
+ const DataCollectionMethodList = {
8196
+ name: 'List',
8197
+ description: 'Return all data records from the collection',
8198
+ getConfigSchema: ({ collectionSpec }) => {
8199
+ var _a, _b;
8200
+ 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);
8201
+ return {
8202
+ type: 'object',
8203
+ properties: {
8204
+ filterFields: {
8205
+ type: 'array',
8206
+ items: { type: 'string', enum: fields },
8207
+ },
8208
+ },
8209
+ };
8210
+ },
8211
+ getInputSchema: ({ method, collectionSpec, credentialsSchema }) => {
8212
+ const fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
8213
+ let filterSchema;
8214
+ if (method === null || method === void 0 ? void 0 : method.filterFields) {
8215
+ filterSchema = pickFieldsFromSchema(fieldsSchema, method.filterFields);
8216
+ }
8217
+ return {
8218
+ type: 'object',
8219
+ properties: nonEmptyObjectProperties({
8220
+ filter: filterSchema,
8221
+ cursor: {
8222
+ type: 'string',
8223
+ description: 'Cursor returned in response to the previous "list" request',
8224
+ },
8225
+ credentials: credentialsSchema,
8226
+ }),
8227
+ };
8228
+ },
8229
+ getOutputSchema: ({ collectionSpec }) => {
8230
+ var _a;
8231
+ return ({
8232
+ type: 'object',
8233
+ properties: {
8234
+ records: {
8235
+ type: 'array',
8236
+ items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8237
+ },
8238
+ cursor: {
8239
+ type: 'string',
8240
+ description: 'Cursor to request the next page of results',
8241
+ },
8242
+ },
8243
+ });
8244
+ },
8245
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8246
+ };
8247
+
8248
+ const DataCollectionMethodMatch = {
8249
+ name: 'Match',
8250
+ description: 'Find a single matching record in a data collection by a set of fields',
8251
+ getConfigSchema: ({ collectionSpec }) => {
8252
+ var _a, _b;
8253
+ 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);
8254
+ return {
8255
+ type: 'object',
8256
+ properties: {
8257
+ fields: {
8258
+ type: 'array',
8259
+ items: { type: 'string', enum: fields },
8260
+ },
8261
+ },
8262
+ };
8263
+ },
8264
+ getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
8265
+ const fieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.fields);
8266
+ return {
8267
+ type: 'object',
8268
+ properties: nonEmptyObjectProperties({
8269
+ query: transformVariablesWith(fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : {}, (locator) => `query.${locatorToField(locator)}`),
8270
+ credentials: credentialsSchema,
8271
+ }),
8272
+ };
8273
+ },
8274
+ getOutputSchema: ({ collectionSpec }) => {
8275
+ var _a;
8276
+ return ({
8277
+ type: 'object',
8278
+ properties: {
8279
+ record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8280
+ },
8281
+ });
8282
+ },
8283
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8284
+ };
8285
+
8286
+ const DataCollectionMethodSearch = {
8287
+ name: 'Search',
8288
+ description: 'Find data records in a collection by a string query',
8289
+ getInputSchema: ({ credentialsSchema }) => ({
8290
+ type: 'object',
8291
+ properties: nonEmptyObjectProperties({
8292
+ query: { type: 'string' },
8293
+ cursor: { type: 'string' },
8294
+ credentials: credentialsSchema,
8295
+ }),
8296
+ }),
8297
+ getOutputSchema: ({ collectionSpec }) => {
8298
+ var _a;
8299
+ return ({
8300
+ type: 'object',
8301
+ properties: {
8302
+ records: {
8303
+ type: 'array',
8304
+ items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8305
+ },
8306
+ cursor: { type: 'string' },
8307
+ },
8308
+ });
8335
8309
  },
8310
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8336
8311
  };
8337
- function makeDataRecordSchema({ fieldsSchema, udm, rawFieldsSchema, }) {
8338
- var _a, _b, _c;
8339
- const schema = structuredClone$1(DATA_RECORD_SCHEMA);
8340
- schema.properties = {
8341
- ...((_a = schema.properties) !== null && _a !== void 0 ? _a : {}),
8342
- fields: fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : { type: 'object' },
8343
- };
8344
- if (udm) {
8345
- const unifiedModel = UNIFIED_DATA_MODELS[udm];
8346
- if (unifiedModel === null || unifiedModel === void 0 ? void 0 : unifiedModel.fieldsSchema) {
8347
- schema.properties = {
8348
- ...((_b = schema.properties) !== null && _b !== void 0 ? _b : {}),
8349
- unifiedFields: unifiedModel.fieldsSchema,
8350
- };
8312
+
8313
+ const DataCollectionMethodUpdate = {
8314
+ name: 'Update',
8315
+ description: 'Update one data record in the collection by its id',
8316
+ getConfigSchema: ({ collectionSpec }) => {
8317
+ var _a, _b;
8318
+ 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);
8319
+ return {
8320
+ type: 'object',
8321
+ properties: {
8322
+ fields: {
8323
+ type: 'array',
8324
+ items: { type: 'string', enum: fields },
8325
+ },
8326
+ excludedFields: {
8327
+ type: 'array',
8328
+ items: { type: 'string', enum: fields },
8329
+ },
8330
+ },
8331
+ };
8332
+ },
8333
+ getInputSchema: ({ collectionSpec, collectionHandler, credentialsSchema, method, parameters }) => {
8334
+ var _a;
8335
+ let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
8336
+ if (method === null || method === void 0 ? void 0 : method.fields) {
8337
+ fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
8351
8338
  }
8352
- }
8353
- if (rawFieldsSchema) {
8354
- schema.properties = {
8355
- ...((_c = schema.properties) !== null && _c !== void 0 ? _c : {}),
8356
- rawFields: rawFieldsSchema,
8339
+ if (method === null || method === void 0 ? void 0 : method.excludedFields) {
8340
+ fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
8341
+ }
8342
+ return {
8343
+ type: 'object',
8344
+ properties: nonEmptyObjectProperties({
8345
+ id: {
8346
+ type: 'string',
8347
+ referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
8348
+ },
8349
+ fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
8350
+ type: 'object',
8351
+ },
8352
+ credentials: credentialsSchema,
8353
+ }),
8357
8354
  };
8358
- }
8359
- return schema;
8360
- }
8355
+ },
8356
+ getOutputSchema: ({}) => ({
8357
+ type: 'object',
8358
+ properties: {
8359
+ id: { type: 'string' },
8360
+ },
8361
+ }),
8362
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8363
+ };
8361
8364
 
8362
8365
  const GetEventConfig = {
8363
8366
  fileKey: 'connector-event-get-event-config',
@@ -9106,6 +9109,7 @@ const GeneratedConnectorOption = z.object({
9106
9109
  description: z.string().optional(),
9107
9110
  inputSchema: DataSchema.optional(),
9108
9111
  connectorParametersSchema: DataSchema.optional(),
9112
+ oAuthCallbackUri: z.string().optional(),
9109
9113
  });
9110
9114
  const ConnectorOptions = z.record(z.string(), ConnectorOption);
9111
9115
  const WritableConnectorVersionData = ConnectorAuthWithFunctions.extend({
@@ -10258,6 +10262,9 @@ const FindActionRunLogsQuery = PaginationQuery.extend({
10258
10262
  .meta({
10259
10263
  filterTitle: 'Status',
10260
10264
  }),
10265
+ externalAppId: z.string().optional().meta({
10266
+ hidden: true,
10267
+ }),
10261
10268
  from: z
10262
10269
  .string()
10263
10270
  .optional()
@@ -10298,6 +10305,13 @@ const FindConnectionsQuery = PaginationQuery.merge(SearchQuery)
10298
10305
  .meta({
10299
10306
  filterTitle: 'Connector',
10300
10307
  }),
10308
+ externalAppId: z
10309
+ .string()
10310
+ .optional()
10311
+ .meta({
10312
+ filterTitle: 'External App',
10313
+ referenceElementType: WorkspaceElementType.App,
10314
+ }),
10301
10315
  disconnected: zodBooleanCoercion()
10302
10316
  .optional()
10303
10317
  .meta({
@@ -10318,10 +10332,6 @@ const FindConnectionsQuery = PaginationQuery.merge(SearchQuery)
10318
10332
  .string()
10319
10333
  .optional()
10320
10334
  .meta({ hidden: true }),
10321
- externalAppId: z.string().optional().meta({
10322
- filterTitle: 'External App',
10323
- referenceElementType: WorkspaceElementType.App,
10324
- }),
10325
10335
  integrationKey: z
10326
10336
  .string()
10327
10337
  .optional()
@@ -10444,6 +10454,13 @@ const DataSourceInstanceApiResponse = DataSourceApiResponse;
10444
10454
  const FindDataSourcesQuery = FindIntegrationLevelMembraneInterfaceQuery.omit({ parentId: true }).extend({
10445
10455
  dataSourceId: z.string().optional(),
10446
10456
  universalDataSourceId: z.string().optional(),
10457
+ externalAppId: z
10458
+ .string()
10459
+ .optional()
10460
+ .meta({
10461
+ filterTitle: 'External App',
10462
+ referenceElementType: WorkspaceElementType.App,
10463
+ }),
10447
10464
  });
10448
10465
  const FindDataSourceInstancesQuery = FindDataSourcesQuery;
10449
10466
  const CreateDataSourceRequest = DataSourceEditableProperties;
@@ -10527,6 +10544,13 @@ const FlowInstanceApiResponse = FlowApiResponse;
10527
10544
  const FindFlowsQuery = FindIntegrationLevelMembraneInterfaceQuery.omit({ parentId: true }).extend({
10528
10545
  flowId: z.string().optional(),
10529
10546
  universalFlowId: z.string().optional(),
10547
+ externalAppId: z
10548
+ .string()
10549
+ .optional()
10550
+ .meta({
10551
+ filterTitle: 'External App',
10552
+ referenceElementType: WorkspaceElementType.App,
10553
+ }),
10530
10554
  });
10531
10555
  const CreateFlowRequest = FlowEditableProperties;
10532
10556
  const UpdateFlowRequest = CreateFlowRequest.extend({}).partial();
@@ -10604,6 +10628,9 @@ const FindFlowRunsQuery = PaginationQuery.extend({
10604
10628
  filterTitle: 'Connection',
10605
10629
  referenceElementType: WorkspaceElementType.Connection,
10606
10630
  }),
10631
+ externalAppId: z.string().optional().meta({
10632
+ hidden: true,
10633
+ }),
10607
10634
  from: z
10608
10635
  .string()
10609
10636
  .optional()
@@ -10766,6 +10793,13 @@ const FieldMappingInstanceApiResponse = FieldMappingApiResponse;
10766
10793
  const FindFieldMappingsQuery = FindIntegrationLevelMembraneInterfaceQuery.omit({ parentId: true }).extend({
10767
10794
  fieldMappingId: z.string().optional(),
10768
10795
  universalFieldMappingId: z.string().optional(),
10796
+ externalAppId: z
10797
+ .string()
10798
+ .optional()
10799
+ .meta({
10800
+ filterTitle: 'External App',
10801
+ referenceElementType: WorkspaceElementType.App,
10802
+ }),
10769
10803
  });
10770
10804
  const FindFieldMappingInstancesQuery = FindFieldMappingsQuery;
10771
10805
  const CreateFieldMappingRequest = FieldMappingEditableProperties;
@@ -11037,6 +11071,9 @@ const ListExternalEventLogRecordsQuery = PaginationQuery.extend({
11037
11071
  .meta({
11038
11072
  filterTitle: 'Status',
11039
11073
  }),
11074
+ externalAppId: z.string().optional().meta({
11075
+ hidden: true,
11076
+ }),
11040
11077
  from: z
11041
11078
  .string()
11042
11079
  .optional()
@@ -11126,6 +11163,9 @@ const FindExternalEventPullsQuery = PaginationQuery.extend({
11126
11163
  .meta({
11127
11164
  filterTitle: 'Status',
11128
11165
  }),
11166
+ externalAppId: z.string().optional().meta({
11167
+ hidden: true,
11168
+ }),
11129
11169
  from: z
11130
11170
  .string()
11131
11171
  .optional()
@@ -11173,6 +11213,9 @@ const ListExternalEventSubscriptionsQuery = PaginationQuery.merge(IncludeArchive
11173
11213
  filterTitle: 'Integration',
11174
11214
  referenceElementType: WorkspaceElementType.Integration,
11175
11215
  }),
11216
+ externalAppId: z.string().optional().meta({
11217
+ hidden: true,
11218
+ }),
11176
11219
  });
11177
11220
  const ExternalEventSubscriptionApiResponse = BaseExternalEventSubscription.extend({
11178
11221
  user: BaseCustomer.optional(),
@@ -11255,6 +11298,9 @@ const ListExternalApiLogsQuery = PaginationQuery.extend({
11255
11298
  filterTitle: 'Status',
11256
11299
  isFlag: true,
11257
11300
  }),
11301
+ externalAppId: z.string().optional().meta({
11302
+ hidden: true,
11303
+ }),
11258
11304
  from: z
11259
11305
  .string()
11260
11306
  .optional()
@@ -11279,6 +11325,7 @@ const ExternalApiLogApiResponse = z.object({
11279
11325
  customerId: z.string(),
11280
11326
  integrationId: z.string(),
11281
11327
  connectionId: z.string(),
11328
+ externalAppId: z.string().optional(),
11282
11329
  statusCode: z.number(),
11283
11330
  isSuccess: z.boolean(),
11284
11331
  s3Uri: z.string(),
@@ -11318,6 +11365,9 @@ const ListIncomingWebhooksQuery = PaginationQuery.extend({
11318
11365
  .meta({
11319
11366
  filterTitle: 'Status',
11320
11367
  }),
11368
+ externalAppId: z.string().optional().meta({
11369
+ hidden: true,
11370
+ }),
11321
11371
  from: z
11322
11372
  .string()
11323
11373
  .optional()
@@ -11340,6 +11390,7 @@ const IncomingWebhookApiResponse = z.object({
11340
11390
  customerId: z.string(),
11341
11391
  integrationId: z.string(),
11342
11392
  connectionId: z.string(),
11393
+ externalAppId: z.string().optional(),
11343
11394
  subscriptionId: z.string(),
11344
11395
  userId: z.string(),
11345
11396
  uuid: z.string(),
@@ -11353,12 +11404,14 @@ const IncomingWebhookApiResponse = z.object({
11353
11404
 
11354
11405
  const CreateConnectedProductRequest = z.object({
11355
11406
  name: z.string(),
11407
+ key: z.string().optional(),
11356
11408
  type: ConnectedProductType,
11357
11409
  audience: ConnectedProductAudience.optional(),
11358
11410
  parameters: AiAgentParameters.optional(),
11359
11411
  });
11360
11412
  const UpdateConnectedProductRequest = z.object({
11361
11413
  name: z.string().optional(),
11414
+ key: z.string().optional(),
11362
11415
  type: ConnectedProductType.optional(),
11363
11416
  audience: ConnectedProductAudience.optional(),
11364
11417
  parameters: AiAgentParameters.optional(),
@@ -11367,7 +11420,6 @@ const FindConnectedProductsQuery = z
11367
11420
  .object({
11368
11421
  type: ConnectedProductType.optional(),
11369
11422
  audience: ConnectedProductAudience.optional(),
11370
- key: z.string().optional(),
11371
11423
  })
11372
11424
  .merge(PaginationQuery)
11373
11425
  .merge(SearchQuery)
@@ -11693,6 +11745,26 @@ const WorkspaceElementSpecs = {
11693
11745
  apiPath: 'customers',
11694
11746
  name: 'Customer',
11695
11747
  namePlural: 'Customers',
11748
+ relatedIntegrationLayerElements: [
11749
+ WorkspaceElementType.Connection,
11750
+ WorkspaceElementType.Action,
11751
+ WorkspaceElementType.Flow,
11752
+ WorkspaceElementType.ExternalEventSubscription,
11753
+ WorkspaceElementType.AppEventSubscription,
11754
+ WorkspaceElementType.DataSource,
11755
+ WorkspaceElementType.FieldMapping,
11756
+ WorkspaceElementType.AppDataSchemaInstance,
11757
+ WorkspaceElementType.DataLinkTableInstance,
11758
+ ],
11759
+ relatedActivityLogElements: [
11760
+ WorkspaceElementType.FlowRun,
11761
+ WorkspaceElementType.ActionRunLogRecord,
11762
+ WorkspaceElementType.ExternalApiLogRecord,
11763
+ WorkspaceElementType.IncomingWebhookLogRecord,
11764
+ WorkspaceElementType.ExternalEventLogRecord,
11765
+ WorkspaceElementType.ExternalEventPull,
11766
+ WorkspaceElementType.AppEventLogRecord,
11767
+ ],
11696
11768
  },
11697
11769
  [WorkspaceElementType.App]: {
11698
11770
  type: WorkspaceElementType.App,
@@ -11701,6 +11773,21 @@ const WorkspaceElementSpecs = {
11701
11773
  namePlural: 'Apps',
11702
11774
  hasKey: true,
11703
11775
  hasPublicLayer: true,
11776
+ relatedIntegrationLayerElements: [
11777
+ WorkspaceElementType.Connection,
11778
+ WorkspaceElementType.Action,
11779
+ WorkspaceElementType.Flow,
11780
+ WorkspaceElementType.DataSource,
11781
+ WorkspaceElementType.FieldMapping,
11782
+ ],
11783
+ relatedActivityLogElements: [
11784
+ WorkspaceElementType.FlowRun,
11785
+ WorkspaceElementType.ActionRunLogRecord,
11786
+ WorkspaceElementType.ExternalApiLogRecord,
11787
+ WorkspaceElementType.IncomingWebhookLogRecord,
11788
+ WorkspaceElementType.ExternalEventLogRecord,
11789
+ WorkspaceElementType.ExternalEventPull,
11790
+ ],
11704
11791
  },
11705
11792
  [WorkspaceElementType.Integration]: {
11706
11793
  type: WorkspaceElementType.Integration,
@@ -11710,6 +11797,27 @@ const WorkspaceElementSpecs = {
11710
11797
  editablePropertiesSchema: IntegrationEditableProperties,
11711
11798
  exportPropertiesSchema: IntegrationExportProperties,
11712
11799
  hasKey: true,
11800
+ relatedIntegrationLayerElements: [
11801
+ WorkspaceElementType.Connection,
11802
+ WorkspaceElementType.Package,
11803
+ WorkspaceElementType.Action,
11804
+ WorkspaceElementType.Flow,
11805
+ WorkspaceElementType.ExternalEventSubscription,
11806
+ WorkspaceElementType.AppEventSubscription,
11807
+ WorkspaceElementType.DataSource,
11808
+ WorkspaceElementType.FieldMapping,
11809
+ WorkspaceElementType.AppDataSchemaInstance,
11810
+ WorkspaceElementType.DataLinkTableInstance,
11811
+ ],
11812
+ relatedActivityLogElements: [
11813
+ WorkspaceElementType.FlowRun,
11814
+ WorkspaceElementType.ActionRunLogRecord,
11815
+ WorkspaceElementType.ExternalApiLogRecord,
11816
+ WorkspaceElementType.IncomingWebhookLogRecord,
11817
+ WorkspaceElementType.ExternalEventLogRecord,
11818
+ WorkspaceElementType.ExternalEventPull,
11819
+ WorkspaceElementType.AppEventLogRecord,
11820
+ ],
11713
11821
  },
11714
11822
  [WorkspaceElementType.Connector]: {
11715
11823
  type: WorkspaceElementType.Connector,
@@ -11728,6 +11836,26 @@ const WorkspaceElementSpecs = {
11728
11836
  exportPropertiesSchema: ConnectionExportProperties,
11729
11837
  hasKey: false,
11730
11838
  hasUuid: false,
11839
+ statsKey: 'connections',
11840
+ relatedIntegrationLayerElements: [
11841
+ WorkspaceElementType.Action,
11842
+ WorkspaceElementType.Flow,
11843
+ WorkspaceElementType.ExternalEventSubscription,
11844
+ WorkspaceElementType.AppEventSubscription,
11845
+ WorkspaceElementType.DataSource,
11846
+ WorkspaceElementType.FieldMapping,
11847
+ WorkspaceElementType.AppDataSchemaInstance,
11848
+ WorkspaceElementType.DataLinkTableInstance,
11849
+ ],
11850
+ relatedActivityLogElements: [
11851
+ WorkspaceElementType.FlowRun,
11852
+ WorkspaceElementType.ActionRunLogRecord,
11853
+ WorkspaceElementType.ExternalApiLogRecord,
11854
+ WorkspaceElementType.IncomingWebhookLogRecord,
11855
+ WorkspaceElementType.ExternalEventLogRecord,
11856
+ WorkspaceElementType.ExternalEventPull,
11857
+ WorkspaceElementType.AppEventLogRecord,
11858
+ ],
11731
11859
  },
11732
11860
  [WorkspaceElementType.Package]: {
11733
11861
  type: WorkspaceElementType.Package,
@@ -11744,6 +11872,7 @@ const WorkspaceElementSpecs = {
11744
11872
  hasParentChildRelationship: true,
11745
11873
  hasPublicLayer: true,
11746
11874
  isProOnly: true,
11875
+ statsKey: 'packages',
11747
11876
  },
11748
11877
  [WorkspaceElementType.ActionInstance]: {
11749
11878
  type: WorkspaceElementType.ActionInstance,
@@ -11770,12 +11899,14 @@ const WorkspaceElementSpecs = {
11770
11899
  hasParentChildRelationship: true,
11771
11900
  hasKey: true,
11772
11901
  hasPublicLayer: true,
11902
+ statsKey: 'actions',
11773
11903
  },
11774
11904
  [WorkspaceElementType.ActionRunLogRecord]: {
11775
11905
  type: WorkspaceElementType.ActionRunLogRecord,
11776
11906
  apiPath: 'action-run-logs',
11777
11907
  name: 'Action Run Log Record',
11778
11908
  namePlural: 'Action Run Log Records',
11909
+ statsKey: 'actionRunLogs',
11779
11910
  },
11780
11911
  [WorkspaceElementType.Flow]: {
11781
11912
  type: WorkspaceElementType.Flow,
@@ -11793,6 +11924,7 @@ const WorkspaceElementSpecs = {
11793
11924
  hasParentChildRelationship: true,
11794
11925
  hasKey: true,
11795
11926
  isProOnly: true,
11927
+ statsKey: 'flows',
11796
11928
  },
11797
11929
  [WorkspaceElementType.FlowInstance]: {
11798
11930
  type: WorkspaceElementType.FlowInstance,
@@ -11813,6 +11945,7 @@ const WorkspaceElementSpecs = {
11813
11945
  name: 'Flow run',
11814
11946
  namePlural: 'Flow runs',
11815
11947
  isProOnly: true,
11948
+ statsKey: 'flowRuns',
11816
11949
  },
11817
11950
  [WorkspaceElementType.FieldMapping]: {
11818
11951
  type: WorkspaceElementType.FieldMapping,
@@ -11830,6 +11963,7 @@ const WorkspaceElementSpecs = {
11830
11963
  hasParentChildRelationship: true,
11831
11964
  hasKey: true,
11832
11965
  isProOnly: true,
11966
+ statsKey: 'fieldMappings',
11833
11967
  },
11834
11968
  [WorkspaceElementType.FieldMappingInstance]: {
11835
11969
  type: WorkspaceElementType.FieldMappingInstance,
@@ -11859,6 +11993,7 @@ const WorkspaceElementSpecs = {
11859
11993
  hasParentChildRelationship: true,
11860
11994
  hasKey: true,
11861
11995
  isProOnly: true,
11996
+ statsKey: 'dataSources',
11862
11997
  },
11863
11998
  [WorkspaceElementType.DataSourceInstance]: {
11864
11999
  type: WorkspaceElementType.DataSourceInstance,
@@ -11893,6 +12028,7 @@ const WorkspaceElementSpecs = {
11893
12028
  parentFieldKey: 'dataLinkTableId',
11894
12029
  isMembraneInterface: true,
11895
12030
  isProOnly: true,
12031
+ statsKey: 'dataLinkTableInstances',
11896
12032
  },
11897
12033
  [WorkspaceElementType.AppEventType]: {
11898
12034
  type: WorkspaceElementType.AppEventType,
@@ -11913,6 +12049,7 @@ const WorkspaceElementSpecs = {
11913
12049
  namePlural: 'App Event Subscriptions',
11914
12050
  isMembraneInterface: true,
11915
12051
  isProOnly: true,
12052
+ statsKey: 'appEventSubscriptions',
11916
12053
  },
11917
12054
  [WorkspaceElementType.AppEventLogRecord]: {
11918
12055
  type: WorkspaceElementType.AppEventLogRecord,
@@ -11920,6 +12057,7 @@ const WorkspaceElementSpecs = {
11920
12057
  name: 'App Event Log Record',
11921
12058
  namePlural: 'App Event Log Records',
11922
12059
  isProOnly: true,
12060
+ statsKey: 'appEvents',
11923
12061
  },
11924
12062
  [WorkspaceElementType.AppDataSchema]: {
11925
12063
  type: WorkspaceElementType.AppDataSchema,
@@ -11941,6 +12079,7 @@ const WorkspaceElementSpecs = {
11941
12079
  parentFieldKey: 'appDataSchemaId',
11942
12080
  isMembraneInterface: true,
11943
12081
  isProOnly: true,
12082
+ statsKey: 'appDataSchemaInstances',
11944
12083
  },
11945
12084
  [WorkspaceElementType.ExternalEventSubscription]: {
11946
12085
  type: WorkspaceElementType.ExternalEventSubscription,
@@ -11949,6 +12088,7 @@ const WorkspaceElementSpecs = {
11949
12088
  namePlural: 'External Event Subscriptions',
11950
12089
  isMembraneInterface: true,
11951
12090
  isProOnly: true,
12091
+ statsKey: 'externalEventSubscriptions',
11952
12092
  },
11953
12093
  [WorkspaceElementType.ExternalEventLogRecord]: {
11954
12094
  type: WorkspaceElementType.ExternalEventLogRecord,
@@ -11956,6 +12096,7 @@ const WorkspaceElementSpecs = {
11956
12096
  name: 'External Event Log Record',
11957
12097
  namePlural: 'External Event Log Records',
11958
12098
  isProOnly: true,
12099
+ statsKey: 'externalEvents',
11959
12100
  },
11960
12101
  [WorkspaceElementType.ExternalEventPull]: {
11961
12102
  type: WorkspaceElementType.ExternalEventPull,
@@ -11963,6 +12104,21 @@ const WorkspaceElementSpecs = {
11963
12104
  name: 'External Event Pull',
11964
12105
  namePlural: 'External Event Pulls',
11965
12106
  isProOnly: true,
12107
+ statsKey: 'externalEventPulls',
12108
+ },
12109
+ [WorkspaceElementType.ExternalApiLogRecord]: {
12110
+ type: WorkspaceElementType.ExternalApiLogRecord,
12111
+ apiPath: 'external-api-logs',
12112
+ name: 'External API Log Record',
12113
+ namePlural: 'External API Log Records',
12114
+ statsKey: 'externalApiLogs',
12115
+ },
12116
+ [WorkspaceElementType.IncomingWebhookLogRecord]: {
12117
+ type: WorkspaceElementType.IncomingWebhookLogRecord,
12118
+ apiPath: 'incoming-webhooks',
12119
+ name: 'Incoming Webhook Log Record',
12120
+ namePlural: 'Incoming Webhook Log Records',
12121
+ statsKey: 'externalWebhookLogs',
11966
12122
  },
11967
12123
  [WorkspaceElementType.Screen]: {
11968
12124
  type: WorkspaceElementType.Screen,
@@ -12366,20 +12522,21 @@ const StatsFilterQuery = z.object({
12366
12522
  tenantId: z.string().optional(),
12367
12523
  integrationId: z.string().optional(),
12368
12524
  connectionId: z.string().optional(),
12525
+ externalAppId: z.string().optional(),
12369
12526
  });
12370
12527
  const ActivityStatsQuery = StatsFilterQuery.extend({
12371
12528
  startDatetime: z.string().datetime({ offset: true }),
12529
+ elementType: z.enum(WorkspaceElementType).optional(),
12530
+ });
12531
+ const IntegrationLayerStatsQuery = StatsFilterQuery.extend({
12532
+ elementType: z.enum(WorkspaceElementType).optional(),
12372
12533
  });
12373
- const IntegrationLayerStatsQuery = StatsFilterQuery;
12374
12534
  const ActionRunsStatsQuery = z.object({
12375
- actionId: z.string().optional(),
12376
- connectionActionId: z.string().optional(),
12535
+ actionId: z.string(),
12377
12536
  startDatetime: z.string().datetime({ offset: true }),
12378
12537
  });
12379
12538
  const FlowRunsStatsQuery = z.object({
12380
- integrationFlowId: z.string().optional(),
12381
- connectionFlowId: z.string().optional(),
12382
- universalFlowId: z.string().optional(),
12539
+ flowId: z.string(),
12383
12540
  startDatetime: z.string().datetime({ offset: true }),
12384
12541
  });
12385
12542
  const WORKSPACE_ELEMENTS_STATS_COLLECTIONS = [
@@ -12940,6 +13097,7 @@ const WORKSPACE_SIZE_LIMITS = [
12940
13097
  const EDITABLE_LIMITS = [
12941
13098
  'parallelApiRequestsPerCustomer',
12942
13099
  'parallelBackgroundJobsPerCustomer',
13100
+ 'parallelCustomCodeRunsPerCustomer',
12943
13101
  'apiRequestsPerCustomerPerSecond',
12944
13102
  'apiRequestsPerCustomerPerHour',
12945
13103
  'externalEventsPerCustomerPerDay',
@@ -15313,6 +15471,7 @@ const AgentSession = z.object({
15313
15471
  hasWorker: z.boolean(),
15314
15472
  isExternal: z.boolean().optional(),
15315
15473
  agentName: z.enum(AgentName).optional(),
15474
+ output: z.record(z.string(), z.unknown()).optional(),
15316
15475
  createdAt: z.iso.datetime(),
15317
15476
  updatedAt: z.iso.datetime(),
15318
15477
  });
@@ -15340,6 +15499,7 @@ const PatchAgentSessionSchema = z.object({
15340
15499
  cost: z.number().optional(),
15341
15500
  error: ErrorDataSchema.optional(),
15342
15501
  opencodeSessionUuid: z.string().optional(),
15502
+ output: z.record(z.string(), z.unknown()).optional(),
15343
15503
  status: z.enum(AgentSessionStatus).optional(),
15344
15504
  });
15345
15505
 
@@ -15472,25 +15632,6 @@ const CreateClusterRequest = z.object({
15472
15632
  });
15473
15633
  const ListClustersQuery = PaginationQuery;
15474
15634
 
15475
- class UI {
15476
- constructor(client) {
15477
- this.client = client;
15478
- }
15479
- async connect(options = {}) {
15480
- const { url, postData } = await this.client.getScreensPostData('connect', {
15481
- ...options,
15482
- allowMultipleConnections: options.allowMultipleConnections ? '1' : '',
15483
- connectorParameters: options.connectorParameters ? JSON.stringify(options.connectorParameters) : undefined,
15484
- });
15485
- return new Promise((resolve) => {
15486
- return openIframeWithPost(url, postData, {
15487
- onClose: () => resolve(null),
15488
- onSuccess: (connection) => resolve(connection),
15489
- });
15490
- });
15491
- }
15492
- }
15493
-
15494
15635
  const API_VERSIONS = {
15495
15636
  LEGACY: 'legacy',
15496
15637
  '2025-10-21': '2025-10-21',
@@ -15742,6 +15883,36 @@ class MembraneApiClient {
15742
15883
  }
15743
15884
  }
15744
15885
 
15886
+ class UI {
15887
+ constructor(client) {
15888
+ this.client = client;
15889
+ }
15890
+ async connect(options = {}) {
15891
+ const { url, postData } = await this.client.getScreensPostData('connect', {
15892
+ ...options,
15893
+ allowMultipleConnections: options.allowMultipleConnections ? '1' : '',
15894
+ connectorParameters: options.connectorParameters ? JSON.stringify(options.connectorParameters) : undefined,
15895
+ });
15896
+ return new Promise((resolve) => {
15897
+ return openIframeWithPost(url, postData, {
15898
+ onClose: () => resolve(null),
15899
+ onSuccess: (connection) => resolve(connection),
15900
+ });
15901
+ });
15902
+ }
15903
+ async UNSAFE_agentSession(options) {
15904
+ const { url, postData } = await this.client.getScreensPostData('agent-session', {
15905
+ sessionId: options.sessionId,
15906
+ theme: options.theme,
15907
+ });
15908
+ return new Promise((resolve) => {
15909
+ return openIframeWithPost(url, postData, {
15910
+ onClose: () => resolve(),
15911
+ });
15912
+ });
15913
+ }
15914
+ }
15915
+
15745
15916
  class MembraneClient extends MembraneApiClient {
15746
15917
  constructor(options) {
15747
15918
  super(options);