@cratis/arc 22.143.0 → 22.144.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/commands/Command.ts +6 -0
  2. package/commands/for_Command/PayInvoice.ts +20 -0
  3. package/commands/for_Command/when_getting_the_slice_location.ts +21 -0
  4. package/dist/cjs/commands/Command.d.ts +2 -0
  5. package/dist/cjs/commands/Command.d.ts.map +1 -1
  6. package/dist/cjs/commands/Command.js +4 -0
  7. package/dist/cjs/commands/Command.js.map +1 -1
  8. package/dist/cjs/queries/ObservableQueryFor.d.ts +2 -0
  9. package/dist/cjs/queries/ObservableQueryFor.d.ts.map +1 -1
  10. package/dist/cjs/queries/ObservableQueryFor.js +4 -0
  11. package/dist/cjs/queries/ObservableQueryFor.js.map +1 -1
  12. package/dist/cjs/queries/QueryFor.d.ts +2 -0
  13. package/dist/cjs/queries/QueryFor.d.ts.map +1 -1
  14. package/dist/cjs/queries/QueryFor.js +4 -0
  15. package/dist/cjs/queries/QueryFor.js.map +1 -1
  16. package/dist/cjs/reflection/SliceLocation.d.ts +12 -0
  17. package/dist/cjs/reflection/SliceLocation.d.ts.map +1 -0
  18. package/dist/cjs/reflection/SliceLocation.js +76 -0
  19. package/dist/cjs/reflection/SliceLocation.js.map +1 -0
  20. package/dist/cjs/reflection/index.d.ts +1 -0
  21. package/dist/cjs/reflection/index.d.ts.map +1 -1
  22. package/dist/cjs/reflection/index.js +2 -0
  23. package/dist/cjs/reflection/index.js.map +1 -1
  24. package/dist/esm/commands/Command.d.ts +2 -0
  25. package/dist/esm/commands/Command.d.ts.map +1 -1
  26. package/dist/esm/commands/Command.js +4 -0
  27. package/dist/esm/commands/Command.js.map +1 -1
  28. package/dist/esm/commands/for_Command/PayInvoice.d.ts +11 -0
  29. package/dist/esm/commands/for_Command/PayInvoice.d.ts.map +1 -0
  30. package/dist/esm/commands/for_Command/PayInvoice.js +14 -0
  31. package/dist/esm/commands/for_Command/PayInvoice.js.map +1 -0
  32. package/dist/esm/commands/for_Command/when_getting_the_slice_location.d.ts +2 -0
  33. package/dist/esm/commands/for_Command/when_getting_the_slice_location.d.ts.map +1 -0
  34. package/dist/esm/commands/for_Command/when_getting_the_slice_location.js +15 -0
  35. package/dist/esm/commands/for_Command/when_getting_the_slice_location.js.map +1 -0
  36. package/dist/esm/queries/ObservableQueryFor.d.ts +2 -0
  37. package/dist/esm/queries/ObservableQueryFor.d.ts.map +1 -1
  38. package/dist/esm/queries/ObservableQueryFor.js +4 -0
  39. package/dist/esm/queries/ObservableQueryFor.js.map +1 -1
  40. package/dist/esm/queries/QueryFor.d.ts +2 -0
  41. package/dist/esm/queries/QueryFor.d.ts.map +1 -1
  42. package/dist/esm/queries/QueryFor.js +4 -0
  43. package/dist/esm/queries/QueryFor.js.map +1 -1
  44. package/dist/esm/queries/for_ObservableQueryFor/when_getting_the_slice_location.d.ts +2 -0
  45. package/dist/esm/queries/for_ObservableQueryFor/when_getting_the_slice_location.d.ts.map +1 -0
  46. package/dist/esm/queries/for_ObservableQueryFor/when_getting_the_slice_location.js +27 -0
  47. package/dist/esm/queries/for_ObservableQueryFor/when_getting_the_slice_location.js.map +1 -0
  48. package/dist/esm/queries/for_QueryFor/when_getting_the_slice_location.d.ts +2 -0
  49. package/dist/esm/queries/for_QueryFor/when_getting_the_slice_location.d.ts.map +1 -0
  50. package/dist/esm/queries/for_QueryFor/when_getting_the_slice_location.js +27 -0
  51. package/dist/esm/queries/for_QueryFor/when_getting_the_slice_location.js.map +1 -0
  52. package/dist/esm/reflection/SliceLocation.d.ts +12 -0
  53. package/dist/esm/reflection/SliceLocation.d.ts.map +1 -0
  54. package/dist/esm/reflection/SliceLocation.js +74 -0
  55. package/dist/esm/reflection/SliceLocation.js.map +1 -0
  56. package/dist/esm/reflection/for_SliceLocation/when_converting_to_string.d.ts +2 -0
  57. package/dist/esm/reflection/for_SliceLocation/when_converting_to_string.d.ts.map +1 -0
  58. package/dist/esm/reflection/for_SliceLocation/when_converting_to_string.js +6 -0
  59. package/dist/esm/reflection/for_SliceLocation/when_converting_to_string.js.map +1 -0
  60. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_a_type.d.ts +2 -0
  61. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_a_type.d.ts.map +1 -0
  62. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_a_type.js +29 -0
  63. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_a_type.js.map +1 -0
  64. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_none.d.ts +2 -0
  65. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_none.d.ts.map +1 -0
  66. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_none.js +14 -0
  67. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_none.js.map +1 -0
  68. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_one.d.ts +2 -0
  69. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_one.d.ts.map +1 -0
  70. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_one.js +12 -0
  71. package/dist/esm/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_one.js.map +1 -0
  72. package/dist/esm/reflection/index.d.ts +1 -0
  73. package/dist/esm/reflection/index.d.ts.map +1 -1
  74. package/dist/esm/reflection/index.js +1 -0
  75. package/dist/esm/reflection/index.js.map +1 -1
  76. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  77. package/package.json +3 -3
  78. package/queries/ObservableQueryFor.ts +6 -0
  79. package/queries/QueryFor.ts +6 -0
  80. package/queries/for_ObservableQueryFor/when_getting_the_slice_location.ts +37 -0
  81. package/queries/for_QueryFor/when_getting_the_slice_location.ts +37 -0
  82. package/reflection/SliceLocation.ts +78 -0
  83. package/reflection/for_SliceLocation/when_converting_to_string.ts +9 -0
  84. package/reflection/for_SliceLocation/when_getting_it_of_a_type.ts +38 -0
  85. package/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_none.ts +20 -0
  86. package/reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_one.ts +18 -0
  87. package/reflection/index.ts +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_getting_the_slice_location.js","sourceRoot":"","sources":["../../../../queries/for_QueryFor/when_getting_the_slice_location.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,MAAM,WAAY,SAAQ,QAAkB;IACxC,MAAM,CAAU,aAAa,GAAkB,IAAI,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IAC1F,KAAK,GAAG,uBAAuB,CAAC;IAChC,YAAY,GAAa,EAAE,CAAC;IAC5B,oBAAoB,GAA0B,EAAE,CAAC;IAE1D,IAAI,yBAAyB;QACzB,OAAO,EAAE,CAAC;IACd,CAAC;IAED;QACI,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACxB,CAAC;CACJ;AAED,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC7C,IAAI,QAAmC,CAAC;IACxC,IAAI,UAAqC,CAAC;IAE1C,UAAU,CAAC,GAAG,EAAE;QACZ,MAAM,KAAK,GAAW,IAAI,WAAW,EAAE,CAAC;QACxC,QAAQ,GAAG,aAAa,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACnC,UAAU,GAAG,aAAa,CAAC,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE,CAAC,QAAS,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1H,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE,CAAC,UAAW,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AACnI,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type SliceLocationDeclaringType = abstract new (...args: never[]) => unknown;
2
+ export declare class SliceLocation {
3
+ readonly module: string;
4
+ readonly feature: string;
5
+ readonly slice: string;
6
+ static readonly empty: SliceLocation;
7
+ constructor(module: string, feature: string, slice: string);
8
+ static of(instance: object): SliceLocation;
9
+ static ofType(type: SliceLocationDeclaringType): SliceLocation;
10
+ toString(): string;
11
+ }
12
+ //# sourceMappingURL=SliceLocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SliceLocation.d.ts","sourceRoot":"","sources":["../../../reflection/SliceLocation.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,0BAA0B,GAAG,QAAQ,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC;AAqBpF,qBAAa,aAAa;IAYV,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM;IARrF,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAiC;IAQrE,YAAqB,MAAM,EAAE,MAAM,EAAW,OAAO,EAAE,MAAM,EAAW,KAAK,EAAE,MAAM,EACpF;IAOD,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAEzC;IAOD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,0BAA0B,GAAG,aAAa,CAY7D;IAMD,QAAQ,IAAI,MAAM,CAEjB;CACJ"}
@@ -0,0 +1,74 @@
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
+ * Represents a class, abstract or concrete, that may declare a static `sliceLocation` member.
5
+ */ function isSliceLocationShaped(value) {
6
+ if (typeof value !== 'object' || value === null) {
7
+ return false;
8
+ }
9
+ const candidate = value;
10
+ return typeof candidate.module === 'string' && typeof candidate.feature === 'string' && typeof candidate.slice === 'string';
11
+ }
12
+ /**
13
+ * Represents where a command or query lives: the module, feature and slice resolved from its backend namespace.
14
+ * @remarks
15
+ * Generated proxies carry it as the static `sliceLocation` member, resolved from the same namespace mapping as the
16
+ * folder the proxy is generated to. When the namespace is too shallow for all three parts, the deepest parts are
17
+ * filled and the rest are empty strings, never null.
18
+ *
19
+ * The location is static metadata on the proxy class only. Instances carry no `sliceLocation` member, because a
20
+ * command or query may itself have a property named `SliceLocation`, which the generated accessor would clash with.
21
+ * Read it with {@link SliceLocation.of} for an instance or {@link SliceLocation.ofType} for a class.
22
+ */ class SliceLocation {
23
+ module;
24
+ feature;
25
+ slice;
26
+ /**
27
+ * Gets a slice location where every part is empty.
28
+ */ static empty = new SliceLocation('', '', '');
29
+ /**
30
+ * Initializes a new instance of the {@link SliceLocation} class.
31
+ * @param module The module the slice belongs to.
32
+ * @param feature The feature the slice belongs to.
33
+ * @param slice The slice itself.
34
+ */ constructor(module, feature, slice){
35
+ this.module = module;
36
+ this.feature = feature;
37
+ this.slice = slice;
38
+ }
39
+ /**
40
+ * Gets the slice location declared on the class of an instance, such as a generated command or query proxy.
41
+ * @param instance The instance to get for.
42
+ * @returns The declared {@link SliceLocation}, or {@link SliceLocation.empty} when the class declares none.
43
+ */ static of(instance) {
44
+ return SliceLocation.ofType(instance.constructor);
45
+ }
46
+ /**
47
+ * Gets the slice location declared as the static `sliceLocation` member of a type, such as a generated command or query proxy class.
48
+ * @param type The type to get for.
49
+ * @returns The declared {@link SliceLocation}, or {@link SliceLocation.empty} when the type declares none.
50
+ */ static ofType(type) {
51
+ const declared = type.sliceLocation;
52
+ if (declared instanceof SliceLocation) {
53
+ return declared;
54
+ }
55
+ // A proxy compiled against another copy of @cratis/arc carries an instance of that copy's class.
56
+ if (isSliceLocationShaped(declared)) {
57
+ return new SliceLocation(declared.module, declared.feature, declared.slice);
58
+ }
59
+ return SliceLocation.empty;
60
+ }
61
+ /**
62
+ * Gets the parts that are set, joined with a forward slash.
63
+ * @returns The slice location as a path, for example `Billing/Invoices/Pay`.
64
+ */ toString() {
65
+ return [
66
+ this.module,
67
+ this.feature,
68
+ this.slice
69
+ ].filter((part)=>part.length > 0).join('/');
70
+ }
71
+ }
72
+
73
+ export { SliceLocation };
74
+ //# sourceMappingURL=SliceLocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SliceLocation.js","sources":["../../../reflection/SliceLocation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Represents a class, abstract or concrete, that may declare a static `sliceLocation` member.\n */\nexport type SliceLocationDeclaringType = abstract new (...args: never[]) => unknown;\n\nfunction isSliceLocationShaped(value: unknown): value is { module: string, feature: string, slice: string } {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n const candidate = value as Record<string, unknown>;\n return typeof candidate.module === 'string' && typeof candidate.feature === 'string' && typeof candidate.slice === 'string';\n}\n\n/**\n * Represents where a command or query lives: the module, feature and slice resolved from its backend namespace.\n * @remarks\n * Generated proxies carry it as the static `sliceLocation` member, resolved from the same namespace mapping as the\n * folder the proxy is generated to. When the namespace is too shallow for all three parts, the deepest parts are\n * filled and the rest are empty strings, never null.\n *\n * The location is static metadata on the proxy class only. Instances carry no `sliceLocation` member, because a\n * command or query may itself have a property named `SliceLocation`, which the generated accessor would clash with.\n * Read it with {@link SliceLocation.of} for an instance or {@link SliceLocation.ofType} for a class.\n */\nexport class SliceLocation {\n /**\n * Gets a slice location where every part is empty.\n */\n static readonly empty: SliceLocation = new SliceLocation('', '', '');\n\n /**\n * Initializes a new instance of the {@link SliceLocation} class.\n * @param module The module the slice belongs to.\n * @param feature The feature the slice belongs to.\n * @param slice The slice itself.\n */\n constructor(readonly module: string, readonly feature: string, readonly slice: string) {\n }\n\n /**\n * Gets the slice location declared on the class of an instance, such as a generated command or query proxy.\n * @param instance The instance to get for.\n * @returns The declared {@link SliceLocation}, or {@link SliceLocation.empty} when the class declares none.\n */\n static of(instance: object): SliceLocation {\n return SliceLocation.ofType(instance.constructor as SliceLocationDeclaringType);\n }\n\n /**\n * Gets the slice location declared as the static `sliceLocation` member of a type, such as a generated command or query proxy class.\n * @param type The type to get for.\n * @returns The declared {@link SliceLocation}, or {@link SliceLocation.empty} when the type declares none.\n */\n static ofType(type: SliceLocationDeclaringType): SliceLocation {\n const declared = (type as { sliceLocation?: unknown }).sliceLocation;\n if (declared instanceof SliceLocation) {\n return declared;\n }\n\n // A proxy compiled against another copy of @cratis/arc carries an instance of that copy's class.\n if (isSliceLocationShaped(declared)) {\n return new SliceLocation(declared.module, declared.feature, declared.slice);\n }\n\n return SliceLocation.empty;\n }\n\n /**\n * Gets the parts that are set, joined with a forward slash.\n * @returns The slice location as a path, for example `Billing/Invoices/Pay`.\n */\n toString(): string {\n return [this.module, this.feature, this.slice].filter(part => part.length > 0).join('/');\n }\n}\n"],"names":["isSliceLocationShaped","value","candidate","module","feature","slice","SliceLocation","empty","of","instance","ofType","type","declared","sliceLocation","toString","filter","part","length","join"],"mappings":"AAAA;AACA;AAEA;;IAKA,SAASA,sBAAsBC,KAAc,EAAA;AACzC,IAAA,IAAI,OAAOA,KAAAA,KAAU,QAAA,IAAYA,KAAAA,KAAU,IAAA,EAAM;QAC7C,OAAO,KAAA;AACX,IAAA;AACA,IAAA,MAAMC,SAAAA,GAAYD,KAAAA;AAClB,IAAA,OAAO,OAAOC,SAAAA,CAAUC,MAAM,KAAK,QAAA,IAAY,OAAOD,SAAAA,CAAUE,OAAO,KAAK,QAAA,IAAY,OAAOF,SAAAA,CAAUG,KAAK,KAAK,QAAA;AACvH;AAEA;;;;;;;;;;AAUC,IACM,MAAMC,aAAAA,CAAAA;;;;AACT;;AAEC,QACD,OAAgBC,KAAAA,GAAuB,IAAID,aAAAA,CAAc,EAAA,EAAI,IAAI,EAAA,CAAA;AAEjE;;;;;QAMA,WAAA,CAAY,MAAuB,EAAE,OAAwB,EAAE,KAAsB,CAAE;aAAlEH,MAAAA,GAAAA,MAAAA;aAAyBC,OAAAA,GAAAA,OAAAA;aAA0BC,KAAAA,GAAAA,KAAAA;AACxE,IAAA;AAEA;;;;QAKA,OAAOG,EAAAA,CAAGC,QAAgB,EAAiB;AACvC,QAAA,OAAOH,aAAAA,CAAcI,MAAM,CAACD,QAAAA,CAAS,WAAW,CAAA;AACpD,IAAA;AAEA;;;;QAKA,OAAOC,MAAAA,CAAOC,IAAgC,EAAiB;QAC3D,MAAMC,QAAAA,GAAW,IAACD,CAAqCE,aAAa;AACpE,QAAA,IAAID,oBAAoBN,aAAAA,EAAe;YACnC,OAAOM,QAAAA;AACX,QAAA;;AAGA,QAAA,IAAIZ,sBAAsBY,QAAAA,CAAAA,EAAW;YACjC,OAAO,IAAIN,cAAcM,QAAAA,CAAST,MAAM,EAAES,QAAAA,CAASR,OAAO,EAAEQ,QAAAA,CAASP,KAAK,CAAA;AAC9E,QAAA;AAEA,QAAA,OAAOC,cAAcC,KAAK;AAC9B,IAAA;AAEA;;;AAGC,QACDO,QAAAA,GAAmB;QACf,OAAO;AAAC,YAAA,IAAI,CAACX,MAAM;AAAE,YAAA,IAAI,CAACC,OAAO;AAAE,YAAA,IAAI,CAACC;SAAM,CAACU,MAAM,CAACC,CAAAA,IAAAA,GAAQA,KAAKC,MAAM,GAAG,CAAA,CAAA,CAAGC,IAAI,CAAC,GAAA,CAAA;AACxF,IAAA;AACJ;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_converting_to_string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_converting_to_string.d.ts","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_converting_to_string.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { SliceLocation } from '../SliceLocation.js';
2
+ describe('when converting to string', () => {
3
+ it('should join all parts with a forward slash', () => new SliceLocation('Billing', 'Invoices', 'Pay').toString().should.equal('Billing/Invoices/Pay'));
4
+ it('should leave out empty parts', () => new SliceLocation('', 'Invoices', 'Pay').toString().should.equal('Invoices/Pay'));
5
+ });
6
+ //# sourceMappingURL=when_converting_to_string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_converting_to_string.js","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_converting_to_string.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACxJ,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAC/H,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_getting_it_of_a_type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_getting_it_of_a_type.d.ts","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_getting_it_of_a_type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import { SliceLocation } from '../SliceLocation.js';
2
+ class Declaring {
3
+ static sliceLocation = new SliceLocation('Billing', 'Invoices', 'Pay');
4
+ }
5
+ class NotDeclaring {
6
+ }
7
+ class DeclaringOneFromAnotherCopy {
8
+ static sliceLocation = { module: 'Billing', feature: 'Invoices', slice: 'Refund' };
9
+ }
10
+ class DeclaringSomethingElse {
11
+ static sliceLocation = 'Billing/Invoices/Pay';
12
+ }
13
+ describe('when getting it of a type', () => {
14
+ let declared;
15
+ let undeclared;
16
+ let notASliceLocation;
17
+ let fromAnotherCopy;
18
+ beforeEach(() => {
19
+ declared = SliceLocation.ofType(Declaring);
20
+ undeclared = SliceLocation.ofType(NotDeclaring);
21
+ notASliceLocation = SliceLocation.ofType(DeclaringSomethingElse);
22
+ fromAnotherCopy = SliceLocation.ofType(DeclaringOneFromAnotherCopy);
23
+ });
24
+ it('should return the declared slice location', () => declared.should.equal(Declaring.sliceLocation));
25
+ it('should return the empty slice location when the type declares none', () => undeclared.should.equal(SliceLocation.empty));
26
+ it('should return a slice location with the parts declared by another copy of the class', () => fromAnotherCopy.should.deep.equal(new SliceLocation('Billing', 'Invoices', 'Refund')));
27
+ it('should return the empty slice location when the static member is not a slice location', () => notASliceLocation.should.equal(SliceLocation.empty));
28
+ });
29
+ //# sourceMappingURL=when_getting_it_of_a_type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_getting_it_of_a_type.js","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_getting_it_of_a_type.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAe,SAAS;IACpB,MAAM,CAAU,aAAa,GAAkB,IAAI,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;CAClG;AAED,MAAM,YAAY;CACjB;AAED,MAAM,2BAA2B;IAC7B,MAAM,CAAU,aAAa,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;CAC/F;AAED,MAAM,sBAAsB;IACxB,MAAM,CAAU,aAAa,GAAG,sBAAsB,CAAC;CAC1D;AAED,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACvC,IAAI,QAAuB,CAAC;IAC5B,IAAI,UAAyB,CAAC;IAC9B,IAAI,iBAAgC,CAAC;IACrC,IAAI,eAA8B,CAAC;IAEnC,UAAU,CAAC,GAAG,EAAE;QACZ,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC3C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAChD,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;QACjE,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;IACtG,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7H,EAAE,CAAC,qFAAqF,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvL,EAAE,CAAC,uFAAuF,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3J,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_getting_it_of_an_instance_whose_class_declares_none.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_getting_it_of_an_instance_whose_class_declares_none.d.ts","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_none.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { SliceLocation } from '../SliceLocation.js';
2
+ class NotDeclaring {
3
+ }
4
+ describe('when getting it of an instance whose class declares none', () => {
5
+ let result;
6
+ beforeEach(() => {
7
+ result = SliceLocation.of(new NotDeclaring());
8
+ });
9
+ it('should return the empty slice location', () => result.should.equal(SliceLocation.empty));
10
+ it('should have an empty module', () => result.module.should.equal(''));
11
+ it('should have an empty feature', () => result.feature.should.equal(''));
12
+ it('should have an empty slice', () => result.slice.should.equal(''));
13
+ });
14
+ //# sourceMappingURL=when_getting_it_of_an_instance_whose_class_declares_none.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_getting_it_of_an_instance_whose_class_declares_none.js","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_none.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,YAAY;CACjB;AAED,QAAQ,CAAC,0DAA0D,EAAE,GAAG,EAAE;IACtE,IAAI,MAAqB,CAAC;IAE1B,UAAU,CAAC,GAAG,EAAE;QACZ,MAAM,GAAG,aAAa,CAAC,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7F,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACxE,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1E,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_getting_it_of_an_instance_whose_class_declares_one.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_getting_it_of_an_instance_whose_class_declares_one.d.ts","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_one.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { SliceLocation } from '../SliceLocation.js';
2
+ class Declaring {
3
+ static sliceLocation = new SliceLocation('Billing', 'Invoices', 'Pay');
4
+ }
5
+ describe('when getting it of an instance whose class declares one', () => {
6
+ let result;
7
+ beforeEach(() => {
8
+ result = SliceLocation.of(new Declaring());
9
+ });
10
+ it('should return the declared slice location', () => result.should.equal(Declaring.sliceLocation));
11
+ });
12
+ //# sourceMappingURL=when_getting_it_of_an_instance_whose_class_declares_one.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_getting_it_of_an_instance_whose_class_declares_one.js","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_getting_it_of_an_instance_whose_class_declares_one.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,SAAS;IACX,MAAM,CAAU,aAAa,GAAkB,IAAI,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;CAClG;AAED,QAAQ,CAAC,yDAAyD,EAAE,GAAG,EAAE;IACrE,IAAI,MAAqB,CAAC;IAE1B,UAAU,CAAC,GAAG,EAAE;QACZ,MAAM,GAAG,aAAa,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;AACxG,CAAC,CAAC,CAAC"}
@@ -2,4 +2,5 @@ export * from './IHaveParameters.js';
2
2
  export * from './ParameterDescriptor.js';
3
3
  export * from './ParametersHelper.js';
4
4
  export * from './PropertyDescriptor.js';
5
+ export * from './SliceLocation.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../reflection/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../reflection/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export { ParameterDescriptor } from './ParameterDescriptor.js';
2
2
  export { ParametersHelper } from './ParametersHelper.js';
3
3
  export { PropertyDescriptor } from './PropertyDescriptor.js';
4
+ export { SliceLocation } from './SliceLocation.js';
4
5
 
5
6
  // Copyright (c) Cratis. All rights reserved.
6
7
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../reflection/index.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport * from './IHaveParameters.js';\nexport * from './ParameterDescriptor.js';\nexport * from './ParametersHelper.js';\nexport * from './PropertyDescriptor.js';\n"],"names":[],"mappings":";;;;AAAA;AACA"}
1
+ {"version":3,"file":"index.js","sources":["../../../reflection/index.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport * from './IHaveParameters.js';\nexport * from './ParameterDescriptor.js';\nexport * from './ParametersHelper.js';\nexport * from './PropertyDescriptor.js';\nexport * from './SliceLocation.js';\n"],"names":[],"mappings":";;;;;AAAA;AACA"}