@cratis/chronicle 6.2.0 → 6.3.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 (70) hide show
  1. package/confidentiality/EncryptedNotSupportedOnEventSourceId.ts +21 -0
  2. package/confidentiality/EncryptionScope.ts +34 -0
  3. package/confidentiality/PIIAndEncryptedCombinedNotSupported.ts +29 -0
  4. package/confidentiality/SecurityMetadata.ts +22 -0
  5. package/confidentiality/SecurityMetadataResolver.ts +54 -0
  6. package/confidentiality/SecurityMetadataType.ts +56 -0
  7. package/confidentiality/encrypted.spec.ts +105 -0
  8. package/confidentiality/encrypted.ts +143 -0
  9. package/confidentiality/index.ts +10 -0
  10. package/dist/confidentiality/EncryptedNotSupportedOnEventSourceId.d.ts +11 -0
  11. package/dist/confidentiality/EncryptedNotSupportedOnEventSourceId.d.ts.map +1 -0
  12. package/dist/confidentiality/EncryptedNotSupportedOnEventSourceId.js +19 -0
  13. package/dist/confidentiality/EncryptedNotSupportedOnEventSourceId.js.map +1 -0
  14. package/dist/confidentiality/EncryptionScope.d.ts +30 -0
  15. package/dist/confidentiality/EncryptionScope.d.ts.map +1 -0
  16. package/dist/confidentiality/EncryptionScope.js +33 -0
  17. package/dist/confidentiality/EncryptionScope.js.map +1 -0
  18. package/dist/confidentiality/PIIAndEncryptedCombinedNotSupported.d.ts +19 -0
  19. package/dist/confidentiality/PIIAndEncryptedCombinedNotSupported.d.ts.map +1 -0
  20. package/dist/confidentiality/PIIAndEncryptedCombinedNotSupported.js +27 -0
  21. package/dist/confidentiality/PIIAndEncryptedCombinedNotSupported.js.map +1 -0
  22. package/dist/confidentiality/SecurityMetadata.d.ts +18 -0
  23. package/dist/confidentiality/SecurityMetadata.d.ts.map +1 -0
  24. package/dist/confidentiality/SecurityMetadata.js +4 -0
  25. package/dist/confidentiality/SecurityMetadata.js.map +1 -0
  26. package/dist/confidentiality/SecurityMetadataResolver.d.ts +30 -0
  27. package/dist/confidentiality/SecurityMetadataResolver.d.ts.map +1 -0
  28. package/dist/confidentiality/SecurityMetadataResolver.js +48 -0
  29. package/dist/confidentiality/SecurityMetadataResolver.js.map +1 -0
  30. package/dist/confidentiality/SecurityMetadataType.d.ts +42 -0
  31. package/dist/confidentiality/SecurityMetadataType.d.ts.map +1 -0
  32. package/dist/confidentiality/SecurityMetadataType.js +50 -0
  33. package/dist/confidentiality/SecurityMetadataType.js.map +1 -0
  34. package/dist/confidentiality/encrypted.d.ts +72 -0
  35. package/dist/confidentiality/encrypted.d.ts.map +1 -0
  36. package/dist/confidentiality/encrypted.js +130 -0
  37. package/dist/confidentiality/encrypted.js.map +1 -0
  38. package/dist/confidentiality/index.d.ts +8 -0
  39. package/dist/confidentiality/index.d.ts.map +1 -0
  40. package/dist/confidentiality/index.js +9 -0
  41. package/dist/confidentiality/index.js.map +1 -0
  42. package/dist/events/constraints/Constraints.d.ts.map +1 -1
  43. package/dist/events/constraints/Constraints.js +6 -1
  44. package/dist/events/constraints/Constraints.js.map +1 -1
  45. package/dist/events/constraints/IUniqueConstraintBuilder.d.ts +2 -1
  46. package/dist/events/constraints/IUniqueConstraintBuilder.d.ts.map +1 -1
  47. package/dist/events/constraints/UniqueConstraintBuilder.d.ts +3 -0
  48. package/dist/events/constraints/UniqueConstraintBuilder.d.ts.map +1 -1
  49. package/dist/events/constraints/UniqueConstraintBuilder.js +7 -2
  50. package/dist/events/constraints/UniqueConstraintBuilder.js.map +1 -1
  51. package/dist/index.d.ts +3 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +3 -1
  54. package/dist/index.js.map +1 -1
  55. package/dist/schemas/JsonSchema.d.ts +18 -0
  56. package/dist/schemas/JsonSchema.d.ts.map +1 -1
  57. package/dist/schemas/JsonSchemaGenerator.d.ts +41 -0
  58. package/dist/schemas/JsonSchemaGenerator.d.ts.map +1 -1
  59. package/dist/schemas/JsonSchemaGenerator.js +102 -9
  60. package/dist/schemas/JsonSchemaGenerator.js.map +1 -1
  61. package/dist/tsconfig.tsbuildinfo +1 -1
  62. package/events/constraints/Constraints.ts +6 -1
  63. package/events/constraints/IUniqueConstraintBuilder.ts +2 -1
  64. package/events/constraints/UniqueConstraintBuilder.ts +10 -2
  65. package/events/constraints/for_Constraints/when_registering_unique_property_constraints.spec.ts +137 -0
  66. package/index.ts +3 -0
  67. package/package.json +7 -2
  68. package/schemas/JsonSchema.ts +20 -0
  69. package/schemas/JsonSchemaGenerator.confidentiality.spec.ts +194 -0
  70. package/schemas/JsonSchemaGenerator.ts +115 -10
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAA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mB,CAAC;AAElC,OAAO,EACH,MAAM,EACN,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,KAAK,EACL,OAAO,EACP,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,UAAU,EACV,eAAe,GAClB,CAAC"}
@@ -11,6 +11,23 @@ export interface ComplianceSchemaMetadata {
11
11
  */
12
12
  details: string;
13
13
  }
14
+ /**
15
+ * Represents a single security classification recorded on a schema node.
16
+ *
17
+ * This is the security counterpart to {@link ComplianceSchemaMetadata} - written under its own,
18
+ * separate `security` schema key rather than merged into `compliance`. See
19
+ * `Source/confidentiality/SecurityMetadataType.ts` for why.
20
+ */
21
+ export interface SecuritySchemaMetadata {
22
+ /**
23
+ * The type of security metadata (e.g. 'EncryptedSubject', 'EncryptedNamespace', 'EncryptedGlobal').
24
+ */
25
+ metadataType: string;
26
+ /**
27
+ * Any additional details - can be empty.
28
+ */
29
+ details: string;
30
+ }
14
31
  /**
15
32
  * Represents a JSON Schema object.
16
33
  */
@@ -26,5 +43,6 @@ export type JsonSchema = {
26
43
  additionalProperties?: boolean | JsonSchema;
27
44
  enum?: Array<string | number | boolean | null>;
28
45
  compliance?: ComplianceSchemaMetadata[];
46
+ security?: SecuritySchemaMetadata[];
29
47
  };
30
48
  //# sourceMappingURL=JsonSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"JsonSchema.d.ts","sourceRoot":"","sources":["../../schemas/JsonSchema.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACrB,OAAO,CAAC,EAAE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AAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACxC,QAAQ,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACvC,CAAC"}
@@ -87,5 +87,46 @@ export declare class JsonSchemaGenerator {
87
87
  * nothing and makes the generated schema noisier to read and to diff.
88
88
  */
89
89
  private static hasComplianceMetadataOfType;
90
+ /**
91
+ * Collects security metadata for a property from every source compliance metadata is resolved
92
+ * from: the property itself, its declaring class, and its own type (the concept case). This is
93
+ * the security counterpart to {@link collectComplianceMetadata} - a deliberately separate walk
94
+ * rather than a shared one, over a completely separate `@encrypted()` decorator vocabulary.
95
+ * @param target - The class prototype the property is declared on.
96
+ * @param propertyKey - The property name.
97
+ * @param propertyType - The property's runtime type, when resolved.
98
+ * @returns The collected security metadata, in property → declaring-class → type order.
99
+ */
100
+ private static collectSecurityMetadata;
101
+ /**
102
+ * Adds security metadata to a schema node, descending into an object's properties so that the
103
+ * metadata always lands on the leaves that actually hold a value. This is the security
104
+ * counterpart to {@link addComplianceMetadataToSchema} - see its remarks for why metadata is
105
+ * pushed to leaves and why an array is left as a container.
106
+ * @param schema - The schema node to add to.
107
+ * @param metadata - The security metadata to add.
108
+ */
109
+ private static addSecurityMetadataToSchema;
110
+ /**
111
+ * Checks whether a security array already carries metadata of a given type.
112
+ * @param security - The security array to check.
113
+ * @param metadataType - The metadata type to look for.
114
+ * @returns True when the metadata type is already present, false if not.
115
+ */
116
+ private static hasSecurityMetadataOfType;
117
+ /**
118
+ * Rejects a property or type that resolved both compliance and security metadata.
119
+ * @param name - The property or type name, used in the thrown error.
120
+ * @param complianceMetadata - The compliance metadata collected for the property/type.
121
+ * @param securityMetadata - The security metadata collected for the property/type.
122
+ * @remarks
123
+ * This is not merely redundant - it corrupts the value. The kernel applies every matching
124
+ * handler for a property in sequence, so a value marked both ways is encrypted first under the
125
+ * PII key and then again under the Encrypted key; releasing it decrypts with the wrong key
126
+ * against ciphertext, which fails loudly rather than returning a wrong value. Checked here, at
127
+ * schema-generation time, the same point C#'s `EncryptedMetadataProvider.ThrowIfAlsoPII` checks
128
+ * it - this client has no compile-time analyzer, so this runtime check is the only backstop.
129
+ */
130
+ private static throwIfBothCompliantAndSecure;
90
131
  }
91
132
  //# sourceMappingURL=JsonSchemaGenerator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"JsonSchemaGenerator.d.ts","sourceRoot":"","sources":["../../schemas/JsonSchemaGenerator.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAA4B,UAAU,EAAE,MAAM,cAAc,CAAC;AAKpE;;GAEG;AACH,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAGtC;IAEH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAEnC;IAEH;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAWnD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG,UAAU;IAmClG,OAAO,CAAC,MAAM,CAAC,sBAAsB;IA2CrC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAiBnC;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IASlC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IASnC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CAAC,yBAAyB;IAuBxC;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IAyB5C;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAI1C;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAuBtC;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAyB1C;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAIxC;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;CAK/C"}
@@ -4,6 +4,8 @@ import 'reflect-metadata';
4
4
  import { ConceptAs, Fields, Guid } from '@cratis/fundamentals';
5
5
  import { TypeIntrospector } from '../types';
6
6
  import { ComplianceMetadataResolver } from '../compliance/ComplianceMetadataResolver';
7
+ import { SecurityMetadataResolver } from '../confidentiality/SecurityMetadataResolver';
8
+ import { PIIAndEncryptedCombinedNotSupported } from '../confidentiality/PIIAndEncryptedCombinedNotSupported';
7
9
  /**
8
10
  * Generates JSON schemas for class constructors using reflection metadata.
9
11
  */
@@ -46,11 +48,15 @@ export class JsonSchemaGenerator {
46
48
  // the runtime type was unavailable (e.g. esbuild/tsx omits design:paramtypes).
47
49
  if (Object.keys(propertySchema).length > 0) {
48
50
  // An array of concept elements resolves and applies its own item-level compliance
49
- // inside mapRuntimeTypeToSchema - the general property/type/declaring-class walk
50
- // below is skipped for it, mirroring the C# generator's enumerable-of-concept branch.
51
+ // and security metadata inside mapRuntimeTypeToSchema - the general
52
+ // property/type/declaring-class walk below is skipped for it, mirroring the C#
53
+ // generator's enumerable-of-concept branch.
51
54
  if (!this.isConceptArrayMember(target, memberName, memberType)) {
52
- const metadata = this.collectComplianceMetadata(prototype, memberName, memberType);
53
- this.addComplianceMetadataToSchema(propertySchema, metadata);
55
+ const complianceMetadata = this.collectComplianceMetadata(prototype, memberName, memberType);
56
+ const securityMetadata = this.collectSecurityMetadata(prototype, memberName, memberType);
57
+ this.throwIfBothCompliantAndSecure(memberName, complianceMetadata, securityMetadata);
58
+ this.addComplianceMetadataToSchema(propertySchema, complianceMetadata);
59
+ this.addSecurityMetadataToSchema(propertySchema, securityMetadata);
54
60
  }
55
61
  schemaProperties[memberName] = propertySchema;
56
62
  }
@@ -111,13 +117,16 @@ export class JsonSchemaGenerator {
111
117
  static mapArrayTypeToSchema(declaringType, propertyName) {
112
118
  const elementType = this.getArrayElementType(declaringType, propertyName);
113
119
  // An array whose element is a ConceptAs<T> loses its classification the moment it is put in
114
- // a list unless the element concept's own compliance metadata is carried onto the item schema -
115
- // a value that would be encrypted as a scalar would otherwise be persisted in the clear as a
116
- // list element. Mirrors the C# generator's explicit enumerable-of-concept branch.
120
+ // a list unless the element concept's own compliance/security metadata is carried onto the
121
+ // item schema - a value that would be encrypted as a scalar would otherwise be persisted in
122
+ // the clear as a list element. Mirrors the C# generator's explicit enumerable-of-concept branch.
117
123
  if (elementType && this.isConceptAs(elementType)) {
118
124
  const itemSchema = this.mapRuntimeTypeToSchema(elementType);
119
- const metadata = ComplianceMetadataResolver.getMetadataForType(elementType);
120
- this.addComplianceMetadataToSchema(itemSchema, metadata);
125
+ const complianceMetadata = ComplianceMetadataResolver.getMetadataForType(elementType);
126
+ const securityMetadata = SecurityMetadataResolver.getMetadataForType(elementType);
127
+ this.throwIfBothCompliantAndSecure(elementType.name, complianceMetadata, securityMetadata);
128
+ this.addComplianceMetadataToSchema(itemSchema, complianceMetadata);
129
+ this.addSecurityMetadataToSchema(itemSchema, securityMetadata);
121
130
  return { type: 'array', items: itemSchema };
122
131
  }
123
132
  return { type: 'array', items: { type: 'object' } };
@@ -256,5 +265,89 @@ export class JsonSchemaGenerator {
256
265
  static hasComplianceMetadataOfType(compliance, metadataType) {
257
266
  return compliance.some(item => item.metadataType === metadataType);
258
267
  }
268
+ /**
269
+ * Collects security metadata for a property from every source compliance metadata is resolved
270
+ * from: the property itself, its declaring class, and its own type (the concept case). This is
271
+ * the security counterpart to {@link collectComplianceMetadata} - a deliberately separate walk
272
+ * rather than a shared one, over a completely separate `@encrypted()` decorator vocabulary.
273
+ * @param target - The class prototype the property is declared on.
274
+ * @param propertyKey - The property name.
275
+ * @param propertyType - The property's runtime type, when resolved.
276
+ * @returns The collected security metadata, in property → declaring-class → type order.
277
+ */
278
+ static collectSecurityMetadata(target, propertyKey, propertyType) {
279
+ const metadata = [];
280
+ // Property-level security decorator.
281
+ if (SecurityMetadataResolver.hasMetadataFor(target, propertyKey)) {
282
+ metadata.push(...SecurityMetadataResolver.getMetadataFor(target, propertyKey));
283
+ }
284
+ // Declaring class-level security decorator - a class-level @encrypted() marks every one of
285
+ // its own properties, the same way a class-level @pii() does for compliance.
286
+ const declaringClass = target.constructor;
287
+ if (declaringClass) {
288
+ metadata.push(...SecurityMetadataResolver.getMetadataForType(declaringClass));
289
+ }
290
+ // Type-level security decorator on the property's own type (e.g., @encrypted on a ConceptAs).
291
+ if (propertyType) {
292
+ metadata.push(...SecurityMetadataResolver.getMetadataForType(propertyType));
293
+ }
294
+ return metadata;
295
+ }
296
+ /**
297
+ * Adds security metadata to a schema node, descending into an object's properties so that the
298
+ * metadata always lands on the leaves that actually hold a value. This is the security
299
+ * counterpart to {@link addComplianceMetadataToSchema} - see its remarks for why metadata is
300
+ * pushed to leaves and why an array is left as a container.
301
+ * @param schema - The schema node to add to.
302
+ * @param metadata - The security metadata to add.
303
+ */
304
+ static addSecurityMetadataToSchema(schema, metadata) {
305
+ if (metadata.length === 0) {
306
+ return;
307
+ }
308
+ if (schema.properties && Object.keys(schema.properties).length > 0) {
309
+ for (const propertySchema of Object.values(schema.properties)) {
310
+ this.addSecurityMetadataToSchema(propertySchema, metadata);
311
+ }
312
+ return;
313
+ }
314
+ const security = schema.security ?? [];
315
+ for (const item of metadata) {
316
+ const metadataType = item.metadataType.value.toString();
317
+ if (!this.hasSecurityMetadataOfType(security, metadataType)) {
318
+ security.push({ metadataType, details: item.details });
319
+ }
320
+ }
321
+ if (security.length > 0) {
322
+ schema.security = security;
323
+ }
324
+ }
325
+ /**
326
+ * Checks whether a security array already carries metadata of a given type.
327
+ * @param security - The security array to check.
328
+ * @param metadataType - The metadata type to look for.
329
+ * @returns True when the metadata type is already present, false if not.
330
+ */
331
+ static hasSecurityMetadataOfType(security, metadataType) {
332
+ return security.some(item => item.metadataType === metadataType);
333
+ }
334
+ /**
335
+ * Rejects a property or type that resolved both compliance and security metadata.
336
+ * @param name - The property or type name, used in the thrown error.
337
+ * @param complianceMetadata - The compliance metadata collected for the property/type.
338
+ * @param securityMetadata - The security metadata collected for the property/type.
339
+ * @remarks
340
+ * This is not merely redundant - it corrupts the value. The kernel applies every matching
341
+ * handler for a property in sequence, so a value marked both ways is encrypted first under the
342
+ * PII key and then again under the Encrypted key; releasing it decrypts with the wrong key
343
+ * against ciphertext, which fails loudly rather than returning a wrong value. Checked here, at
344
+ * schema-generation time, the same point C#'s `EncryptedMetadataProvider.ThrowIfAlsoPII` checks
345
+ * it - this client has no compile-time analyzer, so this runtime check is the only backstop.
346
+ */
347
+ static throwIfBothCompliantAndSecure(name, complianceMetadata, securityMetadata) {
348
+ if (complianceMetadata.length > 0 && securityMetadata.length > 0) {
349
+ throw new PIIAndEncryptedCombinedNotSupported(name);
350
+ }
351
+ }
259
352
  }
260
353
  //# sourceMappingURL=JsonSchemaGenerator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JsonSchemaGenerator.js","sourceRoot":"","sources":["../../schemas/JsonSchemaGenerator.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAe,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAEtF;;GAEG;AACH,MAAM,OAAO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,MAAM,CAAC,yBAAyB,CAAC,QAAkC,EAAE,YAAoB;QAC7F,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,KAAK,YAAY,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;;;;;;;OAYG;IACK,MAAM,CAAC,6BAA6B,CAAC,IAAY,EAAE,kBAAwC,EAAE,gBAAoC;QACrI,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/D,MAAM,IAAI,mCAAmC,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC;IACL,CAAC"}
@@ -1 +1 @@
1
- {"root":["../ChronicleClient.ts","../ChronicleOptions.ts","../EventStore.ts","../EventStoreName.ts","../EventStoreNamespaceName.ts","../IChronicleClient.ts","../IEventStore.ts","../Metrics.ts","../Tracing.ts","../index.ts","../artifacts/DefaultClientArtifactsProvider.ts","../artifacts/IClientArtifactsProvider.ts","../artifacts/index.ts","../auditing/Causation.ts","../auditing/CausationManager.ts","../auditing/CausationType.ts","../auditing/ICausationManager.ts","../auditing/index.ts","../compliance/ComplianceContracts.ts","../compliance/ComplianceMetadata.ts","../compliance/ComplianceMetadataResolver.ts","../compliance/ComplianceMetadataType.ts","../compliance/IPIIManager.ts","../compliance/PIIManager.ts","../compliance/PIINotSupportedOnEventSourceId.ts","../compliance/index.ts","../compliance/pii.ts","../compliance/subject.ts","../connection/ChronicleConnection.ts","../connection/ChronicleConnectionString.ts","../connection/ChronicleServerAddressResolver.ts","../connection/ChronicleServices.ts","../connection/ChronicleSrvResolutionError.ts","../connection/ChronicleSrvResolver.ts","../connection/CompatibilityPreflight.ts","../connection/ConnectionLifecycle.ts","../connection/DateTimeOffset.ts","../connection/Guid.ts","../connection/ILoadBalancerStrategy.ts","../connection/IncompatibleChronicleServer.ts","../connection/KernelKeepAlive.ts","../connection/LeastConnectionsLoadBalancerStrategy.ts","../connection/LoadBalancerMode.ts","../connection/LoadBalancerStrategyFactory.ts","../connection/RandomLoadBalancerStrategy.ts","../connection/RoundRobinLoadBalancerStrategy.ts","../connection/TokenProvider.ts","../connection/callResults.ts","../connection/fetchOAuthAccessToken.ts","../connection/formatServerAddress.ts","../connection/index.ts","../correlation/CorrelationId.ts","../correlation/CorrelationIdManager.ts","../correlation/ICorrelationIdAccessor.ts","../correlation/ICorrelationIdSetter.ts","../correlation/index.ts","../eventSequences/AppendError.ts","../eventSequences/AppendOperationsBroadcaster.ts","../eventSequences/AppendOptions.ts","../eventSequences/AppendResult.ts","../eventSequences/AppendedEventWithResult.ts","../eventSequences/CompleteStreamError.ts","../eventSequences/CompleteStreamResult.ts","../eventSequences/ConcurrencyScope.ts","../eventSequences/ConcurrencyViolation.ts","../eventSequences/ConstraintViolation.ts","../eventSequences/EventForEventSourceId.ts","../eventSequences/EventLog.ts","../eventSequences/EventSequence.ts","../eventSequences/EventSequenceId.ts","../eventSequences/EventSequenceNumber.ts","../eventSequences/IEventLog.ts","../eventSequences/IEventSequence.ts","../eventSequences/ITransactionalEventSequence.ts","../eventSequences/TransactionalEventSequence.ts","../eventSequences/WaitForCompletionResult.ts","../eventSequences/index.ts","../eventStoreSubscriptions/EventStoreSubscriptionBuilder.ts","../eventStoreSubscriptions/EventStoreSubscriptionDefinition.ts","../eventStoreSubscriptions/EventStoreSubscriptionId.ts","../eventStoreSubscriptions/EventStoreSubscriptions.ts","../eventStoreSubscriptions/IEventStoreSubscriptionBuilder.ts","../eventStoreSubscriptions/IEventStoreSubscriptions.ts","../eventStoreSubscriptions/contracts.ts","../eventStoreSubscriptions/index.ts","../events/AppendedEvent.ts","../events/CausationEntry.ts","../events/EventContext.ts","../events/EventType.ts","../events/EventTypeGeneration.ts","../events/EventTypeId.ts","../events/EventTypes.ts","../events/IEventTypes.ts","../events/Tag.ts","../events/WireEventContext.ts","../events/eventTypeDecorator.ts","../events/filterEventsByTagDecorator.ts","../events/index.ts","../events/mergeTags.ts","../events/tagDecorator.ts","../events/toClientEventContext.ts","../events/constraints/ConstraintBuilder.ts","../events/constraints/ConstraintId.ts","../events/constraints/Constraints.ts","../events/constraints/IConstraint.ts","../events/constraints/IConstraintBuilder.ts","../events/constraints/IConstraints.ts","../events/constraints/IUniqueConstraintBuilder.ts","../events/constraints/UniqueConstraintBuilder.ts","../events/constraints/constraint.ts","../events/constraints/index.ts","../events/migrations/EventMigrationBuilder.ts","../events/migrations/EventMigrationPropertyBuilder.ts","../events/migrations/EventTypeMigrators.ts","../events/migrations/IEventMigrationBuilder.ts","../events/migrations/IEventMigrationPropertyBuilder.ts","../events/migrations/IEventTypeMigration.ts","../events/migrations/IEventTypeMigrators.ts","../events/migrations/InvalidMigrationGenerationGap.ts","../events/migrations/eventTypeMigration.ts","../events/migrations/index.ts","../externalServices/ExternalServiceBuilder.ts","../externalServices/ExternalServices.ts","../externalServices/ExternalServicesContracts.ts","../externalServices/IExternalServiceBuilder.ts","../externalServices/IExternalServices.ts","../externalServices/index.ts","../identities/IIdentityManager.ts","../identities/IdentityManager.ts","../identities/index.ts","../identity/IIdentityProvider.ts","../identity/Identity.ts","../identity/IdentityProvider.ts","../identity/index.ts","../jobs/IJobs.ts","../jobs/JobId.ts","../jobs/Jobs.ts","../jobs/index.ts","../observation/FailedPartition.ts","../observation/FailedPartitionAttempt.ts","../observation/FailedPartitions.ts","../observation/ICanBeNotifiedWhenPartitionReplayed.ts","../observation/ICanBeNotifiedWhenReplay.ts","../observation/IFailedPartitions.ts","../observation/ObserverId.ts","../observation/ObserverRunningState.ts","../observation/index.ts","../observation/notifyReplayLifecycle.ts","../observation/toClientFailedPartition.ts","../observation/toObserverRunningState.ts","../projections/GlobalHandlerPropertyNotOnVariant.ts","../projections/IProjections.ts","../projections/ProjectionId.ts","../projections/ProjectionQueryResult.ts","../projections/ProjectionState.ts","../projections/Projections.ts","../projections/UnableToQueryProjection.ts","../projections/VariantMustDeclareEntersOnEvent.ts","../projections/VariantReclassifier.ts","../projections/index.ts","../projections/declarative/AddBuilder.ts","../projections/declarative/AddChildBuilder.ts","../projections/declarative/AllSetBuilder.ts","../projections/declarative/ChildrenBuilder.ts","../projections/declarative/CompositeKeyBuilder.ts","../projections/declarative/FromBuilder.ts","../projections/declarative/FromEveryBuilder.ts","../projections/declarative/IAddBuilder.ts","../projections/declarative/IAddChildBuilder.ts","../projections/declarative/IAllSetBuilder.ts","../projections/declarative/IChildrenBuilder.ts","../projections/declarative/ICompositeKeyBuilder.ts","../projections/declarative/IFromBuilder.ts","../projections/declarative/IFromEveryBuilder.ts","../projections/declarative/IJoinBuilder.ts","../projections/declarative/INestedBuilder.ts","../projections/declarative/IProjectionBuilder.ts","../projections/declarative/IProjectionBuilderFor.ts","../projections/declarative/IProjectionFor.ts","../projections/declarative/IReadModelPropertiesBuilder.ts","../projections/declarative/IRemovedWithBuilder.ts","../projections/declarative/IRemovedWithJoinBuilder.ts","../projections/declarative/ISetBuilder.ts","../projections/declarative/ISubtractBuilder.ts","../projections/declarative/JoinBuilder.ts","../projections/declarative/NestedBuilder.ts","../projections/declarative/ProjectionBuilderCore.ts","../projections/declarative/ProjectionBuilderFor.ts","../projections/declarative/RemovedWithBuilder.ts","../projections/declarative/RemovedWithJoinBuilder.ts","../projections/declarative/SetBuilder.ts","../projections/declarative/SubtractBuilder.ts","../projections/declarative/index.ts","../projections/declarative/projection.ts","../projections/modelBound/FromEventMetadata.ts","../projections/modelBound/FromEventOptions.ts","../projections/modelBound/addFrom.ts","../projections/modelBound/childrenAndNestedBuilder.ts","../projections/modelBound/childrenFrom.ts","../projections/modelBound/clearWith.ts","../projections/modelBound/count.ts","../projections/modelBound/decrement.ts","../projections/modelBound/entersOn.ts","../projections/modelBound/eventSequence.ts","../projections/modelBound/fromAll.ts","../projections/modelBound/fromEvent.ts","../projections/modelBound/fromEvery.ts","../projections/modelBound/globalFor.ts","../projections/modelBound/increment.ts","../projections/modelBound/index.ts","../projections/modelBound/join.ts","../projections/modelBound/nested.ts","../projections/modelBound/noAutoMap.ts","../projections/modelBound/notRewindable.ts","../projections/modelBound/passive.ts","../projections/modelBound/removedWith.ts","../projections/modelBound/removedWithJoin.ts","../projections/modelBound/setFrom.ts","../projections/modelBound/setFromContext.ts","../projections/modelBound/setValue.ts","../projections/modelBound/subtractFrom.ts","../projections/modelBound/variantOf.ts","../reactors/IReactors.ts","../reactors/ReactorId.ts","../reactors/ReactorSideEffects.ts","../reactors/Reactors.ts","../reactors/index.ts","../reactors/reactor.ts","../readModels/IMaterializedReadModels.ts","../readModels/IReadModels.ts","../readModels/MaterializedReadModels.ts","../readModels/ReadModelChangeset.ts","../readModels/ReadModelId.ts","../readModels/ReadModelSnapshot.ts","../readModels/ReadModelSubjectResolver.ts","../readModels/ReadModels.ts","../readModels/index.ts","../readModels/readModel.ts","../reducers/IReducers.ts","../reducers/ReducerId.ts","../reducers/Reducers.ts","../reducers/index.ts","../reducers/reducer.ts","../schemas/JsonSchema.ts","../schemas/JsonSchemaGenerator.ts","../schemas/index.ts","../schemas/jsonSchemaProperty.ts","../seeding/EventSeeding.ts","../seeding/ICanSeedEvents.ts","../seeding/IEventSeeding.ts","../seeding/IEventSeedingBuilder.ts","../seeding/IEventSeedingScopeBuilder.ts","../seeding/index.ts","../seeding/seeder.ts","../sinks/WellKnownSinks.ts","../sinks/index.ts","../transactions/IUnitOfWork.ts","../transactions/IUnitOfWorkManager.ts","../transactions/NoUnitOfWorkHasBeenStarted.ts","../transactions/UnitOfWork.ts","../transactions/UnitOfWorkManager.ts","../transactions/index.ts","../types/DecoratorType.ts","../types/TypeDiscoverer.ts","../types/TypeIntrospector.ts","../types/index.ts","../webhooks/IWebhook.ts","../webhooks/IWebhookDefinitionBuilder.ts","../webhooks/IWebhooks.ts","../webhooks/WebhookDefinitionBuilder.ts","../webhooks/WebhookId.ts","../webhooks/WebhookTargetUrl.ts","../webhooks/Webhooks.ts","../webhooks/index.ts","../webhooks/webhook.ts"],"version":"6.0.3"}
1
+ {"root":["../ChronicleClient.ts","../ChronicleOptions.ts","../EventStore.ts","../EventStoreName.ts","../EventStoreNamespaceName.ts","../IChronicleClient.ts","../IEventStore.ts","../Metrics.ts","../Tracing.ts","../index.ts","../artifacts/DefaultClientArtifactsProvider.ts","../artifacts/IClientArtifactsProvider.ts","../artifacts/index.ts","../auditing/Causation.ts","../auditing/CausationManager.ts","../auditing/CausationType.ts","../auditing/ICausationManager.ts","../auditing/index.ts","../compliance/ComplianceContracts.ts","../compliance/ComplianceMetadata.ts","../compliance/ComplianceMetadataResolver.ts","../compliance/ComplianceMetadataType.ts","../compliance/IPIIManager.ts","../compliance/PIIManager.ts","../compliance/PIINotSupportedOnEventSourceId.ts","../compliance/index.ts","../compliance/pii.ts","../compliance/subject.ts","../confidentiality/EncryptedNotSupportedOnEventSourceId.ts","../confidentiality/EncryptionScope.ts","../confidentiality/PIIAndEncryptedCombinedNotSupported.ts","../confidentiality/SecurityMetadata.ts","../confidentiality/SecurityMetadataResolver.ts","../confidentiality/SecurityMetadataType.ts","../confidentiality/encrypted.ts","../confidentiality/index.ts","../connection/ChronicleConnection.ts","../connection/ChronicleConnectionString.ts","../connection/ChronicleServerAddressResolver.ts","../connection/ChronicleServices.ts","../connection/ChronicleSrvResolutionError.ts","../connection/ChronicleSrvResolver.ts","../connection/CompatibilityPreflight.ts","../connection/ConnectionLifecycle.ts","../connection/DateTimeOffset.ts","../connection/Guid.ts","../connection/ILoadBalancerStrategy.ts","../connection/IncompatibleChronicleServer.ts","../connection/KernelKeepAlive.ts","../connection/LeastConnectionsLoadBalancerStrategy.ts","../connection/LoadBalancerMode.ts","../connection/LoadBalancerStrategyFactory.ts","../connection/RandomLoadBalancerStrategy.ts","../connection/RoundRobinLoadBalancerStrategy.ts","../connection/TokenProvider.ts","../connection/callResults.ts","../connection/fetchOAuthAccessToken.ts","../connection/formatServerAddress.ts","../connection/index.ts","../correlation/CorrelationId.ts","../correlation/CorrelationIdManager.ts","../correlation/ICorrelationIdAccessor.ts","../correlation/ICorrelationIdSetter.ts","../correlation/index.ts","../eventSequences/AppendError.ts","../eventSequences/AppendOperationsBroadcaster.ts","../eventSequences/AppendOptions.ts","../eventSequences/AppendResult.ts","../eventSequences/AppendedEventWithResult.ts","../eventSequences/CompleteStreamError.ts","../eventSequences/CompleteStreamResult.ts","../eventSequences/ConcurrencyScope.ts","../eventSequences/ConcurrencyViolation.ts","../eventSequences/ConstraintViolation.ts","../eventSequences/EventForEventSourceId.ts","../eventSequences/EventLog.ts","../eventSequences/EventSequence.ts","../eventSequences/EventSequenceId.ts","../eventSequences/EventSequenceNumber.ts","../eventSequences/IEventLog.ts","../eventSequences/IEventSequence.ts","../eventSequences/ITransactionalEventSequence.ts","../eventSequences/TransactionalEventSequence.ts","../eventSequences/WaitForCompletionResult.ts","../eventSequences/index.ts","../eventStoreSubscriptions/EventStoreSubscriptionBuilder.ts","../eventStoreSubscriptions/EventStoreSubscriptionDefinition.ts","../eventStoreSubscriptions/EventStoreSubscriptionId.ts","../eventStoreSubscriptions/EventStoreSubscriptions.ts","../eventStoreSubscriptions/IEventStoreSubscriptionBuilder.ts","../eventStoreSubscriptions/IEventStoreSubscriptions.ts","../eventStoreSubscriptions/contracts.ts","../eventStoreSubscriptions/index.ts","../events/AppendedEvent.ts","../events/CausationEntry.ts","../events/EventContext.ts","../events/EventType.ts","../events/EventTypeGeneration.ts","../events/EventTypeId.ts","../events/EventTypes.ts","../events/IEventTypes.ts","../events/Tag.ts","../events/WireEventContext.ts","../events/eventTypeDecorator.ts","../events/filterEventsByTagDecorator.ts","../events/index.ts","../events/mergeTags.ts","../events/tagDecorator.ts","../events/toClientEventContext.ts","../events/constraints/ConstraintBuilder.ts","../events/constraints/ConstraintId.ts","../events/constraints/Constraints.ts","../events/constraints/IConstraint.ts","../events/constraints/IConstraintBuilder.ts","../events/constraints/IConstraints.ts","../events/constraints/IUniqueConstraintBuilder.ts","../events/constraints/UniqueConstraintBuilder.ts","../events/constraints/constraint.ts","../events/constraints/index.ts","../events/migrations/EventMigrationBuilder.ts","../events/migrations/EventMigrationPropertyBuilder.ts","../events/migrations/EventTypeMigrators.ts","../events/migrations/IEventMigrationBuilder.ts","../events/migrations/IEventMigrationPropertyBuilder.ts","../events/migrations/IEventTypeMigration.ts","../events/migrations/IEventTypeMigrators.ts","../events/migrations/InvalidMigrationGenerationGap.ts","../events/migrations/eventTypeMigration.ts","../events/migrations/index.ts","../externalServices/ExternalServiceBuilder.ts","../externalServices/ExternalServices.ts","../externalServices/ExternalServicesContracts.ts","../externalServices/IExternalServiceBuilder.ts","../externalServices/IExternalServices.ts","../externalServices/index.ts","../identities/IIdentityManager.ts","../identities/IdentityManager.ts","../identities/index.ts","../identity/IIdentityProvider.ts","../identity/Identity.ts","../identity/IdentityProvider.ts","../identity/index.ts","../jobs/IJobs.ts","../jobs/JobId.ts","../jobs/Jobs.ts","../jobs/index.ts","../observation/FailedPartition.ts","../observation/FailedPartitionAttempt.ts","../observation/FailedPartitions.ts","../observation/ICanBeNotifiedWhenPartitionReplayed.ts","../observation/ICanBeNotifiedWhenReplay.ts","../observation/IFailedPartitions.ts","../observation/ObserverId.ts","../observation/ObserverRunningState.ts","../observation/index.ts","../observation/notifyReplayLifecycle.ts","../observation/toClientFailedPartition.ts","../observation/toObserverRunningState.ts","../projections/GlobalHandlerPropertyNotOnVariant.ts","../projections/IProjections.ts","../projections/ProjectionId.ts","../projections/ProjectionQueryResult.ts","../projections/ProjectionState.ts","../projections/Projections.ts","../projections/UnableToQueryProjection.ts","../projections/VariantMustDeclareEntersOnEvent.ts","../projections/VariantReclassifier.ts","../projections/index.ts","../projections/declarative/AddBuilder.ts","../projections/declarative/AddChildBuilder.ts","../projections/declarative/AllSetBuilder.ts","../projections/declarative/ChildrenBuilder.ts","../projections/declarative/CompositeKeyBuilder.ts","../projections/declarative/FromBuilder.ts","../projections/declarative/FromEveryBuilder.ts","../projections/declarative/IAddBuilder.ts","../projections/declarative/IAddChildBuilder.ts","../projections/declarative/IAllSetBuilder.ts","../projections/declarative/IChildrenBuilder.ts","../projections/declarative/ICompositeKeyBuilder.ts","../projections/declarative/IFromBuilder.ts","../projections/declarative/IFromEveryBuilder.ts","../projections/declarative/IJoinBuilder.ts","../projections/declarative/INestedBuilder.ts","../projections/declarative/IProjectionBuilder.ts","../projections/declarative/IProjectionBuilderFor.ts","../projections/declarative/IProjectionFor.ts","../projections/declarative/IReadModelPropertiesBuilder.ts","../projections/declarative/IRemovedWithBuilder.ts","../projections/declarative/IRemovedWithJoinBuilder.ts","../projections/declarative/ISetBuilder.ts","../projections/declarative/ISubtractBuilder.ts","../projections/declarative/JoinBuilder.ts","../projections/declarative/NestedBuilder.ts","../projections/declarative/ProjectionBuilderCore.ts","../projections/declarative/ProjectionBuilderFor.ts","../projections/declarative/RemovedWithBuilder.ts","../projections/declarative/RemovedWithJoinBuilder.ts","../projections/declarative/SetBuilder.ts","../projections/declarative/SubtractBuilder.ts","../projections/declarative/index.ts","../projections/declarative/projection.ts","../projections/modelBound/FromEventMetadata.ts","../projections/modelBound/FromEventOptions.ts","../projections/modelBound/addFrom.ts","../projections/modelBound/childrenAndNestedBuilder.ts","../projections/modelBound/childrenFrom.ts","../projections/modelBound/clearWith.ts","../projections/modelBound/count.ts","../projections/modelBound/decrement.ts","../projections/modelBound/entersOn.ts","../projections/modelBound/eventSequence.ts","../projections/modelBound/fromAll.ts","../projections/modelBound/fromEvent.ts","../projections/modelBound/fromEvery.ts","../projections/modelBound/globalFor.ts","../projections/modelBound/increment.ts","../projections/modelBound/index.ts","../projections/modelBound/join.ts","../projections/modelBound/nested.ts","../projections/modelBound/noAutoMap.ts","../projections/modelBound/notRewindable.ts","../projections/modelBound/passive.ts","../projections/modelBound/removedWith.ts","../projections/modelBound/removedWithJoin.ts","../projections/modelBound/setFrom.ts","../projections/modelBound/setFromContext.ts","../projections/modelBound/setValue.ts","../projections/modelBound/subtractFrom.ts","../projections/modelBound/variantOf.ts","../reactors/IReactors.ts","../reactors/ReactorId.ts","../reactors/ReactorSideEffects.ts","../reactors/Reactors.ts","../reactors/index.ts","../reactors/reactor.ts","../readModels/IMaterializedReadModels.ts","../readModels/IReadModels.ts","../readModels/MaterializedReadModels.ts","../readModels/ReadModelChangeset.ts","../readModels/ReadModelId.ts","../readModels/ReadModelSnapshot.ts","../readModels/ReadModelSubjectResolver.ts","../readModels/ReadModels.ts","../readModels/index.ts","../readModels/readModel.ts","../reducers/IReducers.ts","../reducers/ReducerId.ts","../reducers/Reducers.ts","../reducers/index.ts","../reducers/reducer.ts","../schemas/JsonSchema.ts","../schemas/JsonSchemaGenerator.ts","../schemas/index.ts","../schemas/jsonSchemaProperty.ts","../seeding/EventSeeding.ts","../seeding/ICanSeedEvents.ts","../seeding/IEventSeeding.ts","../seeding/IEventSeedingBuilder.ts","../seeding/IEventSeedingScopeBuilder.ts","../seeding/index.ts","../seeding/seeder.ts","../sinks/WellKnownSinks.ts","../sinks/index.ts","../transactions/IUnitOfWork.ts","../transactions/IUnitOfWorkManager.ts","../transactions/NoUnitOfWorkHasBeenStarted.ts","../transactions/UnitOfWork.ts","../transactions/UnitOfWorkManager.ts","../transactions/index.ts","../types/DecoratorType.ts","../types/TypeDiscoverer.ts","../types/TypeIntrospector.ts","../types/index.ts","../webhooks/IWebhook.ts","../webhooks/IWebhookDefinitionBuilder.ts","../webhooks/IWebhooks.ts","../webhooks/WebhookDefinitionBuilder.ts","../webhooks/WebhookId.ts","../webhooks/WebhookTargetUrl.ts","../webhooks/Webhooks.ts","../webhooks/index.ts","../webhooks/webhook.ts"],"version":"6.0.3"}
@@ -57,10 +57,15 @@ export class Constraints implements IConstraints {
57
57
 
58
58
  if (capture.uniqueConstraint) {
59
59
  const uc = capture.uniqueConstraint;
60
+ const removalEventTypeIds = uc.removedWithEventTypeIds ?? [];
61
+ const legacyEventTypeId = uc.removedWithEventTypeId;
60
62
  return {
61
63
  Name: capture.name,
62
64
  Type: ConstraintType.Unique,
63
- RemovedWith: uc.removedWithEventTypeId ? [uc.removedWithEventTypeId] : [],
65
+ RemovedWith: [...new Set([
66
+ ...(legacyEventTypeId && !removalEventTypeIds.includes(legacyEventTypeId) ? [legacyEventTypeId] : []),
67
+ ...removalEventTypeIds
68
+ ])],
64
69
  Definition: {
65
70
  Value0: {
66
71
  EventDefinitions: uc.eventDefinitions.map(ed => ({
@@ -31,7 +31,8 @@ export interface IUniqueConstraintBuilder {
31
31
  ignoreCasing(): IUniqueConstraintBuilder;
32
32
 
33
33
  /**
34
- * Specifies the event type that removes this unique constraint (e.g. a deletion event).
34
+ * Adds an event type that removes this unique property constraint (e.g. a deletion event).
35
+ * Repeated calls retain distinct event types in registration order.
35
36
  * @param eventType - The event constructor that removes the constraint.
36
37
  * @returns This builder for fluent chaining.
37
38
  */
@@ -24,7 +24,10 @@ export interface UniqueConstraintCapture {
24
24
  name?: string;
25
25
  eventDefinitions: UniqueConstraintEventEntry[];
26
26
  ignoreCasing: boolean;
27
+ /** The most recently specified removal event type (retained for legacy capture consumers). */
27
28
  removedWithEventTypeId?: string;
29
+ /** Distinct removal event types in registration order. */
30
+ removedWithEventTypeIds?: string[];
28
31
  message?: string;
29
32
  }
30
33
 
@@ -66,8 +69,13 @@ export class UniqueConstraintBuilder implements IUniqueConstraintBuilder {
66
69
 
67
70
  /** @inheritdoc */
68
71
  removedWith(eventType: Function): IUniqueConstraintBuilder {
69
- const et = getEventTypeFor(eventType);
70
- this._capture.removedWithEventTypeId = et.id.value;
72
+ const eventTypeId = getEventTypeFor(eventType).id.value;
73
+ const removalEventTypeIds = this._capture.removedWithEventTypeIds ??=
74
+ this._capture.removedWithEventTypeId ? [this._capture.removedWithEventTypeId] : [];
75
+ if (!removalEventTypeIds.includes(eventTypeId)) {
76
+ removalEventTypeIds.push(eventTypeId);
77
+ }
78
+ this._capture.removedWithEventTypeId = eventTypeId;
71
79
  return this;
72
80
  }
73
81
 
@@ -0,0 +1,137 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ import { beforeEach, chai, describe, it, vi } from 'vitest';
5
+ import { ConstraintType } from '@cratis/chronicle.contracts';
6
+ import type { IClientArtifactsProvider } from '../../../artifacts';
7
+ import type { ChronicleConnection } from '../../../connection';
8
+ import { eventType } from '../../eventTypeDecorator';
9
+ import { ConstraintBuilder } from '../ConstraintBuilder';
10
+ import { constraint } from '../constraint';
11
+ import { Constraints } from '../Constraints';
12
+ import type { IConstraint } from '../IConstraint';
13
+ import type { IConstraintBuilder } from '../IConstraintBuilder';
14
+
15
+ const should = chai.should();
16
+
17
+ class AddressReserved { emailAddress = ''; }
18
+ class AddressReleased {}
19
+ class AddressExpired {}
20
+ class AddressRevoked {}
21
+ eventType('address-reserved')(AddressReserved);
22
+ eventType('address-released')(AddressReleased);
23
+ eventType('address-expired')(AddressExpired);
24
+ eventType('address-revoked')(AddressRevoked);
25
+
26
+ async function registerConstraint(constraintType: new () => IConstraint) {
27
+ const register = vi.fn().mockResolvedValue({});
28
+ const connection = { constraints: { register } } as unknown as ChronicleConnection;
29
+ const artifacts = {
30
+ eventTypes: [], readModels: [], reactors: [], reducers: [], seeders: [], constraints: [constraintType],
31
+ projections: [], webhooks: [], eventTypeMigrations: [], globalForHandlers: []
32
+ } as IClientArtifactsProvider;
33
+ const constraints = new Constraints('store', connection, artifacts);
34
+ await constraints.register();
35
+ return register.mock.calls[0][0];
36
+ }
37
+
38
+ function propertyConstraint(...removalEvents: Function[]): new () => IConstraint {
39
+ class ReservedAddressConstraint implements IConstraint {
40
+ define(builder: IConstraintBuilder): void {
41
+ builder.perEventSourceType().perEventStreamType().perEventStreamId()
42
+ .unique(unique => {
43
+ unique.on(AddressReserved, event => event.emailAddress).ignoreCasing();
44
+ removalEvents.forEach(eventType => unique.removedWith(eventType));
45
+ });
46
+ }
47
+ }
48
+ constraint('reserved-address')(ReservedAddressConstraint);
49
+ return ReservedAddressConstraint;
50
+ }
51
+
52
+ describe('when registering a unique property constraint without removal events', () => {
53
+ it('should register no removal event types', async () => {
54
+ const request = await registerConstraint(propertyConstraint());
55
+ request.Constraints[0].RemovedWith.should.deep.equal([]);
56
+ });
57
+ });
58
+
59
+ describe('when registering a unique property constraint with one removal event', () => {
60
+ it('should register the removal event type', async () => {
61
+ const request = await registerConstraint(propertyConstraint(AddressReleased));
62
+ request.Constraints[0].RemovedWith.should.deep.equal(['address-released']);
63
+ });
64
+ });
65
+
66
+ describe('when registering a unique property constraint with several removal events', () => {
67
+ let request: Awaited<ReturnType<typeof registerConstraint>>;
68
+ beforeEach(async () => {
69
+ request = await registerConstraint(propertyConstraint(AddressReleased, AddressExpired, AddressRevoked));
70
+ });
71
+
72
+ it('should register all removal event types in declaration order', () => {
73
+ request.Constraints[0].RemovedWith.should.deep.equal(['address-released', 'address-expired', 'address-revoked']);
74
+ });
75
+
76
+ it('should preserve the event properties, casing setting and scope', () => {
77
+ const registered = request.Constraints[0];
78
+ registered.Type.should.equal(ConstraintType.Unique);
79
+ registered.Definition.Value0.EventDefinitions.should.deep.equal([
80
+ { EventTypeId: 'address-reserved', Properties: ['emailAddress'] }
81
+ ]);
82
+ registered.Definition.Value0.IgnoreCasing.should.be.true;
83
+ registered.Scope.should.deep.equal({ EventSourceType: '*', EventStreamType: '*', EventStreamId: '*' });
84
+ request.EventStore.should.equal('store');
85
+ });
86
+ });
87
+
88
+ describe('when registering a unique property constraint with duplicate removal events', () => {
89
+ it('should register each event type only once in first-registration order', async () => {
90
+ const request = await registerConstraint(propertyConstraint(AddressReleased, AddressExpired, AddressReleased, AddressRevoked, AddressExpired));
91
+ request.Constraints[0].RemovedWith.should.deep.equal(['address-released', 'address-expired', 'address-revoked']);
92
+ });
93
+ });
94
+
95
+ describe('when registering a legacy single-field unique property capture', () => {
96
+ it('should retain the singular removal event type', async () => {
97
+ class LegacyConstraint implements IConstraint {
98
+ define(builder: IConstraintBuilder): void {
99
+ (builder as ConstraintBuilder).capture.uniqueConstraint = {
100
+ eventDefinitions: [{ eventTypeId: 'address-reserved', properties: ['emailAddress'] }],
101
+ ignoreCasing: false,
102
+ removedWithEventTypeId: 'address-released'
103
+ };
104
+ }
105
+ }
106
+ constraint('legacy-address')(LegacyConstraint);
107
+ const request = await registerConstraint(LegacyConstraint);
108
+ request.Constraints[0].RemovedWith.should.deep.equal(['address-released']);
109
+ });
110
+ });
111
+
112
+ describe('when registering a unique property capture with legacy and accumulated removal events', () => {
113
+ it('should retain both the legacy event and new events without duplicates', async () => {
114
+ class MixedCaptureConstraint implements IConstraint {
115
+ define(builder: IConstraintBuilder): void {
116
+ (builder as ConstraintBuilder).capture.uniqueConstraint = {
117
+ eventDefinitions: [{ eventTypeId: 'address-reserved', properties: ['emailAddress'] }],
118
+ ignoreCasing: false,
119
+ removedWithEventTypeId: 'address-released',
120
+ removedWithEventTypeIds: ['address-expired', 'address-revoked', 'address-expired']
121
+ };
122
+ }
123
+ }
124
+ constraint('mixed-address')(MixedCaptureConstraint);
125
+ const request = await registerConstraint(MixedCaptureConstraint);
126
+ request.Constraints[0].RemovedWith.should.deep.equal(['address-released', 'address-expired', 'address-revoked']);
127
+ });
128
+ });
129
+
130
+ describe('when capturing several removal events through the fluent builder', () => {
131
+ it('should retain the last event in the legacy singular field', () => {
132
+ const builder = new ConstraintBuilder('reserved-address');
133
+ builder.unique(unique => unique.removedWith(AddressReleased).removedWith(AddressExpired));
134
+ should.equal(builder.capture.uniqueConstraint?.removedWithEventTypeId, 'address-expired');
135
+ builder.capture.uniqueConstraint!.removedWithEventTypeIds!.should.deep.equal(['address-released', 'address-expired']);
136
+ });
137
+ });
package/index.ts CHANGED
@@ -23,6 +23,7 @@ import * as correlation from './correlation';
23
23
  import * as transactions from './transactions';
24
24
  import * as eventStoreSubscriptions from './eventStoreSubscriptions';
25
25
  import * as compliance from './compliance';
26
+ import * as confidentiality from './confidentiality';
26
27
 
27
28
  export { ChronicleClient } from './ChronicleClient';
28
29
  export { IncompatibleChronicleServer } from './connection/IncompatibleChronicleServer';
@@ -58,6 +59,7 @@ export * from './correlation';
58
59
  export * from './transactions';
59
60
  export * from './eventStoreSubscriptions';
60
61
  export * from './compliance';
62
+ export * from './confidentiality';
61
63
 
62
64
  export {
63
65
  events,
@@ -82,4 +84,5 @@ export {
82
84
  transactions,
83
85
  eventStoreSubscriptions,
84
86
  compliance,
87
+ confidentiality,
85
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/chronicle",
3
- "version": "6.2.0",
3
+ "version": "6.3.1",
4
4
  "description": "Event sourcing for TypeScript and Node.js — the idiomatic client for Cratis Chronicle, the open-source event-sourcing database",
5
5
  "author": "Cratis",
6
6
  "license": "MIT",
@@ -61,6 +61,11 @@
61
61
  "import": "./dist/compliance/index.js",
62
62
  "default": "./dist/compliance/index.js"
63
63
  },
64
+ "./confidentiality": {
65
+ "types": "./dist/confidentiality/index.d.ts",
66
+ "import": "./dist/confidentiality/index.js",
67
+ "default": "./dist/confidentiality/index.js"
68
+ },
64
69
  "./reactors": {
65
70
  "types": "./dist/reactors/index.d.ts",
66
71
  "import": "./dist/reactors/index.js",
@@ -160,7 +165,7 @@
160
165
  },
161
166
  "dependencies": {
162
167
  "@bufbuild/protobuf": "^2.15.0",
163
- "@cratis/chronicle.contracts": "19.0.1",
168
+ "@cratis/chronicle.contracts": "19.4.0",
164
169
  "@grpc/grpc-js": "^1.14.4",
165
170
  "@opentelemetry/api": "^1.9.1",
166
171
  "nice-grpc": "^2.1.17",