@devrev/ts-adaas 1.15.3-beta.1 → 1.15.3-beta.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"process-task.d.ts","sourceRoot":"","sources":["../../src/multithreading/process-task.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,oBAAoB,EAGrB,MAAM,kBAAkB,CAAC;AAsB1B,wBAAgB,WAAW,CAAC,cAAc,EAAE,EAC1C,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,cAAc,CAAC,QAsFtC"}
1
+ {"version":3,"file":"process-task.d.ts","sourceRoot":"","sources":["../../src/multithreading/process-task.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,oBAAoB,EAGrB,MAAM,kBAAkB,CAAC;AAG1B,wBAAgB,WAAW,CAAC,cAAc,EAAE,EAC1C,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,cAAc,CAAC,QAqGtC"}
@@ -8,91 +8,86 @@ const logger_context_1 = require("../logger/logger.context");
8
8
  const state_1 = require("../state/state");
9
9
  const workers_1 = require("../types/workers");
10
10
  const worker_adapter_1 = require("./worker-adapter/worker-adapter");
11
- async function handleTimeoutMessage(adapter, taskPromise, onTimeout) {
12
- console.log('Timeout received. Setting flag and waiting for task to finish.');
13
- adapter.handleTimeout();
14
- try {
15
- await taskPromise;
16
- }
17
- catch (error) {
18
- console.warn('Task error during timeout:', (0, logger_1.serializeError)(error));
19
- }
20
- console.log('Task finished. Running onTimeout.');
21
- await (0, logger_context_1.runWithUserLogContext)(async () => onTimeout({ adapter }));
22
- console.log('Finished executing onTimeout function. Exiting worker.');
23
- }
24
11
  function processTask({ task, onTimeout, }) {
25
- if (!node_worker_threads_1.isMainThread) {
26
- void (async () => {
27
- await (0, logger_context_1.runWithSdkLogContext)(async () => {
28
- try {
29
- const event = node_worker_threads_1.workerData.event;
30
- // TODO: Remove when the old types are completely phased out
31
- event.payload.event_type = (0, event_type_translation_1.translateIncomingEventType)(event.payload.event_type);
32
- const initialState = node_worker_threads_1.workerData.initialState;
33
- const initialDomainMapping = node_worker_threads_1.workerData.initialDomainMapping;
34
- const options = node_worker_threads_1.workerData.options;
35
- // eslint-disable-next-line no-global-assign
36
- console = new logger_1.Logger({ event, options });
37
- const adapterState = await (0, state_1.createAdapterState)({
38
- event,
39
- initialState,
40
- initialDomainMapping,
41
- options,
42
- });
43
- if (!node_worker_threads_1.parentPort || !node_worker_threads_1.workerData.event) {
12
+ if (node_worker_threads_1.isMainThread) {
13
+ return;
14
+ }
15
+ void (async () => {
16
+ await (0, logger_context_1.runWithSdkLogContext)(async () => {
17
+ try {
18
+ const event = node_worker_threads_1.workerData.event;
19
+ // TODO: Remove when the old types are completely phased out
20
+ event.payload.event_type = (0, event_type_translation_1.translateIncomingEventType)(event.payload.event_type);
21
+ const initialState = node_worker_threads_1.workerData.initialState;
22
+ const initialDomainMapping = node_worker_threads_1.workerData.initialDomainMapping;
23
+ const options = node_worker_threads_1.workerData.options;
24
+ // eslint-disable-next-line no-global-assign
25
+ console = new logger_1.Logger({ event, options });
26
+ const adapterState = await (0, state_1.createAdapterState)({
27
+ event,
28
+ initialState,
29
+ initialDomainMapping,
30
+ options,
31
+ });
32
+ const adapter = new worker_adapter_1.WorkerAdapter({
33
+ event,
34
+ adapterState,
35
+ options,
36
+ });
37
+ // Timeout handling flow:
38
+ // The task() runs in the main flow below. Meanwhile, the parent thread may send
39
+ // a timeout message at any point. When that happens, the message handler signals
40
+ // the adapter to stop (handleTimeout), waits for task() to finish, then runs onTimeout().
41
+ // If task() completes before any timeout message arrives, the worker exits normally.
42
+ // isTimeoutReceived prevents both flows from calling process.exit.
43
+ let isTimeoutReceived = false;
44
+ let taskExecution;
45
+ node_worker_threads_1.parentPort === null || node_worker_threads_1.parentPort === void 0 ? void 0 : node_worker_threads_1.parentPort.on(workers_1.WorkerEvent.WorkerMessage, (message) => {
46
+ if (message.subject !== workers_1.WorkerMessageSubject.WorkerMessageExit) {
44
47
  return;
45
48
  }
46
- const adapter = new worker_adapter_1.WorkerAdapter({
47
- event,
48
- adapterState,
49
- options,
50
- });
51
- // Track whether timeout was requested
52
- let timeoutRequested = false;
53
- let taskPromise;
54
- // Set up message handler BEFORE starting task
55
- node_worker_threads_1.parentPort.on(workers_1.WorkerEvent.WorkerMessage, (message) => {
56
- if (message.subject !== workers_1.WorkerMessageSubject.WorkerMessageExit) {
57
- return;
58
- }
59
- timeoutRequested = true;
60
- void (0, logger_context_1.runWithSdkLogContext)(async () => {
49
+ isTimeoutReceived = true;
50
+ void (0, logger_context_1.runWithSdkLogContext)(async () => {
51
+ try {
52
+ console.log('Timeout received. Waiting for the task to finish.');
53
+ adapter.handleTimeout();
61
54
  try {
62
- await handleTimeoutMessage(adapter, taskPromise, onTimeout);
63
- process.exit(0);
55
+ await taskExecution;
64
56
  }
65
- catch (err) {
66
- console.error('Error in onTimeout:', (0, logger_1.serializeError)(err));
67
- process.exit(1);
57
+ catch (taskError) {
58
+ console.warn('Task error during timeout:', (0, logger_1.serializeError)(taskError));
68
59
  }
69
- });
70
- });
71
- // Start task and store the promise
72
- taskPromise = (0, logger_context_1.runWithUserLogContext)(async () => task({ adapter }));
73
- try {
74
- await taskPromise;
75
- }
76
- catch (error) {
77
- // If timeout was requested, let the timeout handler finish
78
- if (timeoutRequested) {
79
- console.log('Task threw during timeout. Letting timeout handler finish.');
80
- return;
60
+ console.log('Task finished. Running onTimeout handler.');
61
+ await (0, logger_context_1.runWithUserLogContext)(async () => onTimeout({ adapter }));
62
+ console.log('onTimeout handler complete. Exiting worker.');
63
+ process.exit(0);
81
64
  }
82
- throw error;
83
- }
84
- // Task completed normally
85
- if (!timeoutRequested) {
86
- console.log('Finished executing task. Exiting worker.');
87
- process.exit(0);
65
+ catch (onTimeoutError) {
66
+ console.error('Error in onTimeout handler:', (0, logger_1.serializeError)(onTimeoutError));
67
+ process.exit(1);
68
+ }
69
+ });
70
+ });
71
+ taskExecution = (0, logger_context_1.runWithUserLogContext)(async () => task({ adapter }));
72
+ try {
73
+ await taskExecution;
74
+ }
75
+ catch (taskError) {
76
+ if (isTimeoutReceived) {
77
+ console.log('Task threw during timeout. Letting timeout handler finish.');
78
+ return;
88
79
  }
89
- // If timeout was requested, the message handler will call process.exit
80
+ throw taskError;
90
81
  }
91
- catch (error) {
92
- console.error('Error while processing task.', (0, logger_1.serializeError)(error));
93
- process.exit(1);
82
+ if (!isTimeoutReceived) {
83
+ console.log('Task completed. Exiting worker.');
84
+ process.exit(0);
94
85
  }
95
- });
96
- })();
97
- }
86
+ }
87
+ catch (error) {
88
+ console.error('Error while processing task.', (0, logger_1.serializeError)(error));
89
+ process.exit(1);
90
+ }
91
+ });
92
+ })();
98
93
  }
@@ -15,6 +15,7 @@ export declare function spawn<ConnectorState>({ event, initialState, workerPath,
15
15
  export declare class Spawn {
16
16
  private event;
17
17
  private alreadyEmitted;
18
+ private softTimeoutSent;
18
19
  private defaultLambdaTimeout;
19
20
  private lambdaTimeout;
20
21
  private softTimeoutTimer;
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/multithreading/spawn/spawn.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,qBAAqB,CAAC;AA+C7B;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,MAAM,CAAS;gBACX,EACV,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,eAAe,GAChB,EAAE,cAAc;IAiGjB,OAAO,CAAC,aAAa;YAYP,kBAAkB;CAiCjC"}
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/multithreading/spawn/spawn.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,qBAAqB,CAAC;AA+C7B;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,MAAM,CAAS;gBACX,EACV,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,eAAe,GAChB,EAAE,cAAc;IA4GjB,OAAO,CAAC,aAAa;YAYP,kBAAkB;CAiCjC"}
@@ -137,6 +137,7 @@ class Spawn {
137
137
  this.originalConsole = originalConsole || console;
138
138
  this.logger = console;
139
139
  this.alreadyEmitted = false;
140
+ this.softTimeoutSent = false;
140
141
  this.event = event;
141
142
  this.lambdaTimeout = (options === null || options === void 0 ? void 0 : options.timeout)
142
143
  ? Math.min(options.timeout, this.defaultLambdaTimeout)
@@ -145,6 +146,7 @@ class Spawn {
145
146
  // If soft timeout is reached, send a message to the worker to gracefully exit.
146
147
  this.softTimeoutTimer = setTimeout(() => void (async () => {
147
148
  console.log('SOFT TIMEOUT: Sending a message to the worker to gracefully exit.');
149
+ this.softTimeoutSent = true;
148
150
  if (worker) {
149
151
  worker.postMessage({
150
152
  subject: workers_1.WorkerMessageSubject.WorkerMessageExit,
@@ -167,12 +169,25 @@ class Spawn {
167
169
  }
168
170
  })(), this.lambdaTimeout * constants_1.HARD_TIMEOUT_MULTIPLIER);
169
171
  // If worker exits with process.exit(code), clear the timeouts and exit from
170
- // main thread.
171
- worker.on(workers_1.WorkerEvent.WorkerExit, (code) => void (async () => {
172
- console.info('Worker exited with exit code: ' + code + '.');
173
- this.clearTimeouts();
174
- await this.exitFromMainThread();
175
- })());
172
+ // main thread. When a soft timeout was sent, we use setImmediate to defer
173
+ // processing so that any pending WorkerMessage events (e.g.
174
+ // WorkerMessageEmitted from onTimeout) already queued in the event loop are
175
+ // handled first, preventing a race condition where exitFromMainThread sees
176
+ // alreadyEmitted=false and emits an error even though the worker
177
+ // successfully emitted an event.
178
+ worker.on(workers_1.WorkerEvent.WorkerExit, (code) => {
179
+ const handler = async () => {
180
+ console.info('Worker exited with exit code: ' + code + '.');
181
+ this.clearTimeouts();
182
+ await this.exitFromMainThread();
183
+ };
184
+ if (this.softTimeoutSent) {
185
+ void setImmediate(() => void handler());
186
+ }
187
+ else {
188
+ void handler();
189
+ }
190
+ });
176
191
  worker.on(workers_1.WorkerEvent.WorkerMessage, (message) => {
177
192
  var _a, _b, _c, _d;
178
193
  // Since logs from the worker thread are handled differently in snap-in
@@ -0,0 +1,319 @@
1
+ /**
2
+ * Schema version for the external domain metadata format.
3
+ */
4
+ export type SchemaVersion = 'v0.2.0';
5
+ /** Key identifying a record type in the record_types map, refers_to maps, or type_keys arrays. */
6
+ export type RecordTypeKey = string;
7
+ /** Key identifying a field within a record type or struct type fields map. */
8
+ export type FieldKey = string;
9
+ /** Key identifying an enum value in EnumValue.key or stage diagram stages map keys. */
10
+ export type EnumValueKey = string;
11
+ /** Key identifying a struct type in the struct_types map. */
12
+ export type StructTypeKey = string;
13
+ /** Key identifying a record type category in the record_type_categories map. */
14
+ export type RecordTypeCategoryKey = string;
15
+ /** Key identifying a state in the stage diagram states map. */
16
+ export type StateKey = string;
17
+ /** Key identifying a stage in the stage diagram stages map. */
18
+ export type StageKey = string;
19
+ /**
20
+ * Field type discriminator.
21
+ */
22
+ export type FieldType = 'bool' | 'int' | 'float' | 'text' | 'rich_text' | 'reference' | 'typed_reference' | 'enum' | 'date' | 'timestamp' | 'struct' | 'permission' | 'record_type_privilege' | 'field_privilege' | 'conditional_privilege';
23
+ /**
24
+ * Reference type indicating parent-child relationship.
25
+ */
26
+ export type ReferenceType = 'child' | 'parent';
27
+ /**
28
+ * Comparator for field conditions.
29
+ */
30
+ export type FieldConditionComparator = 'eq' | 'ne';
31
+ /**
32
+ * Effect applied when a field condition is met.
33
+ */
34
+ export type FieldConditionEffect = 'require' | 'show';
35
+ /**
36
+ * Scope of a record type.
37
+ */
38
+ export type RecordTypeScope = 'metadata_is_system_scoped' | 'data_is_system_scoped';
39
+ /**
40
+ * Collection constraints for fields that are collections of values.
41
+ */
42
+ export interface CollectionData {
43
+ min_length?: number;
44
+ max_length?: number;
45
+ }
46
+ /**
47
+ * Integer field constraints.
48
+ */
49
+ export interface IntData {
50
+ min?: number;
51
+ max?: number;
52
+ }
53
+ /**
54
+ * Float field constraints.
55
+ */
56
+ export interface FloatData {
57
+ min?: number;
58
+ max?: number;
59
+ }
60
+ /**
61
+ * Text field constraints.
62
+ */
63
+ export interface TextData {
64
+ min_length?: number;
65
+ max_length?: number;
66
+ }
67
+ /**
68
+ * Enum value definition.
69
+ */
70
+ export interface EnumValue {
71
+ /** The enum value that actually occurs in the json data */
72
+ key: EnumValueKey;
73
+ /** The human readable name of the enum value */
74
+ name?: string;
75
+ description?: string;
76
+ /** Deprecated enum values may still occur in the data, but should not be used in new data */
77
+ is_deprecated?: boolean;
78
+ }
79
+ /**
80
+ * Enum field data containing possible values.
81
+ */
82
+ export interface EnumData {
83
+ values: EnumValue[];
84
+ }
85
+ /**
86
+ * Details about how a reference targets another record type.
87
+ */
88
+ export interface ReferenceDetail {
89
+ /** The field in the target record type by which it is referenced. Assumed to be the primary key if not set. */
90
+ by_field?: FieldKey;
91
+ }
92
+ /**
93
+ * Reference field data specifying target record types.
94
+ */
95
+ export interface ReferenceData {
96
+ /** The record types that this reference can refer to */
97
+ refers_to: Record<RecordTypeKey, ReferenceDetail>;
98
+ /** The parent reference refers to a record that has special ownership over the child */
99
+ reference_type?: ReferenceType;
100
+ }
101
+ /**
102
+ * Typed reference field data specifying target record types.
103
+ */
104
+ export interface TypedReferenceData {
105
+ /** The record types that this reference can refer to */
106
+ refers_to: Record<RecordTypeKey, ReferenceDetail>;
107
+ /** The parent reference refers to a record that has special ownership over the child */
108
+ reference_type?: ReferenceType;
109
+ }
110
+ /**
111
+ * Struct field data referencing a struct type.
112
+ */
113
+ export interface StructData {
114
+ key?: StructTypeKey;
115
+ }
116
+ /**
117
+ * Permission data associating a reference with a role.
118
+ */
119
+ export interface PermissionData {
120
+ member_id?: ReferenceData;
121
+ role?: EnumData;
122
+ }
123
+ /**
124
+ * Conditional privilege data for authorization.
125
+ */
126
+ export interface ConditionalPrivilegeData {
127
+ /** The possible record types or record type categories that can be targeted in conditional privilege. */
128
+ type_keys: RecordTypeKey[];
129
+ }
130
+ /**
131
+ * Field privilege data for authorization.
132
+ */
133
+ export interface FieldPrivilegeData {
134
+ /** The possible record types or record type categories that can be targeted in field privilege. */
135
+ type_keys: RecordTypeKey[];
136
+ }
137
+ /**
138
+ * Record type privilege data for authorization.
139
+ */
140
+ export interface RecordTypePrivilegeData {
141
+ /** The possible record types or record type categories that can be targeted in record type privilege. */
142
+ type_keys: RecordTypeKey[];
143
+ }
144
+ /**
145
+ * Target type key data for authorization policy.
146
+ */
147
+ export interface TargetTypeKeyData {
148
+ /** The possible record types or record type categories that can be targeted in authorization policy. */
149
+ type_keys: RecordTypeKey[];
150
+ }
151
+ /**
152
+ * Field reference data (currently empty, reserved for future use).
153
+ */
154
+ export interface FieldReferenceData {
155
+ [key: string]: never;
156
+ }
157
+ /**
158
+ * Field definition with type discriminator and type-specific data.
159
+ */
160
+ export interface Field {
161
+ /** The type of the field */
162
+ type: FieldType;
163
+ /** The human readable name of the field */
164
+ name?: string;
165
+ description?: string;
166
+ /** Required fields are required in the domain model of the external system. */
167
+ is_required?: boolean;
168
+ /** Read only fields can't be set (when creating or updating a record), but are filled in by some process in the system. */
169
+ is_read_only?: boolean | null;
170
+ /** Fields that are write only should only be written to. */
171
+ is_write_only?: boolean | null;
172
+ /** Indexed fields can be used for searching, sorting or filtering. */
173
+ is_indexed?: boolean | null;
174
+ /** Indicates that the field can be used to uniquely lookup a record. */
175
+ is_identifier?: boolean | null;
176
+ /** Default value for the field */
177
+ default_value?: boolean | number | string;
178
+ /** If collection is set, the field is a 'collection' of the given type. */
179
+ collection?: CollectionData;
180
+ int?: IntData;
181
+ float?: FloatData;
182
+ text?: TextData;
183
+ enum?: EnumData | null;
184
+ reference?: ReferenceData;
185
+ typed_reference?: TypedReferenceData;
186
+ struct?: StructData;
187
+ permission?: PermissionData;
188
+ type_key?: TargetTypeKeyData;
189
+ field_reference?: FieldReferenceData;
190
+ record_type_privilege?: RecordTypePrivilegeData;
191
+ field_privilege?: FieldPrivilegeData;
192
+ conditional_privilege?: ConditionalPrivilegeData;
193
+ }
194
+ /**
195
+ * Field condition definition.
196
+ */
197
+ export interface FieldCondition {
198
+ /** The value of the controlling field that will be compared against to see if the condition is met. */
199
+ value: unknown;
200
+ /** The comparator that will be used to compare the controlling field's value against the Value. */
201
+ comparator: FieldConditionComparator;
202
+ /** The fields that will be affected by the condition being met. */
203
+ affected_fields: FieldKey[];
204
+ /** The effect that will be applied to the affected fields if the condition is met. */
205
+ effect: FieldConditionEffect;
206
+ }
207
+ /**
208
+ * Array of field conditions.
209
+ */
210
+ export type FieldConditions = FieldCondition[];
211
+ /**
212
+ * Custom link names for forward and backward directions.
213
+ */
214
+ export interface CustomLinkNames {
215
+ /** The forward name of the link */
216
+ forward_name: string;
217
+ /** The backward name of the link */
218
+ backward_name: string;
219
+ }
220
+ /**
221
+ * Custom link data for defining link types.
222
+ */
223
+ export interface CustomLinkData {
224
+ /** The field that defines the link types in the system. */
225
+ link_type_field: FieldKey;
226
+ link_direction_names: Record<string, CustomLinkNames> | null;
227
+ }
228
+ /**
229
+ * Custom stage definition in a stage diagram.
230
+ */
231
+ export interface CustomStage {
232
+ /** The state this stage belongs to. Must match the ones defined in the diagram 'states' field or be one of the default options: 'open', 'in_progress', 'closed'. */
233
+ state?: StateKey;
234
+ /** A list of stage names that this stage can transition to. */
235
+ transitions_to?: StageKey[];
236
+ }
237
+ /**
238
+ * Custom state definition in a stage diagram.
239
+ */
240
+ export interface CustomState {
241
+ /** The human readable name of the custom state. */
242
+ name: string;
243
+ /** Denotes that this state is an end state. */
244
+ is_end_state?: boolean;
245
+ /** The sort order of the state. */
246
+ ordinal?: number;
247
+ }
248
+ /**
249
+ * Stage diagram definition for record type workflow.
250
+ */
251
+ export interface StageDiagram {
252
+ /** The field that represents the stage in the external system. */
253
+ controlling_field: FieldKey;
254
+ /** A map of the stages that should be created. Keys must match the enum values in the controlling field. */
255
+ stages: Record<StageKey, CustomStage>;
256
+ /** The stage that the parent record type starts in when it is created. */
257
+ starting_stage?: StageKey;
258
+ /** A map of the states/status categories that should be created. */
259
+ states?: Record<StateKey, CustomState>;
260
+ /** Denotes that this diagram has no explicit transitions and should be created as an 'all-to-all' diagram. */
261
+ all_transitions_allowed?: boolean;
262
+ }
263
+ /**
264
+ * Record type category definition.
265
+ */
266
+ export interface RecordTypeCategory {
267
+ /** The human readable name of the record type category */
268
+ name?: string;
269
+ /** Indicates whether a record can move between the record types of this category while preserving its identity */
270
+ are_record_type_conversions_possible?: boolean;
271
+ }
272
+ /**
273
+ * Record type definition.
274
+ */
275
+ export interface RecordType {
276
+ /** The fields of the record type */
277
+ fields: Record<FieldKey, Field>;
278
+ /** The human readable name of the record type */
279
+ name?: string;
280
+ description?: string;
281
+ category?: RecordTypeCategoryKey;
282
+ /** Whether the record type can be loaded (connector supports creating it in the system) */
283
+ is_loadable?: boolean;
284
+ /** Whether the record type sends the complete system state in every sync */
285
+ is_snapshot?: boolean;
286
+ /** Denotes that the record type has no ID field, primarily used for authorization policies */
287
+ no_identifier?: boolean;
288
+ /** Indicates the scope of this record type */
289
+ scope?: RecordTypeScope;
290
+ /** Field conditions for this record type */
291
+ conditions?: Record<FieldKey, FieldConditions>;
292
+ /** Stage diagram for workflow */
293
+ stage_diagram?: StageDiagram;
294
+ /** Link naming data for custom links */
295
+ link_naming_data?: CustomLinkData;
296
+ }
297
+ /**
298
+ * Struct type definition for reusable field structures.
299
+ */
300
+ export interface StructType {
301
+ /** The fields of the struct type */
302
+ fields: Record<FieldKey, Field>;
303
+ /** The human readable name of the struct type */
304
+ name?: string;
305
+ }
306
+ /**
307
+ * External domain metadata describing the logical structure of an external system.
308
+ */
309
+ export interface ExternalDomainMetadata {
310
+ /** The record types in the domain */
311
+ record_types: Record<RecordTypeKey, RecordType>;
312
+ /** Record type categories */
313
+ record_type_categories?: Record<RecordTypeCategoryKey, RecordTypeCategory>;
314
+ /** Struct types for reusable field structures */
315
+ struct_types?: Record<StructTypeKey, StructType>;
316
+ /** The schema version of the metadata format itself. */
317
+ schema_version?: SchemaVersion;
318
+ }
319
+ //# sourceMappingURL=external-domain-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-domain-metadata.d.ts","sourceRoot":"","sources":["../../src/types/external-domain-metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,G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H,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IAChD,6BAA6B;IAC7B,sBAAsB,CAAC,EAAE,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAC;IAC3E,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACjD,wDAAwD;IACxD,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,4 +6,5 @@ export { AdapterState } from '../state/state.interfaces';
6
6
  export { Artifact, ArtifactsPrepareResponse, SsorAttachment, StreamAttachmentsResponse, StreamResponse, UploadResponse, } from '../uploader/uploader.interfaces';
7
7
  export type { MappersCreateParams, MappersGetByExternalIdParams, MappersGetByTargetIdParams, MappersUpdateParams, } from '../mappers/mappers.interface';
8
8
  export { SyncMapperRecordStatus, SyncMapperRecordTargetType, } from '../mappers/mappers.interface';
9
+ export type { CollectionData, ConditionalPrivilegeData, CustomLinkData, CustomLinkNames, CustomStage, CustomState, EnumData, EnumValue, EnumValueKey, ExternalDomainMetadata, Field, FieldCondition, FieldConditionComparator, FieldConditionEffect, FieldConditions, FieldKey, FieldPrivilegeData, FieldReferenceData, FieldType, FloatData, IntData, PermissionData, RecordType, RecordTypeCategory, RecordTypeCategoryKey, RecordTypeKey, RecordTypePrivilegeData, RecordTypeScope, ReferenceData, ReferenceDetail, ReferenceType, SchemaVersion, StageKey, StageDiagram, StateKey, StructData, StructTypeKey, StructType, TargetTypeKeyData, TextData, TypedReferenceData, } from './external-domain-metadata';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,QAAQ,GACT,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,SAAS,EACT,SAAS,EACT,iCAAiC,EACjC,gBAAgB,EAChB,wCAAwC,EACxC,uCAAuC,EACvC,yCAAyC,EACzC,uCAAuC,EACvC,yCAAyC,EACzC,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,+BAA+B,EAC/B,iCAAiC,EACjC,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,aAAa,GACd,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EACL,QAAQ,EACR,wBAAwB,EACxB,cAAc,EACd,yBAAyB,EACzB,cAAc,EACd,cAAc,GACf,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EACV,mBAAmB,EACnB,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,QAAQ,GACT,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,SAAS,EACT,SAAS,EACT,iCAAiC,EACjC,gBAAgB,EAChB,wCAAwC,EACxC,uCAAuC,EACvC,yCAAyC,EACzC,uCAAuC,EACvC,yCAAyC,EACzC,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,+BAA+B,EAC/B,iCAAiC,EACjC,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,aAAa,GACd,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EACL,QAAQ,EACR,wBAAwB,EACxB,cAAc,EACd,yBAAyB,EACzB,cAAc,EACd,cAAc,GACf,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EACV,mBAAmB,EACnB,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AAGtC,YAAY,EACV,cAAc,EACd,wBAAwB,EACxB,cAAc,EACd,eAAe,EACf,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,sBAAsB,EACtB,KAAK,EACL,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,OAAO,EACP,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,GACnB,MAAM,4BAA4B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrev/ts-adaas",
3
- "version": "1.15.3-beta.1",
3
+ "version": "1.15.3-beta.3",
4
4
  "description": "Typescript library containing the ADaaS(AirDrop as a Service) control protocol.",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "url": "git+https://github.com/devrev/adaas-sdk.git"
23
23
  },
24
24
  "publishConfig": {
25
- "registry": "https://npm.pkg.github.com"
25
+ "registry": "https://registry.npmjs.org"
26
26
  },
27
27
  "keywords": [],
28
28
  "author": "devrev",
@@ -36,6 +36,7 @@
36
36
  "@types/yargs": "^17.0.33",
37
37
  "@typescript-eslint/eslint-plugin": "^8.46.0",
38
38
  "@typescript-eslint/parser": "^8.46.0",
39
+ "ajv": "^8.18.0",
39
40
  "eslint": "9.32.0",
40
41
  "eslint-config-prettier": "^9.1.2",
41
42
  "eslint-plugin-prettier": "4.0.0",