@objectstack/metadata 4.0.4 → 4.0.5

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Metadata Loading, Persistence & Customization Layer for ObjectStack.**
4
4
 
5
- `@objectstack/metadata` is the central service responsible for loading, validating, persisting and watching all metadata definitions (Objects, Views, Flows, Apps, Agents, etc.) in the ObjectStack platform.
5
+ `@objectstack/metadata` is the central service responsible for loading, validating, optionally persisting, and watching all metadata definitions (Objects, Views, Flows, Apps, Agents, etc.) in the ObjectStack platform.
6
6
 
7
7
  It implements the **`IMetadataService`** contract from `@objectstack/spec` and acts as the single source of truth that all other packages depend on.
8
8
 
@@ -40,17 +40,22 @@ It implements the **`IMetadataService`** contract from `@objectstack/spec` and a
40
40
 
41
41
  ## Core Concepts
42
42
 
43
- ### 1. Metadata Sources (Three-Scope Model)
43
+ ### 1. Metadata Sources (Runtime Boundary)
44
44
 
45
- ObjectStack adopts a three-scope layered model for metadata:
45
+ ObjectStack separates ObjectOS runtime reads from control-plane metadata
46
+ persistence:
46
47
 
47
- | Scope | Storage | Mutability | Description |
48
- |:-----------|:-------------|:-------------|:-------------------------------------------|
49
- | `system` | Filesystem | Read-only | Defined in code, shipped with packages |
50
- | `platform` | Database | Admin-editable | Created/modified by admins via UI |
51
- | `user` | Database | User-editable | Personal customizations per user |
48
+ | Runtime context | Storage | Mutability | Description |
49
+ |:----------------|:--------|:-----------|:------------|
50
+ | ObjectOS local/dev | Filesystem or local artifact | Read-only at boot | `MetadataPlugin` scans files or hydrates from `dist/objectstack.json`. |
51
+ | ObjectOS production | Artifact API response | Read-only at boot | Metadata is immutable for a `commitId` / `checksum`; project DB stores business rows only. |
52
+ | Control plane / tooling | `DatabaseLoader` when explicitly configured | Writable | Stores project metadata revisions, overlays, and history outside the ObjectOS project DB. |
52
53
 
53
- Resolution order: **system** merge(**platform**) merge(**user**).
54
+ `MetadataPlugin` does **not** automatically bridge ObjectQL to
55
+ `DatabaseLoader`, and it does not register `sys_metadata` /
56
+ `sys_metadata_history` into the ObjectOS manifest. Database-backed metadata
57
+ persistence remains available through `MetadataManager.setDatabaseDriver()` or
58
+ `setDataEngine()` for control-plane services that opt in explicitly.
54
59
 
55
60
  ### 2. Loaders
56
61
 
@@ -110,7 +115,9 @@ Integrates with the ObjectStack kernel plugin system:
110
115
 
111
116
  - Registers as the primary `IMetadataService` provider
112
117
  - Auto-loads all metadata types from the filesystem on startup (sorted by `loadOrder`)
118
+ - Can hydrate runtime metadata from a local project artifact (`dist/objectstack.json`)
113
119
  - Supports YAML, JSON, TypeScript, and JavaScript metadata formats
120
+ - Keeps ObjectOS metadata read-only; database persistence is not auto-enabled
114
121
 
115
122
  ## Metadata Types
116
123
 
@@ -194,7 +201,7 @@ manager.watchService('object', (event) => {
194
201
  ```typescript
195
202
  import { MetadataPlugin } from '@objectstack/metadata/node';
196
203
 
197
- const plugin = MetadataPlugin({
204
+ const plugin = new MetadataPlugin({
198
205
  rootDir: './src',
199
206
  watch: process.env.NODE_ENV === 'development',
200
207
  });
@@ -202,6 +209,19 @@ const plugin = MetadataPlugin({
202
209
  kernel.use(plugin);
203
210
  ```
204
211
 
212
+ ### With Local Artifact Boot
213
+
214
+ ```typescript
215
+ import { MetadataPlugin } from '@objectstack/metadata/node';
216
+
217
+ const plugin = new MetadataPlugin({
218
+ watch: false,
219
+ artifactSource: { mode: 'local-file', path: './dist/objectstack.json' },
220
+ });
221
+
222
+ kernel.use(plugin);
223
+ ```
224
+
205
225
  ## Package Publishing
206
226
 
207
227
  ObjectStack supports **package-level metadata publishing** — all metadata items within a package are published atomically.