@objectstack/metadata 10.3.0 → 11.1.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/dist/node.cjs CHANGED
@@ -3201,6 +3201,8 @@ var import_spec2 = require("@objectstack/spec");
3201
3201
  var queryableMetadataObjects = [
3202
3202
  import_metadata_core2.SysMetadataObject,
3203
3203
  import_metadata_core2.SysMetadataHistoryObject,
3204
+ // ADR-0067 commit log — sibling of sys_metadata_history (see note above).
3205
+ import_metadata_core2.SysMetadataCommitObject,
3204
3206
  import_metadata_core2.SysMetadataAuditObject,
3205
3207
  // Runtime view storage (shared / personal). Must always be provisioned so
3206
3208
  // end-user view creation via the generic data API has a place to write —
@@ -3353,7 +3355,7 @@ var MetadataPlugin = class {
3353
3355
  const src3 = this.options.artifactSource;
3354
3356
  if (src3?.mode === "local-file") {
3355
3357
  try {
3356
- await this._loadFromLocalFile(ctx, src3.path, src3.fetchTimeoutMs);
3358
+ await this._reloadAndAnnounce(ctx, src3, body?.changed ?? [src3.path]);
3357
3359
  ctx.logger.info("[MetadataPlugin] artifact reloaded via HMR POST", {
3358
3360
  path: src3.path,
3359
3361
  reason: body?.reason
@@ -3388,7 +3390,7 @@ var MetadataPlugin = class {
3388
3390
  if (pending) return;
3389
3391
  pending = true;
3390
3392
  try {
3391
- await this._loadFromLocalFile(ctx, src2.path, src2.fetchTimeoutMs);
3393
+ await this._reloadAndAnnounce(ctx, src2, [src2.path]);
3392
3394
  hub.broadcastReload("artifact-file-changed", [src2.path]);
3393
3395
  ctx.logger.info("[MetadataPlugin] artifact auto-reloaded (file watcher)", {
3394
3396
  path: src2.path
@@ -3559,6 +3561,27 @@ var MetadataPlugin = class {
3559
3561
  ctx.logger.info("[MetadataPlugin] Artifact metadata loaded", { source: label, totalRegistered });
3560
3562
  return totalRegistered;
3561
3563
  }
3564
+ /**
3565
+ * Reload the artifact from disk into the MetadataManager, then announce a
3566
+ * generic `metadata:reloaded` hook. Used by BOTH reload paths (the HMR POST
3567
+ * handler and the server-side artifact-file watcher) — but NOT the initial
3568
+ * boot load, which other plugins already consume directly.
3569
+ *
3570
+ * Runtime consumers that cached boot-time metadata re-sync on this signal.
3571
+ * The automation engine subscribes to re-bind flow triggers it pulled ONCE
3572
+ * at boot — notably scheduled jobs: without this, an edited
3573
+ * schedule-triggered flow keeps firing its pre-edit definition (old runAs /
3574
+ * schedule / logic) until a full process restart. A subscriber failure is
3575
+ * logged but never blocks the reload.
3576
+ */
3577
+ async _reloadAndAnnounce(ctx, src, changed) {
3578
+ await this._loadFromLocalFile(ctx, src.path, src.fetchTimeoutMs);
3579
+ try {
3580
+ await ctx.trigger("metadata:reloaded", { changed });
3581
+ } catch (e) {
3582
+ ctx.logger.warn("[MetadataPlugin] metadata:reloaded subscriber failed", { error: e?.message });
3583
+ }
3584
+ }
3562
3585
  async _loadFromLocalFile(ctx, filePath, fetchTimeoutMs) {
3563
3586
  const isUrl = /^https?:\/\//i.test(filePath);
3564
3587
  ctx.logger.info(