@objectstack/metadata 17.2.0 → 17.4.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.
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/view-container.ts
21
+ var view_container_exports = {};
22
+ __export(view_container_exports, {
23
+ deriveViewContainerObject: () => deriveViewContainerObject
24
+ });
25
+ module.exports = __toCommonJS(view_container_exports);
26
+ function deriveViewContainerObject(container) {
27
+ if (!container || typeof container !== "object") return void 0;
28
+ const c = container;
29
+ const own = typeof c.object === "string" && c.object ? c.object : void 0;
30
+ const byName = typeof c.name === "string" && c.name ? c.name : void 0;
31
+ return own ?? c?.list?.data?.object ?? c?.form?.data?.object ?? byName;
32
+ }
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ deriveViewContainerObject
36
+ });
37
+ //# sourceMappingURL=view-container.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/view-container.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4EO,SAAS,0BAA0B,WAAwC;AAChF,MAAI,CAAC,aAAa,OAAO,cAAc,SAAU,QAAO;AACxD,QAAM,IAAI;AACV,QAAM,MAAM,OAAO,EAAE,WAAW,YAAY,EAAE,SAAS,EAAE,SAAS;AAClE,QAAM,SAAS,OAAO,EAAE,SAAS,YAAY,EAAE,OAAO,EAAE,OAAO;AAC/D,SAAO,OAAO,GAAG,MAAM,MAAM,UAAU,GAAG,MAAM,MAAM,UAAU;AAClE;","names":[]}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * `@objectstack/metadata/view-container` — the one spelling of "which object
3
+ * does an aggregated `defineView` container bind to", as a LEAF entry point.
4
+ *
5
+ * ## Why this subpath exists
6
+ *
7
+ * This is the `/errors` pattern taken a second time, for the same reason
8
+ * (`src/errors.ts` carries the first telling). `@objectstack/metadata`'s ROOT
9
+ * entry pulls `MetadataPlugin` → `NodeMetadataManager` → `chokidar`, plus
10
+ * `glob` and `js-yaml`; a cross-package consumer that wants a six-line pure
11
+ * function should not have to load any of that.
12
+ *
13
+ * The consumer that forced it is `packages/objectql`'s ADR-0076 lean entry.
14
+ * `@objectstack/objectql/core` re-exports `engine.ts`, whose boot-loop
15
+ * registrar has to mint the same registry key as this package's registrars
16
+ * (#14399), so it imports {@link deriveViewContainerObject} rather than
17
+ * hand-copying the chain a fifth time — and reaching it through the root entry
18
+ * made that lean closure load the manager and the filesystem machinery for a
19
+ * function that touches neither. Measured on the built artifacts (#14680):
20
+ * through the root entry that call site loaded SIX extra modules into
21
+ * `@objectstack/objectql/core`'s module-init closure —
22
+ * `packages/metadata/dist/index.js`, `js-yaml`, `glob`, `chokidar` (two
23
+ * files) and `readdirp`, 499,162 B — for ~22 ms of extra init. Through this
24
+ * entry it loads one 469-byte module and nothing else.
25
+ *
26
+ * ## Why the function LIVES here rather than being re-exported from
27
+ * `view-container-expansion.ts`
28
+ *
29
+ * A re-export shim was written first and measured, because `/errors`' header
30
+ * states the requirement the shim has to meet: "this entry re-exports one leaf
31
+ * module and nothing else, so the cross-package edge stays a leaf edge".
32
+ * `view-container-expansion.ts` is not a leaf — its other export,
33
+ * `expandRuntimeViewContainer`, needs `@objectstack/spec` and
34
+ * `@objectstack/spec/shared` — and esbuild tree-shakes the unused FUNCTION but
35
+ * keeps both `import` statements, since it cannot prove an external package is
36
+ * side-effect-free. Measured: the shim's own closure was 84
37
+ * modules / 3,035 KiB (all of `@objectstack/spec` and `zod`, reached through an
38
+ * import statement for a function that had been shaken out); this module's is
39
+ * 1 module / 469 B.
40
+ *
41
+ * So the derivation lives in this module, which imports nothing at all, and
42
+ * `view-container-expansion.ts` imports it from here and re-exports it — every
43
+ * existing importer (`index.ts`'s root export, `plugin.ts`) keeps its spelling.
44
+ *
45
+ * ## Scope of the promise
46
+ *
47
+ * Only {@link deriveViewContainerObject} is exported here. Its former module
48
+ * sibling `expandRuntimeViewContainer` is deliberately left off: it is internal
49
+ * to this package (`metadata-manager.ts` is its only caller, and the root entry
50
+ * does not export it either), and an exported symbol nobody imports is a promise
51
+ * made for nothing — Prime Directive #10 pointed at our own API surface, the
52
+ * same call `src/errors.ts` made about `isSchemaAlreadyExistsError`.
53
+ *
54
+ * The symbol stays on the ROOT entry as well: this subpath is an additional
55
+ * door, not a relocation, and the root export is a published promise with
56
+ * possible out-of-repo consumers.
57
+ */
58
+ /**
59
+ * Which object an aggregated view container binds to.
60
+ *
61
+ * The container's OWN top-level `object` field — `ViewSchema.object`,
62
+ * documented there as "how a stack-level `views: [...]` entry says which object
63
+ * its views belong to; read by `getViewsByObject()` / `GET /meta/view?object=`"
64
+ * — is the authorial, explicit signal and is consulted FIRST (#13407). The
65
+ * three-deep fallback below it is kept unchanged for every container written
66
+ * before that field was read here: `list.data.object`, then `form.data.object`,
67
+ * then the row's own `name` — which is the bound object only by convention, and
68
+ * is why a container that set the top-level field but not `list.data.object`
69
+ * used to bind under the wrong key or not at all.
70
+ *
71
+ * Returns `undefined` when no binding can be derived; every caller treats that
72
+ * as "no expansion" rather than an error.
73
+ */
74
+ declare function deriveViewContainerObject(container: unknown): string | undefined;
75
+
76
+ export { deriveViewContainerObject };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * `@objectstack/metadata/view-container` — the one spelling of "which object
3
+ * does an aggregated `defineView` container bind to", as a LEAF entry point.
4
+ *
5
+ * ## Why this subpath exists
6
+ *
7
+ * This is the `/errors` pattern taken a second time, for the same reason
8
+ * (`src/errors.ts` carries the first telling). `@objectstack/metadata`'s ROOT
9
+ * entry pulls `MetadataPlugin` → `NodeMetadataManager` → `chokidar`, plus
10
+ * `glob` and `js-yaml`; a cross-package consumer that wants a six-line pure
11
+ * function should not have to load any of that.
12
+ *
13
+ * The consumer that forced it is `packages/objectql`'s ADR-0076 lean entry.
14
+ * `@objectstack/objectql/core` re-exports `engine.ts`, whose boot-loop
15
+ * registrar has to mint the same registry key as this package's registrars
16
+ * (#14399), so it imports {@link deriveViewContainerObject} rather than
17
+ * hand-copying the chain a fifth time — and reaching it through the root entry
18
+ * made that lean closure load the manager and the filesystem machinery for a
19
+ * function that touches neither. Measured on the built artifacts (#14680):
20
+ * through the root entry that call site loaded SIX extra modules into
21
+ * `@objectstack/objectql/core`'s module-init closure —
22
+ * `packages/metadata/dist/index.js`, `js-yaml`, `glob`, `chokidar` (two
23
+ * files) and `readdirp`, 499,162 B — for ~22 ms of extra init. Through this
24
+ * entry it loads one 469-byte module and nothing else.
25
+ *
26
+ * ## Why the function LIVES here rather than being re-exported from
27
+ * `view-container-expansion.ts`
28
+ *
29
+ * A re-export shim was written first and measured, because `/errors`' header
30
+ * states the requirement the shim has to meet: "this entry re-exports one leaf
31
+ * module and nothing else, so the cross-package edge stays a leaf edge".
32
+ * `view-container-expansion.ts` is not a leaf — its other export,
33
+ * `expandRuntimeViewContainer`, needs `@objectstack/spec` and
34
+ * `@objectstack/spec/shared` — and esbuild tree-shakes the unused FUNCTION but
35
+ * keeps both `import` statements, since it cannot prove an external package is
36
+ * side-effect-free. Measured: the shim's own closure was 84
37
+ * modules / 3,035 KiB (all of `@objectstack/spec` and `zod`, reached through an
38
+ * import statement for a function that had been shaken out); this module's is
39
+ * 1 module / 469 B.
40
+ *
41
+ * So the derivation lives in this module, which imports nothing at all, and
42
+ * `view-container-expansion.ts` imports it from here and re-exports it — every
43
+ * existing importer (`index.ts`'s root export, `plugin.ts`) keeps its spelling.
44
+ *
45
+ * ## Scope of the promise
46
+ *
47
+ * Only {@link deriveViewContainerObject} is exported here. Its former module
48
+ * sibling `expandRuntimeViewContainer` is deliberately left off: it is internal
49
+ * to this package (`metadata-manager.ts` is its only caller, and the root entry
50
+ * does not export it either), and an exported symbol nobody imports is a promise
51
+ * made for nothing — Prime Directive #10 pointed at our own API surface, the
52
+ * same call `src/errors.ts` made about `isSchemaAlreadyExistsError`.
53
+ *
54
+ * The symbol stays on the ROOT entry as well: this subpath is an additional
55
+ * door, not a relocation, and the root export is a published promise with
56
+ * possible out-of-repo consumers.
57
+ */
58
+ /**
59
+ * Which object an aggregated view container binds to.
60
+ *
61
+ * The container's OWN top-level `object` field — `ViewSchema.object`,
62
+ * documented there as "how a stack-level `views: [...]` entry says which object
63
+ * its views belong to; read by `getViewsByObject()` / `GET /meta/view?object=`"
64
+ * — is the authorial, explicit signal and is consulted FIRST (#13407). The
65
+ * three-deep fallback below it is kept unchanged for every container written
66
+ * before that field was read here: `list.data.object`, then `form.data.object`,
67
+ * then the row's own `name` — which is the bound object only by convention, and
68
+ * is why a container that set the top-level field but not `list.data.object`
69
+ * used to bind under the wrong key or not at all.
70
+ *
71
+ * Returns `undefined` when no binding can be derived; every caller treats that
72
+ * as "no expansion" rather than an error.
73
+ */
74
+ declare function deriveViewContainerObject(container: unknown): string | undefined;
75
+
76
+ export { deriveViewContainerObject };
@@ -0,0 +1,12 @@
1
+ // src/view-container.ts
2
+ function deriveViewContainerObject(container) {
3
+ if (!container || typeof container !== "object") return void 0;
4
+ const c = container;
5
+ const own = typeof c.object === "string" && c.object ? c.object : void 0;
6
+ const byName = typeof c.name === "string" && c.name ? c.name : void 0;
7
+ return own ?? c?.list?.data?.object ?? c?.form?.data?.object ?? byName;
8
+ }
9
+ export {
10
+ deriveViewContainerObject
11
+ };
12
+ //# sourceMappingURL=view-container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/view-container.ts"],"mappings":";AA4EO,SAAS,0BAA0B,WAAwC;AAChF,MAAI,CAAC,aAAa,OAAO,cAAc,SAAU,QAAO;AACxD,QAAM,IAAI;AACV,QAAM,MAAM,OAAO,EAAE,WAAW,YAAY,EAAE,SAAS,EAAE,SAAS;AAClE,QAAM,SAAS,OAAO,EAAE,SAAS,YAAY,EAAE,OAAO,EAAE,OAAO;AAC/D,SAAO,OAAO,GAAG,MAAM,MAAM,UAAU,GAAG,MAAM,MAAM,UAAU;AAClE;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@objectstack/metadata",
3
- "version": "17.2.0",
3
+ "version": "17.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Metadata loading, saving, and persistence for ObjectStack",
6
6
  "type": "module",
@@ -8,24 +8,54 @@
8
8
  "types": "dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.cjs"
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
14
19
  },
15
20
  "./node": {
16
- "types": "./dist/node.d.ts",
17
- "import": "./dist/node.js",
18
- "require": "./dist/node.cjs"
21
+ "import": {
22
+ "types": "./dist/node.d.ts",
23
+ "default": "./dist/node.js"
24
+ },
25
+ "require": {
26
+ "types": "./dist/node.d.cts",
27
+ "default": "./dist/node.cjs"
28
+ }
19
29
  },
20
30
  "./migrations": {
21
- "types": "./dist/migrations/index.d.ts",
22
- "import": "./dist/migrations/index.js",
23
- "require": "./dist/migrations/index.cjs"
31
+ "import": {
32
+ "types": "./dist/migrations/index.d.ts",
33
+ "default": "./dist/migrations/index.js"
34
+ },
35
+ "require": {
36
+ "types": "./dist/migrations/index.d.cts",
37
+ "default": "./dist/migrations/index.cjs"
38
+ }
24
39
  },
25
40
  "./errors": {
26
- "types": "./dist/errors.d.ts",
27
- "import": "./dist/errors.js",
28
- "require": "./dist/errors.cjs"
41
+ "import": {
42
+ "types": "./dist/errors.d.ts",
43
+ "default": "./dist/errors.js"
44
+ },
45
+ "require": {
46
+ "types": "./dist/errors.d.cts",
47
+ "default": "./dist/errors.cjs"
48
+ }
49
+ },
50
+ "./view-container": {
51
+ "import": {
52
+ "types": "./dist/view-container.d.ts",
53
+ "default": "./dist/view-container.js"
54
+ },
55
+ "require": {
56
+ "types": "./dist/view-container.d.cts",
57
+ "default": "./dist/view-container.cjs"
58
+ }
29
59
  }
30
60
  },
31
61
  "files": [
@@ -45,19 +75,19 @@
45
75
  "glob": "^13.0.6",
46
76
  "js-yaml": "^5.2.3",
47
77
  "zod": "^4.4.3",
48
- "@objectstack/core": "17.2.0",
49
- "@objectstack/metadata-core": "17.2.0",
50
- "@objectstack/metadata-fs": "17.2.0",
51
- "@objectstack/platform-objects": "17.2.0",
52
- "@objectstack/spec": "17.2.0",
53
- "@objectstack/types": "17.2.0"
78
+ "@objectstack/core": "17.4.0",
79
+ "@objectstack/metadata-core": "17.4.0",
80
+ "@objectstack/metadata-fs": "17.4.0",
81
+ "@objectstack/platform-objects": "17.4.0",
82
+ "@objectstack/spec": "17.4.0",
83
+ "@objectstack/types": "17.4.0"
54
84
  },
55
85
  "devDependencies": {
56
86
  "@types/js-yaml": "^4.0.9",
57
87
  "@types/node": "^26.2.0",
58
88
  "typescript": "^6.0.3",
59
89
  "vitest": "^4.1.10",
60
- "@objectstack/driver-sqlite-wasm": "17.2.0"
90
+ "@objectstack/driver-sqlite-wasm": "17.4.0"
61
91
  },
62
92
  "author": "ObjectStack",
63
93
  "repository": {
@@ -74,9 +104,10 @@
74
104
  "node": ">=22.0.0"
75
105
  },
76
106
  "scripts": {
77
- "build": "tsup",
107
+ "build": "tsup && node ../../scripts/check-dts-emitted.mjs",
78
108
  "dev": "tsc --watch",
79
109
  "clean": "rm -rf dist",
110
+ "typecheck": "tsc --noEmit",
80
111
  "test": "vitest run",
81
112
  "test:watch": "vitest",
82
113
  "test:coverage": "vitest run --coverage"