@cratis/arc 22.144.0 → 22.146.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.
@@ -7,6 +7,8 @@ export declare class SliceLocation {
7
7
  constructor(module: string, feature: string, slice: string);
8
8
  static of(instance: object): SliceLocation;
9
9
  static ofType(type: SliceLocationDeclaringType): SliceLocation;
10
+ get isEmpty(): boolean;
11
+ equals(other: SliceLocation): boolean;
10
12
  toString(): string;
11
13
  }
12
14
  //# sourceMappingURL=SliceLocation.d.ts.map
@@ -1 +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"}
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;IAKD,IAAI,OAAO,IAAI,OAAO,CAErB;IAOD,MAAM,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAEpC;IAMD,QAAQ,IAAI,MAAM,CAEjB;CACJ"}
@@ -60,6 +60,18 @@
60
60
  }
61
61
  return SliceLocation.empty;
62
62
  }
63
+ /**
64
+ * Gets whether every part is empty, meaning nothing is known about where something lives.
65
+ */ get isEmpty() {
66
+ return this.module.length === 0 && this.feature.length === 0 && this.slice.length === 0;
67
+ }
68
+ /**
69
+ * Checks whether another slice location has the same module, feature and slice.
70
+ * @param other The slice location to compare with.
71
+ * @returns True when all parts are equal, false otherwise.
72
+ */ equals(other) {
73
+ return this.module === other.module && this.feature === other.feature && this.slice === other.slice;
74
+ }
63
75
  /**
64
76
  * Gets the parts that are set, joined with a forward slash.
65
77
  * @returns The slice location as a path, for example `Billing/Invoices/Pay`.
@@ -1 +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;;"}
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 whether every part is empty, meaning nothing is known about where something lives.\n */\n get isEmpty(): boolean {\n return this.module.length === 0 && this.feature.length === 0 && this.slice.length === 0;\n }\n\n /**\n * Checks whether another slice location has the same module, feature and slice.\n * @param other The slice location to compare with.\n * @returns True when all parts are equal, false otherwise.\n */\n equals(other: SliceLocation): boolean {\n return this.module === other.module && this.feature === other.feature && this.slice === other.slice;\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","isEmpty","length","equals","other","toString","filter","part","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;;AAEC,QACD,IAAIO,OAAAA,GAAmB;AACnB,QAAA,OAAO,IAAI,CAACX,MAAM,CAACY,MAAM,KAAK,KAAK,IAAI,CAACX,OAAO,CAACW,MAAM,KAAK,CAAA,IAAK,IAAI,CAACV,KAAK,CAACU,MAAM,KAAK,CAAA;AAC1F,IAAA;AAEA;;;;QAKAC,MAAAA,CAAOC,KAAoB,EAAW;AAClC,QAAA,OAAO,IAAI,CAACd,MAAM,KAAKc,KAAAA,CAAMd,MAAM,IAAI,IAAI,CAACC,OAAO,KAAKa,KAAAA,CAAMb,OAAO,IAAI,IAAI,CAACC,KAAK,KAAKY,MAAMZ,KAAK;AACvG,IAAA;AAEA;;;AAGC,QACDa,QAAAA,GAAmB;QACf,OAAO;AAAC,YAAA,IAAI,CAACf,MAAM;AAAE,YAAA,IAAI,CAACC,OAAO;AAAE,YAAA,IAAI,CAACC;SAAM,CAACc,MAAM,CAACC,CAAAA,IAAAA,GAAQA,KAAKL,MAAM,GAAG,CAAA,CAAA,CAAGM,IAAI,CAAC,GAAA,CAAA;AACxF,IAAA;AACJ;;"}
@@ -7,6 +7,8 @@ export declare class SliceLocation {
7
7
  constructor(module: string, feature: string, slice: string);
8
8
  static of(instance: object): SliceLocation;
9
9
  static ofType(type: SliceLocationDeclaringType): SliceLocation;
10
+ get isEmpty(): boolean;
11
+ equals(other: SliceLocation): boolean;
10
12
  toString(): string;
11
13
  }
12
14
  //# sourceMappingURL=SliceLocation.d.ts.map
@@ -1 +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"}
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;IAKD,IAAI,OAAO,IAAI,OAAO,CAErB;IAOD,MAAM,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAEpC;IAMD,QAAQ,IAAI,MAAM,CAEjB;CACJ"}
@@ -58,6 +58,18 @@
58
58
  }
59
59
  return SliceLocation.empty;
60
60
  }
61
+ /**
62
+ * Gets whether every part is empty, meaning nothing is known about where something lives.
63
+ */ get isEmpty() {
64
+ return this.module.length === 0 && this.feature.length === 0 && this.slice.length === 0;
65
+ }
66
+ /**
67
+ * Checks whether another slice location has the same module, feature and slice.
68
+ * @param other The slice location to compare with.
69
+ * @returns True when all parts are equal, false otherwise.
70
+ */ equals(other) {
71
+ return this.module === other.module && this.feature === other.feature && this.slice === other.slice;
72
+ }
61
73
  /**
62
74
  * Gets the parts that are set, joined with a forward slash.
63
75
  * @returns The slice location as a path, for example `Billing/Invoices/Pay`.
@@ -1 +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;;"}
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 whether every part is empty, meaning nothing is known about where something lives.\n */\n get isEmpty(): boolean {\n return this.module.length === 0 && this.feature.length === 0 && this.slice.length === 0;\n }\n\n /**\n * Checks whether another slice location has the same module, feature and slice.\n * @param other The slice location to compare with.\n * @returns True when all parts are equal, false otherwise.\n */\n equals(other: SliceLocation): boolean {\n return this.module === other.module && this.feature === other.feature && this.slice === other.slice;\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","isEmpty","length","equals","other","toString","filter","part","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;;AAEC,QACD,IAAIO,OAAAA,GAAmB;AACnB,QAAA,OAAO,IAAI,CAACX,MAAM,CAACY,MAAM,KAAK,KAAK,IAAI,CAACX,OAAO,CAACW,MAAM,KAAK,CAAA,IAAK,IAAI,CAACV,KAAK,CAACU,MAAM,KAAK,CAAA;AAC1F,IAAA;AAEA;;;;QAKAC,MAAAA,CAAOC,KAAoB,EAAW;AAClC,QAAA,OAAO,IAAI,CAACd,MAAM,KAAKc,KAAAA,CAAMd,MAAM,IAAI,IAAI,CAACC,OAAO,KAAKa,KAAAA,CAAMb,OAAO,IAAI,IAAI,CAACC,KAAK,KAAKY,MAAMZ,KAAK;AACvG,IAAA;AAEA;;;AAGC,QACDa,QAAAA,GAAmB;QACf,OAAO;AAAC,YAAA,IAAI,CAACf,MAAM;AAAE,YAAA,IAAI,CAACC,OAAO;AAAE,YAAA,IAAI,CAACC;SAAM,CAACc,MAAM,CAACC,CAAAA,IAAAA,GAAQA,KAAKL,MAAM,GAAG,CAAA,CAAA,CAAGM,IAAI,CAAC,GAAA,CAAA;AACxF,IAAA;AACJ;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_checking_if_it_is_empty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_checking_if_it_is_empty.d.ts","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_checking_if_it_is_empty.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { SliceLocation } from '../SliceLocation.js';
2
+ describe('when checking if it is empty', () => {
3
+ it('should be empty when every part is empty', () => SliceLocation.empty.isEmpty.should.be.true);
4
+ it('should not be empty when only the slice is set', () => new SliceLocation('', '', 'Pay').isEmpty.should.be.false);
5
+ it('should not be empty when only the module is set', () => new SliceLocation('Billing', '', '').isEmpty.should.be.false);
6
+ });
7
+ //# sourceMappingURL=when_checking_if_it_is_empty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_checking_if_it_is_empty.js","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_checking_if_it_is_empty.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACjG,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACrH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC9H,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_comparing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_comparing.d.ts","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_comparing.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { SliceLocation } from '../SliceLocation.js';
2
+ describe('when comparing', () => {
3
+ const location = new SliceLocation('Billing', 'Invoices', 'Pay');
4
+ it('should be equal to a location with the same parts', () => location.equals(new SliceLocation('Billing', 'Invoices', 'Pay')).should.be.true);
5
+ it('should not be equal when the module differs', () => location.equals(new SliceLocation('Sales', 'Invoices', 'Pay')).should.be.false);
6
+ it('should not be equal when the feature differs', () => location.equals(new SliceLocation('Billing', 'Orders', 'Pay')).should.be.false);
7
+ it('should not be equal when the slice differs', () => location.equals(new SliceLocation('Billing', 'Invoices', 'List')).should.be.false);
8
+ });
9
+ //# sourceMappingURL=when_comparing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_comparing.js","sourceRoot":"","sources":["../../../../reflection/for_SliceLocation/when_comparing.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,MAAM,QAAQ,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAEjE,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/I,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACxI,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACzI,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC9I,CAAC,CAAC,CAAC"}