@objectstack/metadata 17.3.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.
- package/CHANGELOG.md +532 -0
- package/README.md +6 -4
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.cjs +299 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -60
- package/dist/index.d.ts +227 -60
- package/dist/index.js +294 -35
- package/dist/index.js.map +1 -1
- package/dist/migrations/index.cjs +104 -22
- package/dist/migrations/index.cjs.map +1 -1
- package/dist/migrations/index.d.cts +40 -1
- package/dist/migrations/index.d.ts +40 -1
- package/dist/migrations/index.js +107 -22
- package/dist/migrations/index.js.map +1 -1
- package/dist/node.cjs +299 -36
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +24 -1
- package/dist/node.d.ts +24 -1
- package/dist/node.js +294 -35
- package/dist/node.js.map +1 -1
- package/dist/view-container.cjs +37 -0
- package/dist/view-container.cjs.map +1 -0
- package/dist/view-container.d.cts +76 -0
- package/dist/view-container.d.ts +76 -0
- package/dist/view-container.js +12 -0
- package/dist/view-container.js.map +1 -0
- package/package.json +18 -8
|
@@ -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.
|
|
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",
|
|
@@ -46,6 +46,16 @@
|
|
|
46
46
|
"types": "./dist/errors.d.cts",
|
|
47
47
|
"default": "./dist/errors.cjs"
|
|
48
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
|
+
}
|
|
49
59
|
}
|
|
50
60
|
},
|
|
51
61
|
"files": [
|
|
@@ -65,19 +75,19 @@
|
|
|
65
75
|
"glob": "^13.0.6",
|
|
66
76
|
"js-yaml": "^5.2.3",
|
|
67
77
|
"zod": "^4.4.3",
|
|
68
|
-
"@objectstack/core": "17.
|
|
69
|
-
"@objectstack/metadata-core": "17.
|
|
70
|
-
"@objectstack/metadata-fs": "17.
|
|
71
|
-
"@objectstack/platform-objects": "17.
|
|
72
|
-
"@objectstack/spec": "17.
|
|
73
|
-
"@objectstack/types": "17.
|
|
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"
|
|
74
84
|
},
|
|
75
85
|
"devDependencies": {
|
|
76
86
|
"@types/js-yaml": "^4.0.9",
|
|
77
87
|
"@types/node": "^26.2.0",
|
|
78
88
|
"typescript": "^6.0.3",
|
|
79
89
|
"vitest": "^4.1.10",
|
|
80
|
-
"@objectstack/driver-sqlite-wasm": "17.
|
|
90
|
+
"@objectstack/driver-sqlite-wasm": "17.4.0"
|
|
81
91
|
},
|
|
82
92
|
"author": "ObjectStack",
|
|
83
93
|
"repository": {
|