@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.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._loadFromLocalFile(ctx, src3.path, src3.fetchTimeoutMs);
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._loadFromLocalFile(ctx, src2.path, src2.fetchTimeoutMs);
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(