@k8ts/instruments 0.9.4 → 0.11.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 (169) hide show
  1. package/dist/core/graph/entity.d.ts +24 -5
  2. package/dist/core/graph/entity.d.ts.map +1 -1
  3. package/dist/core/graph/entity.js +11 -5
  4. package/dist/core/graph/entity.js.map +1 -1
  5. package/dist/core/graph/node.d.ts +31 -8
  6. package/dist/core/graph/node.d.ts.map +1 -1
  7. package/dist/core/graph/node.js +53 -26
  8. package/dist/core/graph/node.js.map +1 -1
  9. package/dist/core/graph/origin/entity.d.ts +9 -4
  10. package/dist/core/graph/origin/entity.d.ts.map +1 -1
  11. package/dist/core/graph/origin/entity.js +22 -2
  12. package/dist/core/graph/origin/entity.js.map +1 -1
  13. package/dist/core/graph/origin/events.d.ts +6 -6
  14. package/dist/core/graph/origin/events.d.ts.map +1 -1
  15. package/dist/core/graph/origin/exporter.d.ts +5 -4
  16. package/dist/core/graph/origin/exporter.d.ts.map +1 -1
  17. package/dist/core/graph/origin/exporter.js +9 -5
  18. package/dist/core/graph/origin/exporter.js.map +1 -1
  19. package/dist/core/graph/origin/external.d.ts +6 -2
  20. package/dist/core/graph/origin/external.d.ts.map +1 -1
  21. package/dist/core/graph/origin/external.js +4 -0
  22. package/dist/core/graph/origin/external.js.map +1 -1
  23. package/dist/core/graph/origin/kind-map/index.d.ts +7 -7
  24. package/dist/core/graph/origin/kind-map/index.d.ts.map +1 -1
  25. package/dist/core/graph/origin/kind-map/index.js +2 -2
  26. package/dist/core/graph/origin/kind-map/index.js.map +1 -1
  27. package/dist/core/graph/origin/node.d.ts +5 -5
  28. package/dist/core/graph/origin/node.d.ts.map +1 -1
  29. package/dist/core/graph/origin/origin-events.d.ts +6 -6
  30. package/dist/core/graph/origin/origin-events.d.ts.map +1 -1
  31. package/dist/core/graph/origin/tracker.d.ts +1 -1
  32. package/dist/core/graph/origin/tracker.d.ts.map +1 -1
  33. package/dist/core/graph/origin/tracker.js +2 -1
  34. package/dist/core/graph/origin/tracker.js.map +1 -1
  35. package/dist/core/graph/relation.d.ts +2 -2
  36. package/dist/core/graph/relation.d.ts.map +1 -1
  37. package/dist/core/graph/relation.js +1 -0
  38. package/dist/core/graph/relation.js.map +1 -1
  39. package/dist/core/graph/resource/api-kind/index.d.ts +51 -57
  40. package/dist/core/graph/resource/api-kind/index.d.ts.map +1 -1
  41. package/dist/core/graph/resource/api-kind/index.js +191 -205
  42. package/dist/core/graph/resource/api-kind/index.js.map +1 -1
  43. package/dist/core/graph/resource/child.d.ts +7 -6
  44. package/dist/core/graph/resource/child.d.ts.map +1 -1
  45. package/dist/core/graph/resource/child.js +3 -3
  46. package/dist/core/graph/resource/child.js.map +1 -1
  47. package/dist/core/graph/resource/entity.d.ts +8 -10
  48. package/dist/core/graph/resource/entity.d.ts.map +1 -1
  49. package/dist/core/graph/resource/entity.js +21 -11
  50. package/dist/core/graph/resource/entity.js.map +1 -1
  51. package/dist/core/graph/resource/external/base.d.ts +4 -9
  52. package/dist/core/graph/resource/external/base.d.ts.map +1 -1
  53. package/dist/core/graph/resource/external/base.js +5 -12
  54. package/dist/core/graph/resource/external/base.js.map +1 -1
  55. package/dist/core/graph/resource/external/features.d.ts +1 -10
  56. package/dist/core/graph/resource/external/features.d.ts.map +1 -1
  57. package/dist/core/graph/resource/external/props.d.ts +2 -2
  58. package/dist/core/graph/resource/external/props.d.ts.map +1 -1
  59. package/dist/core/graph/resource/node.d.ts +9 -9
  60. package/dist/core/graph/resource/node.d.ts.map +1 -1
  61. package/dist/core/graph/resource/node.js +6 -6
  62. package/dist/core/graph/resource/node.js.map +1 -1
  63. package/dist/core/graph/resource/ref-key/ref-key.d.ts +70 -7
  64. package/dist/core/graph/resource/ref-key/ref-key.d.ts.map +1 -1
  65. package/dist/core/graph/resource/ref-key/ref-key.js +47 -2
  66. package/dist/core/graph/resource/ref-key/ref-key.js.map +1 -1
  67. package/dist/core/graph/resource/reference/fw-ref-exports.d.ts +40 -9
  68. package/dist/core/graph/resource/reference/fw-ref-exports.d.ts.map +1 -1
  69. package/dist/core/graph/resource/reference/fw-ref-exports.js +47 -13
  70. package/dist/core/graph/resource/reference/fw-ref-exports.js.map +1 -1
  71. package/dist/core/graph/resource/reference/fw-ref.d.ts +41 -12
  72. package/dist/core/graph/resource/reference/fw-ref.d.ts.map +1 -1
  73. package/dist/core/graph/resource/reference/fw-ref.js +42 -10
  74. package/dist/core/graph/resource/reference/fw-ref.js.map +1 -1
  75. package/dist/core/graph/resource/reference/index.d.ts +2 -2
  76. package/dist/core/graph/resource/reference/index.d.ts.map +1 -1
  77. package/dist/core/graph/resource/reference/index.js +3 -3
  78. package/dist/core/graph/resource/reference/index.js.map +1 -1
  79. package/dist/core/graph/resource/reference/refable.d.ts +11 -12
  80. package/dist/core/graph/resource/reference/refable.d.ts.map +1 -1
  81. package/dist/core/graph/resource/top.d.ts +6 -5
  82. package/dist/core/graph/resource/top.d.ts.map +1 -1
  83. package/dist/core/graph/resource/top.js +6 -3
  84. package/dist/core/graph/resource/top.js.map +1 -1
  85. package/dist/core/manifest/index.d.ts +2 -2
  86. package/dist/core/manifest/index.d.ts.map +1 -1
  87. package/dist/core/manifest/index.js.map +1 -1
  88. package/dist/expressions/data-sources/base.d.ts +23 -0
  89. package/dist/expressions/data-sources/base.d.ts.map +1 -1
  90. package/dist/expressions/data-sources/base.js +22 -0
  91. package/dist/expressions/data-sources/base.js.map +1 -1
  92. package/dist/expressions/data-sources/env-var.d.ts +24 -1
  93. package/dist/expressions/data-sources/env-var.d.ts.map +1 -1
  94. package/dist/expressions/data-sources/env-var.js +22 -2
  95. package/dist/expressions/data-sources/env-var.js.map +1 -1
  96. package/dist/expressions/data-sources/interface.d.ts +30 -0
  97. package/dist/expressions/data-sources/interface.d.ts.map +1 -1
  98. package/dist/expressions/data-sources/local-file.d.ts +41 -3
  99. package/dist/expressions/data-sources/local-file.d.ts.map +1 -1
  100. package/dist/expressions/data-sources/local-file.js +37 -2
  101. package/dist/expressions/data-sources/local-file.js.map +1 -1
  102. package/dist/expressions/network/ports/index.d.ts +6 -6
  103. package/dist/expressions/network/ports/index.d.ts.map +1 -1
  104. package/dist/expressions/network/ports/index.js +4 -4
  105. package/dist/expressions/network/ports/index.js.map +1 -1
  106. package/dist/expressions/network/ports/map.d.ts +50 -8
  107. package/dist/expressions/network/ports/map.d.ts.map +1 -1
  108. package/dist/expressions/network/ports/map.js +34 -5
  109. package/dist/expressions/network/ports/map.js.map +1 -1
  110. package/dist/expressions/network/ports/set.d.ts +88 -13
  111. package/dist/expressions/network/ports/set.d.ts.map +1 -1
  112. package/dist/expressions/network/ports/set.js +49 -7
  113. package/dist/expressions/network/ports/set.js.map +1 -1
  114. package/dist/expressions/network/ports/tools/entry.d.ts +5 -4
  115. package/dist/expressions/network/ports/tools/entry.d.ts.map +1 -1
  116. package/dist/expressions/network/ports/tools/entry.js +1 -1
  117. package/dist/expressions/network/ports/tools/entry.js.map +1 -1
  118. package/dist/expressions/network/ports/tools/parse.d.ts +2 -2
  119. package/dist/expressions/network/ports/tools/parse.d.ts.map +1 -1
  120. package/dist/expressions/network/ports/tools/parse.js.map +1 -1
  121. package/dist/expressions/network/ports/types.d.ts +13 -22
  122. package/dist/expressions/network/ports/types.d.ts.map +1 -1
  123. package/dist/expressions/quantities/reqlem/objects.d.ts +2 -2
  124. package/dist/expressions/quantities/reqlem/objects.d.ts.map +1 -1
  125. package/dist/expressions/quantities/reqlem/objects.js +4 -4
  126. package/dist/expressions/quantities/reqlem/objects.js.map +1 -1
  127. package/dist/expressions/quantities/units/unit-parser.d.ts.map +1 -1
  128. package/dist/expressions/quantities/units/unit-parser.js +0 -1
  129. package/dist/expressions/quantities/units/unit-parser.js.map +1 -1
  130. package/package.json +5 -5
  131. package/src/core/graph/entities.md +1 -0
  132. package/src/core/graph/entity.ts +36 -9
  133. package/src/core/graph/node.ts +72 -41
  134. package/src/core/graph/origin/entity.ts +27 -7
  135. package/src/core/graph/origin/events.ts +6 -6
  136. package/src/core/graph/origin/exporter.ts +14 -12
  137. package/src/core/graph/origin/external.ts +6 -3
  138. package/src/core/graph/origin/kind-map/index.ts +13 -13
  139. package/src/core/graph/origin/node.ts +3 -3
  140. package/src/core/graph/origin/origin-events.ts +6 -6
  141. package/src/core/graph/origin/tracker.ts +2 -2
  142. package/src/core/graph/readme.md +161 -0
  143. package/src/core/graph/relation.ts +4 -2
  144. package/src/core/graph/resource/api-kind/index.ts +139 -160
  145. package/src/core/graph/resource/child.ts +7 -10
  146. package/src/core/graph/resource/entity.ts +25 -12
  147. package/src/core/graph/resource/external/base.ts +4 -12
  148. package/src/core/graph/resource/external/features.ts +0 -16
  149. package/src/core/graph/resource/external/props.ts +2 -2
  150. package/src/core/graph/resource/node.ts +8 -8
  151. package/src/core/graph/resource/ref-key/ref-key.ts +77 -11
  152. package/src/core/graph/resource/reference/fw-ref-exports.ts +69 -20
  153. package/src/core/graph/resource/reference/fw-ref.ts +75 -21
  154. package/src/core/graph/resource/reference/index.ts +2 -2
  155. package/src/core/graph/resource/reference/refable.ts +13 -18
  156. package/src/core/graph/resource/top.ts +8 -5
  157. package/src/core/manifest/index.ts +2 -2
  158. package/src/expressions/data-sources/base.ts +24 -0
  159. package/src/expressions/data-sources/env-var.ts +23 -1
  160. package/src/expressions/data-sources/interface.ts +32 -0
  161. package/src/expressions/data-sources/local-file.ts +59 -3
  162. package/src/expressions/network/ports/index.ts +7 -7
  163. package/src/expressions/network/ports/map.ts +58 -10
  164. package/src/expressions/network/ports/set.ts +100 -25
  165. package/src/expressions/network/ports/tools/entry.ts +9 -14
  166. package/src/expressions/network/ports/tools/parse.ts +3 -3
  167. package/src/expressions/network/ports/types.ts +12 -26
  168. package/src/expressions/quantities/reqlem/objects.ts +3 -3
  169. package/src/expressions/quantities/units/unit-parser.ts +0 -1
@@ -1,36 +1,27 @@
1
1
  import type { Ip4, Ip4_String } from "../ip";
2
- export interface PortSpecObj {
3
- port: Port;
4
- protocol: Protocol;
5
- }
6
- export type Port = number;
7
- export type InputPort = Port | `${Port}`;
8
- export type InputProtocol = Protocol | Lowercase<Protocol>;
9
- export type Protocol = "TCP" | "UDP";
10
- export type InputPortProto = `${Port}/${InputProtocol}`;
11
- export interface PortMapEntry {
2
+ type Port = number;
3
+ export type Port_Basic_Input = Port | `${Port}`;
4
+ export type Port_Protocol_Input = Port_Protocol | Lowercase<Port_Protocol>;
5
+ export type Port_Protocol = "TCP" | "UDP";
6
+ export type Port_WithProto_Input = `${Port}/${Port_Protocol_Input}`;
7
+ export interface Port_Mapping_Entry {
12
8
  name: string;
13
- protocol: Protocol;
9
+ protocol: Port_Protocol;
14
10
  frontend: number;
15
11
  }
16
- export interface PortSetEntry {
12
+ export interface Port_Full {
17
13
  name: string;
18
14
  port: number;
19
- protocol: Protocol;
15
+ protocol: Port_Protocol;
20
16
  hostIp?: Ip4;
21
17
  hostPort?: number;
22
18
  }
23
- export interface InputPortSetEntry {
19
+ export interface Port_Full_Input {
24
20
  port: Port;
25
- protocol: InputProtocol;
21
+ protocol: Port_Protocol_Input;
26
22
  hostIp?: Ip4_String;
27
23
  hostPort?: Port;
28
24
  }
29
- export type InputPortSetSpec = InputPortSetEntry | InputPort | InputPortProto;
30
- export type InputPortSetRecord<Names extends string = string> = {
31
- [K in Names]: InputPortSetSpec;
32
- };
33
- export type InputPortMapping<Names extends string = string> = [Names] extends [never] ? never : {
34
- [K in Names]: number | true;
35
- };
25
+ export type Port_Input = Port_Full_Input | Port_Basic_Input | Port_WithProto_Input;
26
+ export {};
36
27
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/expressions/network/ports/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAE5C,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,QAAQ,CAAA;CACr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types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAE5C,KAAK,IAAI,GAAG,MAAM,CAAA;AAClB,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,GAAG,IAAI,EAAE,CAAA;AAC/C,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC,CAAA;AAC1E,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,KAAK,CAAA;AACzC,MAAM,MAAM,oBAAoB,GAAG,GAAG,IAAI,IAAI,mBAAmB,EAAE,CAAA;AACnE,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,aAAa,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,aAAa,CAAA;IACvB,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,QAAQ,CAAC,EAAE,IAAI,CAAA;CAClB;AAED,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,gBAAgB,GAAG,oBAAoB,CAAA"}
@@ -2,7 +2,7 @@ import { type Parjser } from "parjs";
2
2
  import type { UnitParser, UnitValue } from "../units";
3
3
  import { AnyUnitParser } from "../units/unit-parser";
4
4
  import type { ReqLimit, Resources_ReqLimits_Trait, Resources_UnitMap_Trait } from "./types";
5
- export declare class Resources_Map<const RM extends Resources_UnitMap_Trait<RM>> {
5
+ export declare class Resources_UnitMap<const RM extends Resources_UnitMap_Trait<RM>> {
6
6
  private _map;
7
7
  constructor(_map: Map<string, ReqLimit>);
8
8
  toObject(): any;
@@ -16,7 +16,7 @@ export declare class ResourcesSpec<const RM extends Resources_UnitMap_Trait<RM>>
16
16
  private _parseUnitValue;
17
17
  private _parseReqLimit;
18
18
  __INPUT__: Resources_ReqLimits_Trait<RM>;
19
- parse<const R extends Resources_ReqLimits_Trait<RM>>(input: R): Resources_Map<RM>;
19
+ parse<const R extends Resources_ReqLimits_Trait<RM>>(input: R): Resources_UnitMap<RM>;
20
20
  static make<const RM extends Resources_UnitMap_Trait<RM>>(unitMap: {
21
21
  [K in keyof RM]: UnitParser<RM[K]>;
22
22
  }): ResourcesSpec<RM>;
@@ -1 +1 @@
1
- {"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../../../src/expressions/quantities/reqlem/objects.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,OAAO,CAAA;AAG5C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAE3F,qBAAa,aAAa,CAAC,KAAK,CAAC,EAAE,SAAS,uBAAuB,CAAC,EAAE,CAAC;IACvD,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC;IAE/C,QAAQ;CAqBX;AAED,qBAAa,aAAa,CAAC,KAAK,CAAC,EAAE,SAAS,uBAAuB,CAAC,EAAE,CAAC;IACnE,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC,CAAA;IAClE,QAAQ,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;IACzD,QAAQ,CA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AAC,CAAA;IAClE,QAAQ,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;IACzD,QAAQ,CAAC,cAAc,gBAAuB;IAC9C,QAAQ,CAAC,kBAAkB,4BAA4C;gBAC3D,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC;IAQ7C,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,cAAc;IAOtB,SAAS,EAAG,yBAAyB,CAAC,EAAE,CAAC,CAAA;IAEzC,KAAK,CAAC,KAAK,CAAC,CAAC,SAAS,yBAAyB,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,iBAAiB,CAAC,EAAE,CAAC;IAkCrF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,uBAAuB,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE;SAC9D,CAAC,IAAI,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KACrC;CAGJ"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResourcesSpec = exports.Resources_Map = void 0;
3
+ exports.ResourcesSpec = exports.Resources_UnitMap = void 0;
4
4
  const util_1 = require("@k8ts/metadata/util");
5
5
  const doddle_1 = require("doddle");
6
6
  const lodash_1 = require("lodash");
@@ -9,7 +9,7 @@ const combinators_1 = require("parjs/combinators");
9
9
  const error_1 = require("../../../error");
10
10
  const unit_parser_1 = require("../units/unit-parser");
11
11
  const parser_1 = require("./parser");
12
- class Resources_Map {
12
+ class Resources_UnitMap {
13
13
  _map;
14
14
  constructor(_map) {
15
15
  this._map = _map;
@@ -35,7 +35,7 @@ class Resources_Map {
35
35
  return (0, lodash_1.merge)({}, ...kubernetesForm.values());
36
36
  }
37
37
  }
38
- exports.Resources_Map = Resources_Map;
38
+ exports.Resources_UnitMap = Resources_UnitMap;
39
39
  class ResourcesSpec {
40
40
  _unitParsers;
41
41
  _reqLimitParsers;
@@ -93,7 +93,7 @@ class ResourcesSpec {
93
93
  return [key, getVal()];
94
94
  })
95
95
  .pull();
96
- return new Resources_Map(map);
96
+ return new Resources_UnitMap(map);
97
97
  }
98
98
  static make(unitMap) {
99
99
  return new ResourcesSpec((0, util_1.mapFromObject)(unitMap));
@@ -1 +1 @@
1
- {"version":3,"file":"objects.js","sourceRoot":"","sources":["../../../../src/expressions/quantities/reqlem/objects.ts"],"names":[],"mappings":";;;AAAA,8CAA8D;AAC9D,mCAA4B;AAC5B,mCAAuC;AACvC,iCAA4C;AAC5C,mDAAgD;AAChD,0CAAiD;AAEjD,sDAAoD;AACpD,qCAA+C;AAG/C,MAAa,aAAa;IACF;IAApB,YAAoB,IAA2B;QAA3B,SAAI,GAAJ,IAAI,CAAuB;IAAG,CAAC;IAEnD,QAAQ;QACJ,MAAM,cAAc,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACvD,MAAM,MAAM,GAAG,EAAS,CAAA;YACxB,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBAChB,MAAM,CAAC,QAAQ,GAAG;oBACd,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG;iBAC3B,CAAA;YACL,CAAC;YACD,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,MAAM,CAAC,MAAM,GAAG;oBACZ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG;iBACzB,CAAA;YACL,CAAC;YACD,IAAI,CAAC,IAAA,gBAAO,EAAC,MAAM,CAAC,EAAE,CAAC;gBACnB,OAAO,MAAM,CAAA;YACjB,CAAC;YACD,OAAO,SAAS,CAAA;QACpB,CAAC,CAAC,CAAA;QAEF,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,CAA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// TODO: Simplify unit parser to allow for arbitrary resources/units
13
12
  class UnitValue {
14
13
  unit;
15
14
  value;
@@ -1 +1 @@
1
- {"version":3,"file":"unit-parser.js","sourceRoot":"","sources":["../../../../src/expressions/quantities/units/unit-parser.ts"],"names":[],"mappings":";;;AAAA,iCAAiD;AACjD,mDAA8D;AAC9D,0CAAiD;AACjD,MAAM,KAAK,GAAG,IAAA,cAAM,GAAE,CAAC,IAAI,CAAC,IAAA,kBAAI,GAAE,EAAE,IAAA,uBAAS,GAAE,CAAC,CAAA;AAEhD,MAAM,UAAU,GAAG,IAAA,WAAG,GAAE,CAAC,IAAI,CACzB,IAAA,kBAAI,EAAC,KAAK,CAAC,EACX,IAAA,iBAAG,EAAC,GAAG,CAAC,EAAE;IACN,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,GAAG,CAAA;IACzB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AAC1B,CAAC,CAAC,CACL,CAAA;AACD,oEAAoE;AACpE,MAAa,SAAS;IAEL;IACA;IACA;IAHb,YACa,IAAU,EACV,KAAa,EACb,IAAY;QAFZ,SAAI,GAAJ,IAAI,CAAM;QACV,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAQ;IACtB,CAAC;IAEJ,IAAI,GAAG;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IACtC,CAAC;IAED,IAAI,GAAG;QACH,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,KAAK,CAAA;QACtB,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAA;IACnB,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,GAAG,CAAA;IACnB,CAAC;CACJ;AArBD,8BAqBC;AAED,MAAsB,UAAU;IAGG;IAFtB,MAAM,CAA0B;IAEzC,YAA+B,SAAiB;QAAjB,cAAS,GAAT,SAAS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AAM,IAAI,wBAAgB,CAAC,QAAQ,IAAI,gCAAgC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;QAC5F,CAAC;IACL,CAAC;IAED,MAAM,CAAC,IAAI,CAA4B,QAAgB,EAAE,KAAgB;QACrE,OAAO,IAAI,aAAa,CAAO,QAAQ,EAAE,KAAK,CAAC,CAAA;IACnD,CAAC;CACJ;AAjBD,sCAiBC"}
1
+ {"version":3,"file":"unit-parser.js","sourceRoot":"","sources":["../../../../src/expressions/quantities/units/unit-parser.ts"],"names":[],"mappings":";;;AAAA,iCAAiD;AACjD,mDAA8D;AAC9D,0CAAiD;AACjD,MAAM,KAAK,GAAG,IAAA,cAAM,GAAE,CAAC,IAAI,CAAC,IAAA,kBAAI,GAAE,EAAE,IAAA,uBAAS,GAAE,CAAC,CAAA;AAEhD,MAAM,UAAU,GAAG,IAAA,WAAG,GAAE,CAAC,IAAI,CACzB,IAAA,kBAAI,EAAC,KAAK,CAAC,EACX,IAAA,iBAAG,EAAC,GAAG,CAAC,EAAE;IACN,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,GAAG,CAAA;IACzB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AAC1B,CAAC,CAAC,CACL,CAAA;AACD,MAAa,SAAS;IAEL;IACA;IACA;IAHb,YACa,IAAU,EACV,KAAa,EACb,IAAY;QAFZ,SAAI,GAAJ,IAAI,CAAM;QACV,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAQ;IACtB,CAAC;IAEJ,IAAI,GAAG;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IACtC,CAAC;IAED,IAAI,GAAG;QACH,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,KAAK,CAAA;QACtB,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAA;IACnB,CAAC;IAED,QAAQ;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,CAAA;QAFE,WAAM,GAAN,MAAM,CAAW;IAGtC,CAAC;IAED,SAAS,CAAC,IAAY;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAY,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,wBAAgB,CAAC,QAAQ,IAAI,gCAAgC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;QAC5F,CAAC;IACL,CAAC;IAED,MAAM,CAAC,IAAI,CAA4B,QAAgB,EAAE,KAAgB;QACrE,OAAO,IAAI,aAAa,CAAO,QAAQ,EAAE,KAAK,CAAC,CAAA;IACnD,CAAC;CACJ;AAjBD,sCAiBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k8ts/instruments",
3
- "version": "0.9.4",
3
+ "version": "0.11.0",
4
4
  "description": "A collection of utilities and core components for k8ts.",
5
5
  "keywords": [
6
6
  "k8ts",
@@ -61,7 +61,7 @@
61
61
  "dependencies": {
62
62
  "chalk": "4.1.2",
63
63
  "dayjs": "^1.11.13",
64
- "doddle": "^7.2.0",
64
+ "doddle": "^7.3.1",
65
65
  "eventemitter3": "^5.0.1",
66
66
  "ip-address": "^10.0.1",
67
67
  "lodash": "^4.17.21",
@@ -74,10 +74,10 @@
74
74
  "what-are-you": "^0.2.0"
75
75
  },
76
76
  "devDependencies": {
77
- "@k8ts/metadata": "^0.7.4",
77
+ "@k8ts/metadata": "^0.10.0",
78
78
  "@types/jest": "^30.0.0",
79
79
  "@types/lodash": "^4.17.16",
80
- "@types/node": "20.9.1",
80
+ "@types/node": "22",
81
81
  "declare-it": "^2.1.0",
82
82
  "jest": "^30.2.0",
83
83
  "npm-run-all": "^4.1.5",
@@ -89,7 +89,7 @@
89
89
  "yamprint": "^0.8.4"
90
90
  },
91
91
  "peerDependencies": {
92
- "@k8ts/metadata": "^0.7.4"
92
+ "@k8ts/metadata": "^0.10.0"
93
93
  },
94
94
  "engines": {
95
95
  "node": ">=16.0.0"
@@ -0,0 +1 @@
1
+ Entities represent unique, mutable objects
@@ -1,33 +1,60 @@
1
+ import { getNiceClassName, type AnyCtor } from "what-are-you"
1
2
  import type { Node } from "./node"
2
- import { FwReference } from "./resource/reference/fw-ref"
3
3
  export type LiteralModes = "simple" | "pretty" | "prefix"
4
4
 
5
5
  let globalEntityId = 0
6
+
7
+ type AbsCtor<T> = abstract new (...args: any[]) => any
8
+ export type RefLike = {
9
+ get ref(): {
10
+ kind: string
11
+ name: string
12
+ namespace?: string
13
+ }
14
+ kind: any
15
+ name: string
16
+ assert<Inst extends RefLike>(cls: abstract new (...args: any[]) => Inst): Inst
17
+ is<Inst extends RefLike>(cls: abstract new (...args: any[]) => Inst): this is Inst
18
+ }
6
19
  export abstract class Entity<
7
20
  _Node extends Node<_Node, _Ent> = Node<any, any>,
8
- _Ent extends Entity<_Node, _Ent> = Entity<any, any>
21
+ _Ent extends Entity<_Node, _Ent> = Entity<any, any>,
22
+ _EntRefType extends RefLike = RefLike
9
23
  > {
24
+ abstract get ref(): RefLike["ref"]
25
+ abstract readonly kind: any
10
26
  private readonly _ID = (() => {
11
27
  return globalEntityId++
12
28
  })()
13
29
  abstract readonly node: _Node
14
30
  abstract readonly name: string
15
- equals(other: any): boolean {
16
- if (FwReference.is(other)) {
17
- return this.equals(other["__pull__"]())
31
+ assert<Inst extends _EntRefType>(cls: AnyCtor<Inst>): Inst {
32
+ if (this.is(cls)) {
33
+ return this as any as Inst
34
+ }
35
+ throw new Error(
36
+ `This Resource ${this} is not compatible with the class ${getNiceClassName(cls)}.`
37
+ )
38
+ }
39
+ is<K extends this["kind"]>(kind: K): this is { kind: K }
40
+ is<Inst extends _EntRefType = _EntRefType>(cls: AnyCtor<Inst>): this is Inst
41
+ is(cls: any): boolean {
42
+ if (typeof cls === "function") {
43
+ return this instanceof cls
18
44
  }
19
- return Object.is(this, other)
45
+ return this.kind.equals(cls)
20
46
  }
47
+ abstract equals(other: any): boolean
21
48
 
22
- protected __kids__(): Iterable<_Ent> {
49
+ protected __kids__(): Iterable<_EntRefType> {
23
50
  return []
24
51
  }
25
52
 
26
- protected __parent__(): _Ent | undefined {
53
+ protected __parent__(): _EntRefType | undefined {
27
54
  return undefined
28
55
  }
29
56
 
30
- protected __needs__(): Record<string, _Ent | undefined | _Ent[]> {
57
+ protected __needs__(): Record<string, _EntRefType | undefined | _EntRefType[]> {
31
58
  return {}
32
59
  }
33
60
  }
@@ -1,46 +1,74 @@
1
1
  import { seq, type Seq } from "doddle"
2
- import type { Entity } from "./entity"
2
+ import { Entity } from "./entity"
3
3
  import { Relation } from "./relation"
4
- import { FwReference } from "./resource/reference"
5
-
4
+ import { FwRef } from "./resource/reference/fw-ref"
5
+ /**
6
+ * The {@link Node} is a wrapper around a {@link Entity} that provides traversal, display, and other
7
+ * utilities. Note that the {@link Node} itself is immutable. Changes only happen to the underlying
8
+ * {@link Entity}.
9
+ *
10
+ * Two {@link Node} instances are considered equal if they wrap the same {@link Entity}, even if
11
+ * they're different instances.
12
+ *
13
+ * Node classes are primarily used for traversal in the graph structure formed by {@link Entity}
14
+ * instances. They provide methods to navigate parent-child relationships, access metadata, and
15
+ * explore dependencies between entities.
16
+ *
17
+ * This is mainly done in the manifestation pipeline, but users can also rely on it to construct
18
+ * resources dynamically.
19
+ *
20
+ * Accessing the `Node` of an `Entity` always forces any `FwRef` instances to resolve.
21
+ */
6
22
  export abstract class Node<
7
23
  _Node extends Node<_Node, _Entity> = Node<any, any>,
8
24
  _Entity extends Entity<_Node, _Entity> = Entity<any, any>
9
25
  > {
26
+ /** The nodes of child entities. */
27
+
28
+ private readonly _ID: number
29
+ constructor(readonly entity: _Entity) {
30
+ this._ID = this.entity["_ID"]
31
+ }
10
32
  get kids() {
11
- return seq(this.entity["__kids__"]()).map(x => x.node)
33
+ return seq(this.entity["__kids__"]()).map(x => x.assert(Entity).node as _Node)
12
34
  }
35
+ /** The direct **needs** of this this node's entity. */
13
36
  get relations() {
14
- const needs = this.entity["__needs__"]()
37
+ const needs = seq(() => {
38
+ return seq.fromObject(this.entity["__needs__"]())
39
+ })
15
40
  return seq(function* () {
16
- for (const [relName, target] of Object.entries(needs)) {
41
+ for (const [relName, target] of needs) {
17
42
  if (Array.isArray(target)) {
18
43
  for (const t of target) {
19
44
  if (t) {
20
- yield new Relation<_Node>(relName, t.node)
45
+ yield new Relation<_Node>(
46
+ relName,
47
+ t.assert(Entity<_Node, _Entity>).node
48
+ )
21
49
  }
22
50
  }
23
51
  } else {
24
52
  if (target) {
25
- yield new Relation<_Node>(relName, target.node)
53
+ yield new Relation<_Node>(
54
+ relName,
55
+ target.assert(Entity<_Node, _Entity>).node
56
+ )
26
57
  }
27
58
  }
28
59
  }
29
60
  })
30
61
  }
31
62
 
63
+ /** The node for this node's parent entity. */
32
64
  get parent(): _Node | null {
33
- return this.entity["__parent__"]()?.node ?? null
34
- }
35
-
36
- protected get _asNode() {
37
- return this as any as _Node
38
- }
39
- private readonly _ID: number
40
- constructor(readonly entity: _Entity) {
41
- this._ID = this.entity["_ID"]
65
+ return (this.entity["__parent__"]()?.assert(Entity).node as any) ?? null
42
66
  }
43
67
 
68
+ /**
69
+ * The root node of this node's entity tree. Doesn't cross tree boundaries, so the root of a
70
+ * Resource-level tree.
71
+ */
44
72
  get root(): _Node {
45
73
  return (this.ancestors.at(-1).pull() as any) ?? (this as any)
46
74
  }
@@ -51,7 +79,10 @@ export abstract class Node<
51
79
  return this.parent === null
52
80
  }
53
81
  equals(other: any): boolean {
54
- if (FwReference.is(other)) {
82
+ if (!other) {
83
+ return false
84
+ }
85
+ if (FwRef.is(other)) {
55
86
  return this.equals(other["__pull__"]())
56
87
  }
57
88
  if (other instanceof Node === false) {
@@ -60,23 +91,23 @@ export abstract class Node<
60
91
  return this.entity.equals(other.entity)
61
92
  }
62
93
 
63
- readonly ancestors = seq((): _Node[] => {
64
- const seen = [] as _Node[]
65
- const recurse = function (from: _Node) {
94
+ readonly ancestors = seq((): Node[] => {
95
+ const seen = [] as Node[]
96
+ const recurse = function (from: Node) {
66
97
  const parent = from.parent
67
98
  if (parent && !seen.find(x => x.equals(parent))) {
68
99
  seen.push(parent)
69
100
  recurse(parent)
70
101
  }
71
102
  }
72
- recurse(this._asNode)
103
+ recurse(this)
73
104
  return seen
74
- })
105
+ }).as<_Node>()
75
106
 
76
- readonly descendants = seq((): _Node[] => {
107
+ readonly descendants = seq((): Node[] => {
77
108
  const self = this
78
- let seen = [] as _Node[]
79
- const recurse = function (from: _Node) {
109
+ let seen = [] as Node[]
110
+ const recurse = function (from: Node) {
80
111
  for (const kid of from.kids) {
81
112
  if (seen.find(x => x.equals(kid))) {
82
113
  continue
@@ -85,40 +116,40 @@ export abstract class Node<
85
116
  recurse(kid)
86
117
  }
87
118
  }
88
- recurse(this._asNode)
119
+ recurse(this)
89
120
  return seen
90
- })
121
+ }).as<_Node>()
91
122
 
92
- isParentOf(other: _Node): boolean {
93
- if (FwReference.is(other)) {
94
- return other.isChildOf(this._asNode)
123
+ isParentOf(other: Node): boolean {
124
+ if (FwRef.is(other)) {
125
+ return other.isChildOf(this)
95
126
  }
96
127
  return other.equals(this) || other.ancestors.some(x => x.equals(this)).pull()
97
128
  }
98
129
 
99
- isChildOf(other: _Node): boolean {
100
- if (FwReference.is(other)) {
101
- return other.isParentOf(this._asNode)
130
+ isChildOf(other: Node): boolean {
131
+ if (FwRef.is(other)) {
132
+ return other.isParentOf(this)
102
133
  }
103
134
  return this.equals(other) || this.ancestors.some(x => x.equals(other)).pull()
104
135
  }
105
136
 
106
- hasRelationTo(other: _Node): boolean {
137
+ hasRelationTo(other: Node): boolean {
107
138
  return this.recursiveRelations.some(x => x.needed.equals(other)).pull()
108
139
  }
109
140
 
110
- readonly recursiveRelationsSubtree = seq((): Seq<Relation<_Node>> => {
141
+ readonly recursiveRelationsSubtree = seq((): Seq<Relation<Node>> => {
111
142
  const self = this
112
143
  return seq(function* () {
113
- for (const child of [self, ...self.descendants] as _Node[]) {
144
+ for (const child of [self, ...self.descendants] as Node[]) {
114
145
  yield* child.recursiveRelations
115
146
  }
116
147
  }) as any
117
- })
148
+ }).as<Relation<_Node>>()
118
149
 
119
150
  readonly recursiveRelations = seq(() => {
120
- let resources = [] as _Node[]
121
- const recurseIntoDependency = function* (root: Relation<_Node>): Iterable<Relation<_Node>> {
151
+ let resources = [] as Node[]
152
+ const recurseIntoDependency = function* (root: Relation<Node>): Iterable<Relation<Node>> {
122
153
  yield root
123
154
  if (resources.find(r => r.equals(root.needed))) {
124
155
  return
@@ -130,7 +161,7 @@ export abstract class Node<
130
161
  yield* recurseIntoDependency(needsEdge)
131
162
  }
132
163
  }
133
- return seq(recurseIntoDependency.bind(null, new Relation<_Node>("self", this._asNode)))
164
+ return seq(recurseIntoDependency.bind(null, new Relation<_Node>("self", this)))
134
165
  .after(() => {
135
166
  resources = []
136
167
  })
@@ -4,8 +4,8 @@ import { seq } from "doddle"
4
4
  import { mapValues } from "lodash"
5
5
  import { displayers } from "../../../utils/displayers"
6
6
  import { Entity } from "../entity"
7
- import type { Resource_Entity } from "../resource/entity"
8
- import type { Ref2_Of } from "../resource/reference/refable"
7
+ import { Rsc_Entity } from "../resource/entity"
8
+ import type { Rsc_Ref } from "../resource/reference/refable"
9
9
  import { OriginEventsEmitter, type Origin_EventMap } from "./events"
10
10
  import { KindMap } from "./kind-map"
11
11
  import { OriginNode, type Origin_Props } from "./node"
@@ -24,12 +24,31 @@ export abstract class Origin_Entity<Props extends Origin_Props = Origin_Props> e
24
24
  OriginNode,
25
25
  Origin_Entity
26
26
  > {
27
+ get ref() {
28
+ return {
29
+ kind: this.kind,
30
+ name: this.name
31
+ }
32
+ }
27
33
  abstract get kind(): string
28
34
  private _emitter = OriginEventsEmitter()
29
- private readonly _ownResources: Resource_Entity[] = []
35
+ private readonly _ownResources: Rsc_Entity[] = []
30
36
  private readonly _ownKids: Origin_Entity[] = []
31
37
  readonly meta: Meta
32
38
 
39
+ equals(other: any): boolean {
40
+ const FwRef_Exports = require("../resource/reference/fw-ref-exports").FwRef_Exports
41
+ if (!other) {
42
+ return false
43
+ }
44
+ if (other instanceof Origin_Entity) {
45
+ return Object.is(this, other)
46
+ }
47
+ if (FwRef_Exports.is(other)) {
48
+ return other.equals(this)
49
+ }
50
+ return false
51
+ }
33
52
  constructor(
34
53
  readonly name: string,
35
54
  protected readonly _props: Props
@@ -63,11 +82,12 @@ export abstract class Origin_Entity<Props extends Origin_Props = Origin_Props> e
63
82
  const values = mapValues(data, v => `${v}`)
64
83
 
65
84
  for (const target of [this.node, ...this.node.ancestors]) {
66
- target.entity._emitter.emit(event, data)
85
+ target.entity.assert(Origin_Entity)._emitter.emit(event, data)
67
86
  }
68
87
  }
69
88
  protected __resource_kinds__(): KindMap {
70
- const parentKindsIfAny = this.__parent__()?.__resource_kinds__() ?? []
89
+ const parent = this.__parent__()?.assert(Origin_Entity)
90
+ const parentKindsIfAny = parent?.__resource_kinds__() ?? []
71
91
  return new KindMap([...(this._props.kinds ?? []), ...parentKindsIfAny])
72
92
  }
73
93
 
@@ -83,7 +103,7 @@ export abstract class Origin_Entity<Props extends Origin_Props = Origin_Props> e
83
103
  })
84
104
  }
85
105
 
86
- protected __attach_resource__(resources: Resource_Entity | Iterable<Resource_Entity>) {
106
+ protected __attach_resource__(resources: Rsc_Entity | Iterable<Rsc_Entity>) {
87
107
  resources = Symbol.iterator in resources ? resources : [resources]
88
108
  for (const resource of resources) {
89
109
  this._ownResources.push(resource)
@@ -104,7 +124,7 @@ export abstract class Origin_Entity<Props extends Origin_Props = Origin_Props> e
104
124
  }
105
125
 
106
126
  // We don't cache this because resources can be added dynamically
107
- get resources(): Iterable<Ref2_Of> {
127
+ get resources(): Iterable<Rsc_Ref> {
108
128
  const self = this
109
129
  return seq(function* () {
110
130
  for (const resource of self._ownResources) {
@@ -1,7 +1,7 @@
1
1
  import { doddle } from "doddle"
2
2
  import EventEmitter from "eventemitter3"
3
3
  import type { Manifest } from "../../manifest"
4
- import type { Resource_Entity, Resource_Top } from "../resource"
4
+ import type { Rsc_Entity, Rsc_Top } from "../resource"
5
5
  import type { Origin_Entity } from "./entity"
6
6
 
7
7
  export function OriginEventsEmitter() {
@@ -45,24 +45,24 @@ export function SubscribeFn(self: Origin_Entity, em: EventEmitter<Origin_EventMa
45
45
  export interface Origin_EventMap {
46
46
  "resource/exported": {
47
47
  readonly origin: Origin_Entity
48
- readonly resource: Resource_Top
48
+ readonly resource: Rsc_Top
49
49
  }
50
50
  "resource/attached": {
51
51
  readonly origin: Origin_Entity
52
- readonly resource: Resource_Entity
52
+ readonly resource: Rsc_Entity
53
53
  }
54
54
  "resource/manifested": {
55
55
  readonly origin: Origin_Entity
56
56
  readonly manifest: Manifest
57
- readonly resource: Resource_Top
57
+ readonly resource: Rsc_Top
58
58
  }
59
59
  "resource/loaded": {
60
60
  readonly origin: Origin_Entity
61
- readonly resource: Resource_Top
61
+ readonly resource: Rsc_Top
62
62
  }
63
63
  "resource/serialized": {
64
64
  readonly origin: Origin_Entity
65
- readonly resource: Resource_Top
65
+ readonly resource: Rsc_Top
66
66
  readonly manifest: Manifest
67
67
  content: string
68
68
  }