@k8ts/instruments 0.1.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 (307) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +3 -0
  3. package/dist/_embedder/base.d.ts +11 -0
  4. package/dist/_embedder/base.d.ts.map +1 -0
  5. package/dist/_embedder/base.js +39 -0
  6. package/dist/_embedder/base.js.map +1 -0
  7. package/dist/_embedder/index.d.ts +2 -0
  8. package/dist/_embedder/index.d.ts.map +1 -0
  9. package/dist/_embedder/index.js +18 -0
  10. package/dist/_embedder/index.js.map +1 -0
  11. package/dist/_string/index.d.ts +6 -0
  12. package/dist/_string/index.d.ts.map +1 -0
  13. package/dist/_string/index.js +22 -0
  14. package/dist/_string/index.js.map +1 -0
  15. package/dist/_string/markers.d.ts +3 -0
  16. package/dist/_string/markers.d.ts.map +1 -0
  17. package/dist/_string/markers.js +48 -0
  18. package/dist/_string/markers.js.map +1 -0
  19. package/dist/_string/post-processor.d.ts +7 -0
  20. package/dist/_string/post-processor.d.ts.map +1 -0
  21. package/dist/_string/post-processor.js +30 -0
  22. package/dist/_string/post-processor.js.map +1 -0
  23. package/dist/_string/pretty-objects.d.ts +27 -0
  24. package/dist/_string/pretty-objects.d.ts.map +1 -0
  25. package/dist/_string/pretty-objects.js +192 -0
  26. package/dist/_string/pretty-objects.js.map +1 -0
  27. package/dist/_string/pretty-print.d.ts +2 -0
  28. package/dist/_string/pretty-print.d.ts.map +1 -0
  29. package/dist/_string/pretty-print.js +27 -0
  30. package/dist/_string/pretty-print.js.map +1 -0
  31. package/dist/_string/super-script.d.ts +2 -0
  32. package/dist/_string/super-script.d.ts.map +1 -0
  33. package/dist/_string/super-script.js +20 -0
  34. package/dist/_string/super-script.js.map +1 -0
  35. package/dist/api-kind/index.d.ts +43 -0
  36. package/dist/api-kind/index.d.ts.map +1 -0
  37. package/dist/api-kind/index.js +102 -0
  38. package/dist/api-kind/index.js.map +1 -0
  39. package/dist/cmd/cli-command.d.ts +23 -0
  40. package/dist/cmd/cli-command.d.ts.map +1 -0
  41. package/dist/cmd/cli-command.js +73 -0
  42. package/dist/cmd/cli-command.js.map +1 -0
  43. package/dist/cmd/cli-term.d.ts +25 -0
  44. package/dist/cmd/cli-term.d.ts.map +1 -0
  45. package/dist/cmd/cli-term.js +55 -0
  46. package/dist/cmd/cli-term.js.map +1 -0
  47. package/dist/cmd/index.d.ts +3 -0
  48. package/dist/cmd/index.d.ts.map +1 -0
  49. package/dist/cmd/index.js +7 -0
  50. package/dist/cmd/index.js.map +1 -0
  51. package/dist/cmd/types.d.ts +5 -0
  52. package/dist/cmd/types.d.ts.map +1 -0
  53. package/dist/cmd/types.js +3 -0
  54. package/dist/cmd/types.js.map +1 -0
  55. package/dist/displayers/displayers.d.ts +33 -0
  56. package/dist/displayers/displayers.d.ts.map +1 -0
  57. package/dist/displayers/displayers.js +129 -0
  58. package/dist/displayers/displayers.js.map +1 -0
  59. package/dist/displayers/index.d.ts +2 -0
  60. package/dist/displayers/index.d.ts.map +1 -0
  61. package/dist/displayers/index.js +18 -0
  62. package/dist/displayers/index.js.map +1 -0
  63. package/dist/env/env.d.ts +20 -0
  64. package/dist/env/env.d.ts.map +1 -0
  65. package/dist/env/env.js +68 -0
  66. package/dist/env/env.js.map +1 -0
  67. package/dist/env/index.d.ts +3 -0
  68. package/dist/env/index.d.ts.map +1 -0
  69. package/dist/env/index.js +7 -0
  70. package/dist/env/index.js.map +1 -0
  71. package/dist/env/types.d.ts +4 -0
  72. package/dist/env/types.d.ts.map +1 -0
  73. package/dist/env/types.js +3 -0
  74. package/dist/env/types.js.map +1 -0
  75. package/dist/env/validate-name.d.ts +2 -0
  76. package/dist/env/validate-name.d.ts.map +1 -0
  77. package/dist/env/validate-name.js +12 -0
  78. package/dist/env/validate-name.js.map +1 -0
  79. package/dist/error.d.ts +8 -0
  80. package/dist/error.d.ts.map +1 -0
  81. package/dist/error.js +20 -0
  82. package/dist/error.js.map +1 -0
  83. package/dist/forward-exports/delayed-exports.d.ts +18 -0
  84. package/dist/forward-exports/delayed-exports.d.ts.map +1 -0
  85. package/dist/forward-exports/delayed-exports.js +119 -0
  86. package/dist/forward-exports/delayed-exports.js.map +1 -0
  87. package/dist/forward-exports/index.d.ts +2 -0
  88. package/dist/forward-exports/index.d.ts.map +1 -0
  89. package/dist/forward-exports/index.js +18 -0
  90. package/dist/forward-exports/index.js.map +1 -0
  91. package/dist/graph/base-node.d.ts +34 -0
  92. package/dist/graph/base-node.d.ts.map +1 -0
  93. package/dist/graph/base-node.js +102 -0
  94. package/dist/graph/base-node.js.map +1 -0
  95. package/dist/graph/base-origin-entity.d.ts +19 -0
  96. package/dist/graph/base-origin-entity.d.ts.map +1 -0
  97. package/dist/graph/base-origin-entity.js +105 -0
  98. package/dist/graph/base-origin-entity.js.map +1 -0
  99. package/dist/graph/dependencies.d.ts +12 -0
  100. package/dist/graph/dependencies.d.ts.map +1 -0
  101. package/dist/graph/dependencies.js +82 -0
  102. package/dist/graph/dependencies.js.map +1 -0
  103. package/dist/graph/index.d.ts +7 -0
  104. package/dist/graph/index.d.ts.map +1 -0
  105. package/dist/graph/index.js +23 -0
  106. package/dist/graph/index.js.map +1 -0
  107. package/dist/graph/origin-node.d.ts +32 -0
  108. package/dist/graph/origin-node.d.ts.map +1 -0
  109. package/dist/graph/origin-node.js +161 -0
  110. package/dist/graph/origin-node.js.map +1 -0
  111. package/dist/graph/relations.d.ts +26 -0
  112. package/dist/graph/relations.d.ts.map +1 -0
  113. package/dist/graph/relations.js +38 -0
  114. package/dist/graph/relations.js.map +1 -0
  115. package/dist/graph/resource-node.d.ts +28 -0
  116. package/dist/graph/resource-node.d.ts.map +1 -0
  117. package/dist/graph/resource-node.js +144 -0
  118. package/dist/graph/resource-node.js.map +1 -0
  119. package/dist/image/family.d.ts +26 -0
  120. package/dist/image/family.d.ts.map +1 -0
  121. package/dist/image/family.js +63 -0
  122. package/dist/image/family.js.map +1 -0
  123. package/dist/image/index.d.ts +2 -0
  124. package/dist/image/index.d.ts.map +1 -0
  125. package/dist/image/index.js +9 -0
  126. package/dist/image/index.js.map +1 -0
  127. package/dist/index.d.ts +19 -0
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +35 -0
  130. package/dist/index.js.map +1 -0
  131. package/dist/kind-map/index.d.ts +44 -0
  132. package/dist/kind-map/index.d.ts.map +1 -0
  133. package/dist/kind-map/index.js +123 -0
  134. package/dist/kind-map/index.js.map +1 -0
  135. package/dist/manifest/index.d.ts +46 -0
  136. package/dist/manifest/index.d.ts.map +1 -0
  137. package/dist/manifest/index.js +21 -0
  138. package/dist/manifest/index.js.map +1 -0
  139. package/dist/manifest/manifest-builder.d.ts +45 -0
  140. package/dist/manifest/manifest-builder.d.ts.map +1 -0
  141. package/dist/manifest/manifest-builder.js +66 -0
  142. package/dist/manifest/manifest-builder.js.map +1 -0
  143. package/dist/ports/error.d.ts +5 -0
  144. package/dist/ports/error.d.ts.map +1 -0
  145. package/dist/ports/error.js +13 -0
  146. package/dist/ports/error.js.map +1 -0
  147. package/dist/ports/index.d.ts +7 -0
  148. package/dist/ports/index.d.ts.map +1 -0
  149. package/dist/ports/index.js +13 -0
  150. package/dist/ports/index.js.map +1 -0
  151. package/dist/ports/map.d.ts +13 -0
  152. package/dist/ports/map.d.ts.map +1 -0
  153. package/dist/ports/map.js +38 -0
  154. package/dist/ports/map.js.map +1 -0
  155. package/dist/ports/set.d.ts +18 -0
  156. package/dist/ports/set.d.ts.map +1 -0
  157. package/dist/ports/set.js +60 -0
  158. package/dist/ports/set.js.map +1 -0
  159. package/dist/ports/tools/entry.d.ts +6 -0
  160. package/dist/ports/tools/entry.d.ts.map +1 -0
  161. package/dist/ports/tools/entry.js +36 -0
  162. package/dist/ports/tools/entry.js.map +1 -0
  163. package/dist/ports/tools/parse.d.ts +3 -0
  164. package/dist/ports/tools/parse.d.ts.map +1 -0
  165. package/dist/ports/tools/parse.js +35 -0
  166. package/dist/ports/tools/parse.js.map +1 -0
  167. package/dist/ports/types.d.ts +37 -0
  168. package/dist/ports/types.d.ts.map +1 -0
  169. package/dist/ports/types.js +3 -0
  170. package/dist/ports/types.js.map +1 -0
  171. package/dist/producer/index.d.ts +2 -0
  172. package/dist/producer/index.d.ts.map +1 -0
  173. package/dist/producer/index.js +18 -0
  174. package/dist/producer/index.js.map +1 -0
  175. package/dist/producer/producer.d.ts +6 -0
  176. package/dist/producer/producer.d.ts.map +1 -0
  177. package/dist/producer/producer.js +13 -0
  178. package/dist/producer/producer.js.map +1 -0
  179. package/dist/ref-key/index.d.ts +2 -0
  180. package/dist/ref-key/index.d.ts.map +1 -0
  181. package/dist/ref-key/index.js +18 -0
  182. package/dist/ref-key/index.js.map +1 -0
  183. package/dist/ref-key/ref-key.d.ts +23 -0
  184. package/dist/ref-key/ref-key.d.ts.map +1 -0
  185. package/dist/ref-key/ref-key.js +67 -0
  186. package/dist/ref-key/ref-key.js.map +1 -0
  187. package/dist/reference/forward-ref.d.ts +22 -0
  188. package/dist/reference/forward-ref.d.ts.map +1 -0
  189. package/dist/reference/forward-ref.js +126 -0
  190. package/dist/reference/forward-ref.js.map +1 -0
  191. package/dist/reference/index.d.ts +4 -0
  192. package/dist/reference/index.d.ts.map +1 -0
  193. package/dist/reference/index.js +8 -0
  194. package/dist/reference/index.js.map +1 -0
  195. package/dist/reference/refable.d.ts +12 -0
  196. package/dist/reference/refable.d.ts.map +1 -0
  197. package/dist/reference/refable.js +3 -0
  198. package/dist/reference/refable.js.map +1 -0
  199. package/dist/resources/index.d.ts +3 -0
  200. package/dist/resources/index.d.ts.map +1 -0
  201. package/dist/resources/index.js +19 -0
  202. package/dist/resources/index.js.map +1 -0
  203. package/dist/resources/objects.d.ts +22 -0
  204. package/dist/resources/objects.d.ts.map +1 -0
  205. package/dist/resources/objects.js +93 -0
  206. package/dist/resources/objects.js.map +1 -0
  207. package/dist/resources/parser.d.ts +4 -0
  208. package/dist/resources/parser.d.ts.map +1 -0
  209. package/dist/resources/parser.js +21 -0
  210. package/dist/resources/parser.js.map +1 -0
  211. package/dist/resources/types.d.ts +18 -0
  212. package/dist/resources/types.d.ts.map +1 -0
  213. package/dist/resources/types.js +3 -0
  214. package/dist/resources/types.js.map +1 -0
  215. package/dist/src.tsbuildinfo +1 -0
  216. package/dist/test.tsbuildinfo +1 -0
  217. package/dist/tracing/git.d.ts +19 -0
  218. package/dist/tracing/git.d.ts.map +1 -0
  219. package/dist/tracing/git.js +45 -0
  220. package/dist/tracing/git.js.map +1 -0
  221. package/dist/tracing/index.d.ts +4 -0
  222. package/dist/tracing/index.d.ts.map +1 -0
  223. package/dist/tracing/index.js +20 -0
  224. package/dist/tracing/index.js.map +1 -0
  225. package/dist/tracing/trace.d.ts +11 -0
  226. package/dist/tracing/trace.d.ts.map +1 -0
  227. package/dist/tracing/trace.js +27 -0
  228. package/dist/tracing/trace.js.map +1 -0
  229. package/dist/tracing/traced.d.ts +4 -0
  230. package/dist/tracing/traced.d.ts.map +1 -0
  231. package/dist/tracing/traced.js +6 -0
  232. package/dist/tracing/traced.js.map +1 -0
  233. package/dist/units/index.d.ts +3 -0
  234. package/dist/units/index.d.ts.map +1 -0
  235. package/dist/units/index.js +22 -0
  236. package/dist/units/index.js.map +1 -0
  237. package/dist/units/unit-parser.d.ts +19 -0
  238. package/dist/units/unit-parser.d.ts.map +1 -0
  239. package/dist/units/unit-parser.js +53 -0
  240. package/dist/units/unit-parser.js.map +1 -0
  241. package/dist/units/units.d.ts +37 -0
  242. package/dist/units/units.d.ts.map +1 -0
  243. package/dist/units/units.js +36 -0
  244. package/dist/units/units.js.map +1 -0
  245. package/package.json +89 -0
  246. package/src/_embedder/base.ts +42 -0
  247. package/src/_embedder/index.ts +1 -0
  248. package/src/_string/index.ts +5 -0
  249. package/src/_string/markers.ts +47 -0
  250. package/src/_string/post-processor.ts +25 -0
  251. package/src/_string/pretty-objects.ts +65 -0
  252. package/src/_string/pretty-print.ts +24 -0
  253. package/src/_string/super-script.ts +17 -0
  254. package/src/api-kind/index.ts +134 -0
  255. package/src/cmd/cli-command.ts +89 -0
  256. package/src/cmd/cli-term.ts +60 -0
  257. package/src/cmd/index.ts +2 -0
  258. package/src/cmd/types.ts +4 -0
  259. package/src/displayers/displayers.ts +147 -0
  260. package/src/displayers/index.ts +1 -0
  261. package/src/env/env.ts +74 -0
  262. package/src/env/index.ts +2 -0
  263. package/src/env/types.ts +7 -0
  264. package/src/env/validate-name.ts +10 -0
  265. package/src/error.ts +15 -0
  266. package/src/forward-exports/delayed-exports.ts +155 -0
  267. package/src/forward-exports/index.ts +1 -0
  268. package/src/graph/base-node.ts +125 -0
  269. package/src/graph/base-origin-entity.ts +44 -0
  270. package/src/graph/dependencies.ts +27 -0
  271. package/src/graph/index.ts +6 -0
  272. package/src/graph/origin-node.ts +118 -0
  273. package/src/graph/relations.ts +62 -0
  274. package/src/graph/resource-node.ts +104 -0
  275. package/src/image/family.ts +71 -0
  276. package/src/image/index.ts +1 -0
  277. package/src/index.ts +18 -0
  278. package/src/kind-map/index.ts +150 -0
  279. package/src/manifest/index.ts +53 -0
  280. package/src/manifest/manifest-builder.ts +98 -0
  281. package/src/ports/error.ts +8 -0
  282. package/src/ports/index.ts +8 -0
  283. package/src/ports/map.ts +41 -0
  284. package/src/ports/set.ts +79 -0
  285. package/src/ports/tools/entry.ts +43 -0
  286. package/src/ports/tools/parse.ts +40 -0
  287. package/src/ports/types.ts +42 -0
  288. package/src/producer/index.ts +1 -0
  289. package/src/producer/producer.ts +18 -0
  290. package/src/ref-key/index.ts +1 -0
  291. package/src/ref-key/ref-key.ts +76 -0
  292. package/src/reference/forward-ref.ts +122 -0
  293. package/src/reference/index.ts +3 -0
  294. package/src/reference/refable.ts +11 -0
  295. package/src/resources/index.ts +2 -0
  296. package/src/resources/objects.ts +99 -0
  297. package/src/resources/parser.ts +24 -0
  298. package/src/resources/types.ts +23 -0
  299. package/src/tracing/git.ts +51 -0
  300. package/src/tracing/index.ts +3 -0
  301. package/src/tracing/trace.ts +31 -0
  302. package/src/tracing/traced.ts +4 -0
  303. package/src/tsconfig.json +10 -0
  304. package/src/units/index.ts +2 -0
  305. package/src/units/unit-parser.ts +63 -0
  306. package/src/units/units.ts +53 -0
  307. package/tsconfig.json +15 -0
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PortMap = void 0;
4
+ const error_1 = require("./error");
5
+ class PortMap {
6
+ constructor(_map) {
7
+ this._map = _map;
8
+ }
9
+ _apply(f) {
10
+ return new PortMap(f(this._map));
11
+ }
12
+ pick(...name) {
13
+ return this._apply(map => map.filter((_, key) => name.includes(key)));
14
+ }
15
+ get values() {
16
+ return this._map;
17
+ }
18
+ map(mapping) {
19
+ return new PortMap(this._map.map(entry => {
20
+ return {
21
+ ...entry,
22
+ source: entry.target,
23
+ target: mapping[entry.name]
24
+ };
25
+ }));
26
+ }
27
+ get(name) {
28
+ if (!this._map.has(name)) {
29
+ throw new error_1.PortError(`Port ${name} not found`);
30
+ }
31
+ return this._map.get(name);
32
+ }
33
+ toMap() {
34
+ return this._map;
35
+ }
36
+ }
37
+ exports.PortMap = PortMap;
38
+ //# sourceMappingURL=map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.js","sourceRoot":"","sources":["../../src/ports/map.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AAEnC,MAAa,OAAO;IAChB,YAA6B,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;IAAG,CAAC;IAExD,MAAM,CAAC,CAAgE;QAC3E,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACpC,CAAC;IAED,IAAI,CAAwB,GAAG,IAAe;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAc,CAAC,CAAC,CAAC,CAAA;IACpF,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAA;IACpB,CAAC;IAED,GAAG,CAAC,OAA8B;QAC9B,OAAO,IAAI,OAAO,CACd,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAClB,OAAO;gBACH,GAAG,KAAK;gBACR,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,IAA4B,CAAC;aACtD,CAAA;QACL,CAAC,CAAC,CACL,CAAA;IACL,CAAC;IAED,GAAG,CAAC,IAAW;QACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,iBAAS,CAAC,QAAQ,IAAI,YAAY,CAAC,CAAA;QACjD,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiB,CAAA;IAC9C,CAAC;IAED,KAAK;QACD,OAAO,IAAI,CAAC,IAAI,CAAA;IACpB,CAAC;CACJ;AArCD,0BAqCC"}
@@ -0,0 +1,18 @@
1
+ import { Map } from "immutable";
2
+ import { PortMap } from "./map";
3
+ import type { InputPort, InputPortMapping, InputPortSetEntry, InputPortSetRecord, InputProtocol, PortSetEntry } from "./types";
4
+ export declare class PortSet<Names extends string = never> {
5
+ private readonly _map;
6
+ constructor(_map?: Map<Names, PortSetEntry>);
7
+ private _apply;
8
+ union<InNames extends string>(other: PortSet<InNames>): PortSet<Names | InNames>;
9
+ add<Name extends string>(name: Name, port: InputPort, protocol: InputProtocol): PortSet<Names | Name>;
10
+ add<Name extends string>(name: Name, entry: InputPortSetEntry): PortSet<Names | Name>;
11
+ add<InNames extends string>(input: InputPortSetRecord<InNames>): PortSet<Names | InNames>;
12
+ pick<InNames extends Names>(...name: InNames[]): PortSet<InNames>;
13
+ get(name: Names): PortSetEntry;
14
+ get values(): Map<Names, PortSetEntry>;
15
+ map(mapping: InputPortMapping<Names>): PortMap<Names>;
16
+ static make<Names extends string>(input: InputPortSetRecord<Names>): PortSet<Names>;
17
+ }
18
+ //# sourceMappingURL=set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/ports/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,KAAK,EACR,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACf,MAAM,SAAS,CAAA;AAGhB,qBAAa,OAAO,CAAC,KAAK,SAAS,MAAM,GAAG,KAAK;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,GAAE,GAAG,CAAC,KAAK,EAAE,YAAY,CAAS;IAEnE,OAAO,CAAC,MAAM;IAId,KAAK,CAAC,OAAO,SAAS,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;IAGhF,GAAG,CAAC,IAAI,SAAS,MAAM,EACnB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,aAAa,GACxB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IACxB,GAAG,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IACrF,GAAG,CAAC,OAAO,SAAS,MAAM,EAAE,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;IAczF,IAAI,CAAC,OAAO,SAAS,KAAK,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAIjE,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,YAAY;IAO9B,IAAI,MAAM,6BAET;IAED,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;IAgBrD,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC;CAGrE"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PortSet = void 0;
4
+ const immutable_1 = require("immutable");
5
+ const error_1 = require("./error");
6
+ const map_1 = require("./map");
7
+ const entry_1 = require("./tools/entry");
8
+ class PortSet {
9
+ constructor(_map = (0, immutable_1.Map)()) {
10
+ this._map = _map;
11
+ }
12
+ _apply(f) {
13
+ return new PortSet(f(this._map));
14
+ }
15
+ union(other) {
16
+ return new PortSet(this._map.merge(other._map));
17
+ }
18
+ add(a, b, c) {
19
+ if (c) {
20
+ return this._apply(map => map.set(a, { name: a, port: +b, protocol: c.toUpperCase() }));
21
+ }
22
+ if (b) {
23
+ return this._apply(map => map.set(a, (0, entry_1.parsePortInput)(a, b)));
24
+ }
25
+ return this._apply(map => {
26
+ const processed = (0, entry_1.portRecordInput)(a);
27
+ return map.merge(processed);
28
+ });
29
+ }
30
+ pick(...name) {
31
+ return this._apply(map => map.filter((_, key) => name.includes(key)));
32
+ }
33
+ get(name) {
34
+ if (!this._map.has(name)) {
35
+ throw new error_1.PortError(`Port ${name} not found`);
36
+ }
37
+ return this._map.get(name);
38
+ }
39
+ get values() {
40
+ return this._map;
41
+ }
42
+ map(mapping) {
43
+ return new map_1.PortMap(this._map.map(entry => {
44
+ if (!(entry.name in mapping)) {
45
+ throw new error_1.PortError(`Port ${entry.name} not found in mapping`);
46
+ }
47
+ return {
48
+ name: entry.name,
49
+ protocol: entry.protocol,
50
+ source: entry.port,
51
+ target: mapping[entry.name]
52
+ };
53
+ }));
54
+ }
55
+ static make(input) {
56
+ return new PortSet().add(input);
57
+ }
58
+ }
59
+ exports.PortSet = PortSet;
60
+ //# sourceMappingURL=set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.js","sourceRoot":"","sources":["../../src/ports/set.ts"],"names":[],"mappings":";;;AAAA,yCAA+B;AAC/B,mCAAmC;AACnC,+BAA+B;AAC/B,yCAA+D;AAW/D,MAAa,OAAO;IAChB,YAA6B,OAAiC,IAAA,eAAG,GAAE;QAAtC,SAAI,GAAJ,IAAI,CAAkC;IAAG,CAAC;IAE/D,MAAM,CAAC,CAAgE;QAC3E,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACpC,CAAC;IAED,KAAK,CAAyB,KAAuB;QACjD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IACnD,CAAC;IAQD,GAAG,CAAC,CAAM,EAAE,CAAO,EAAE,CAAO;QACxB,IAAI,CAAC,EAAE,CAAC;YACJ,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAA;QAC3F,CAAC;QACD,IAAI,CAAC,EAAE,CAAC;YACJ,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,IAAA,sBAAc,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YACrB,MAAM,SAAS,GAAG,IAAA,uBAAe,EAAC,CAAC,CAAC,CAAA;YACpC,OAAO,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;IACN,CAAC;IAED,IAAI,CAAwB,GAAG,IAAe;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAc,CAAC,CAAC,CAAQ,CAAA;IAC3F,CAAC;IAED,GAAG,CAAC,IAAW;QACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,iBAAS,CAAC,QAAQ,IAAI,YAAY,CAAC,CAAA;QACjD,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE,CAAA;IAC/B,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAA;IACpB,CAAC;IAED,GAAG,CAAC,OAAgC;QAChC,OAAO,IAAI,aAAO,CACd,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAClB,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,iBAAS,CAAC,QAAQ,KAAK,CAAC,IAAI,uBAAuB,CAAC,CAAA;YAClE,CAAC;YACD,OAAO;gBACH,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,MAAM,EAAE,KAAK,CAAC,IAAI;gBAClB,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,IAA4B,CAAC;aACtD,CAAA;QACL,CAAC,CAAC,CACL,CAAA;IACL,CAAC;IAED,MAAM,CAAC,IAAI,CAAuB,KAAgC;QAC9D,OAAO,IAAI,OAAO,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACnC,CAAC;CACJ;AAhED,0BAgEC"}
@@ -0,0 +1,6 @@
1
+ import { Map } from "immutable";
2
+ import { PortSet } from "../set";
3
+ import type { InputPortSetRecord, InputPortSetSpec, PortSetEntry } from "../types";
4
+ export declare function parsePortInput(name: string, input: InputPortSetSpec): PortSetEntry;
5
+ export declare function portRecordInput(record: InputPortSetRecord<string> | PortSet<string>): Map<string, PortSetEntry>;
6
+ //# sourceMappingURL=entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../../src/ports/tools/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAER,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EAEf,MAAM,UAAU,CAAA;AAWjB,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAWlF;AAED,wBAAgB,eAAe,CAC3B,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GACrD,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAQ3B"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parsePortInput = parsePortInput;
4
+ exports.portRecordInput = portRecordInput;
5
+ const immutable_1 = require("immutable");
6
+ const set_1 = require("../set");
7
+ const parse_1 = require("./parse");
8
+ function portSetEntry(name, value) {
9
+ return {
10
+ name,
11
+ port: value.port,
12
+ protocol: value.protocol.toUpperCase()
13
+ };
14
+ }
15
+ function parsePortInput(name, input) {
16
+ if (typeof input === "string") {
17
+ return portSetEntry(name, (0, parse_1.parsePortSpec)(name, input));
18
+ }
19
+ if (typeof input === "number") {
20
+ return portSetEntry(name, {
21
+ port: input,
22
+ protocol: "TCP"
23
+ });
24
+ }
25
+ return portSetEntry(name, input);
26
+ }
27
+ function portRecordInput(record) {
28
+ if (record instanceof set_1.PortSet) {
29
+ return record.values;
30
+ }
31
+ const inputMap = (0, immutable_1.Map)(record);
32
+ return inputMap
33
+ .map((v, k) => parsePortInput(k, v))
34
+ .map((value, key) => portSetEntry(key, value));
35
+ }
36
+ //# sourceMappingURL=entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../src/ports/tools/entry.ts"],"names":[],"mappings":";;AAmBA,wCAWC;AAED,0CAUC;AA1CD,yCAA+B;AAC/B,gCAAgC;AAQhC,mCAAuC;AAEvC,SAAS,YAAY,CAAC,IAAY,EAAE,KAAwB;IACxD,OAAO;QACH,IAAI;QACJ,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAc;KACrD,CAAA;AACL,CAAC;AAED,SAAgB,cAAc,CAAC,IAAY,EAAE,KAAuB;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,YAAY,CAAC,IAAI,EAAE,IAAA,qBAAa,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;IACzD,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,YAAY,CAAC,IAAI,EAAE;YACtB,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,KAAc;SAC3B,CAAC,CAAA;IACN,CAAC;IACD,OAAO,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACpC,CAAC;AAED,SAAgB,eAAe,CAC3B,MAAoD;IAEpD,IAAI,MAAM,YAAY,aAAO,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC,MAAM,CAAA;IACxB,CAAC;IACD,MAAM,QAAQ,GAAG,IAAA,eAAG,EAAC,MAAM,CAAC,CAAA;IAC5B,OAAO,QAAQ;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACnC,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;AACtD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { InputPortSetEntry } from "../types";
2
+ export declare function parsePortSpec(name: string, input: string): InputPortSetEntry;
3
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/ports/tools/parse.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAY,MAAM,UAAU,CAAA;AA4B3D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,qBAQxD"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parsePortSpec = parsePortSpec;
4
+ const parjs_1 = require("parjs");
5
+ const combinators_1 = require("parjs/combinators");
6
+ const error_1 = require("../error");
7
+ function validatePort(port) {
8
+ if (port < 0 || port > 65535) {
9
+ return {
10
+ kind: "Hard",
11
+ message: "Port must be between 0 and 65535"
12
+ };
13
+ }
14
+ return true;
15
+ }
16
+ const pProtocol = (0, parjs_1.anyStringOf)("tcp", "udp", "TCP", "UDP").pipe((0, combinators_1.map)(s => s.toUpperCase()));
17
+ const pPort = (0, parjs_1.int)().pipe((0, combinators_1.must)(validatePort));
18
+ const pProtocolPart = (0, parjs_1.string)("/").pipe((0, combinators_1.qthen)(pProtocol), (0, combinators_1.maybe)("TCP"));
19
+ const pPortSpec = pPort.pipe((0, combinators_1.then)(pProtocolPart), (0, combinators_1.map)(arr => {
20
+ const [port, protocol] = arr;
21
+ return {
22
+ port,
23
+ protocol: protocol?.toUpperCase() ?? "TCP"
24
+ };
25
+ }));
26
+ function parsePortSpec(name, input) {
27
+ const result = pPortSpec.parse(input);
28
+ if (result.kind === "OK") {
29
+ return result.value;
30
+ }
31
+ throw new error_1.PortError(name, {
32
+ parseError: result.reason
33
+ });
34
+ }
35
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/ports/tools/parse.ts"],"names":[],"mappings":";;AA+BA,sCAQC;AAvCD,iCAAgD;AAChD,mDAAiE;AACjE,oCAAoC;AAGpC,SAAS,YAAY,CAAC,IAAY;IAC9B,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QAC3B,OAAO;YACH,IAAI,EAAE,MAAe;YACrB,OAAO,EAAE,kCAAkC;SAC9C,CAAA;IACL,CAAC;IACD,OAAO,IAAI,CAAA;AACf,CAAC;AACD,MAAM,SAAS,GAAG,IAAA,mBAAW,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,CAC1D,IAAA,iBAAG,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAc,CAAC,CACxC,CAAA;AAED,MAAM,KAAK,GAAG,IAAA,WAAG,GAAE,CAAC,IAAI,CAAC,IAAA,kBAAI,EAAC,YAAY,CAAC,CAAC,CAAA;AAC5C,MAAM,aAAa,GAAG,IAAA,cAAM,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,mBAAK,EAAC,SAAS,CAAC,EAAE,IAAA,mBAAK,EAAC,KAAK,CAAC,CAAC,CAAA;AACtE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CACxB,IAAA,kBAAI,EAAC,aAAa,CAAC,EACnB,IAAA,iBAAG,EAAC,GAAG,CAAC,EAAE;IACN,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,GAAG,CAAA;IAC5B,OAAO;QACH,IAAI;QACJ,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,KAAK;KACxB,CAAA;AAC1B,CAAC,CAAC,CACL,CAAA;AAED,SAAgB,aAAa,CAAC,IAAY,EAAE,KAAa;IACrD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACrC,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,KAAK,CAAA;IACvB,CAAC;IACD,MAAM,IAAI,iBAAS,CAAC,IAAI,EAAE;QACtB,UAAU,EAAE,MAAM,CAAC,MAAM;KAC5B,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,37 @@
1
+ export interface PortSpecObj {
2
+ port: Port;
3
+ protocol: Protocol;
4
+ }
5
+ export type Port = number;
6
+ export type InputPort = Port | `${Port}`;
7
+ export type InputProtocol = Protocol | Lowercase<Protocol>;
8
+ export type Protocol = "TCP" | "UDP";
9
+ export type InputPortProto = `${Port}/${InputProtocol}`;
10
+ export interface PortMapEntry {
11
+ name: string;
12
+ protocol: Protocol;
13
+ source: number;
14
+ target: number;
15
+ }
16
+ export interface PortSetEntry {
17
+ name: string;
18
+ port: number;
19
+ protocol: Protocol;
20
+ }
21
+ export interface InputPortSetEntry {
22
+ port: Port;
23
+ protocol: InputProtocol;
24
+ }
25
+ export type InputPortSetSpec = InputPortSetEntry | InputPort | InputPortProto;
26
+ export interface InputPortMapEntry {
27
+ source: Port;
28
+ target: Port;
29
+ protocol: InputProtocol;
30
+ }
31
+ export type InputPortSetRecord<Names extends string = string> = {
32
+ [K in Names]: InputPortSetSpec;
33
+ };
34
+ export type InputPortMapping<Names extends string = string> = {
35
+ [K in Names]: number;
36
+ };
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ports/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,QAAQ,CAAA;CACrB;AAED,MAAM,MAAM,IAAI,GAAG,MAAM,CAAA;AACzB,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,GAAG,IAAI,EAAE,CAAA;AACxC,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAC1D,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAA;AACpC,MAAM,MAAM,cAAc,GAAG,GAAG,IAAI,IAAI,aAAa,EAAE,CAAA;AACvD,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;CACrB;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,aAAa,CAAA;CAC1B;AAED,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,SAAS,GAAG,cAAc,CAAA;AAE7E,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,IAAI,CAAA;IACZ,MAAM,EAAE,IAAI,CAAA;IACZ,QAAQ,EAAE,aAAa,CAAA;CAC1B;AAED,MAAM,MAAM,kBAAkB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI;KAC3D,CAAC,IAAI,KAAK,GAAG,gBAAgB;CACjC,CAAA;AACD,MAAM,MAAM,gBAAgB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI;KACzD,CAAC,IAAI,KAAK,GAAG,MAAM;CACvB,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ports/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./producer";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/producer/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./producer"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/producer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B"}
@@ -0,0 +1,6 @@
1
+ export type Producer<Factory extends object, Thing extends object> = Producer.Producer<Factory, Thing>;
2
+ export declare namespace Producer {
3
+ type Producer<Factory extends object, Produced extends object> = (factory: Factory) => Iterable<Produced>;
4
+ function map<Factory extends object, Produced extends object, NewInput extends object>(producer: Producer<Factory, Produced>, projection: (input: NewInput) => Factory): (input: NewInput) => Iterable<Produced>;
5
+ }
6
+ //# sourceMappingURL=producer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"producer.d.ts","sourceRoot":"","sources":["../../src/producer/producer.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,OAAO,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,IAAI,QAAQ,CAAC,QAAQ,CAClF,OAAO,EACP,KAAK,CACR,CAAA;AACD,yBAAiB,QAAQ,CAAC;IACtB,KAAY,QAAQ,CAAC,OAAO,SAAS,MAAM,EAAE,QAAQ,SAAS,MAAM,IAAI,CACpE,OAAO,EAAE,OAAO,KACf,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAEvB,SAAgB,GAAG,CAAC,OAAO,SAAS,MAAM,EAAE,QAAQ,SAAS,MAAM,EAAE,QAAQ,SAAS,MAAM,EACxF,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,EACrC,UAAU,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,IAET,OAAO,QAAQ,wBAGjD;CACJ"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Producer = void 0;
4
+ var Producer;
5
+ (function (Producer) {
6
+ function map(producer, projection) {
7
+ return function bound_producer(input) {
8
+ return producer(projection(input));
9
+ };
10
+ }
11
+ Producer.map = map;
12
+ })(Producer || (exports.Producer = Producer = {}));
13
+ //# sourceMappingURL=producer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"producer.js","sourceRoot":"","sources":["../../src/producer/producer.ts"],"names":[],"mappings":";;;AAIA,IAAiB,QAAQ,CAaxB;AAbD,WAAiB,QAAQ;IAKrB,SAAgB,GAAG,CACf,QAAqC,EACrC,UAAwC;QAExC,OAAO,SAAS,cAAc,CAAC,KAAe;YAC1C,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;QACtC,CAAC,CAAA;IACL,CAAC;IAPe,YAAG,MAOlB,CAAA;AACL,CAAC,EAbgB,QAAQ,wBAAR,QAAQ,QAaxB"}
@@ -0,0 +1,2 @@
1
+ export * from "./ref-key";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ref-key/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ref-key"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ref-key/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB"}
@@ -0,0 +1,23 @@
1
+ import { Kind } from "../api-kind";
2
+ export type RefKey<Kind extends string = string, Name extends string = string> = RefKey.RefKey<Kind, Name>;
3
+ export declare namespace RefKey {
4
+ function make<K extends string, Name extends string>(kind: Kind.Identifier<K>, name: Name): RefKey<K, Name>;
5
+ type Input = RefKey | RefKey["string"];
6
+ type Format<Kind extends string, Name extends string> = `${Kind}/${Name}`;
7
+ interface Parsed {
8
+ kind: string;
9
+ name: string;
10
+ }
11
+ function parse(ref: string): Parsed;
12
+ function tryParse(ref: string): Parsed | undefined;
13
+ class RefKey<K extends string = string, Name extends string = string> {
14
+ readonly kind: Kind.Identifier<K>;
15
+ readonly name: Name;
16
+ constructor(kind: Kind.Identifier<K>, name: Name);
17
+ get string(): Format<K, Name>;
18
+ equals(other: RefKey): boolean;
19
+ hashCode(): number;
20
+ toString(): `${K}/${Name}`;
21
+ }
22
+ }
23
+ //# sourceMappingURL=ref-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref-key.d.ts","sourceRoot":"","sources":["../../src/ref-key/ref-key.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,MAAM,MAAM,MAAM,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,MAAM,CAC1F,IAAI,EACJ,IAAI,CACP,CAAA;AACD,yBAAiB,MAAM,CAAC;IACpB,SAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,EACtD,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,IAAI,GACX,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAEjB;IACD,KAAY,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC7C,KAAY,MAAM,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,IAAI,GAAG,IAAI,IAAI,IAAI,EAAE,CAAA;IAEhF,UAAiB,MAAM;QACnB,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACf;IAED,SAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,UAMhC;IAED,SAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAkBxD;IACD,MAAa,MAAM,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM;QAEnE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACjC,QAAQ,CAAC,IAAI,EAAE,IAAI;oBADV,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,IAAI;QAGvB,IAAI,MAAM,IAAI,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAE5B;QAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;QAS9B,QAAQ;QAGR,QAAQ;KAGX;CACJ"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RefKey = void 0;
4
+ const immutable_1 = require("immutable");
5
+ const error_1 = require("../error");
6
+ var RefKey;
7
+ (function (RefKey_1) {
8
+ function make(kind, name) {
9
+ return new RefKey(kind, name);
10
+ }
11
+ RefKey_1.make = make;
12
+ const separator = "/";
13
+ function parse(ref) {
14
+ const result = tryParse(ref);
15
+ if (!result) {
16
+ throw new error_1.InstrumentsError(`Could not parse reference key: ${ref}`);
17
+ }
18
+ return result;
19
+ }
20
+ RefKey_1.parse = parse;
21
+ function tryParse(ref) {
22
+ if (typeof ref !== "string") {
23
+ return undefined;
24
+ }
25
+ if (ref == null) {
26
+ return undefined;
27
+ }
28
+ if (typeof ref === "object") {
29
+ return undefined;
30
+ }
31
+ const [kind, name] = ref.split(separator).map(s => s.trim());
32
+ if (!kind || !name) {
33
+ return undefined;
34
+ }
35
+ return {
36
+ kind,
37
+ name
38
+ };
39
+ }
40
+ RefKey_1.tryParse = tryParse;
41
+ class RefKey {
42
+ constructor(kind, name) {
43
+ this.kind = kind;
44
+ this.name = name;
45
+ }
46
+ get string() {
47
+ return [this.kind.name, this.name].join(separator);
48
+ }
49
+ equals(other) {
50
+ if (other == null) {
51
+ return false;
52
+ }
53
+ if (typeof other !== "object") {
54
+ return false;
55
+ }
56
+ return this.kind.equals(other.kind) && this.name === other.name;
57
+ }
58
+ hashCode() {
59
+ return (0, immutable_1.hash)(this.string);
60
+ }
61
+ toString() {
62
+ return this.string;
63
+ }
64
+ }
65
+ RefKey_1.RefKey = RefKey;
66
+ })(RefKey || (exports.RefKey = RefKey = {}));
67
+ //# sourceMappingURL=ref-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref-key.js","sourceRoot":"","sources":["../../src/ref-key/ref-key.ts"],"names":[],"mappings":";;;AAAA,yCAAgC;AAEhC,oCAA2C;AAK3C,IAAiB,MAAM,CAoEtB;AApED,WAAiB,QAAM;IACnB,SAAgB,IAAI,CAChB,IAAwB,EACxB,IAAU;QAEV,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACjC,CAAC;IALe,aAAI,OAKnB,CAAA;IAGD,MAAM,SAAS,GAAG,GAAG,CAAA;IAMrB,SAAgB,KAAK,CAAC,GAAW;QAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;QAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,wBAAgB,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAA;QACvE,CAAC;QACD,OAAO,MAAM,CAAA;IACjB,CAAC;IANe,cAAK,QAMpB,CAAA;IAED,SAAgB,QAAQ,CAAC,GAAW;QAChC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACd,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;QAC5D,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,OAAO;YACH,IAAI;YACJ,IAAI;SACP,CAAA;IACL,CAAC;IAlBe,iBAAQ,WAkBvB,CAAA;IACD,MAAa,MAAM;QACf,YACa,IAAwB,EACxB,IAAU;YADV,SAAI,GAAJ,IAAI,CAAoB;YACxB,SAAI,GAAJ,IAAI,CAAM;QACpB,CAAC;QAEJ,IAAI,MAAM;YACN,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAoB,CAAA;QACzE,CAAC;QAED,MAAM,CAAC,KAAa;YAChB,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;gBAChB,OAAO,KAAK,CAAA;YAChB,CAAC;YACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC5B,OAAO,KAAK,CAAA;YAChB,CAAC;YACD,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAA;QACnE,CAAC;QACD,QAAQ;YACJ,OAAO,IAAA,gBAAI,EAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC;QACD,QAAQ;YACJ,OAAO,IAAI,CAAC,MAAM,CAAA;QACtB,CAAC;KACJ;IAzBY,eAAM,SAyBlB,CAAA;AACL,CAAC,EApEgB,MAAM,sBAAN,MAAM,QAoEtB"}
@@ -0,0 +1,22 @@
1
+ import type { Doddle } from "doddle";
2
+ import { RefKey } from "../ref-key/ref-key";
3
+ export type ForwardRef<T extends object> = ForwardRef.Core<T> & T;
4
+ export declare namespace ForwardRef {
5
+ function is(x: any): boolean;
6
+ function make<T extends object>(props: Props<T>): ForwardRef<T>;
7
+ interface Props<Referenced extends object> {
8
+ readonly key: RefKey;
9
+ readonly namespace?: string;
10
+ readonly origin: object;
11
+ readonly resolver: Doddle<Referenced>;
12
+ readonly class: Function;
13
+ }
14
+ class Core<T extends object> {
15
+ #private;
16
+ constructor(props: Props<T>);
17
+ equals(other: any): any;
18
+ hashCode(): number;
19
+ get __reference_props__(): Props<T>;
20
+ }
21
+ }
22
+ //# sourceMappingURL=forward-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forward-ref.d.ts","sourceRoot":"","sources":["../../src/reference/forward-ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAGpC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACjE,yBAAiB,UAAU,CAAC;IACxB,SAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAElC;IACD,SAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAGrE;IACD,UAAiB,KAAK,CAAC,UAAU,SAAS,MAAM;QAC5C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;QACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;QAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;QACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;QACrC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;KAC3B;IAED,MAAa,IAAI,CAAC,CAAC,SAAS,MAAM;;oBAElB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAI3B,MAAM,CAAC,KAAK,EAAE,GAAG;QAWjB,QAAQ;QAIR,IAAI,mBAAmB,aAEtB;KACJ;CA2EJ"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.ForwardRef = void 0;
15
+ const immutable_1 = require("immutable");
16
+ const error_1 = require("../error");
17
+ var ForwardRef;
18
+ (function (ForwardRef) {
19
+ var _Core_props, _Handler_instances, _Handler_createImmutableError;
20
+ function is(x) {
21
+ return "__reference_props__" in x;
22
+ }
23
+ ForwardRef.is = is;
24
+ function make(props) {
25
+ const core = new Core(props);
26
+ return new Proxy(core, new Handler(core));
27
+ }
28
+ ForwardRef.make = make;
29
+ class Core {
30
+ constructor(props) {
31
+ _Core_props.set(this, void 0);
32
+ __classPrivateFieldSet(this, _Core_props, props, "f");
33
+ }
34
+ equals(other) {
35
+ const resolved = __classPrivateFieldGet(this, _Core_props, "f").resolver.pull();
36
+ if (ForwardRef.is(other)) {
37
+ return other.equals(resolved);
38
+ }
39
+ if ("equals" in resolved) {
40
+ return resolved.equals(other);
41
+ }
42
+ return resolved === other;
43
+ }
44
+ hashCode() {
45
+ return (0, immutable_1.hash)(immutable_1.List.of(__classPrivateFieldGet(this, _Core_props, "f").key, __classPrivateFieldGet(this, _Core_props, "f").origin));
46
+ }
47
+ get __reference_props__() {
48
+ return __classPrivateFieldGet(this, _Core_props, "f");
49
+ }
50
+ }
51
+ _Core_props = new WeakMap();
52
+ ForwardRef.Core = Core;
53
+ class Handler {
54
+ get _props() {
55
+ return this._core.__reference_props__;
56
+ }
57
+ constructor(_core) {
58
+ _Handler_instances.add(this);
59
+ this._core = _core;
60
+ }
61
+ get(target, prop) {
62
+ const { _props, _core } = this;
63
+ if (Reflect.has(_core, prop)) {
64
+ return Reflect.get(_core, prop);
65
+ }
66
+ const resource = _props.resolver.pull();
67
+ const result = Reflect.get(resource, prop);
68
+ if (typeof result === "function") {
69
+ return result.bind(resource);
70
+ }
71
+ return result;
72
+ }
73
+ getPrototypeOf(target) {
74
+ const { _props } = this;
75
+ return _props.class.prototype;
76
+ }
77
+ has(target, prop) {
78
+ const { _props, _core } = this;
79
+ if (Reflect.has(_core, prop)) {
80
+ return true;
81
+ }
82
+ const resource = _props.resolver.pull();
83
+ return Reflect.has(resource, prop);
84
+ }
85
+ getOwnPropertyDescriptor(_, p) {
86
+ const { _core, _props } = this;
87
+ const desc = Object.getOwnPropertyDescriptor(_core, p);
88
+ if (desc) {
89
+ desc.configurable = false;
90
+ return desc;
91
+ }
92
+ const resource = _props.resolver.pull();
93
+ const resourceDesc = Object.getOwnPropertyDescriptor(resource, p);
94
+ return resourceDesc;
95
+ }
96
+ get referant() {
97
+ return this._core.__reference_props__.key.string;
98
+ }
99
+ defineProperty(_, property, desc) {
100
+ throw __classPrivateFieldGet(this, _Handler_instances, "m", _Handler_createImmutableError).call(this, `define property ${String(property)} on`);
101
+ }
102
+ deleteProperty(_, p) {
103
+ throw __classPrivateFieldGet(this, _Handler_instances, "m", _Handler_createImmutableError).call(this, `delete property ${String(p)} from`);
104
+ }
105
+ preventExtensions() {
106
+ return true;
107
+ }
108
+ isExtensible() {
109
+ return false;
110
+ }
111
+ set(_, p) {
112
+ throw __classPrivateFieldGet(this, _Handler_instances, "m", _Handler_createImmutableError).call(this, `set property ${String(p)} on`);
113
+ }
114
+ ownKeys() {
115
+ const pulled = this._props.resolver.pull();
116
+ return [...Reflect.ownKeys(this._core), ...Reflect.ownKeys(pulled)];
117
+ }
118
+ setPrototypeOf() {
119
+ throw __classPrivateFieldGet(this, _Handler_instances, "m", _Handler_createImmutableError).call(this, `set the prototype of`);
120
+ }
121
+ }
122
+ _Handler_instances = new WeakSet(), _Handler_createImmutableError = function _Handler_createImmutableError(action) {
123
+ return new error_1.ProxyOperationError(`Tried to ${action} a forward reference to ${this.referant}, but it cannot be modified.`);
124
+ };
125
+ })(ForwardRef || (exports.ForwardRef = ForwardRef = {}));
126
+ //# sourceMappingURL=forward-ref.js.map