@cratis/chronicle 6.67.2 → 6.67.4

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 (35) hide show
  1. package/dist/testing/EventScenario.d.ts.map +1 -1
  2. package/dist/testing/EventScenario.js +102 -51
  3. package/dist/testing/EventScenario.js.map +1 -1
  4. package/dist/testing/InProcessConstraints.d.ts +2 -1
  5. package/dist/testing/InProcessConstraints.d.ts.map +1 -1
  6. package/dist/testing/InProcessConstraints.js +8 -4
  7. package/dist/testing/InProcessConstraints.js.map +1 -1
  8. package/dist/testing/InProcessEventSequence.d.ts.map +1 -1
  9. package/dist/testing/InProcessEventSequence.js +4 -2
  10. package/dist/testing/InProcessEventSequence.js.map +1 -1
  11. package/dist/testing/PropertyDefinitionSupport.d.ts +5 -0
  12. package/dist/testing/PropertyDefinitionSupport.d.ts.map +1 -0
  13. package/dist/testing/PropertyDefinitionSupport.js +37 -0
  14. package/dist/testing/PropertyDefinitionSupport.js.map +1 -0
  15. package/dist/tsconfig.tsbuildinfo +1 -1
  16. package/package.json +1 -1
  17. package/testing/EventScenario.constraint-composite.spec.ts +1 -1
  18. package/testing/EventScenario.constraint-cycles.spec.ts +1 -1
  19. package/testing/EventScenario.fixtures.spec.ts +2 -1
  20. package/testing/EventScenario.ts +119 -59
  21. package/testing/InProcessConstraints.ts +7 -4
  22. package/testing/InProcessEventSequence.ts +5 -2
  23. package/testing/PropertyDefinitionSupport.ts +36 -0
  24. package/testing/for_EventScenario/when_appending_event_sequence_constraints/event_sequence_scenario_behaviors.fixture.ts +1 -1
  25. package/testing/for_EventScenario/when_appending_event_sequence_constraints/with_legacy_decorators.legacy.spec.ts +7 -3
  26. package/testing/for_EventScenario/when_appending_event_sequence_constraints/with_standard_decorators.standard.spec.ts +7 -3
  27. package/testing/for_EventScenario/when_appending_field_combinations/combination_behaviors.fixture.ts +122 -0
  28. package/testing/for_EventScenario/when_appending_field_combinations/definition_rejection_behaviors.fixture.ts +116 -0
  29. package/testing/for_EventScenario/when_appending_field_combinations/removal_and_overlap.legacy.spec.ts +36 -0
  30. package/testing/for_EventScenario/when_appending_field_combinations/removal_and_overlap.standard.spec.ts +35 -0
  31. package/testing/for_EventScenario/when_appending_field_combinations/removal_and_overlap_behaviors.fixture.ts +193 -0
  32. package/testing/for_EventScenario/when_appending_field_combinations/with_legacy_decorators.legacy.spec.ts +35 -0
  33. package/testing/for_EventScenario/when_appending_field_combinations/with_standard_decorators.standard.spec.ts +34 -0
  34. package/testing/for_EventScenario/when_appending_field_types/with_unproven_schemas.legacy.spec.ts +2 -4
  35. package/testing/for_EventScenario/when_appending_scoped_constraints/with_unproven_operations.spec.ts +1 -1
@@ -0,0 +1,35 @@
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 'reflect-metadata';
5
+ import { field, Guid } from '@cratis/fundamentals';
6
+ import { describe } from 'vitest';
7
+ import { eventType } from '../../../events/eventTypeDecorator.js';
8
+ import { combinationBehaviors } from './combination_behaviors.fixture.js';
9
+ import { definitionRejectionBehaviors } from './definition_rejection_behaviors.fixture.js';
10
+
11
+ @eventType('OracleCombinedNumber')
12
+ class NumberKey {
13
+ @field(Number) key = -7;
14
+ @field(String) suffix = 'Alpha';
15
+ @field(Guid) identifier = Guid.parse('abcdef01-abcd-abcd-abcd-abcdef012345');
16
+ }
17
+ @eventType('OracleCombinedGuid')
18
+ class GuidKey {
19
+ @field(Guid) key = Guid.parse('abcdef01-abcd-abcd-abcd-abcdef012345');
20
+ @field(String) suffix = 'Alpha';
21
+ @field(Number) amount = -7;
22
+ }
23
+ @eventType('OracleCombinedText')
24
+ class TextKey { @field(String) key = ''; }
25
+ @eventType('OracleCombinedRemoved')
26
+ class Removed { @field(String) label = ''; }
27
+ @eventType('OracleCombinedBoolean')
28
+ class Flag { @field(Boolean) key = true; }
29
+ @eventType('OracleCombinedFieldless')
30
+ class Fieldless { }
31
+
32
+ describe('when appending combined Guid/numeric keys with legacy decorators', () => {
33
+ combinationBehaviors({ number: NumberKey, guid: GuidKey, string: TextKey, removed: Removed });
34
+ definitionRejectionBehaviors({ number: NumberKey, guid: GuidKey, text: TextKey, removed: Removed, flag: Flag, fieldless: Fieldless });
35
+ });
@@ -0,0 +1,34 @@
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 { field, Guid } from '@cratis/fundamentals';
5
+ import { describe } from 'vitest';
6
+ import { eventType } from '../../../events/eventTypeDecorator.js';
7
+ import { combinationBehaviors } from './combination_behaviors.fixture.js';
8
+ import { definitionRejectionBehaviors } from './definition_rejection_behaviors.fixture.js';
9
+
10
+ @eventType('OracleCombinedNumber')
11
+ class NumberKey {
12
+ @field(Number) key = -7;
13
+ @field(String) suffix = 'Alpha';
14
+ @field(Guid) identifier = Guid.parse('abcdef01-abcd-abcd-abcd-abcdef012345');
15
+ }
16
+ @eventType('OracleCombinedGuid')
17
+ class GuidKey {
18
+ @field(Guid) key = Guid.parse('abcdef01-abcd-abcd-abcd-abcdef012345');
19
+ @field(String) suffix = 'Alpha';
20
+ @field(Number) amount = -7;
21
+ }
22
+ @eventType('OracleCombinedText')
23
+ class TextKey { @field(String) key = ''; }
24
+ @eventType('OracleCombinedRemoved')
25
+ class Removed { @field(String) label = ''; }
26
+ @eventType('OracleCombinedBoolean')
27
+ class Flag { @field(Boolean) key = true; }
28
+ @eventType('OracleCombinedFieldless')
29
+ class Fieldless { }
30
+
31
+ describe('when appending combined Guid/numeric keys with standard decorators', () => {
32
+ combinationBehaviors({ number: NumberKey, guid: GuidKey, string: TextKey, removed: Removed });
33
+ definitionRejectionBehaviors({ number: NumberKey, guid: GuidKey, text: TextKey, removed: Removed, flag: Flag, fieldless: Fieldless });
34
+ });
@@ -33,17 +33,15 @@ for (const schema of [
33
33
  });
34
34
  }
35
35
 
36
- for (const mode of ['composite', 'scoped', 'ignoreCasing']) {
36
+ for (const mode of ['ignoreCasing']) {
37
37
  describe(`when registering a ${mode} Guid key without fixture evidence`, () => {
38
38
  it('should reject instead of inheriting plain-string constraint support', () => {
39
39
  class Recorded { @field(Guid) key = Guid.empty; @field(String) label = ''; }
40
40
  eventType(`UnprovenGuid${mode}`)(Recorded);
41
41
  class Definition {
42
42
  define(builder: IConstraintBuilder) {
43
- if (mode === 'scoped') builder.perEventSourceType();
44
43
  builder.unique(key => {
45
- if (mode === 'composite') key.on(Recorded, event => event.key, event => event.label);
46
- else key.on(Recorded, event => event.key);
44
+ key.on(Recorded, event => event.key);
47
45
  if (mode === 'ignoreCasing') key.ignoreCasing();
48
46
  });
49
47
  }
@@ -39,7 +39,7 @@ async function unsupported(action: () => unknown, reason: string): Promise<void>
39
39
  describe('when configuring unproven scoped property shapes', () => {
40
40
  for (const [name, configure, reason] of [
41
41
  ['covered removal', (builder: IConstraintBuilder) => builder.unique(value => value.on(Claim, event => event.key).removedWith(Claim)), 'Scoped covered-and-removal property events'],
42
- ['fieldless removal', (builder: IConstraintBuilder) => builder.unique(value => value.on(Claim, event => event.key).removedWith(Fieldless)), 'Scoped fieldless removal events']
42
+ ['fieldless removal', (builder: IConstraintBuilder) => builder.unique(value => value.on(Claim, event => event.key).removedWith(Fieldless).ignoreCasing()), 'Scoped fieldless removers require a case-sensitive single-property unique constraint']
43
43
  ] as const) {
44
44
  it(`should reject ${name} with its specific boundary rather than a compiler failure`, async () => {
45
45
  const eventTypes = name === 'fieldless removal' ? [Claim, Fieldless] : [Claim, Flag, Removed];