@idfkit/schemas 0.2.0-rc.1 → 0.2.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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Schema } from './schema.js';
2
+ import type { ProsePool } from './types.js';
2
3
  export { BlobStore, Schema } from './schema.js';
3
4
  export type { SchemaDelta } from './schema.js';
4
- export type { BundleIndex, FieldKind, Manifest, SlimExtensible, SlimField, SlimType, } from './types.js';
5
+ export type { BundleIndex, FieldKind, Manifest, ProsePool, SlimExtensible, SlimField, SlimType, } from './types.js';
5
6
  /**
6
7
  * Where bundle files come from.
7
8
  *
@@ -49,5 +50,34 @@ export declare class SchemaBundle {
49
50
  load(version: string): Promise<Schema>;
50
51
  /** A version already loaded, or undefined. Synchronous by design. */
51
52
  loaded(version: string): Schema | undefined;
53
+ /**
54
+ * Load the explanatory prose this bundle's manifests index into.
55
+ *
56
+ * One pool serves every version: `build.mjs` deduplicates the memos and notes
57
+ * of all seventeen schemas into a single array and the manifests carry indices
58
+ * into it, so there is no version to pass here.
59
+ *
60
+ * It is a separate call rather than part of `load` because the two are wanted
61
+ * at different moments by different callers. Parsing a model needs the records
62
+ * and never needs a sentence of English; describing a type for a reader needs
63
+ * both. Keeping the fetch separate is what lets the parse path stay unaware the
64
+ * pool exists, which `check-bundle-purity.mjs` asserts by building a minimal
65
+ * read-and-write graph and failing on any input under `data/`.
66
+ *
67
+ * Repeat calls return the same array; concurrent calls share one read.
68
+ */
69
+ loadProse(): Promise<ProsePool>;
70
+ /**
71
+ * The prose pool if it has been loaded, or undefined. Synchronous by design.
72
+ *
73
+ * The counterpart of `loaded`, and it exists for the same reason. Everything
74
+ * that reads prose is synchronous: `describeObjectType` takes a pool rather
75
+ * than fetching one, and every answer in `@idfkit/language` is a pure function
76
+ * so an editor server can answer a cursor without holding a thread. A consumer
77
+ * calls `loadProse` once when a document arrives and reads this on the request
78
+ * path. Without the pair, a caller would either await inside a path it keeps
79
+ * synchronous or build a second cache beside the one this class already has.
80
+ */
81
+ prose(): ProsePool | undefined;
52
82
  }
53
83
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,cAAc,EACd,SAAS,EACT,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CA6BxD;AAED;;;;;;GAMG;AACH,qBAAa,YAAY;;gBAQX,MAAM,EAAE,YAAY;IAIhC,oDAAoD;IAC9C,QAAQ,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAI5C,wCAAwC;IAClC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAO/B;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAY5C,qEAAqE;IACrE,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CA4B5C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAyB,SAAS,EAAY,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,cAAc,EACd,SAAS,EACT,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CA6BxD;AAED;;;;;;GAMG;AACH,qBAAa,YAAY;;gBAWX,MAAM,EAAE,YAAY;IAIhC,oDAAoD;IAC9C,QAAQ,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAI5C,wCAAwC;IAClC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAO/B;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAY5C,qEAAqE;IACrE,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI3C;;;;;;;;;;;;;;;OAeG;IACG,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;IAarC;;;;;;;;;;OAUG;IACH,KAAK,IAAI,SAAS,GAAG,SAAS;CAkC/B"}
package/dist/index.js CHANGED
@@ -58,6 +58,9 @@ export class SchemaBundle {
58
58
  #schemas = new Map();
59
59
  /** In-flight loads, so concurrent callers share one request. */
60
60
  #pending = new Map();
61
+ #prose;
62
+ /** In-flight prose read, on the same terms as `#pending`. */
63
+ #proseInFlight;
61
64
  constructor(source) {
62
65
  this.#source = source;
63
66
  }
@@ -93,6 +96,53 @@ export class SchemaBundle {
93
96
  loaded(version) {
94
97
  return this.#schemas.get(version);
95
98
  }
99
+ /**
100
+ * Load the explanatory prose this bundle's manifests index into.
101
+ *
102
+ * One pool serves every version: `build.mjs` deduplicates the memos and notes
103
+ * of all seventeen schemas into a single array and the manifests carry indices
104
+ * into it, so there is no version to pass here.
105
+ *
106
+ * It is a separate call rather than part of `load` because the two are wanted
107
+ * at different moments by different callers. Parsing a model needs the records
108
+ * and never needs a sentence of English; describing a type for a reader needs
109
+ * both. Keeping the fetch separate is what lets the parse path stay unaware the
110
+ * pool exists, which `check-bundle-purity.mjs` asserts by building a minimal
111
+ * read-and-write graph and failing on any input under `data/`.
112
+ *
113
+ * Repeat calls return the same array; concurrent calls share one read.
114
+ */
115
+ async loadProse() {
116
+ if (this.#prose !== undefined)
117
+ return this.#prose;
118
+ const inFlight = this.#proseInFlight;
119
+ if (inFlight !== undefined)
120
+ return inFlight;
121
+ const promise = this.#loadProse().finally(() => {
122
+ this.#proseInFlight = undefined;
123
+ });
124
+ this.#proseInFlight = promise;
125
+ return promise;
126
+ }
127
+ /**
128
+ * The prose pool if it has been loaded, or undefined. Synchronous by design.
129
+ *
130
+ * The counterpart of `loaded`, and it exists for the same reason. Everything
131
+ * that reads prose is synchronous: `describeObjectType` takes a pool rather
132
+ * than fetching one, and every answer in `@idfkit/language` is a pure function
133
+ * so an editor server can answer a cursor without holding a thread. A consumer
134
+ * calls `loadProse` once when a document arrives and reads this on the request
135
+ * path. Without the pair, a caller would either await inside a path it keeps
136
+ * synchronous or build a second cache beside the one this class already has.
137
+ */
138
+ prose() {
139
+ return this.#prose;
140
+ }
141
+ async #loadProse() {
142
+ const pool = (await this.#source.read('docs.json'));
143
+ this.#prose = pool;
144
+ return pool;
145
+ }
96
146
  async #load(version) {
97
147
  const index = await this.#loadIndex();
98
148
  const fileName = index.manifests[version];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.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AC,QAAQ,CAAC,CAAa,CAAC;QACjE,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAgB,CAAC;QACvE,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
package/dist/types.d.ts CHANGED
@@ -78,6 +78,28 @@ export interface SlimField {
78
78
  u?: string;
79
79
  /** Value is case-sensitive and must not be normalized. */
80
80
  rc?: 1;
81
+ /**
82
+ * The enum also accepts the empty string.
83
+ *
84
+ * `e` is filtered of `''` because it is what validation checks against, and
85
+ * admitting the blank there would change what `validate()` accepts. Python's
86
+ * `describe_object_type` reports it, so the description path puts it back
87
+ * from this flag and validation never sees it.
88
+ *
89
+ * A flag rather than an index because the blank is first every time: across
90
+ * all 17 bundled schemas, all 21,962 blank-bearing enums carry it at position
91
+ * 0. `bundle.test.ts` asserts that, so a schema that breaks it fails loudly
92
+ * instead of silently reordering a choice list.
93
+ */
94
+ eb?: 1;
95
+ /**
96
+ * The field's explanatory sentence, as an index into the prose pool.
97
+ *
98
+ * An index, not the text: 3,837 distinct field notes are shared across about
99
+ * 119,000 occurrences. Resolve it against `docs.json.gz`, which is loaded on
100
+ * demand and is never on the parse path.
101
+ */
102
+ n?: number;
81
103
  }
82
104
  export interface SlimExtensible {
83
105
  /** epJSON key holding the array, e.g. `vertices`. */
@@ -106,6 +128,23 @@ export interface SlimType {
106
128
  x?: SlimExtensible;
107
129
  /** IDD group, e.g. `Thermal Zones and Surfaces`. */
108
130
  g?: string;
131
+ /**
132
+ * The type's explanatory sentence, as an index into the prose pool.
133
+ *
134
+ * See `SlimField.n`. Present for 845 of 858 types in 26.1.0; a type with no
135
+ * memo in the source schema has none here, and both languages report nothing
136
+ * rather than a placeholder.
137
+ */
138
+ m?: number;
139
+ /**
140
+ * Field names in declaration order, for the types where `f` cannot give it.
141
+ *
142
+ * `f` holds only the name for exactly three types in every bundled version,
143
+ * so the description path would otherwise fall back to the key order of `p` —
144
+ * which the content-addressing serializer has sorted alphabetically. This
145
+ * records the order that sort destroys, and is emitted only for those three.
146
+ */
147
+ fo?: string[];
109
148
  }
110
149
  /** A manifest maps object type name to a blob hash in the shared store. */
111
150
  export type Manifest = Record<string, string>;
@@ -115,4 +154,16 @@ export interface BundleIndex {
115
154
  /** Per-version manifest file names, keyed by version string. */
116
155
  manifests: Record<string, string>;
117
156
  }
157
+ /**
158
+ * The schema's explanatory prose, deduplicated across every bundled version.
159
+ *
160
+ * A plain array of strings, indexed by `SlimType.m` and `SlimField.n`. It lives
161
+ * here rather than beside the code that reads it because THE INDICES ARE ONLY
162
+ * MEANINGFUL AGAINST THE MANIFESTS BUILT IN THE SAME RUN: `build.mjs` writes
163
+ * `docs.json` and the manifests together, and a pool paired with manifests from
164
+ * a different build resolves every sentence to the wrong one, silently. Keeping
165
+ * the type and the loader on `SchemaBundle` is what makes that pairing hard to
166
+ * get wrong.
167
+ */
168
+ export type ProsePool = readonly string[];
118
169
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,+EAA+E;AAC/E,MAAM,MAAM,SAAS;AACnB,+BAA+B;AAC7B,GAAG;AACL,oDAAoD;GAClD,GAAG;AACL,gDAAgD;GAC9C,GAAG;AACL,gCAAgC;GAC9B,KAAK,CAAC;AAEV,MAAM,WAAW,SAAS;IACxB,qBAAqB;IACrB,CAAC,EAAE,SAAS,CAAC;IACb;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,CAA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MAAM,EAAE,CAAC;IACnB,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,MAAM,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idfkit/schemas",
3
- "version": "0.2.0-rc.1",
3
+ "version": "0.2.0",
4
4
  "description": "Content-addressed EnergyPlus epJSON schemas for all supported versions",
5
5
  "type": "module",
6
6
  "license": "MIT",