@objectstack/metadata 10.2.0 → 11.0.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/LICENSE +202 -93
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +25 -2
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +26 -2
- package/dist/node.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -608,6 +608,20 @@ declare class MetadataPlugin implements Plugin {
|
|
|
608
608
|
* metadata items into the MetadataManager.
|
|
609
609
|
*/
|
|
610
610
|
private _parseAndRegisterArtifact;
|
|
611
|
+
/**
|
|
612
|
+
* Reload the artifact from disk into the MetadataManager, then announce a
|
|
613
|
+
* generic `metadata:reloaded` hook. Used by BOTH reload paths (the HMR POST
|
|
614
|
+
* handler and the server-side artifact-file watcher) — but NOT the initial
|
|
615
|
+
* boot load, which other plugins already consume directly.
|
|
616
|
+
*
|
|
617
|
+
* Runtime consumers that cached boot-time metadata re-sync on this signal.
|
|
618
|
+
* The automation engine subscribes to re-bind flow triggers it pulled ONCE
|
|
619
|
+
* at boot — notably scheduled jobs: without this, an edited
|
|
620
|
+
* schedule-triggered flow keeps firing its pre-edit definition (old runAs /
|
|
621
|
+
* schedule / logic) until a full process restart. A subscriber failure is
|
|
622
|
+
* logged but never blocks the reload.
|
|
623
|
+
*/
|
|
624
|
+
private _reloadAndAnnounce;
|
|
611
625
|
private _loadFromLocalFile;
|
|
612
626
|
/**
|
|
613
627
|
* P2: Load metadata from the cloud artifact API endpoint.
|
package/dist/index.d.ts
CHANGED
|
@@ -608,6 +608,20 @@ declare class MetadataPlugin implements Plugin {
|
|
|
608
608
|
* metadata items into the MetadataManager.
|
|
609
609
|
*/
|
|
610
610
|
private _parseAndRegisterArtifact;
|
|
611
|
+
/**
|
|
612
|
+
* Reload the artifact from disk into the MetadataManager, then announce a
|
|
613
|
+
* generic `metadata:reloaded` hook. Used by BOTH reload paths (the HMR POST
|
|
614
|
+
* handler and the server-side artifact-file watcher) — but NOT the initial
|
|
615
|
+
* boot load, which other plugins already consume directly.
|
|
616
|
+
*
|
|
617
|
+
* Runtime consumers that cached boot-time metadata re-sync on this signal.
|
|
618
|
+
* The automation engine subscribes to re-bind flow triggers it pulled ONCE
|
|
619
|
+
* at boot — notably scheduled jobs: without this, an edited
|
|
620
|
+
* schedule-triggered flow keeps firing its pre-edit definition (old runAs /
|
|
621
|
+
* schedule / logic) until a full process restart. A subscriber failure is
|
|
622
|
+
* logged but never blocks the reload.
|
|
623
|
+
*/
|
|
624
|
+
private _reloadAndAnnounce;
|
|
611
625
|
private _loadFromLocalFile;
|
|
612
626
|
/**
|
|
613
627
|
* P2: Load metadata from the cloud artifact API endpoint.
|
package/dist/index.js
CHANGED
|
@@ -3153,6 +3153,7 @@ import { applyProtection } from "@objectstack/spec/shared";
|
|
|
3153
3153
|
import {
|
|
3154
3154
|
SysMetadataObject as SysMetadataObject2,
|
|
3155
3155
|
SysMetadataHistoryObject as SysMetadataHistoryObject2,
|
|
3156
|
+
SysMetadataCommitObject,
|
|
3156
3157
|
SysMetadataAuditObject,
|
|
3157
3158
|
SysViewDefinitionObject
|
|
3158
3159
|
} from "@objectstack/metadata-core";
|
|
@@ -3161,6 +3162,8 @@ import { isAggregatedViewContainer as isAggregatedViewContainer2, expandViewCont
|
|
|
3161
3162
|
var queryableMetadataObjects = [
|
|
3162
3163
|
SysMetadataObject2,
|
|
3163
3164
|
SysMetadataHistoryObject2,
|
|
3165
|
+
// ADR-0067 commit log — sibling of sys_metadata_history (see note above).
|
|
3166
|
+
SysMetadataCommitObject,
|
|
3164
3167
|
SysMetadataAuditObject,
|
|
3165
3168
|
// Runtime view storage (shared / personal). Must always be provisioned so
|
|
3166
3169
|
// end-user view creation via the generic data API has a place to write —
|
|
@@ -3313,7 +3316,7 @@ var MetadataPlugin = class {
|
|
|
3313
3316
|
const src3 = this.options.artifactSource;
|
|
3314
3317
|
if (src3?.mode === "local-file") {
|
|
3315
3318
|
try {
|
|
3316
|
-
await this.
|
|
3319
|
+
await this._reloadAndAnnounce(ctx, src3, body?.changed ?? [src3.path]);
|
|
3317
3320
|
ctx.logger.info("[MetadataPlugin] artifact reloaded via HMR POST", {
|
|
3318
3321
|
path: src3.path,
|
|
3319
3322
|
reason: body?.reason
|
|
@@ -3348,7 +3351,7 @@ var MetadataPlugin = class {
|
|
|
3348
3351
|
if (pending) return;
|
|
3349
3352
|
pending = true;
|
|
3350
3353
|
try {
|
|
3351
|
-
await this.
|
|
3354
|
+
await this._reloadAndAnnounce(ctx, src2, [src2.path]);
|
|
3352
3355
|
hub.broadcastReload("artifact-file-changed", [src2.path]);
|
|
3353
3356
|
ctx.logger.info("[MetadataPlugin] artifact auto-reloaded (file watcher)", {
|
|
3354
3357
|
path: src2.path
|
|
@@ -3519,6 +3522,27 @@ var MetadataPlugin = class {
|
|
|
3519
3522
|
ctx.logger.info("[MetadataPlugin] Artifact metadata loaded", { source: label, totalRegistered });
|
|
3520
3523
|
return totalRegistered;
|
|
3521
3524
|
}
|
|
3525
|
+
/**
|
|
3526
|
+
* Reload the artifact from disk into the MetadataManager, then announce a
|
|
3527
|
+
* generic `metadata:reloaded` hook. Used by BOTH reload paths (the HMR POST
|
|
3528
|
+
* handler and the server-side artifact-file watcher) — but NOT the initial
|
|
3529
|
+
* boot load, which other plugins already consume directly.
|
|
3530
|
+
*
|
|
3531
|
+
* Runtime consumers that cached boot-time metadata re-sync on this signal.
|
|
3532
|
+
* The automation engine subscribes to re-bind flow triggers it pulled ONCE
|
|
3533
|
+
* at boot — notably scheduled jobs: without this, an edited
|
|
3534
|
+
* schedule-triggered flow keeps firing its pre-edit definition (old runAs /
|
|
3535
|
+
* schedule / logic) until a full process restart. A subscriber failure is
|
|
3536
|
+
* logged but never blocks the reload.
|
|
3537
|
+
*/
|
|
3538
|
+
async _reloadAndAnnounce(ctx, src, changed) {
|
|
3539
|
+
await this._loadFromLocalFile(ctx, src.path, src.fetchTimeoutMs);
|
|
3540
|
+
try {
|
|
3541
|
+
await ctx.trigger("metadata:reloaded", { changed });
|
|
3542
|
+
} catch (e) {
|
|
3543
|
+
ctx.logger.warn("[MetadataPlugin] metadata:reloaded subscriber failed", { error: e?.message });
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3522
3546
|
async _loadFromLocalFile(ctx, filePath, fetchTimeoutMs) {
|
|
3523
3547
|
const isUrl = /^https?:\/\//i.test(filePath);
|
|
3524
3548
|
ctx.logger.info(
|