@finos/legend-extension-dsl-persistence 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/lib/index.css +1 -1
  2. package/lib/index.d.ts +2 -0
  3. package/lib/index.d.ts.map +1 -1
  4. package/lib/index.js +6 -0
  5. package/lib/index.js.map +1 -1
  6. package/lib/models/DSLPersistence_ModelUtils.d.ts +2 -0
  7. package/lib/models/DSLPersistence_ModelUtils.d.ts.map +1 -1
  8. package/lib/models/DSLPersistence_ModelUtils.js +3 -0
  9. package/lib/models/DSLPersistence_ModelUtils.js.map +1 -1
  10. package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Milestoning.d.ts +14 -0
  11. package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Milestoning.d.ts.map +1 -1
  12. package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Milestoning.js +27 -0
  13. package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Milestoning.js.map +1 -1
  14. package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Milestoning.d.ts +14 -0
  15. package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Milestoning.d.ts.map +1 -1
  16. package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Milestoning.js +27 -0
  17. package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Milestoning.js.map +1 -1
  18. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.d.ts +19 -0
  19. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.d.ts.map +1 -0
  20. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.js +18 -0
  21. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.js.map +1 -0
  22. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.d.ts +6 -2
  23. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.d.ts.map +1 -1
  24. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.js +25 -2
  25. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.js.map +1 -1
  26. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.d.ts +6 -2
  27. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.d.ts.map +1 -1
  28. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.js +25 -2
  29. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.js.map +1 -1
  30. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.d.ts +37 -0
  31. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.d.ts.map +1 -1
  32. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.js +63 -25
  33. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.js.map +1 -1
  34. package/lib/package.json +5 -5
  35. package/package.json +12 -12
  36. package/src/index.ts +11 -0
  37. package/src/models/DSLPersistence_ModelUtils.ts +4 -0
  38. package/src/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Milestoning.ts +40 -0
  39. package/src/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Milestoning.ts +40 -0
  40. package/src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.ts +30 -0
  41. package/src/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.ts +41 -0
  42. package/src/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.ts +42 -0
  43. package/src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.ts +100 -24
  44. package/tsconfig.json +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-extension-dsl-persistence",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Legend extension for Persistence DSL",
5
5
  "keywords": [
6
6
  "legend",
@@ -43,27 +43,27 @@
43
43
  "test:watch": "jest --watch"
44
44
  },
45
45
  "dependencies": {
46
- "@finos/legend-application": "4.0.0",
47
- "@finos/legend-art": "2.0.0",
48
- "@finos/legend-graph": "8.0.0",
49
- "@finos/legend-model-storage": "2.0.0",
50
- "@finos/legend-shared": "3.0.0",
51
- "@finos/legend-studio": "10.0.0",
52
- "@types/react": "18.0.12",
46
+ "@finos/legend-application": "4.0.1",
47
+ "@finos/legend-art": "2.0.1",
48
+ "@finos/legend-graph": "8.0.1",
49
+ "@finos/legend-model-storage": "2.0.1",
50
+ "@finos/legend-shared": "3.0.1",
51
+ "@finos/legend-studio": "10.1.0",
52
+ "@types/react": "18.0.14",
53
53
  "mobx": "6.6.0",
54
- "react": "18.1.0",
54
+ "react": "18.2.0",
55
55
  "serializr": "2.0.5"
56
56
  },
57
57
  "devDependencies": {
58
- "@finos/legend-dev-utils": "2.0.0",
58
+ "@finos/legend-dev-utils": "2.0.1",
59
59
  "@jest/globals": "28.1.1",
60
60
  "cross-env": "7.0.3",
61
- "eslint": "8.17.0",
61
+ "eslint": "8.18.0",
62
62
  "jest": "28.1.1",
63
63
  "npm-run-all": "4.1.5",
64
64
  "rimraf": "3.0.2",
65
65
  "sass": "1.52.3",
66
- "typescript": "4.7.3"
66
+ "typescript": "4.7.4"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "react": "^18.0.0"
package/src/index.ts CHANGED
@@ -16,5 +16,16 @@
16
16
 
17
17
  export * from './DSLPersistence_Extension.js';
18
18
  export { DSLPersistence_LegendStudioPlugin } from './components/studio/DSLPersistence_LegendStudioPlugin.js';
19
+
20
+ // ---------- PACKAGEABLE ELEMENT ----------
21
+
22
+ // metamodels
19
23
  export { Persistence } from './models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Persistence.js';
24
+
25
+ // v1 protocols
20
26
  export { V1_Persistence } from './models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Persistence.js';
27
+
28
+ // ---------- TRANSFORMATION ----------
29
+
30
+ export { V1_transformPersistence } from './models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.js';
31
+ export { V1_buildPersistence } from './models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.js';
@@ -67,6 +67,10 @@ export enum PERSISTENCE_HASH_STRUCTURE {
67
67
  DATE_TIME_TRANSACTION_MILESTONING = 'DATE_TIME_TRANSACTION_MILESTONING',
68
68
  BATCH_ID_AND_DATE_TIME_TRANSACTION_MILESTONING = 'BATCH_ID_AND_DATE_TIME_TRANSACTION_MILESTONING',
69
69
 
70
+ // transaction derivation
71
+ SOURCE_SPECIFIES_IN_DATE_TIME = 'SOURCE_SPECIFIES_IN_DATE_TIME',
72
+ SOURCE_SPECIFIES_IN_AND_OUT_DATE_TIME = 'SOURCE_SPECIFIES_IN_AND_OUT_DATE_TIME',
73
+
70
74
  // validity milestoning
71
75
  DATE_TIME_VALIDITY_MILESTONING = 'DATE_TIME_VALIDITY_MILESTONING',
72
76
 
@@ -45,12 +45,14 @@ export class DateTimeTransactionMilestoning
45
45
  {
46
46
  dateTimeInName!: string;
47
47
  dateTimeOutName!: string;
48
+ derivation?: TransactionDerivation;
48
49
 
49
50
  override get hashCode(): string {
50
51
  return hashArray([
51
52
  PERSISTENCE_HASH_STRUCTURE.DATE_TIME_TRANSACTION_MILESTONING,
52
53
  this.dateTimeInName,
53
54
  this.dateTimeOutName,
55
+ this.derivation ?? '',
54
56
  ]);
55
57
  }
56
58
  }
@@ -63,6 +65,7 @@ export class BatchIdAndDateTimeTransactionMilestoning
63
65
  batchIdOutName!: string;
64
66
  dateTimeInName!: string;
65
67
  dateTimeOutName!: string;
68
+ derivation?: TransactionDerivation;
66
69
 
67
70
  override get hashCode(): string {
68
71
  return hashArray([
@@ -71,6 +74,43 @@ export class BatchIdAndDateTimeTransactionMilestoning
71
74
  this.batchIdOutName,
72
75
  this.dateTimeInName,
73
76
  this.dateTimeOutName,
77
+ this.derivation ?? '',
78
+ ]);
79
+ }
80
+ }
81
+
82
+ // transaction derivation
83
+
84
+ export abstract class TransactionDerivation implements Hashable {
85
+ abstract get hashCode(): string;
86
+ }
87
+
88
+ export class SourceSpecifiesInDateTime
89
+ extends TransactionDerivation
90
+ implements Hashable
91
+ {
92
+ sourceDateTimeInField!: string;
93
+
94
+ override get hashCode(): string {
95
+ return hashArray([
96
+ PERSISTENCE_HASH_STRUCTURE.SOURCE_SPECIFIES_IN_DATE_TIME,
97
+ this.sourceDateTimeInField,
98
+ ]);
99
+ }
100
+ }
101
+
102
+ export class SourceSpecifiesInAndOutDateTime
103
+ extends TransactionDerivation
104
+ implements Hashable
105
+ {
106
+ sourceDateTimeInField!: string;
107
+ sourceDateTimeOutField!: string;
108
+
109
+ override get hashCode(): string {
110
+ return hashArray([
111
+ PERSISTENCE_HASH_STRUCTURE.SOURCE_SPECIFIES_IN_AND_OUT_DATE_TIME,
112
+ this.sourceDateTimeInField,
113
+ this.sourceDateTimeOutField,
74
114
  ]);
75
115
  }
76
116
  }
@@ -45,12 +45,14 @@ export class V1_DateTimeTransactionMilestoning
45
45
  {
46
46
  dateTimeInName!: string;
47
47
  dateTimeOutName!: string;
48
+ derivation?: V1_TransactionDerivation;
48
49
 
49
50
  override get hashCode(): string {
50
51
  return hashArray([
51
52
  PERSISTENCE_HASH_STRUCTURE.DATE_TIME_TRANSACTION_MILESTONING,
52
53
  this.dateTimeInName,
53
54
  this.dateTimeOutName,
55
+ this.derivation ?? '',
54
56
  ]);
55
57
  }
56
58
  }
@@ -63,6 +65,7 @@ export class V1_BatchIdAndDateTimeTransactionMilestoning
63
65
  batchIdOutName!: string;
64
66
  dateTimeInName!: string;
65
67
  dateTimeOutName!: string;
68
+ derivation?: V1_TransactionDerivation;
66
69
 
67
70
  override get hashCode(): string {
68
71
  return hashArray([
@@ -71,6 +74,43 @@ export class V1_BatchIdAndDateTimeTransactionMilestoning
71
74
  this.batchIdOutName,
72
75
  this.dateTimeInName,
73
76
  this.dateTimeOutName,
77
+ this.derivation ?? '',
78
+ ]);
79
+ }
80
+ }
81
+
82
+ // transaction derivation
83
+
84
+ export abstract class V1_TransactionDerivation implements Hashable {
85
+ abstract get hashCode(): string;
86
+ }
87
+
88
+ export class V1_SourceSpecifiesInDateTime
89
+ extends V1_TransactionDerivation
90
+ implements Hashable
91
+ {
92
+ sourceDateTimeInField!: string;
93
+
94
+ override get hashCode(): string {
95
+ return hashArray([
96
+ PERSISTENCE_HASH_STRUCTURE.SOURCE_SPECIFIES_IN_DATE_TIME,
97
+ this.sourceDateTimeInField,
98
+ ]);
99
+ }
100
+ }
101
+
102
+ export class V1_SourceSpecifiesInAndOutDateTime
103
+ extends V1_TransactionDerivation
104
+ implements Hashable
105
+ {
106
+ sourceDateTimeInField!: string;
107
+ sourceDateTimeOutField!: string;
108
+
109
+ override get hashCode(): string {
110
+ return hashArray([
111
+ PERSISTENCE_HASH_STRUCTURE.SOURCE_SPECIFIES_IN_AND_OUT_DATE_TIME,
112
+ this.sourceDateTimeInField,
113
+ this.sourceDateTimeOutField,
74
114
  ]);
75
115
  }
76
116
  }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import type { Persistence } from '../../../../../metamodels/pure/model/packageableElements/persistence/DSLPersistence_Persistence.js';
18
+ import { getPersistence } from '../../../../../../graphManager/DSLPersistence_GraphManagerHelper.js';
19
+ import type {
20
+ PackageableElementImplicitReference,
21
+ V1_GraphBuilderContext,
22
+ } from '@finos/legend-graph';
23
+
24
+ export const V1_resolvePersistence = (
25
+ path: string,
26
+ context: V1_GraphBuilderContext,
27
+ ): PackageableElementImplicitReference<Persistence> =>
28
+ context.createImplicitPackageableElementReference(path, (_path: string) =>
29
+ getPersistence(_path, context.graph),
30
+ );
@@ -48,6 +48,9 @@ import {
48
48
  DateTimeValidityMilestoning,
49
49
  SourceSpecifiesFromAndThruDateTime,
50
50
  SourceSpecifiesFromDateTime,
51
+ SourceSpecifiesInAndOutDateTime,
52
+ SourceSpecifiesInDateTime,
53
+ type TransactionDerivation,
51
54
  type TransactionMilestoning,
52
55
  type ValidityDerivation,
53
56
  type ValidityMilestoning,
@@ -115,6 +118,9 @@ import {
115
118
  V1_DateTimeValidityMilestoning,
116
119
  V1_SourceSpecifiesFromAndThruDateTime,
117
120
  V1_SourceSpecifiesFromDateTime,
121
+ V1_SourceSpecifiesInAndOutDateTime,
122
+ V1_SourceSpecifiesInDateTime,
123
+ type V1_TransactionDerivation,
118
124
  type V1_TransactionMilestoning,
119
125
  type V1_ValidityDerivation,
120
126
  type V1_ValidityMilestoning,
@@ -262,6 +268,29 @@ export const V1_transformMergeStrategy = (
262
268
  );
263
269
  };
264
270
 
271
+ /**********
272
+ * transaction derivation
273
+ **********/
274
+
275
+ export const V1_transformTransactionDerivation = (
276
+ element: TransactionDerivation,
277
+ context: V1_GraphTransformerContext,
278
+ ): V1_TransactionDerivation => {
279
+ if (element instanceof SourceSpecifiesInDateTime) {
280
+ const protocol = new V1_SourceSpecifiesInDateTime();
281
+ protocol.sourceDateTimeInField = element.sourceDateTimeInField;
282
+ return protocol;
283
+ } else if (element instanceof SourceSpecifiesInAndOutDateTime) {
284
+ const protocol = new V1_SourceSpecifiesInAndOutDateTime();
285
+ protocol.sourceDateTimeInField = element.sourceDateTimeInField;
286
+ protocol.sourceDateTimeOutField = element.sourceDateTimeOutField;
287
+ return protocol;
288
+ }
289
+ throw new UnsupportedOperationError(
290
+ `Can't transform transaction derivation '${element}'`,
291
+ );
292
+ };
293
+
265
294
  /**********
266
295
  * transaction milestoning
267
296
  **********/
@@ -279,6 +308,12 @@ export const V1_transformTransactionMilestoning = (
279
308
  const protocol = new V1_DateTimeTransactionMilestoning();
280
309
  protocol.dateTimeInName = element.dateTimeInName;
281
310
  protocol.dateTimeOutName = element.dateTimeOutName;
311
+ if (element.derivation) {
312
+ protocol.derivation = V1_transformTransactionDerivation(
313
+ element.derivation,
314
+ context,
315
+ );
316
+ }
282
317
  return protocol;
283
318
  } else if (element instanceof BatchIdAndDateTimeTransactionMilestoning) {
284
319
  const protocol = new V1_BatchIdAndDateTimeTransactionMilestoning();
@@ -286,6 +321,12 @@ export const V1_transformTransactionMilestoning = (
286
321
  protocol.batchIdOutName = element.batchIdOutName;
287
322
  protocol.dateTimeInName = element.dateTimeInName;
288
323
  protocol.dateTimeOutName = element.dateTimeOutName;
324
+ if (element.derivation) {
325
+ protocol.derivation = V1_transformTransactionDerivation(
326
+ element.derivation,
327
+ context,
328
+ );
329
+ }
289
330
  return protocol;
290
331
  }
291
332
  throw new UnsupportedOperationError(
@@ -48,6 +48,9 @@ import {
48
48
  V1_DateTimeValidityMilestoning,
49
49
  V1_SourceSpecifiesFromAndThruDateTime,
50
50
  V1_SourceSpecifiesFromDateTime,
51
+ V1_SourceSpecifiesInAndOutDateTime,
52
+ V1_SourceSpecifiesInDateTime,
53
+ type V1_TransactionDerivation,
51
54
  type V1_TransactionMilestoning,
52
55
  type V1_ValidityDerivation,
53
56
  type V1_ValidityMilestoning,
@@ -115,6 +118,9 @@ import {
115
118
  DateTimeValidityMilestoning,
116
119
  SourceSpecifiesFromAndThruDateTime,
117
120
  SourceSpecifiesFromDateTime,
121
+ SourceSpecifiesInAndOutDateTime,
122
+ SourceSpecifiesInDateTime,
123
+ type TransactionDerivation,
118
124
  type TransactionMilestoning,
119
125
  type ValidityDerivation,
120
126
  type ValidityMilestoning,
@@ -263,6 +269,30 @@ export const V1_buildMergeStrategy = (
263
269
  throw new UnsupportedOperationError(`Can't build merge strategy`, protocol);
264
270
  };
265
271
 
272
+ /**********
273
+ * transaction derivation
274
+ **********/
275
+
276
+ export const V1_buildTransactionDerivation = (
277
+ protocol: V1_TransactionDerivation,
278
+ context: V1_GraphBuilderContext,
279
+ ): TransactionDerivation => {
280
+ if (protocol instanceof V1_SourceSpecifiesInDateTime) {
281
+ const derivation = new SourceSpecifiesInDateTime();
282
+ derivation.sourceDateTimeInField = protocol.sourceDateTimeInField;
283
+ return derivation;
284
+ } else if (protocol instanceof V1_SourceSpecifiesInAndOutDateTime) {
285
+ const derivation = new SourceSpecifiesInAndOutDateTime();
286
+ derivation.sourceDateTimeInField = protocol.sourceDateTimeInField;
287
+ derivation.sourceDateTimeOutField = protocol.sourceDateTimeOutField;
288
+ return derivation;
289
+ }
290
+ throw new UnsupportedOperationError(
291
+ `Can't build transaction derivation mode`,
292
+ protocol,
293
+ );
294
+ };
295
+
266
296
  /**********
267
297
  * transaction milestoning
268
298
  **********/
@@ -280,6 +310,12 @@ export const V1_buildTransactionMilestoning = (
280
310
  const milestoning = new DateTimeTransactionMilestoning();
281
311
  milestoning.dateTimeInName = protocol.dateTimeInName;
282
312
  milestoning.dateTimeOutName = protocol.dateTimeOutName;
313
+ if (protocol.derivation) {
314
+ milestoning.derivation = V1_buildTransactionDerivation(
315
+ protocol.derivation,
316
+ context,
317
+ );
318
+ }
283
319
  return milestoning;
284
320
  } else if (protocol instanceof V1_BatchIdAndDateTimeTransactionMilestoning) {
285
321
  const milestoning = new BatchIdAndDateTimeTransactionMilestoning();
@@ -287,6 +323,12 @@ export const V1_buildTransactionMilestoning = (
287
323
  milestoning.batchIdOutName = protocol.batchIdOutName;
288
324
  milestoning.dateTimeInName = protocol.dateTimeInName;
289
325
  milestoning.dateTimeOutName = protocol.dateTimeOutName;
326
+ if (protocol.derivation) {
327
+ milestoning.derivation = V1_buildTransactionDerivation(
328
+ protocol.derivation,
329
+ context,
330
+ );
331
+ }
290
332
  return milestoning;
291
333
  }
292
334
  throw new UnsupportedOperationError(
@@ -84,6 +84,9 @@ import {
84
84
  V1_DateTimeValidityMilestoning,
85
85
  V1_SourceSpecifiesFromAndThruDateTime,
86
86
  V1_SourceSpecifiesFromDateTime,
87
+ V1_SourceSpecifiesInAndOutDateTime,
88
+ V1_SourceSpecifiesInDateTime,
89
+ type V1_TransactionDerivation,
87
90
  type V1_TransactionMilestoning,
88
91
  type V1_ValidityDerivation,
89
92
  type V1_ValidityMilestoning,
@@ -126,7 +129,7 @@ const V1_pagerDutyNotifyeeModelSchema = createModelSchema(
126
129
  },
127
130
  );
128
131
 
129
- const V1_serializeNotifyee = (
132
+ export const V1_serializeNotifyee = (
130
133
  protocol: V1_Notifyee,
131
134
  ): PlainObject<V1_Notifyee> => {
132
135
  if (protocol instanceof V1_EmailNotifyee) {
@@ -137,7 +140,7 @@ const V1_serializeNotifyee = (
137
140
  throw new UnsupportedOperationError(`Can't serialize notifyee`, protocol);
138
141
  };
139
142
 
140
- const V1_deserializeNotifyee = (
143
+ export const V1_deserializeNotifyee = (
141
144
  json: PlainObject<V1_Notifyee>,
142
145
  ): V1_Notifyee => {
143
146
  switch (json._type) {
@@ -184,7 +187,7 @@ const V1_dateTimeAuditingModelSchema = createModelSchema(V1_DateTimeAuditing, {
184
187
  dateTimeName: primitive(),
185
188
  });
186
189
 
187
- const V1_serializeAuditing = (
190
+ export const V1_serializeAuditing = (
188
191
  protocol: V1_Auditing,
189
192
  ): PlainObject<V1_Auditing> => {
190
193
  if (protocol instanceof V1_NoAuditing) {
@@ -195,7 +198,7 @@ const V1_serializeAuditing = (
195
198
  throw new UnsupportedOperationError(`Can't serialize auditing`, protocol);
196
199
  };
197
200
 
198
- const V1_deserializeAuditing = (
201
+ export const V1_deserializeAuditing = (
199
202
  json: PlainObject<V1_Auditing>,
200
203
  ): V1_Auditing => {
201
204
  switch (json._type) {
@@ -239,7 +242,7 @@ const V1_deleteIndicatorMergeStrategyModelSchema = createModelSchema(
239
242
  },
240
243
  );
241
244
 
242
- const V1_serializeMergeStrategy = (
245
+ export const V1_serializeMergeStrategy = (
243
246
  protocol: V1_MergeStrategy,
244
247
  ): PlainObject<V1_MergeStrategy> => {
245
248
  if (protocol instanceof V1_NoDeletesMergeStrategy) {
@@ -253,7 +256,7 @@ const V1_serializeMergeStrategy = (
253
256
  );
254
257
  };
255
258
 
256
- const V1_deserializeMergeStrategy = (
259
+ export const V1_deserializeMergeStrategy = (
257
260
  json: PlainObject<V1_MergeStrategy>,
258
261
  ): V1_MergeStrategy => {
259
262
  switch (json._type) {
@@ -268,6 +271,65 @@ const V1_deserializeMergeStrategy = (
268
271
  }
269
272
  };
270
273
 
274
+ /**********
275
+ * transaction derivation
276
+ **********/
277
+
278
+ enum V1_TransactionDerivationType {
279
+ SOURCE_SPECIFIES_IN_DATE_TIME = 'sourceSpecifiesInDateTime',
280
+ SOURCE_SPECIFIES_IN_AND_OUT_DATE_TIME = 'sourceSpecifiesInAndOutDateTime',
281
+ }
282
+
283
+ const V1_sourceSpecifiesInDateTimeModelSchema = createModelSchema(
284
+ V1_SourceSpecifiesInDateTime,
285
+ {
286
+ _type: usingConstantValueSchema(
287
+ V1_TransactionDerivationType.SOURCE_SPECIFIES_IN_DATE_TIME,
288
+ ),
289
+ sourceDateTimeInField: primitive(),
290
+ },
291
+ );
292
+
293
+ const V1_sourceSpecifiesInAndOutDateTimeModelSchema = createModelSchema(
294
+ V1_SourceSpecifiesInAndOutDateTime,
295
+ {
296
+ _type: usingConstantValueSchema(
297
+ V1_TransactionDerivationType.SOURCE_SPECIFIES_IN_AND_OUT_DATE_TIME,
298
+ ),
299
+ sourceDateTimeInField: primitive(),
300
+ sourceDateTimeOutField: primitive(),
301
+ },
302
+ );
303
+
304
+ export const V1_serializeTransactionDerivation = (
305
+ protocol: V1_TransactionDerivation,
306
+ ): PlainObject<V1_TransactionDerivation> => {
307
+ if (protocol instanceof V1_SourceSpecifiesInDateTime) {
308
+ return serialize(V1_sourceSpecifiesInDateTimeModelSchema, protocol);
309
+ } else if (protocol instanceof V1_SourceSpecifiesInAndOutDateTime) {
310
+ return serialize(V1_sourceSpecifiesInAndOutDateTimeModelSchema, protocol);
311
+ }
312
+ throw new UnsupportedOperationError(
313
+ `Can't serialize transaction derivation`,
314
+ protocol,
315
+ );
316
+ };
317
+
318
+ export const V1_deserializeTransactionDerivation = (
319
+ json: PlainObject<V1_TransactionDerivation>,
320
+ ): V1_TransactionDerivation => {
321
+ switch (json._type) {
322
+ case V1_TransactionDerivationType.SOURCE_SPECIFIES_IN_DATE_TIME:
323
+ return deserialize(V1_sourceSpecifiesInDateTimeModelSchema, json);
324
+ case V1_TransactionDerivationType.SOURCE_SPECIFIES_IN_AND_OUT_DATE_TIME:
325
+ return deserialize(V1_sourceSpecifiesInAndOutDateTimeModelSchema, json);
326
+ default:
327
+ throw new UnsupportedOperationError(
328
+ `Can't deserialize transaction derivation '${json._type}'`,
329
+ );
330
+ }
331
+ };
332
+
271
333
  /**********
272
334
  * transaction milestoning
273
335
  **********/
@@ -297,6 +359,10 @@ const V1_dateTimeTransactionMilestoningModelSchema = createModelSchema(
297
359
  ),
298
360
  dateTimeInName: primitive(),
299
361
  dateTimeOutName: primitive(),
362
+ derivation: custom(
363
+ (val) => (val ? V1_serializeTransactionDerivation(val) : SKIP),
364
+ (val) => V1_deserializeTransactionDerivation(val),
365
+ ),
300
366
  },
301
367
  );
302
368
 
@@ -309,9 +375,15 @@ const V1_batchIdAndDateTimeTransactionMilestoningModelSchema =
309
375
  batchIdOutName: primitive(),
310
376
  dateTimeInName: primitive(),
311
377
  dateTimeOutName: primitive(),
378
+ derivation: optional(
379
+ custom(
380
+ (val) => (val ? V1_serializeTransactionDerivation(val) : SKIP),
381
+ (val) => V1_deserializeTransactionDerivation(val),
382
+ ),
383
+ ),
312
384
  });
313
385
 
314
- const V1_serializeTransactionMilestoning = (
386
+ export const V1_serializeTransactionMilestoning = (
315
387
  protocol: V1_TransactionMilestoning,
316
388
  ): PlainObject<V1_TransactionMilestoning> => {
317
389
  if (protocol instanceof V1_BatchIdTransactionMilestoning) {
@@ -330,7 +402,7 @@ const V1_serializeTransactionMilestoning = (
330
402
  );
331
403
  };
332
404
 
333
- const V1_deserializeTransactionMilestoning = (
405
+ export const V1_deserializeTransactionMilestoning = (
334
406
  json: PlainObject<V1_TransactionMilestoning>,
335
407
  ): V1_TransactionMilestoning => {
336
408
  switch (json._type) {
@@ -380,7 +452,7 @@ const V1_sourceSpecifiesFromAndThruDateTimeModelSchema = createModelSchema(
380
452
  },
381
453
  );
382
454
 
383
- const V1_serializeValidityDerivation = (
455
+ export const V1_serializeValidityDerivation = (
384
456
  protocol: V1_ValidityDerivation,
385
457
  ): PlainObject<V1_ValidityDerivation> => {
386
458
  if (protocol instanceof V1_SourceSpecifiesFromDateTime) {
@@ -397,7 +469,7 @@ const V1_serializeValidityDerivation = (
397
469
  );
398
470
  };
399
471
 
400
- const V1_deserializeValidityDerivation = (
472
+ export const V1_deserializeValidityDerivation = (
401
473
  json: PlainObject<V1_ValidityDerivation>,
402
474
  ): V1_ValidityDerivation => {
403
475
  switch (json._type) {
@@ -438,7 +510,7 @@ const V1_dateTimeValidityMilestoningModelSchema = createModelSchema(
438
510
  },
439
511
  );
440
512
 
441
- const V1_serializeValidityMilestoning = (
513
+ export const V1_serializeValidityMilestoning = (
442
514
  protocol: V1_ValidityMilestoning,
443
515
  ): PlainObject<V1_ValidityMilestoning> => {
444
516
  if (protocol instanceof V1_DateTimeValidityMilestoning) {
@@ -450,7 +522,7 @@ const V1_serializeValidityMilestoning = (
450
522
  );
451
523
  };
452
524
 
453
- const V1_deserializeValidityMilestoning = (
525
+ export const V1_deserializeValidityMilestoning = (
454
526
  json: PlainObject<V1_ValidityMilestoning>,
455
527
  ): V1_ValidityMilestoning => {
456
528
  switch (json._type) {
@@ -563,7 +635,7 @@ const V1_appendOnlyModelSchema = createModelSchema(V1_AppendOnly, {
563
635
  filterDuplicates: primitive(),
564
636
  });
565
637
 
566
- const V1_serializeIngestMode = (
638
+ export const V1_serializeIngestMode = (
567
639
  protocol: V1_IngestMode,
568
640
  ): PlainObject<V1_IngestMode> => {
569
641
  if (protocol instanceof V1_NontemporalSnapshot) {
@@ -584,7 +656,7 @@ const V1_serializeIngestMode = (
584
656
  throw new UnsupportedOperationError(`Can't serialize ingest mode`, protocol);
585
657
  };
586
658
 
587
- const V1_deserializeIngestMode = (
659
+ export const V1_deserializeIngestMode = (
588
660
  json: PlainObject<V1_IngestMode>,
589
661
  ): V1_IngestMode => {
590
662
  switch (json._type) {
@@ -641,7 +713,7 @@ const V1_objectStorageSinkModelSchema = (
641
713
  ),
642
714
  });
643
715
 
644
- const V1_serializeSink = (
716
+ export const V1_serializeSink = (
645
717
  protocol: V1_Sink,
646
718
  plugins: PureProtocolProcessorPlugin[],
647
719
  ): PlainObject<V1_Sink> => {
@@ -653,7 +725,7 @@ const V1_serializeSink = (
653
725
  throw new UnsupportedOperationError(`Can't serialize sink`, protocol);
654
726
  };
655
727
 
656
- const V1_deserializeSink = (
728
+ export const V1_deserializeSink = (
657
729
  json: PlainObject<V1_Sink>,
658
730
  plugins: PureProtocolProcessorPlugin[],
659
731
  ): V1_Sink => {
@@ -718,7 +790,7 @@ const V1_duplicateCountDeduplicationStrategyModelSchema = createModelSchema(
718
790
  },
719
791
  );
720
792
 
721
- const V1_serializeDeduplicationStrategy = (
793
+ export const V1_serializeDeduplicationStrategy = (
722
794
  protocol: V1_DeduplicationStrategy,
723
795
  ): PlainObject<V1_DeduplicationStrategy> => {
724
796
  if (protocol instanceof V1_NoDeduplicationStrategy) {
@@ -739,7 +811,7 @@ const V1_serializeDeduplicationStrategy = (
739
811
  );
740
812
  };
741
813
 
742
- const V1_deserializeDeduplicationStrategy = (
814
+ export const V1_deserializeDeduplicationStrategy = (
743
815
  json: PlainObject<V1_DeduplicationStrategy>,
744
816
  ): V1_DeduplicationStrategy => {
745
817
  switch (json._type) {
@@ -812,7 +884,7 @@ const V1_multiFlatTargetModelSchema = createModelSchema(V1_MultiFlatTarget, {
812
884
  transactionScope: primitive(),
813
885
  });
814
886
 
815
- const V1_serializeTargetShape = (
887
+ export const V1_serializeTargetShape = (
816
888
  protocol: V1_TargetShape,
817
889
  ): PlainObject<V1_TargetShape> => {
818
890
  if (protocol instanceof V1_MultiFlatTarget) {
@@ -823,7 +895,7 @@ const V1_serializeTargetShape = (
823
895
  throw new UnsupportedOperationError(`Can't serialize target shape`, protocol);
824
896
  };
825
897
 
826
- const V1_deserializeTargetShape = (
898
+ export const V1_deserializeTargetShape = (
827
899
  json: PlainObject<V1_TargetShape>,
828
900
  ): V1_TargetShape => {
829
901
  switch (json._type) {
@@ -877,7 +949,7 @@ const V1_batchPersisterModelSchema = (
877
949
  ),
878
950
  });
879
951
 
880
- const V1_serializePersister = (
952
+ export const V1_serializePersister = (
881
953
  protocol: V1_Persister,
882
954
  plugins: PureProtocolProcessorPlugin[],
883
955
  ): PlainObject<V1_Persister> => {
@@ -889,7 +961,7 @@ const V1_serializePersister = (
889
961
  throw new UnsupportedOperationError(`Can't serialize persister`, protocol);
890
962
  };
891
963
 
892
- const V1_deserializePersister = (
964
+ export const V1_deserializePersister = (
893
965
  json: PlainObject<V1_Persister>,
894
966
  plugins: PureProtocolProcessorPlugin[],
895
967
  ): V1_Persister => {
@@ -927,7 +999,9 @@ const V1_cronTriggerModelSchema = createModelSchema(V1_CronTrigger, {
927
999
  dayOfWeek: primitive(),
928
1000
  });
929
1001
 
930
- const V1_serializeTrigger = (protocol: V1_Trigger): PlainObject<V1_Trigger> => {
1002
+ export const V1_serializeTrigger = (
1003
+ protocol: V1_Trigger,
1004
+ ): PlainObject<V1_Trigger> => {
931
1005
  if (protocol instanceof V1_ManualTrigger) {
932
1006
  return serialize(V1_manualTriggerModelSchema, protocol);
933
1007
  } else if (protocol instanceof V1_CronTrigger) {
@@ -936,7 +1010,9 @@ const V1_serializeTrigger = (protocol: V1_Trigger): PlainObject<V1_Trigger> => {
936
1010
  throw new UnsupportedOperationError(`Can't serialize trigger`, protocol);
937
1011
  };
938
1012
 
939
- const V1_deserializeTrigger = (json: PlainObject<V1_Trigger>): V1_Trigger => {
1013
+ export const V1_deserializeTrigger = (
1014
+ json: PlainObject<V1_Trigger>,
1015
+ ): V1_Trigger => {
940
1016
  switch (json._type) {
941
1017
  case V1_TriggerType.MANUAL_TRIGGER:
942
1018
  return deserialize(V1_manualTriggerModelSchema, json);