@idfkit/schemas 0.0.1 → 0.2.0-rc.1

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.
package/README.md CHANGED
@@ -16,10 +16,12 @@ npm install @idfkit/schemas
16
16
  The raw epJSON schemas are ~10 MB each, 17 of them, 11.9 MB gzipped in total. In
17
17
  a Python wheel nobody notices. On a page load it decides your architecture.
18
18
 
19
- 87% of object-type definitions are byte-identical across releases: `Zone` has not
20
- changed since EnergyPlus 8.9. So this package stores each unique definition once,
21
- keyed by a content hash, and gives every version a manifest mapping type name to
22
- hash.
19
+ The 17 manifests name 14,092 object-type definitions between them, and only
20
+ 2,568 of those are distinct. 82% of what the releases carry is a byte-identical
21
+ repeat of a definition another release already has: `Construction`, for
22
+ instance, has changed once in 17 releases. So this package stores each unique
23
+ definition once, keyed by a content hash, and gives every version a manifest
24
+ mapping type name to hash.
23
25
 
24
26
  | | All 17 versions, gzipped |
25
27
  | ---------------------------------------- | ------------------------ |
@@ -28,7 +30,7 @@ hash.
28
30
  | Content-addressed (this package) | ~1,000 KB |
29
31
 
30
32
  Splitting per version would have been the obvious move and is the wrong one: it
31
- duplicates the shared 87% across packages and makes cross-version work require
33
+ duplicates the shared 82% across packages and makes cross-version work require
32
34
  several installs. The longer argument is in [Content-addressed
33
35
  schemas](https://js.idfkit.com/explanation/content-addressed-schemas/).
34
36
 
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
@@ -17,8 +17,14 @@ export interface BundleSource {
17
17
  *
18
18
  * Reads the gzipped bundle and inflates it with `DecompressionStream`, which is
19
19
  * baseline-available in browsers. That keeps the served payload at roughly 1 MB
20
- * for all 17 versions instead of the ~6 MB the raw JSON would cost, and it does
21
- * not depend on the host serving the right `Content-Encoding`.
20
+ * for all 17 versions instead of the ~6 MB the raw JSON would cost.
21
+ *
22
+ * The payload is sniffed for the gzip magic bytes before inflating. A host that
23
+ * maps the `.gz` extension to `Content-Encoding: gzip` (Vite's dev server,
24
+ * nginx with `gzip_static on`, and several static hosts) makes the HTTP client
25
+ * inflate the body itself, leaving plain JSON with nothing left to decompress.
26
+ * Feeding that to `DecompressionStream` fails with an opaque `incorrect header
27
+ * check`, so we only decompress when the bytes actually start with `1f 8b`.
22
28
  */
23
29
  export declare function httpSource(baseUrl: string): BundleSource;
24
30
  /**
@@ -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;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAexD;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;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"}
package/dist/index.js CHANGED
@@ -5,21 +5,41 @@ export { BlobStore, Schema } from './schema.js';
5
5
  *
6
6
  * Reads the gzipped bundle and inflates it with `DecompressionStream`, which is
7
7
  * baseline-available in browsers. That keeps the served payload at roughly 1 MB
8
- * for all 17 versions instead of the ~6 MB the raw JSON would cost, and it does
9
- * not depend on the host serving the right `Content-Encoding`.
8
+ * for all 17 versions instead of the ~6 MB the raw JSON would cost.
9
+ *
10
+ * The payload is sniffed for the gzip magic bytes before inflating. A host that
11
+ * maps the `.gz` extension to `Content-Encoding: gzip` (Vite's dev server,
12
+ * nginx with `gzip_static on`, and several static hosts) makes the HTTP client
13
+ * inflate the body itself, leaving plain JSON with nothing left to decompress.
14
+ * Feeding that to `DecompressionStream` fails with an opaque `incorrect header
15
+ * check`, so we only decompress when the bytes actually start with `1f 8b`.
10
16
  */
11
17
  export function httpSource(baseUrl) {
12
- const base = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
18
+ // Resolve against the document base when there is one, so a same-origin
19
+ // path like '/schemas/' works the way `fetch('/schemas/...')` does. In Node
20
+ // there is no base, and a relative path stays an error — it cannot resolve.
21
+ // Resolution is deferred to `read` so that merely constructing the source
22
+ // (e.g. `new SchemaBundle(httpSource('/schemas/'))` at module scope in an
23
+ // isomorphic app) never throws on the server; the error only surfaces if a
24
+ // relative base is actually read where it cannot resolve.
25
+ const normalized = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
13
26
  return {
14
27
  async read(fileName) {
28
+ const documentBase = globalThis.location?.href;
29
+ const base = new URL(normalized, documentBase).href;
15
30
  const response = await fetch(new URL(`${fileName}.gz`, base));
16
31
  if (!response.ok) {
17
32
  throw new Error(`Failed to load ${fileName}.gz: ${response.status} ${response.statusText}`);
18
33
  }
19
- if (response.body === null) {
34
+ const bytes = new Uint8Array(await response.arrayBuffer());
35
+ if (bytes.length === 0) {
20
36
  throw new Error(`Empty response for ${fileName}.gz`);
21
37
  }
22
- const stream = response.body.pipeThrough(new DecompressionStream('gzip'));
38
+ // The client already inflated the body (host set Content-Encoding: gzip).
39
+ if (bytes[0] !== 0x1f || bytes[1] !== 0x8b) {
40
+ return JSON.parse(new TextDecoder().decode(bytes));
41
+ }
42
+ const stream = new Blob([bytes]).stream().pipeThrough(new DecompressionStream('gzip'));
23
43
  return JSON.parse(await new Response(stream).text());
24
44
  },
25
45
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,M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,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
@@ -4,8 +4,9 @@
4
4
  * This is deliberately NOT the raw epJSON schema. Keys are single letters and
5
5
  * documentation metadata (`note`, `ip-units`, `field_info`) is dropped, because
6
6
  * this bundle is on the critical path of every parse and, in a browser, every
7
- * page load. Human-facing metadata lives in `@idfkit/schemas/docs`, which only
8
- * tooling that renders documentation needs to pull in.
7
+ * page load. This package republishes that metadata nowhere; tooling that
8
+ * renders documentation reads the raw epJSON schemas directly, or uses
9
+ * idfkit-docs (https://docs.idfkit.com).
9
10
  */
10
11
  /** Field storage class, mirroring how the IDF writer must format the value. */
11
12
  export type FieldKind =
@@ -20,22 +21,59 @@ export type FieldKind =
20
21
  export interface SlimField {
21
22
  /** Storage class. */
22
23
  t: FieldKind;
23
- /** Field accepts `Autosize` / `Autocalculate` in addition to a number. */
24
+ /**
25
+ * Field is an `anyOf` of a numeric branch and a string branch, in that order.
26
+ *
27
+ * Set for every one of the 13060 such fields across the 17 bundled versions.
28
+ * The numeric branch's type, enum and bounds are hoisted onto this record;
29
+ * the string branch survives as `se`.
30
+ */
24
31
  auto?: 1;
32
+ /**
33
+ * String literals the `anyOf` string branch accepts, verbatim from the schema.
34
+ *
35
+ * Only meaningful together with `auto`. Absent while `auto` is set means the
36
+ * string branch carries no enum at all and ANY string is legal there, which is
37
+ * the shape of 646 fields including `Schedule:Compact`'s extensible `field`.
38
+ * That is why the empty string is kept here rather than filtered out the way
39
+ * `e` filters it: `se: ['']` (the whole string branch of the 68 fields whose
40
+ * number branch carries a numeric enum) and no `se` at all mean the opposite
41
+ * of one another.
42
+ *
43
+ * The sentinel is not a constant: 10565 fields take `Autosize` and 1781 take
44
+ * `Autocalculate`, so a validator that accepts either everywhere accepts a
45
+ * value EnergyPlus rejects.
46
+ */
47
+ se?: string[];
25
48
  /** Names of reference lists this field points *into* (i.e. it is a foreign key). */
26
49
  ol?: string[];
27
50
  /** Names of reference lists this field contributes *to* (i.e. it is a key). */
28
51
  ref?: string[];
29
- /** Permitted values for a choice field. */
30
- e?: string[];
52
+ /**
53
+ * Permitted values for a choice field.
54
+ *
55
+ * Numbers, not strings, on the 68 fields across the versions that express a
56
+ * choice numerically (`e: [1, 3]` on `Site:GroundDomain:Slab.phase`). Compare
57
+ * strings case-insensitively and numbers by value.
58
+ */
59
+ e?: (string | number)[];
31
60
  /** Schema default, applied on write when the field is absent. */
32
61
  d?: string | number;
33
62
  min?: number;
34
63
  max?: number;
35
- /** Exclusive minimum. */
36
- xmin?: number;
37
- /** Exclusive maximum. */
38
- xmax?: number;
64
+ /**
65
+ * Exclusive minimum, in whichever JSON Schema dialect the version shipped.
66
+ *
67
+ * A number is the bound itself (draft-06+, 9.6.0 onwards). The boolean `true`
68
+ * qualifies the sibling `min`, making it exclusive (draft-04, 8.9.0 through
69
+ * 9.5.0). Measured across the bundled schemas: `xmin` is boolean 9013 times
70
+ * in the older seven versions and numeric 13840 times in the newer ten;
71
+ * `xmax` behaves identically, and no version mixes the two. Branch on the
72
+ * value's type, never on the version.
73
+ */
74
+ xmin?: number | boolean;
75
+ /** Exclusive maximum. Number or boolean, exactly as `xmin`. */
76
+ xmax?: number | boolean;
39
77
  /** SI units, used by the unit-conversion helpers. */
40
78
  u?: string;
41
79
  /** Value is case-sensitive and must not be normalized. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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,CAA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GAAG,OAAO,CAAC;IACxB,qDAAqD;IACrD,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,0DAA0D;IAC1D,EAAE,CAAC,EAAE,CAAC,CAAC;CACR;AAED,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,kEAAkE;IAClE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,QAAQ;IACvB,yEAAyE;IACzE,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,qDAAqD;IACrD,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC7B,4BAA4B;IAC5B,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IACb,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,iCAAiC;IACjC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,8EAA8E;IAC9E,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,8EAA8E;IAC9E,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,0DAA0D;IAC1D,CAAC,CAAC,EAAE,cAAc,CAAC;IACnB,oDAAoD;IACpD,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,2EAA2E;AAC3E,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC"}
package/dist/types.js CHANGED
@@ -4,8 +4,9 @@
4
4
  * This is deliberately NOT the raw epJSON schema. Keys are single letters and
5
5
  * documentation metadata (`note`, `ip-units`, `field_info`) is dropped, because
6
6
  * this bundle is on the critical path of every parse and, in a browser, every
7
- * page load. Human-facing metadata lives in `@idfkit/schemas/docs`, which only
8
- * tooling that renders documentation needs to pull in.
7
+ * page load. This package republishes that metadata nowhere; tooling that
8
+ * renders documentation reads the raw epJSON schemas directly, or uses
9
+ * idfkit-docs (https://docs.idfkit.com).
9
10
  */
10
11
  export {};
11
12
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idfkit/schemas",
3
- "version": "0.0.1",
3
+ "version": "0.2.0-rc.1",
4
4
  "description": "Content-addressed EnergyPlus epJSON schemas for all supported versions",
5
5
  "type": "module",
6
6
  "license": "MIT",