@milaboratories/pl-model-common 1.48.0 → 1.50.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 (189) hide show
  1. package/dist/author_marker.d.ts +1 -2
  2. package/dist/author_marker.d.ts.map +1 -1
  3. package/dist/base64.d.ts +4 -6
  4. package/dist/base64.d.ts.map +1 -1
  5. package/dist/block_state.d.ts +13 -9
  6. package/dist/block_state.d.ts.map +1 -1
  7. package/dist/bmodel/block_config.d.ts +51 -29
  8. package/dist/bmodel/block_config.d.ts.map +1 -1
  9. package/dist/bmodel/block_kind_ref.d.ts +4 -6
  10. package/dist/bmodel/block_kind_ref.d.ts.map +1 -1
  11. package/dist/bmodel/code.d.ts +4 -5
  12. package/dist/bmodel/code.d.ts.map +1 -1
  13. package/dist/bmodel/container.d.ts +5 -5
  14. package/dist/bmodel/container.d.ts.map +1 -1
  15. package/dist/bmodel/normalization.d.ts +1 -3
  16. package/dist/bmodel/normalization.d.ts.map +1 -1
  17. package/dist/bmodel/types.d.ts +1 -2
  18. package/dist/bmodel/types.d.ts.map +1 -1
  19. package/dist/branding.d.ts +2 -3
  20. package/dist/branding.d.ts.map +1 -1
  21. package/dist/columns/accessor_traversal.d.ts +6 -8
  22. package/dist/columns/accessor_traversal.d.ts.map +1 -1
  23. package/dist/columns/column_registry.d.ts +2 -3
  24. package/dist/columns/column_registry.d.ts.map +1 -1
  25. package/dist/columns/column_selector.d.ts +9 -9
  26. package/dist/columns/column_selector.d.ts.map +1 -1
  27. package/dist/columns/dedup.d.ts +1 -3
  28. package/dist/columns/dedup.d.ts.map +1 -1
  29. package/dist/columns/providers.d.ts +3 -4
  30. package/dist/columns/providers.d.ts.map +1 -1
  31. package/dist/columns/types.d.ts +12 -9
  32. package/dist/columns/types.d.ts.map +1 -1
  33. package/dist/common_types.d.ts +4 -6
  34. package/dist/common_types.d.ts.map +1 -1
  35. package/dist/dialog/index.d.ts +4 -5
  36. package/dist/dialog/index.d.ts.map +1 -1
  37. package/dist/driver_kit.d.ts +2 -2
  38. package/dist/driver_kit.d.ts.map +1 -1
  39. package/dist/drivers/ChunkedStreamReader.d.ts +3 -5
  40. package/dist/drivers/ChunkedStreamReader.d.ts.map +1 -1
  41. package/dist/drivers/blob.d.ts +36 -25
  42. package/dist/drivers/blob.d.ts.map +1 -1
  43. package/dist/drivers/columns/columns_collection_driver.d.ts +6 -7
  44. package/dist/drivers/columns/columns_collection_driver.d.ts.map +1 -1
  45. package/dist/drivers/columns/discover_columns_options.d.ts +9 -8
  46. package/dist/drivers/columns/discover_columns_options.d.ts.map +1 -1
  47. package/dist/drivers/index.cjs +1 -0
  48. package/dist/drivers/index.d.ts +4 -2
  49. package/dist/drivers/index.js +2 -2
  50. package/dist/drivers/interfaces.d.ts +2 -3
  51. package/dist/drivers/interfaces.d.ts.map +1 -1
  52. package/dist/drivers/log.d.ts +26 -28
  53. package/dist/drivers/log.d.ts.map +1 -1
  54. package/dist/drivers/ls.d.ts +37 -27
  55. package/dist/drivers/ls.d.ts.map +1 -1
  56. package/dist/drivers/pframe/column_filter.d.ts +1 -3
  57. package/dist/drivers/pframe/column_filter.d.ts.map +1 -1
  58. package/dist/drivers/pframe/data_info.d.ts +77 -50
  59. package/dist/drivers/pframe/data_info.d.ts.map +1 -1
  60. package/dist/drivers/pframe/data_types.d.ts +50 -45
  61. package/dist/drivers/pframe/data_types.d.ts.map +1 -1
  62. package/dist/drivers/pframe/driver.d.ts +5 -5
  63. package/dist/drivers/pframe/driver.d.ts.map +1 -1
  64. package/dist/drivers/pframe/filter_spec.d.ts +10 -12
  65. package/dist/drivers/pframe/filter_spec.d.ts.map +1 -1
  66. package/dist/drivers/pframe/find_columns.d.ts +2 -4
  67. package/dist/drivers/pframe/find_columns.d.ts.map +1 -1
  68. package/dist/drivers/pframe/index.cjs +1 -0
  69. package/dist/drivers/pframe/index.d.ts +4 -2
  70. package/dist/drivers/pframe/index.js +2 -2
  71. package/dist/drivers/pframe/linker_columns.d.ts +4 -10
  72. package/dist/drivers/pframe/linker_columns.d.ts.map +1 -1
  73. package/dist/drivers/pframe/pframe.d.ts +3 -3
  74. package/dist/drivers/pframe/pframe.d.ts.map +1 -1
  75. package/dist/drivers/pframe/query/query_common.d.ts +52 -46
  76. package/dist/drivers/pframe/query/query_common.d.ts.map +1 -1
  77. package/dist/drivers/pframe/query/query_data.d.ts +26 -21
  78. package/dist/drivers/pframe/query/query_data.d.ts.map +1 -1
  79. package/dist/drivers/pframe/query/query_spec.d.ts +22 -19
  80. package/dist/drivers/pframe/query/query_spec.d.ts.map +1 -1
  81. package/dist/drivers/pframe/query/utils.d.ts +15 -11
  82. package/dist/drivers/pframe/query/utils.d.ts.map +1 -1
  83. package/dist/drivers/pframe/spec/anchored.d.ts +3 -5
  84. package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -1
  85. package/dist/drivers/pframe/spec/discovered_column.d.ts +10 -11
  86. package/dist/drivers/pframe/spec/discovered_column.d.ts.map +1 -1
  87. package/dist/drivers/pframe/spec/filtered_column.d.ts +17 -18
  88. package/dist/drivers/pframe/spec/filtered_column.d.ts.map +1 -1
  89. package/dist/drivers/pframe/spec/ids.d.ts +16 -16
  90. package/dist/drivers/pframe/spec/ids.d.ts.map +1 -1
  91. package/dist/drivers/pframe/spec/index.cjs +1 -0
  92. package/dist/drivers/pframe/spec/index.d.ts +2 -2
  93. package/dist/drivers/pframe/spec/index.js +2 -2
  94. package/dist/drivers/pframe/spec/native_id.d.ts +3 -3
  95. package/dist/drivers/pframe/spec/native_id.d.ts.map +1 -1
  96. package/dist/drivers/pframe/spec/overridden.d.ts +14 -16
  97. package/dist/drivers/pframe/spec/overridden.d.ts.map +1 -1
  98. package/dist/drivers/pframe/spec/selectors.d.ts +22 -22
  99. package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
  100. package/dist/drivers/pframe/spec/spec.cjs +39 -2
  101. package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
  102. package/dist/drivers/pframe/spec/spec.d.ts +103 -71
  103. package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
  104. package/dist/drivers/pframe/spec/spec.js +39 -3
  105. package/dist/drivers/pframe/spec/spec.js.map +1 -1
  106. package/dist/drivers/pframe/spec_driver.d.ts +30 -25
  107. package/dist/drivers/pframe/spec_driver.d.ts.map +1 -1
  108. package/dist/drivers/pframe/table.d.ts +1 -3
  109. package/dist/drivers/pframe/table.d.ts.map +1 -1
  110. package/dist/drivers/pframe/table_calculate.d.ts +55 -46
  111. package/dist/drivers/pframe/table_calculate.d.ts.map +1 -1
  112. package/dist/drivers/pframe/table_common.d.ts +9 -10
  113. package/dist/drivers/pframe/table_common.d.ts.map +1 -1
  114. package/dist/drivers/pframe/unique_values.d.ts +3 -3
  115. package/dist/drivers/pframe/unique_values.d.ts.map +1 -1
  116. package/dist/drivers/upload.d.ts +2 -3
  117. package/dist/drivers/upload.d.ts.map +1 -1
  118. package/dist/drivers/urls.d.ts +7 -8
  119. package/dist/drivers/urls.d.ts.map +1 -1
  120. package/dist/errors.d.ts +35 -36
  121. package/dist/errors.d.ts.map +1 -1
  122. package/dist/flags/block_flags.cjs.map +1 -1
  123. package/dist/flags/block_flags.d.ts +7 -7
  124. package/dist/flags/block_flags.d.ts.map +1 -1
  125. package/dist/flags/block_flags.js.map +1 -1
  126. package/dist/flags/flag_utils.d.ts +6 -8
  127. package/dist/flags/flag_utils.d.ts.map +1 -1
  128. package/dist/flags/type_utils.d.ts +6 -7
  129. package/dist/flags/type_utils.d.ts.map +1 -1
  130. package/dist/httpAuth.d.ts +4 -5
  131. package/dist/httpAuth.d.ts.map +1 -1
  132. package/dist/index.cjs +1 -0
  133. package/dist/index.d.ts +9 -2
  134. package/dist/index.js +2 -2
  135. package/dist/json.d.ts +11 -12
  136. package/dist/json.d.ts.map +1 -1
  137. package/dist/navigation.d.ts +16 -11
  138. package/dist/navigation.d.ts.map +1 -1
  139. package/dist/plid.d.ts +7 -9
  140. package/dist/plid.d.ts.map +1 -1
  141. package/dist/pool/entry.d.ts +8 -6
  142. package/dist/pool/entry.d.ts.map +1 -1
  143. package/dist/pool/query.d.ts +3 -4
  144. package/dist/pool/query.d.ts.map +1 -1
  145. package/dist/pool/spec.d.ts +33 -30
  146. package/dist/pool/spec.d.ts.map +1 -1
  147. package/dist/pool_entry.d.ts +2 -3
  148. package/dist/pool_entry.d.ts.map +1 -1
  149. package/dist/project_id.d.ts +1 -3
  150. package/dist/project_id.d.ts.map +1 -1
  151. package/dist/ref.d.ts +22 -23
  152. package/dist/ref.d.ts.map +1 -1
  153. package/dist/resource_types.d.ts +2 -3
  154. package/dist/resource_types.d.ts.map +1 -1
  155. package/dist/services/node_service_handlers.d.ts +1 -3
  156. package/dist/services/node_service_handlers.d.ts.map +1 -1
  157. package/dist/services/service_capabilities.d.ts +7 -9
  158. package/dist/services/service_capabilities.d.ts.map +1 -1
  159. package/dist/services/service_declarations.d.ts +2 -2
  160. package/dist/services/service_declarations.d.ts.map +1 -1
  161. package/dist/services/service_injectors.d.ts +7 -8
  162. package/dist/services/service_injectors.d.ts.map +1 -1
  163. package/dist/services/service_registry.d.ts +2 -4
  164. package/dist/services/service_registry.d.ts.map +1 -1
  165. package/dist/services/service_types.d.ts +24 -26
  166. package/dist/services/service_types.d.ts.map +1 -1
  167. package/dist/template/kind_selector.d.ts +9 -11
  168. package/dist/template/kind_selector.d.ts.map +1 -1
  169. package/dist/template/project_template_v1.d.ts +22 -20
  170. package/dist/template/project_template_v1.d.ts.map +1 -1
  171. package/dist/template/template_ref_form.d.ts +6 -5
  172. package/dist/template/template_ref_form.d.ts.map +1 -1
  173. package/dist/template/template_relocate.cjs +24 -3
  174. package/dist/template/template_relocate.cjs.map +1 -1
  175. package/dist/template/template_relocate.d.ts +8 -4
  176. package/dist/template/template_relocate.d.ts.map +1 -1
  177. package/dist/template/template_relocate.js +24 -3
  178. package/dist/template/template_relocate.js.map +1 -1
  179. package/dist/utag.d.ts +2 -4
  180. package/dist/utag.d.ts.map +1 -1
  181. package/dist/util.d.ts +2 -3
  182. package/dist/util.d.ts.map +1 -1
  183. package/dist/value_or_error.d.ts +2 -3
  184. package/dist/value_or_error.d.ts.map +1 -1
  185. package/package.json +4 -4
  186. package/src/drivers/pframe/spec/spec.ts +50 -2
  187. package/src/flags/block_flags.ts +1 -1
  188. package/src/template/template_relocate.test.ts +57 -0
  189. package/src/template/template_relocate.ts +32 -4
@@ -1,13 +1,12 @@
1
1
  import { BlockKindSelectorReference } from "./kind_selector.js";
2
2
  import { Branded } from "@milaboratories/helpers";
3
-
4
3
  //#region src/template/project_template_v1.d.ts
5
4
  /**
6
5
  * Value of a template file's `schema` field — the format marker every
7
6
  * `template-v1` document opens with.
8
7
  */
9
- declare const PROJECT_TEMPLATE_SCHEMA_V1 = "template-v1";
10
- type ProjectTemplateSchemaV1 = typeof PROJECT_TEMPLATE_SCHEMA_V1;
8
+ export declare const PROJECT_TEMPLATE_SCHEMA_V1 = "template-v1";
9
+ export type ProjectTemplateSchemaV1 = typeof PROJECT_TEMPLATE_SCHEMA_V1;
11
10
  /**
12
11
  * On-wire reference to one exact block package version, `{name}@X.Y.Z`.
13
12
  *
@@ -16,14 +15,14 @@ type ProjectTemplateSchemaV1 = typeof PROJECT_TEMPLATE_SCHEMA_V1;
16
15
  * `BlockPackId` (`{ organization, name, version }`) is import-side work; the
17
16
  * organization lives inside the npm scope here, as it does for kind names.
18
17
  */
19
- type BlockPackReference = Branded<string, "BlockPackReference">;
18
+ export type BlockPackReference = Branded<string, "BlockPackReference">;
20
19
  /**
21
20
  * Split a {@link BlockPackReference} into `{ name, version }`.
22
21
  *
23
22
  * @throws if the reference carries no version segment or the version is not
24
23
  * exactly `X.Y.Z`
25
24
  */
26
- declare function parseBlockPackReference(ref: BlockPackReference): {
25
+ export declare function parseBlockPackReference(ref: BlockPackReference): {
27
26
  name: string;
28
27
  version: string;
29
28
  };
@@ -42,7 +41,7 @@ declare function parseBlockPackReference(ref: BlockPackReference): {
42
41
  * business: this type fixes only the grammar, so a document remains readable by a
43
42
  * consumer that cannot fetch every scheme.
44
43
  */
45
- type BlockPackLocationReference = Branded<string, "BlockPackLocationReference">;
44
+ export type BlockPackLocationReference = Branded<string, "BlockPackLocationReference">;
46
45
  /**
47
46
  * Read the scheme off a {@link BlockPackLocationReference}, which is all the
48
47
  * document layer knows about it — resolving the rest belongs to whoever can reach
@@ -54,7 +53,7 @@ type BlockPackLocationReference = Branded<string, "BlockPackLocationReference">;
54
53
  *
55
54
  * @throws if the value carries no scheme
56
55
  */
57
- declare function parseBlockPackLocation(ref: BlockPackLocationReference): {
56
+ export declare function parseBlockPackLocation(ref: BlockPackLocationReference): {
58
57
  scheme: string;
59
58
  };
60
59
  /**
@@ -75,7 +74,7 @@ declare function parseBlockPackLocation(ref: BlockPackLocationReference): {
75
74
  * entirely; carrying both would state two different things with no way to reconcile them, so
76
75
  * the type admits at most one.
77
76
  */
78
- type ProjectTemplateV1Entry = {
77
+ export type ProjectTemplateV1Entry = {
79
78
  /**
80
79
  * Template-local identifier, unique within the file. Names the entry for
81
80
  * inter-block references; on export it is the block's project-local UUID,
@@ -110,7 +109,7 @@ type ProjectTemplateV1Entry = {
110
109
  * Readers are unaffected: every arm declares both keys, so `entry.block` and `entry.location`
111
110
  * stay directly readable without narrowing.
112
111
  */
113
- type BlockPackLocatorOverride = {
112
+ export type BlockPackLocatorOverride = {
114
113
  /**
115
114
  * WHICH VERSION to install, leaving it to the environment to decide which registry
116
115
  * serves it — so an entry pinned this way stays portable.
@@ -120,10 +119,12 @@ type BlockPackLocatorOverride = {
120
119
  * it already records the exact version the block implements, leaving a pin nothing to
121
120
  * add — so this is a hand-written field.
122
121
  */
123
- readonly block?: BlockPackReference; /** Excluded: this arm is the version pin. */
122
+ readonly block?: BlockPackReference;
123
+ /** Excluded: this arm is the version pin. */
124
124
  readonly location?: never;
125
125
  } | {
126
- /** Excluded: this arm is the place. */readonly block?: never;
126
+ /** Excluded: this arm is the place. */
127
+ readonly block?: never;
127
128
  /**
128
129
  * WHICH PLACE to install from, as an absolute URI (see
129
130
  * {@link BlockPackLocationReference}).
@@ -151,13 +152,15 @@ type BlockPackLocatorOverride = {
151
152
  * dependency; serializing to YAML bytes belongs with the caller that already
152
153
  * has one (pl-middle-layer).
153
154
  */
154
- type ProjectTemplateV1 = {
155
+ export type ProjectTemplateV1 = {
155
156
  readonly schema: ProjectTemplateSchemaV1;
156
157
  readonly blocks: readonly ProjectTemplateV1Entry[];
157
158
  };
158
159
  /** One thing wrong with a document, and where in it. */
159
- type TemplateParseIssue = {
160
- /** Location in the decoded value: `["blocks", 2, "kind"]`. */readonly path: readonly (string | number)[]; /** What is wrong, worded for whoever is editing the file. */
160
+ export type TemplateParseIssue = {
161
+ /** Location in the decoded value: `["blocks", 2, "kind"]`. */
162
+ readonly path: readonly (string | number)[];
163
+ /** What is wrong, worded for whoever is editing the file. */
161
164
  readonly message: string;
162
165
  };
163
166
  /**
@@ -166,19 +169,19 @@ type TemplateParseIssue = {
166
169
  * Indexes read as they are written in the file — `blocks[2]`, not `blocks.2` — so the place
167
170
  * can be found by reading rather than by counting.
168
171
  */
169
- declare function formatTemplateParseIssue(issue: TemplateParseIssue): string;
172
+ export declare function formatTemplateParseIssue(issue: TemplateParseIssue): string;
170
173
  /**
171
174
  * Every problem a document has, thrown once so a caller fixes the file in one pass.
172
175
  *
173
176
  * The issues are in `message` as well as on `issues`, because a throw that escapes to a log is
174
177
  * read as its message and nothing else.
175
178
  */
176
- declare class ProjectTemplateV1ParseError extends Error {
179
+ export declare class ProjectTemplateV1ParseError extends Error {
177
180
  readonly issues: readonly TemplateParseIssue[];
178
181
  constructor(issues: readonly TemplateParseIssue[]);
179
182
  }
180
183
  /** A document, or everything wrong with the value that was supposed to be one. */
181
- type ProjectTemplateV1ReadResult = {
184
+ export type ProjectTemplateV1ReadResult = {
182
185
  readonly ok: true;
183
186
  readonly document: ProjectTemplateV1;
184
187
  } | {
@@ -202,14 +205,13 @@ type ProjectTemplateV1ReadResult = {
202
205
  *
203
206
  * Collects rather than stops: a file with three mistakes should take one pass to fix.
204
207
  */
205
- declare function readProjectTemplateV1(value: unknown): ProjectTemplateV1ReadResult;
208
+ export declare function readProjectTemplateV1(value: unknown): ProjectTemplateV1ReadResult;
206
209
  /**
207
210
  * {@link readProjectTemplateV1} for a caller that treats an unreadable document as
208
211
  * exceptional — export, which asserts on every run that what it wrote can be read back.
209
212
  *
210
213
  * @throws {ProjectTemplateV1ParseError} carrying every problem found
211
214
  */
212
- declare function parseProjectTemplateV1(value: unknown): ProjectTemplateV1;
215
+ export declare function parseProjectTemplateV1(value: unknown): ProjectTemplateV1;
213
216
  //#endregion
214
- export { BlockPackLocationReference, BlockPackLocatorOverride, BlockPackReference, PROJECT_TEMPLATE_SCHEMA_V1, ProjectTemplateSchemaV1, ProjectTemplateV1, ProjectTemplateV1Entry, ProjectTemplateV1ParseError, ProjectTemplateV1ReadResult, TemplateParseIssue, formatTemplateParseIssue, parseBlockPackLocation, parseBlockPackReference, parseProjectTemplateV1, readProjectTemplateV1 };
215
217
  //# sourceMappingURL=project_template_v1.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project_template_v1.d.ts","names":[],"sources":["../../src/template/project_template_v1.ts"],"mappings":";;;;;;AASA;;cAAa,0BAAA;AAAA,KACD,uBAAA,UAAiC,0BAA0B;AADhC;AACvC;;;;AAAuE;AAUvE;;AAXuC,KAW3B,kBAAA,GAAqB,OAAO;;AAAA;AAQxC;;;;iBAAgB,uBAAA,CAAwB,GAAA,EAAK,kBAAkB;EAC7D,IAAA;EACA,OAAA;AAAA;;AAAO;AA2BT;;;;AAAgD;AAahD;;;;;;;;KAbY,0BAAA,GAA6B,OAAO;AAqDhD;;;;;;;;;;;AAAA,iBAxCgB,sBAAA,CAAuB,GAAA,EAAK,0BAA0B;EAAK,MAAA;AAAA;;AA+D/C;AAa5B;;;;;;;;;;;AA6BoD;AAiBpD;;;;KAlFY,sBAAA;EAmFO;;;;AAC+B;EAD/B,SA7ER,EAAA;EAAA,SACA,IAAA,EAAM,0BAAA;;;AAiGC;AASlB;;;;AAAkE;AAmBlE;;;;;;WA9GW,MAAA,EAAQ,MAAA;AAAA,IACf,wBAAA;;;;;;;;AA8GwD;AAY5D;;;KA7GY,wBAAA;EA8GG;;;;;;;AACuD;AAyBtE;EA1Be,SAnGA,KAAA,GAAQ,kBAAA;WAER,QAAA;AAAA;EAwRC,gDApRD,KAAA;;;AAoR0D;;;;;;;;;WAxQ1D,QAAA,GAAW,0BAA0B;AAAA;;;;;;;;;;;;;;;KAiBxC,iBAAA;EAAA,SACD,MAAA,EAAQ,uBAAA;EAAA,SACR,MAAA,WAAiB,sBAAsB;AAAA;;KAgBtC,kBAAA;yEAED,IAAA;WAEA,OAAO;AAAA;;;;;;;iBASF,wBAAA,CAAyB,KAAyB,EAAlB,kBAAkB;;;;;;;cAmBrD,2BAAA,SAAoC,KAAA;EAAA,SAC1B,MAAA,WAAiB,kBAAA;cAAjB,MAAA,WAAiB,kBAAA;AAAA;;KAY5B,2BAAA;EAAA,SACG,EAAA;EAAA,SAAmB,QAAA,EAAU,iBAAA;AAAA;EAAA,SAC7B,EAAA;EAAA,SAAoB,MAAA,WAAiB,kBAAkB;AAAA;;;;;;;;;;;;;;;;;;iBAyBtD,qBAAA,CAAsB,KAAA,YAAiB,2BAA2B;;;;;;;iBA6JlE,sBAAA,CAAuB,KAAA,YAAiB,iBAAiB"}
1
+ {"version":3,"file":"project_template_v1.d.ts","names":[],"sources":["../../src/template/project_template_v1.ts"],"mappings":";;;;;;;qBASa;YACD,iCAAiC;;;;;;;;;YAUjC,qBAAqB;;;;;;;wBAQjB,wBAAwB,KAAK;EAC3C;EACA;;;;;;;;;;;;;;;;;YA2BU,6BAA6B;;;;;;;;;;;;wBAazB,uBAAuB,KAAK;EAA+B;;;;;;;;;;;;;;;;;;;;YAwC/D;;;;;;WAMD;WACA,MAAM;;;;;;;;;;;;;;;WAeN,QAAQ;IACf;;;;;;;;;;;;YAaQ;;;;;;;;;;WAWG,QAAQ;;WAER;;;WAIA;;;;;;;;;;;;WAYA,WAAW;;;;;;;;;;;;;;;;YAiBd;WACD,QAAQ;WACR,iBAAiB;;;YAgBhB;;WAED;;WAEA;;;;;;;;wBASK,yBAAyB,OAAO;;;;;;;qBAmBnC,oCAAoC;WAC1B,iBAAiB;EAAtC,YAAqB,iBAAiB;;;YAY5B;WACG;WAAmB,UAAU;;WAC7B;WAAoB,iBAAiB;;;;;;;;;;;;;;;;;;;wBAyBpC,sBAAsB,iBAAiB;;;;;;;wBA6JvC,uBAAuB,iBAAiB"}
@@ -26,8 +26,10 @@
26
26
  * parser runs, so a kind's params contract is written against `PlRef` alone and never learns
27
27
  * this type exists.
28
28
  */
29
- type TemplatePlRef = {
30
- /** The template-local id of the entry this points at. */readonly block: string; /** The upstream output's name, exactly as a `PlRef` spells it. */
29
+ export type TemplatePlRef = {
30
+ /** The template-local id of the entry this points at. */
31
+ readonly block: string;
32
+ /** The upstream output's name, exactly as a `PlRef` spells it. */
31
33
  readonly name: string;
32
34
  };
33
35
  /**
@@ -37,7 +39,7 @@ type TemplatePlRef = {
37
39
  * and nothing else. A value carrying `__isRef` is a `PlRef` already and is not this — the two
38
40
  * are told apart by shape and never overlap.
39
41
  */
40
- declare function isTemplatePlRef(value: unknown): value is TemplatePlRef;
42
+ export declare function isTemplatePlRef(value: unknown): value is TemplatePlRef;
41
43
  /**
42
44
  * Expand every readable reference form in `params` into the form the system stores.
43
45
  *
@@ -68,7 +70,6 @@ declare function isTemplatePlRef(value: unknown): value is TemplatePlRef;
68
70
  * would have to be resolved somewhere that knows the document, and would drag that knowledge
69
71
  * into every caller of this. Keep them information-preserving.
70
72
  */
71
- declare function expandTemplateRefs<T>(params: T): T;
73
+ export declare function expandTemplateRefs<T>(params: T): T;
72
74
  //#endregion
73
- export { TemplatePlRef, expandTemplateRefs, isTemplatePlRef };
74
75
  //# sourceMappingURL=template_ref_form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_ref_form.d.ts","names":[],"sources":["../../src/template/template_ref_form.ts"],"mappings":";;AA6BA;;;;AAIe;AAUf;;;;;;;;AAAuE;AAsCvE;;;;;;;;;AAAmD;;;KApDvC,aAAA;oEAED,KAAA;WAEA,IAAI;AAAA;;;;;;;;iBAUC,eAAA,CAAgB,KAAA,YAAiB,KAAA,IAAS,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCvD,kBAAA,IAAsB,MAAA,EAAQ,CAAA,GAAI,CAAC"}
1
+ {"version":3,"file":"template_ref_form.d.ts","names":[],"sources":["../../src/template/template_ref_form.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;YA6BY;;WAED;;WAEA;;;;;;;;;wBAUK,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsC1C,mBAAmB,GAAG,QAAQ,IAAI"}
@@ -1,5 +1,7 @@
1
+ const require_spec = require("../drivers/pframe/spec/spec.cjs");
1
2
  const require_ids = require("../drivers/pframe/spec/ids.cjs");
2
3
  require("../drivers/index.cjs");
4
+ let es_toolkit = require("es-toolkit");
3
5
  //#region src/template/template_relocate.ts
4
6
  /**
5
7
  * Point every column identifier in a block's params at the blocks of the project being built.
@@ -16,8 +18,13 @@ require("../drivers/index.cjs");
16
18
  *
17
19
  * Rewriting is structural, never textual: an identifier is taken apart, its `blockId` fields
18
20
  * are replaced, and it is rebuilt canonically. That is what keeps a value that merely *looks*
19
- * like an id — a `domain` entry, an axis filter — from being rewritten along with it, and
20
- * what re-sorts a qualifications map whose keys are identifiers.
21
+ * like an id — an axis filter, a domain this package can see belongs to an identifier it
22
+ * knows — from being rewritten along with it, and what re-sorts a qualifications map whose
23
+ * keys are identifiers.
24
+ *
25
+ * A domain reached on its own is the exception, and `relocateDomain` below says why: an axis is
26
+ * qualified by the block that produced it. Only the domain keys known to name a block are
27
+ * repointed — matching an entry id is not on its own evidence of a reference.
21
28
  *
22
29
  * An id the map does not mention is left as it is. That is the ordering rule doing its work:
23
30
  * a caller building the map as it creates blocks passes only the entries already created, so
@@ -35,9 +42,23 @@ function relocateBlockIds(params, blockIds) {
35
42
  if (typeof node === "string") return require_ids.remapColumnIdBlockIds(node, remapBlockId);
36
43
  if (require_ids.isColumnUniversalKey(node)) return require_ids.remapColumnIdBlockIds(node, remapBlockId);
37
44
  if (Array.isArray(node)) return node.map(walk);
38
- if (typeof node === "object" && node !== null) return Object.fromEntries(Object.entries(node).map(([key, value]) => [require_ids.remapColumnIdBlockIds(key, remapBlockId), walk(value)]));
45
+ if (typeof node === "object" && node !== null) return Object.fromEntries(Object.entries(node).map(([key, value]) => [require_ids.remapColumnIdBlockIds(key, remapBlockId), key === "domain" && (0, es_toolkit.isPlainObject)(value) ? relocateDomain(value) : walk(value)]));
39
46
  return node;
40
47
  };
48
+ /**
49
+ * The block-naming entries of a domain, repointed at the project being built: an axis a block
50
+ * produced names that block in its domain, so those are references like any other.
51
+ *
52
+ * Only the keys {@link BlockScopedDomain} lists, because a template's entry ids are arbitrary
53
+ * non-empty strings — a hand-written template may name an entry `closest`, and a qualifier
54
+ * reading `closest` is not a reference to it. Matching the map is not on its own enough to
55
+ * tell one from the other; the key is.
56
+ *
57
+ * Reached only from the generic object case — inside an identifier this package recognizes a
58
+ * domain is spec data and stays as it is, which is what keeps an overridden column's
59
+ * `specOverrides.domain` untouched.
60
+ */
61
+ const relocateDomain = (domain) => Object.fromEntries(Object.entries(domain).map(([key, value]) => [key, typeof value === "string" && require_spec.BlockScopedDomain.has(key) ? remapBlockId(value) : walk(value)]));
41
62
  return walk(params);
42
63
  }
43
64
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"template_relocate.cjs","names":["remapColumnIdBlockIds","isColumnUniversalKey"],"sources":["../../src/template/template_relocate.ts"],"sourcesContent":["import { isColumnUniversalKey, remapColumnIdBlockIds } from \"../drivers\";\n\n/**\n * Point every column identifier in a block's params at the blocks of the project being built.\n *\n * The whole of what a template does about references, and it lives here — in the package the\n * block's own bundle imports — because knowing which values carry block ids is knowing the\n * reference system. The engine carrying the params neither marks them, reads them, nor\n * rewrites them: it hands the block its params and this map, and takes back what comes out.\n *\n * Params travel verbatim precisely so that this is possible. A file holds a `PlRef` as the\n * object the block stored and a column id as the canonical string the block stored, with no\n * marker of any kind, and the identifiers are found here by recognizing them — the same way\n * the project's own dependency detector finds them in live args.\n *\n * Rewriting is structural, never textual: an identifier is taken apart, its `blockId` fields\n * are replaced, and it is rebuilt canonically. That is what keeps a value that merely *looks*\n * like an id — a `domain` entry, an axis filter — from being rewritten along with it, and\n * what re-sorts a qualifications map whose keys are identifiers.\n *\n * An id the map does not mention is left as it is. That is the ordering rule doing its work:\n * a caller building the map as it creates blocks passes only the entries already created, so\n * a reference to an entry further down the file stays pointing at a block that does not\n * exist, and the applied block reports itself as missing references rather than being wired\n * to something below it.\n *\n * @param params Whatever the block projected, as the document stored it\n * @param blockIds template-local entry id → the block id that entry was given\n */\nexport function relocateBlockIds<T>(params: T, blockIds: ReadonlyMap<string, string>): T {\n if (blockIds.size === 0) return params;\n const remapBlockId = (blockId: string) => blockIds.get(blockId) ?? blockId;\n\n const walk = (node: unknown): unknown => {\n // Any string may be an identifier under any amount of escaping; one that is not comes\n // back as the very same string, so this needs no test of its own here.\n if (typeof node === \"string\") return remapColumnIdBlockIds(node, remapBlockId);\n\n // Before the generic object case: an identifier IS an object, and descending into one\n // would rewrite the strings nested in it piecemeal instead of rebuilding the whole id —\n // losing the bottom-up canonicalization that keeps the result a valid identifier.\n if (isColumnUniversalKey(node)) return remapColumnIdBlockIds(node, remapBlockId);\n\n if (Array.isArray(node)) return node.map(walk);\n\n if (typeof node === \"object\" && node !== null) {\n // Keys as well as values: params may be keyed by column id — per-column settings, say\n // — and a key is exactly as much of a reference as a value is.\n return Object.fromEntries(\n Object.entries(node).map(([key, value]) => [\n remapColumnIdBlockIds(key, remapBlockId),\n walk(value),\n ]),\n );\n }\n\n return node;\n };\n\n return walk(params) as T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,iBAAoB,QAAW,UAA0C;CACvF,IAAI,SAAS,SAAS,GAAG,OAAO;CAChC,MAAM,gBAAgB,YAAoB,SAAS,IAAI,OAAO,KAAK;CAEnE,MAAM,QAAQ,SAA2B;EAGvC,IAAI,OAAO,SAAS,UAAU,OAAOA,YAAAA,sBAAsB,MAAM,YAAY;EAK7E,IAAIC,YAAAA,qBAAqB,IAAI,GAAG,OAAOD,YAAAA,sBAAsB,MAAM,YAAY;EAE/E,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,IAAI;EAE7C,IAAI,OAAO,SAAS,YAAY,SAAS,MAGvC,OAAO,OAAO,YACZ,OAAO,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CACzCA,YAAAA,sBAAsB,KAAK,YAAY,GACvC,KAAK,KAAK,CACZ,CAAC,CACH;EAGF,OAAO;CACT;CAEA,OAAO,KAAK,MAAM;AACpB"}
1
+ {"version":3,"file":"template_relocate.cjs","names":["remapColumnIdBlockIds","isColumnUniversalKey","BlockScopedDomain"],"sources":["../../src/template/template_relocate.ts"],"sourcesContent":["import { isPlainObject } from \"es-toolkit\";\n\nimport { BlockScopedDomain, isColumnUniversalKey, remapColumnIdBlockIds } from \"../drivers\";\n\n/**\n * Point every column identifier in a block's params at the blocks of the project being built.\n *\n * The whole of what a template does about references, and it lives here — in the package the\n * block's own bundle imports — because knowing which values carry block ids is knowing the\n * reference system. The engine carrying the params neither marks them, reads them, nor\n * rewrites them: it hands the block its params and this map, and takes back what comes out.\n *\n * Params travel verbatim precisely so that this is possible. A file holds a `PlRef` as the\n * object the block stored and a column id as the canonical string the block stored, with no\n * marker of any kind, and the identifiers are found here by recognizing them — the same way\n * the project's own dependency detector finds them in live args.\n *\n * Rewriting is structural, never textual: an identifier is taken apart, its `blockId` fields\n * are replaced, and it is rebuilt canonically. That is what keeps a value that merely *looks*\n * like an id — an axis filter, a domain this package can see belongs to an identifier it\n * knows — from being rewritten along with it, and what re-sorts a qualifications map whose\n * keys are identifiers.\n *\n * A domain reached on its own is the exception, and `relocateDomain` below says why: an axis is\n * qualified by the block that produced it. Only the domain keys known to name a block are\n * repointed — matching an entry id is not on its own evidence of a reference.\n *\n * An id the map does not mention is left as it is. That is the ordering rule doing its work:\n * a caller building the map as it creates blocks passes only the entries already created, so\n * a reference to an entry further down the file stays pointing at a block that does not\n * exist, and the applied block reports itself as missing references rather than being wired\n * to something below it.\n *\n * @param params Whatever the block projected, as the document stored it\n * @param blockIds template-local entry id → the block id that entry was given\n */\nexport function relocateBlockIds<T>(params: T, blockIds: ReadonlyMap<string, string>): T {\n if (blockIds.size === 0) return params;\n const remapBlockId = (blockId: string) => blockIds.get(blockId) ?? blockId;\n\n const walk = (node: unknown): unknown => {\n // Any string may be an identifier under any amount of escaping; one that is not comes\n // back as the very same string, so this needs no test of its own here.\n if (typeof node === \"string\") return remapColumnIdBlockIds(node, remapBlockId);\n\n // Before the generic object case: an identifier IS an object, and descending into one\n // would rewrite the strings nested in it piecemeal instead of rebuilding the whole id —\n // losing the bottom-up canonicalization that keeps the result a valid identifier.\n if (isColumnUniversalKey(node)) return remapColumnIdBlockIds(node, remapBlockId);\n\n if (Array.isArray(node)) return node.map(walk);\n\n if (typeof node === \"object\" && node !== null) {\n // Keys as well as values: params may be keyed by column id — per-column settings, say\n // — and a key is exactly as much of a reference as a value is.\n return Object.fromEntries(\n Object.entries(node).map(([key, value]) => [\n remapColumnIdBlockIds(key, remapBlockId),\n key === \"domain\" && isPlainObject(value) ? relocateDomain(value) : walk(value),\n ]),\n );\n }\n\n return node;\n };\n\n /**\n * The block-naming entries of a domain, repointed at the project being built: an axis a block\n * produced names that block in its domain, so those are references like any other.\n *\n * Only the keys {@link BlockScopedDomain} lists, because a template's entry ids are arbitrary\n * non-empty strings — a hand-written template may name an entry `closest`, and a qualifier\n * reading `closest` is not a reference to it. Matching the map is not on its own enough to\n * tell one from the other; the key is.\n *\n * Reached only from the generic object case — inside an identifier this package recognizes a\n * domain is spec data and stays as it is, which is what keeps an overridden column's\n * `specOverrides.domain` untouched.\n */\n const relocateDomain = (domain: Record<string, unknown>): Record<string, unknown> =>\n Object.fromEntries(\n Object.entries(domain).map(([key, value]) => [\n key,\n typeof value === \"string\" && BlockScopedDomain.has(key) ? remapBlockId(value) : walk(value),\n ]),\n );\n\n return walk(params) as T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,iBAAoB,QAAW,UAA0C;CACvF,IAAI,SAAS,SAAS,GAAG,OAAO;CAChC,MAAM,gBAAgB,YAAoB,SAAS,IAAI,OAAO,KAAK;CAEnE,MAAM,QAAQ,SAA2B;EAGvC,IAAI,OAAO,SAAS,UAAU,OAAOA,YAAAA,sBAAsB,MAAM,YAAY;EAK7E,IAAIC,YAAAA,qBAAqB,IAAI,GAAG,OAAOD,YAAAA,sBAAsB,MAAM,YAAY;EAE/E,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,IAAI;EAE7C,IAAI,OAAO,SAAS,YAAY,SAAS,MAGvC,OAAO,OAAO,YACZ,OAAO,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CACzCA,YAAAA,sBAAsB,KAAK,YAAY,GACvC,QAAQ,aAAA,GAAA,WAAA,cAAA,CAA0B,KAAK,IAAI,eAAe,KAAK,IAAI,KAAK,KAAK,CAC/E,CAAC,CACH;EAGF,OAAO;CACT;;;;;;;;;;;;;;CAeA,MAAM,kBAAkB,WACtB,OAAO,YACL,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAC3C,KACA,OAAO,UAAU,YAAYE,aAAAA,kBAAkB,IAAI,GAAG,IAAI,aAAa,KAAK,IAAI,KAAK,KAAK,CAC5F,CAAC,CACH;CAEF,OAAO,KAAK,MAAM;AACpB"}
@@ -14,8 +14,13 @@
14
14
  *
15
15
  * Rewriting is structural, never textual: an identifier is taken apart, its `blockId` fields
16
16
  * are replaced, and it is rebuilt canonically. That is what keeps a value that merely *looks*
17
- * like an id — a `domain` entry, an axis filter — from being rewritten along with it, and
18
- * what re-sorts a qualifications map whose keys are identifiers.
17
+ * like an id — an axis filter, a domain this package can see belongs to an identifier it
18
+ * knows — from being rewritten along with it, and what re-sorts a qualifications map whose
19
+ * keys are identifiers.
20
+ *
21
+ * A domain reached on its own is the exception, and `relocateDomain` below says why: an axis is
22
+ * qualified by the block that produced it. Only the domain keys known to name a block are
23
+ * repointed — matching an entry id is not on its own evidence of a reference.
19
24
  *
20
25
  * An id the map does not mention is left as it is. That is the ordering rule doing its work:
21
26
  * a caller building the map as it creates blocks passes only the entries already created, so
@@ -26,7 +31,6 @@
26
31
  * @param params Whatever the block projected, as the document stored it
27
32
  * @param blockIds template-local entry id → the block id that entry was given
28
33
  */
29
- declare function relocateBlockIds<T>(params: T, blockIds: ReadonlyMap<string, string>): T;
34
+ export declare function relocateBlockIds<T>(params: T, blockIds: ReadonlyMap<string, string>): T;
30
35
  //#endregion
31
- export { relocateBlockIds };
32
36
  //# sourceMappingURL=template_relocate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_relocate.d.ts","names":[],"sources":["../../src/template/template_relocate.ts"],"mappings":";;AA6BA;;;;;;;;;;;;;;;AAAwF;;;;;;;;;;;iBAAxE,gBAAA,IAAoB,MAAA,EAAQ,CAAA,EAAG,QAAA,EAAU,WAAA,mBAA8B,CAAA"}
1
+ {"version":3,"file":"template_relocate.d.ts","names":[],"sources":["../../src/template/template_relocate.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAoCgB,iBAAiB,GAAG,QAAQ,GAAG,UAAU,8BAA8B"}
@@ -1,5 +1,7 @@
1
+ import { BlockScopedDomain } from "../drivers/pframe/spec/spec.js";
1
2
  import { isColumnUniversalKey, remapColumnIdBlockIds } from "../drivers/pframe/spec/ids.js";
2
3
  import "../drivers/index.js";
4
+ import { isPlainObject } from "es-toolkit";
3
5
  //#region src/template/template_relocate.ts
4
6
  /**
5
7
  * Point every column identifier in a block's params at the blocks of the project being built.
@@ -16,8 +18,13 @@ import "../drivers/index.js";
16
18
  *
17
19
  * Rewriting is structural, never textual: an identifier is taken apart, its `blockId` fields
18
20
  * are replaced, and it is rebuilt canonically. That is what keeps a value that merely *looks*
19
- * like an id — a `domain` entry, an axis filter — from being rewritten along with it, and
20
- * what re-sorts a qualifications map whose keys are identifiers.
21
+ * like an id — an axis filter, a domain this package can see belongs to an identifier it
22
+ * knows — from being rewritten along with it, and what re-sorts a qualifications map whose
23
+ * keys are identifiers.
24
+ *
25
+ * A domain reached on its own is the exception, and `relocateDomain` below says why: an axis is
26
+ * qualified by the block that produced it. Only the domain keys known to name a block are
27
+ * repointed — matching an entry id is not on its own evidence of a reference.
21
28
  *
22
29
  * An id the map does not mention is left as it is. That is the ordering rule doing its work:
23
30
  * a caller building the map as it creates blocks passes only the entries already created, so
@@ -35,9 +42,23 @@ function relocateBlockIds(params, blockIds) {
35
42
  if (typeof node === "string") return remapColumnIdBlockIds(node, remapBlockId);
36
43
  if (isColumnUniversalKey(node)) return remapColumnIdBlockIds(node, remapBlockId);
37
44
  if (Array.isArray(node)) return node.map(walk);
38
- if (typeof node === "object" && node !== null) return Object.fromEntries(Object.entries(node).map(([key, value]) => [remapColumnIdBlockIds(key, remapBlockId), walk(value)]));
45
+ if (typeof node === "object" && node !== null) return Object.fromEntries(Object.entries(node).map(([key, value]) => [remapColumnIdBlockIds(key, remapBlockId), key === "domain" && isPlainObject(value) ? relocateDomain(value) : walk(value)]));
39
46
  return node;
40
47
  };
48
+ /**
49
+ * The block-naming entries of a domain, repointed at the project being built: an axis a block
50
+ * produced names that block in its domain, so those are references like any other.
51
+ *
52
+ * Only the keys {@link BlockScopedDomain} lists, because a template's entry ids are arbitrary
53
+ * non-empty strings — a hand-written template may name an entry `closest`, and a qualifier
54
+ * reading `closest` is not a reference to it. Matching the map is not on its own enough to
55
+ * tell one from the other; the key is.
56
+ *
57
+ * Reached only from the generic object case — inside an identifier this package recognizes a
58
+ * domain is spec data and stays as it is, which is what keeps an overridden column's
59
+ * `specOverrides.domain` untouched.
60
+ */
61
+ const relocateDomain = (domain) => Object.fromEntries(Object.entries(domain).map(([key, value]) => [key, typeof value === "string" && BlockScopedDomain.has(key) ? remapBlockId(value) : walk(value)]));
41
62
  return walk(params);
42
63
  }
43
64
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"template_relocate.js","names":[],"sources":["../../src/template/template_relocate.ts"],"sourcesContent":["import { isColumnUniversalKey, remapColumnIdBlockIds } from \"../drivers\";\n\n/**\n * Point every column identifier in a block's params at the blocks of the project being built.\n *\n * The whole of what a template does about references, and it lives here — in the package the\n * block's own bundle imports — because knowing which values carry block ids is knowing the\n * reference system. The engine carrying the params neither marks them, reads them, nor\n * rewrites them: it hands the block its params and this map, and takes back what comes out.\n *\n * Params travel verbatim precisely so that this is possible. A file holds a `PlRef` as the\n * object the block stored and a column id as the canonical string the block stored, with no\n * marker of any kind, and the identifiers are found here by recognizing them — the same way\n * the project's own dependency detector finds them in live args.\n *\n * Rewriting is structural, never textual: an identifier is taken apart, its `blockId` fields\n * are replaced, and it is rebuilt canonically. That is what keeps a value that merely *looks*\n * like an id — a `domain` entry, an axis filter — from being rewritten along with it, and\n * what re-sorts a qualifications map whose keys are identifiers.\n *\n * An id the map does not mention is left as it is. That is the ordering rule doing its work:\n * a caller building the map as it creates blocks passes only the entries already created, so\n * a reference to an entry further down the file stays pointing at a block that does not\n * exist, and the applied block reports itself as missing references rather than being wired\n * to something below it.\n *\n * @param params Whatever the block projected, as the document stored it\n * @param blockIds template-local entry id → the block id that entry was given\n */\nexport function relocateBlockIds<T>(params: T, blockIds: ReadonlyMap<string, string>): T {\n if (blockIds.size === 0) return params;\n const remapBlockId = (blockId: string) => blockIds.get(blockId) ?? blockId;\n\n const walk = (node: unknown): unknown => {\n // Any string may be an identifier under any amount of escaping; one that is not comes\n // back as the very same string, so this needs no test of its own here.\n if (typeof node === \"string\") return remapColumnIdBlockIds(node, remapBlockId);\n\n // Before the generic object case: an identifier IS an object, and descending into one\n // would rewrite the strings nested in it piecemeal instead of rebuilding the whole id —\n // losing the bottom-up canonicalization that keeps the result a valid identifier.\n if (isColumnUniversalKey(node)) return remapColumnIdBlockIds(node, remapBlockId);\n\n if (Array.isArray(node)) return node.map(walk);\n\n if (typeof node === \"object\" && node !== null) {\n // Keys as well as values: params may be keyed by column id — per-column settings, say\n // — and a key is exactly as much of a reference as a value is.\n return Object.fromEntries(\n Object.entries(node).map(([key, value]) => [\n remapColumnIdBlockIds(key, remapBlockId),\n walk(value),\n ]),\n );\n }\n\n return node;\n };\n\n return walk(params) as T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,iBAAoB,QAAW,UAA0C;CACvF,IAAI,SAAS,SAAS,GAAG,OAAO;CAChC,MAAM,gBAAgB,YAAoB,SAAS,IAAI,OAAO,KAAK;CAEnE,MAAM,QAAQ,SAA2B;EAGvC,IAAI,OAAO,SAAS,UAAU,OAAO,sBAAsB,MAAM,YAAY;EAK7E,IAAI,qBAAqB,IAAI,GAAG,OAAO,sBAAsB,MAAM,YAAY;EAE/E,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,IAAI;EAE7C,IAAI,OAAO,SAAS,YAAY,SAAS,MAGvC,OAAO,OAAO,YACZ,OAAO,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CACzC,sBAAsB,KAAK,YAAY,GACvC,KAAK,KAAK,CACZ,CAAC,CACH;EAGF,OAAO;CACT;CAEA,OAAO,KAAK,MAAM;AACpB"}
1
+ {"version":3,"file":"template_relocate.js","names":[],"sources":["../../src/template/template_relocate.ts"],"sourcesContent":["import { isPlainObject } from \"es-toolkit\";\n\nimport { BlockScopedDomain, isColumnUniversalKey, remapColumnIdBlockIds } from \"../drivers\";\n\n/**\n * Point every column identifier in a block's params at the blocks of the project being built.\n *\n * The whole of what a template does about references, and it lives here — in the package the\n * block's own bundle imports — because knowing which values carry block ids is knowing the\n * reference system. The engine carrying the params neither marks them, reads them, nor\n * rewrites them: it hands the block its params and this map, and takes back what comes out.\n *\n * Params travel verbatim precisely so that this is possible. A file holds a `PlRef` as the\n * object the block stored and a column id as the canonical string the block stored, with no\n * marker of any kind, and the identifiers are found here by recognizing them — the same way\n * the project's own dependency detector finds them in live args.\n *\n * Rewriting is structural, never textual: an identifier is taken apart, its `blockId` fields\n * are replaced, and it is rebuilt canonically. That is what keeps a value that merely *looks*\n * like an id — an axis filter, a domain this package can see belongs to an identifier it\n * knows — from being rewritten along with it, and what re-sorts a qualifications map whose\n * keys are identifiers.\n *\n * A domain reached on its own is the exception, and `relocateDomain` below says why: an axis is\n * qualified by the block that produced it. Only the domain keys known to name a block are\n * repointed — matching an entry id is not on its own evidence of a reference.\n *\n * An id the map does not mention is left as it is. That is the ordering rule doing its work:\n * a caller building the map as it creates blocks passes only the entries already created, so\n * a reference to an entry further down the file stays pointing at a block that does not\n * exist, and the applied block reports itself as missing references rather than being wired\n * to something below it.\n *\n * @param params Whatever the block projected, as the document stored it\n * @param blockIds template-local entry id → the block id that entry was given\n */\nexport function relocateBlockIds<T>(params: T, blockIds: ReadonlyMap<string, string>): T {\n if (blockIds.size === 0) return params;\n const remapBlockId = (blockId: string) => blockIds.get(blockId) ?? blockId;\n\n const walk = (node: unknown): unknown => {\n // Any string may be an identifier under any amount of escaping; one that is not comes\n // back as the very same string, so this needs no test of its own here.\n if (typeof node === \"string\") return remapColumnIdBlockIds(node, remapBlockId);\n\n // Before the generic object case: an identifier IS an object, and descending into one\n // would rewrite the strings nested in it piecemeal instead of rebuilding the whole id —\n // losing the bottom-up canonicalization that keeps the result a valid identifier.\n if (isColumnUniversalKey(node)) return remapColumnIdBlockIds(node, remapBlockId);\n\n if (Array.isArray(node)) return node.map(walk);\n\n if (typeof node === \"object\" && node !== null) {\n // Keys as well as values: params may be keyed by column id — per-column settings, say\n // — and a key is exactly as much of a reference as a value is.\n return Object.fromEntries(\n Object.entries(node).map(([key, value]) => [\n remapColumnIdBlockIds(key, remapBlockId),\n key === \"domain\" && isPlainObject(value) ? relocateDomain(value) : walk(value),\n ]),\n );\n }\n\n return node;\n };\n\n /**\n * The block-naming entries of a domain, repointed at the project being built: an axis a block\n * produced names that block in its domain, so those are references like any other.\n *\n * Only the keys {@link BlockScopedDomain} lists, because a template's entry ids are arbitrary\n * non-empty strings — a hand-written template may name an entry `closest`, and a qualifier\n * reading `closest` is not a reference to it. Matching the map is not on its own enough to\n * tell one from the other; the key is.\n *\n * Reached only from the generic object case — inside an identifier this package recognizes a\n * domain is spec data and stays as it is, which is what keeps an overridden column's\n * `specOverrides.domain` untouched.\n */\n const relocateDomain = (domain: Record<string, unknown>): Record<string, unknown> =>\n Object.fromEntries(\n Object.entries(domain).map(([key, value]) => [\n key,\n typeof value === \"string\" && BlockScopedDomain.has(key) ? remapBlockId(value) : walk(value),\n ]),\n );\n\n return walk(params) as T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,iBAAoB,QAAW,UAA0C;CACvF,IAAI,SAAS,SAAS,GAAG,OAAO;CAChC,MAAM,gBAAgB,YAAoB,SAAS,IAAI,OAAO,KAAK;CAEnE,MAAM,QAAQ,SAA2B;EAGvC,IAAI,OAAO,SAAS,UAAU,OAAO,sBAAsB,MAAM,YAAY;EAK7E,IAAI,qBAAqB,IAAI,GAAG,OAAO,sBAAsB,MAAM,YAAY;EAE/E,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,IAAI;EAE7C,IAAI,OAAO,SAAS,YAAY,SAAS,MAGvC,OAAO,OAAO,YACZ,OAAO,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CACzC,sBAAsB,KAAK,YAAY,GACvC,QAAQ,YAAY,cAAc,KAAK,IAAI,eAAe,KAAK,IAAI,KAAK,KAAK,CAC/E,CAAC,CACH;EAGF,OAAO;CACT;;;;;;;;;;;;;;CAeA,MAAM,kBAAkB,WACtB,OAAO,YACL,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAC3C,KACA,OAAO,UAAU,YAAY,kBAAkB,IAAI,GAAG,IAAI,aAAa,KAAK,IAAI,KAAK,KAAK,CAC5F,CAAC,CACH;CAEF,OAAO,KAAK,MAAM;AACpB"}
package/dist/utag.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { AuthorMarker } from "./author_marker.js";
2
-
3
2
  //#region src/utag.d.ts
4
3
  /** Value returned for changing states supporting reactive listening for changes */
5
- interface ValueWithUTag<V> {
4
+ export interface ValueWithUTag<V> {
6
5
  /** Value snapshot. */
7
6
  readonly value: V;
8
7
  /**
@@ -14,9 +13,8 @@ interface ValueWithUTag<V> {
14
13
  * */
15
14
  readonly uTag: string;
16
15
  }
17
- interface ValueWithUTagAndAuthor<V> extends ValueWithUTag<V> {
16
+ export interface ValueWithUTagAndAuthor<V> extends ValueWithUTag<V> {
18
17
  readonly author?: AuthorMarker;
19
18
  }
20
19
  //#endregion
21
- export { ValueWithUTag, ValueWithUTagAndAuthor };
22
20
  //# sourceMappingURL=utag.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utag.d.ts","names":[],"sources":["../src/utag.ts"],"mappings":";;;;UAGiB,aAAA;EAAA;EAAA,SAEN,KAAA,EAAO,CAAC;EAFW;;;;;;;EAAA,SAWnB,IAAA;AAAA;AAAA,UAGM,sBAAA,YAAkC,aAAA,CAAc,CAAA;EAAA,SACtD,MAAA,GAAS,YAAA;AAAA"}
1
+ {"version":3,"file":"utag.d.ts","names":[],"sources":["../src/utag.ts"],"mappings":";;;iBAGiB,cAAc;;WAEpB,OAAO;;;;;;;;WASP;;iBAGM,uBAAuB,WAAW,cAAc;WACtD,SAAS"}
package/dist/util.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  //#region src/util.d.ts
2
- declare function assertNever(x: never): never;
2
+ export declare function assertNever(x: never): never;
3
3
  /**
4
4
  * Return unique entries of the array by the provided id
5
5
  * For each id, the last entry is kept
6
6
  */
7
- declare function uniqueBy<T>(array: T[], makeId: (entry: T) => string): T[];
7
+ export declare function uniqueBy<T>(array: T[], makeId: (entry: T) => string): T[];
8
8
  //#endregion
9
- export { assertNever, uniqueBy };
10
9
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","names":[],"sources":["../src/util.ts"],"mappings":";iBAAgB,WAAA,CAAY,CAAQ;AAApC;;;;AAAA,iBAQgB,QAAA,IAAY,KAAA,EAAO,CAAA,IAAK,MAAA,GAAS,KAAA,EAAO,CAAA,cAAe,CAAA"}
1
+ {"version":3,"file":"util.d.ts","names":[],"sources":["../src/util.ts"],"mappings":";wBAAgB,YAAY;;;;;wBAQZ,SAAS,GAAG,OAAO,KAAK,SAAS,OAAO,eAAe"}
@@ -1,12 +1,11 @@
1
1
  //#region src/value_or_error.d.ts
2
- type ValueOrError<V, E> = {
2
+ export type ValueOrError<V, E> = {
3
3
  ok: true;
4
4
  value: V;
5
5
  } | {
6
6
  ok: false;
7
7
  error: E;
8
8
  };
9
- declare function mapValueInVOE<V1, V2, E>(voe: ValueOrError<V1, E>, cb: (value: V1) => V2): ValueOrError<V2, E>;
9
+ export declare function mapValueInVOE<V1, V2, E>(voe: ValueOrError<V1, E>, cb: (value: V1) => V2): ValueOrError<V2, E>;
10
10
  //#endregion
11
- export { ValueOrError, mapValueInVOE };
12
11
  //# sourceMappingURL=value_or_error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"value_or_error.d.ts","names":[],"sources":["../src/value_or_error.ts"],"mappings":";KAAY,YAAA;EAEN,EAAA;EACA,KAAA,EAAO,CAAA;AAAA;EAGP,EAAA;EACA,KAAA,EAAO,CAAC;AAAA;AAAA,iBAGE,aAAA,YACd,GAAA,EAAK,YAAA,CAAa,EAAA,EAAI,CAAA,GACtB,EAAA,GAAK,KAAA,EAAO,EAAA,KAAO,EAAA,GAClB,YAAA,CAAa,EAAA,EAAI,CAAA"}
1
+ {"version":3,"file":"value_or_error.d.ts","names":[],"sources":["../src/value_or_error.ts"],"mappings":";YAAY,aAAa,GAAG;EAEtB;EACA,OAAO;;EAGP;EACA,OAAO;;wBAGG,cAAc,IAAI,IAAI,GACpC,KAAK,aAAa,IAAI,IACtB,KAAK,OAAO,OAAO,KAClB,aAAa,IAAI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-common",
3
- "version": "1.48.0",
3
+ "version": "1.50.0",
4
4
  "description": "Platforma SDK Model",
5
5
  "files": [
6
6
  "./dist/**/*",
@@ -25,11 +25,11 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@vitest/coverage-istanbul": "^4.1.3",
28
- "typescript": "~5.9.3",
28
+ "typescript": "7.0.2",
29
29
  "vitest": "^4.1.3",
30
+ "@milaboratories/build-configs": "2.0.2",
30
31
  "@milaboratories/ts-configs": "1.4.0",
31
- "@milaboratories/build-configs": "2.0.0",
32
- "@milaboratories/ts-builder": "1.7.0"
32
+ "@milaboratories/ts-builder": "1.7.2"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "ts-builder build --target node",
@@ -83,6 +83,37 @@ export const Domain = {
83
83
  },
84
84
  } as const;
85
85
 
86
+ /**
87
+ * Domain keys whose value is the id of a block, rather than a qualifier of the data.
88
+ *
89
+ * Applying a template repoints these at the blocks of the project being built: an axis a block
90
+ * produced names that block in its domain, so an axis left naming the exported-from project
91
+ * resolves to nothing. Listing the keys is what makes that safe — a template's entry ids are
92
+ * arbitrary non-empty strings, so a hand-written template may name an entry `closest`, and a
93
+ * qualifier that happens to read `closest` must not be mistaken for a reference to it.
94
+ *
95
+ * A key absent from here is simply left alone, which is the behaviour from before relocation
96
+ * reached domains at all. Adding one is therefore safe; omitting one costs only that a template
97
+ * carrying it applies still pointing at the project it came from.
98
+ */
99
+ export const BlockScopedDomain: ReadonlySet<string> = new Set<string>([
100
+ "pl7.app/blockId",
101
+ "pl7.app/block",
102
+ "pl7.app/redefined-by",
103
+ "pl7.app/annotationRunId",
104
+ "pl7.app/clonotypeAnnotationRunId",
105
+ "pl7.app/clustering/blockId",
106
+ "pl7.app/umap/blockId",
107
+ "pl7.app/peptide/extractionRunId",
108
+ "pl7.app/repertoire/extractionRunId",
109
+ "pl7.app/antibodyVariantDesigner/designRunId",
110
+ "pl7.app/vdj/clonotypingRunId",
111
+ "pl7.app/vdj/clustering/blockId",
112
+ "pl7.app/vdj/integration/blockId",
113
+ "pl7.app/vdj/spatiotemporalAnalysis/blockId",
114
+ "pl7.app/vdj/libraryId",
115
+ ]);
116
+
86
117
  export type Domain = Metadata &
87
118
  Partial<{
88
119
  [Domain.Alphabet]: "nucleotide" | "aminoacid" | (string & {});
@@ -135,6 +166,7 @@ export const Annotation = {
135
166
  IsDenseAxis: "pl7.app/graph/isDenseAxis",
136
167
  IsVirtual: "pl7.app/graph/isVirtual",
137
168
  Palette: "pl7.app/graph/palette",
169
+ Shape: "pl7.app/graph/shape",
138
170
  Thresholds: "pl7.app/graph/thresholds",
139
171
  TreatAbsentValuesAs: "pl7.app/graph/treatAbsentValuesAs",
140
172
  },
@@ -196,7 +228,15 @@ export type Annotation = Metadata &
196
228
  [Annotation.Graph.Axis.UpperLimit]: StringifiedJson<number>;
197
229
  [Annotation.Graph.IsDenseAxis]: StringifiedJson<boolean>;
198
230
  [Annotation.Graph.IsVirtual]: StringifiedJson<boolean>;
199
- [Annotation.Graph.Palette]: StringifiedJson<{ mapping: Record<string, number>; name: string }>;
231
+ [Annotation.Graph.Palette]: StringifiedJson<{
232
+ name: string;
233
+ mapping?: Record<string, number>;
234
+ midPoint?: number;
235
+ min?: number;
236
+ max?: number;
237
+ log?: boolean;
238
+ }>;
239
+ [Annotation.Graph.Shape]: StringifiedJson<{ mapping: Record<string, string> }>;
200
240
  [Annotation.Graph.Thresholds]: StringifiedJson<
201
241
  { columnId: { valueType: ValueType; name: string }; value: number }[]
202
242
  >;
@@ -262,7 +302,15 @@ export const AnnotationJson: AnnotationJson = {
262
302
  [Annotation.Graph.Axis.UpperLimit]: z.number(),
263
303
  [Annotation.Graph.Axis.SymmetricRange]: z.boolean(),
264
304
  [Annotation.Graph.IsDenseAxis]: z.boolean(),
265
- [Annotation.Graph.Palette]: z.object({ mapping: z.record(z.number()), name: z.string() }),
305
+ [Annotation.Graph.Palette]: z.object({
306
+ name: z.string(),
307
+ mapping: z.record(z.coerce.number()).optional(),
308
+ midPoint: z.number().optional(),
309
+ min: z.number().optional(),
310
+ max: z.number().optional(),
311
+ log: z.boolean().optional(),
312
+ }),
313
+ [Annotation.Graph.Shape]: z.object({ mapping: z.record(z.string()) }),
266
314
  [Annotation.Graph.Thresholds]: z.array(
267
315
  z.object({
268
316
  columnId: z.object({ valueType: ValueTypeSchema, name: z.string() }),
@@ -13,7 +13,7 @@ export type BlockCodeFeatureFlags = Record<`supports${string}`, boolean | number
13
13
  Record<`requires${string}`, boolean | number | undefined>;
14
14
 
15
15
  /**
16
- * Known block flags. Flags are set during model compilation, see `BlockModel.create` for more details and for initial values.
16
+ * Known block flags. Flags are set during model compilation, see `BlockModelV3` feature flags for more details and for initial values.
17
17
  */
18
18
  export type BlockCodeKnownFeatureFlags = {
19
19
  readonly supportsLazyState?: boolean;
@@ -109,6 +109,63 @@ describe("relocateBlockIds", () => {
109
109
  });
110
110
  });
111
111
 
112
+ describe("a domain that qualifies an axis", () => {
113
+ // An axis a block produced names that block in its domain — `pl7.app/sampleId` is
114
+ // qualified by the block that defined the samples, a clonotype key by the run that called
115
+ // the clonotypes. A chart bound to such an axis is bound to a reference.
116
+ const axis = (runId: string) => ({
117
+ kind: "axis",
118
+ name: "pl7.app/vdj/clonotypeKey",
119
+ type: "String",
120
+ domain: { "pl7.app/vdj/chain": "IGHeavy", "pl7.app/vdj/clonotypingRunId": runId },
121
+ });
122
+
123
+ test("an entry naming one of this template's entries is repointed", () => {
124
+ expect(relocateBlockIds({ x: axis("old") }, to("old", "new"))).toEqual({ x: axis("new") });
125
+ });
126
+
127
+ test("an entry that is not an entry id is left alone", () => {
128
+ // The map is the whole test of what is a reference: nothing reads a value's shape, so an
129
+ // ordinary qualifier cannot be caught by it.
130
+ const moved = relocateBlockIds({ x: axis("old") }, to("old", "new")) as {
131
+ x: { domain: Record<string, string> };
132
+ };
133
+
134
+ expect(moved.x.domain["pl7.app/vdj/chain"]).toBe("IGHeavy");
135
+ });
136
+
137
+ test("a domain naming a block this template does not carry keeps it", () => {
138
+ // The ordering rule again: an entry created later is not in the map yet, and the applied
139
+ // block reports itself as missing references rather than pointing at the wrong block.
140
+ expect(relocateBlockIds({ x: axis("later") }, to("earlier", "new"))).toEqual({
141
+ x: axis("later"),
142
+ });
143
+ });
144
+
145
+ test("a qualifier that merely collides with an entry id is NOT a reference", () => {
146
+ // Entry ids are validated only as non-empty strings, so a hand-written template names its
147
+ // entries readably. `algo` is a qualifier of the data, and an entry called `closest` does
148
+ // not make it one: matching the map is not evidence, the key is.
149
+ const params = { method: { domain: { algo: "closest", chain: "IGHeavy" } } };
150
+
151
+ expect(relocateBlockIds(params, to("closest", "new"))).toEqual(params);
152
+ });
153
+
154
+ test("a domain INSIDE a recognized identifier is still spec data, and stays", () => {
155
+ // The boundary of the rule above. This id is taken apart by the structural remapper,
156
+ // which never descends to the generic object case, so its overrides are untouched.
157
+ const id = createColumnOverriddenId({
158
+ source: leafId("old", "clonotypes"),
159
+ specOverrides: { domain: { producedBy: "old" } },
160
+ });
161
+
162
+ const moved = relocateBlockIds({ a: id }, to("old", "new")) as { a: string };
163
+ const key = JSON.parse(moved.a) as { specOverrides: { domain: unknown } };
164
+
165
+ expect(key.specOverrides.domain).toEqual({ producedBy: "old" });
166
+ });
167
+ });
168
+
112
169
  describe("depth", () => {
113
170
  test("three nested forms are repointed at the bottom and rebuilt on the way up", () => {
114
171
  const deep = (block: string) =>