@objectstack/platform-objects 4.2.0 → 5.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/index.mjs CHANGED
@@ -5577,11 +5577,11 @@ var SysMetadataObject = ObjectSchema.create({
5577
5577
  required: false,
5578
5578
  defaultValue: 1
5579
5579
  }),
5580
- /** Content checksum for change detection */
5580
+ /** Content checksum for change detection (e.g. `sha256:<64 hex>` = 71 chars) */
5581
5581
  checksum: Field.text({
5582
5582
  label: "Checksum",
5583
5583
  required: false,
5584
- maxLength: 64
5584
+ maxLength: 71
5585
5585
  }),
5586
5586
  /** Origin of this metadata record */
5587
5587
  source: Field.select(["filesystem", "database", "api", "migration"], {
@@ -5648,7 +5648,7 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5648
5648
  icon: "history",
5649
5649
  isSystem: true,
5650
5650
  managedBy: "system",
5651
- description: "Version history and audit trail for metadata changes",
5651
+ description: "Durable event log of metadata overlay changes (per-org, append-only)",
5652
5652
  fields: {
5653
5653
  /** Primary Key (UUID) */
5654
5654
  id: Field.text({
@@ -5656,11 +5656,12 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5656
5656
  required: true,
5657
5657
  readonly: true
5658
5658
  }),
5659
- /** Foreign key to sys_metadata.id */
5660
- metadata_id: Field.lookup("sys_metadata", {
5661
- label: "Metadata",
5659
+ /** Per-org monotonic event sequence (durable cursor for replay). */
5660
+ event_seq: Field.number({
5661
+ label: "Event Seq",
5662
5662
  required: true,
5663
- readonly: true
5663
+ readonly: true,
5664
+ description: "Per-organization monotonic event log cursor."
5664
5665
  }),
5665
5666
  /** Machine name (denormalized for easier querying) */
5666
5667
  name: Field.text({
@@ -5678,7 +5679,7 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5678
5679
  readonly: true,
5679
5680
  maxLength: 100
5680
5681
  }),
5681
- /** Version number at this snapshot */
5682
+ /** Per-(org,type,name) lineage counter at this snapshot. */
5682
5683
  version: Field.number({
5683
5684
  label: "Version",
5684
5685
  required: true,
@@ -5690,33 +5691,47 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5690
5691
  required: true,
5691
5692
  readonly: true
5692
5693
  }),
5693
- /** Historical metadata snapshot (JSON payload) */
5694
+ /**
5695
+ * Historical metadata snapshot (JSON payload).
5696
+ * Null for `operation_type = 'delete'` — the row carries no body.
5697
+ */
5694
5698
  metadata: Field.textarea({
5695
5699
  label: "Metadata",
5696
- required: true,
5700
+ required: false,
5697
5701
  readonly: true,
5698
- description: "JSON-serialized metadata snapshot at this version"
5702
+ description: "JSON-serialized metadata snapshot at this version (null for deletes)."
5699
5703
  }),
5700
- /** SHA-256 checksum of metadata content */
5704
+ /** SHA-256 checksum of metadata content (null for deletes). */
5701
5705
  checksum: Field.text({
5702
5706
  label: "Checksum",
5703
- required: true,
5707
+ required: false,
5704
5708
  readonly: true,
5705
- maxLength: 64
5709
+ maxLength: 80
5706
5710
  }),
5707
- /** Checksum of the previous version */
5711
+ /** Checksum of the previous version (null for the first event). */
5708
5712
  previous_checksum: Field.text({
5709
5713
  label: "Previous Checksum",
5710
5714
  required: false,
5711
5715
  readonly: true,
5712
- maxLength: 64
5716
+ maxLength: 80
5713
5717
  }),
5714
- /** Human-readable description of changes */
5718
+ /** Human-readable description of changes (= MetadataEvent.message). */
5715
5719
  change_note: Field.textarea({
5716
5720
  label: "Change Note",
5717
5721
  required: false,
5718
5722
  readonly: true,
5719
- description: "Description of what changed in this version"
5723
+ description: "Description of what changed in this version."
5724
+ }),
5725
+ /**
5726
+ * Producer of the event ('sys-metadata-repo', 'fs', 'studio',
5727
+ * 'api', …). Defaults to 'sys-metadata-repo' on the canonical
5728
+ * write path; preserved on history() reads as MetadataEvent.source.
5729
+ */
5730
+ source: Field.text({
5731
+ label: "Source",
5732
+ required: false,
5733
+ readonly: true,
5734
+ maxLength: 64
5720
5735
  }),
5721
5736
  /** Organization ID for multi-tenant isolation */
5722
5737
  organization_id: Field.lookup("sys_organization", {
@@ -5725,15 +5740,7 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5725
5740
  readonly: true,
5726
5741
  description: "Organization for multi-tenant isolation."
5727
5742
  }),
5728
- /** Environment ID null = platform-global, set = env-scoped */
5729
- project_id: Field.text({
5730
- label: "Environment ID",
5731
- required: false,
5732
- readonly: true,
5733
- maxLength: 255,
5734
- description: "Scopes this history entry to a specific environment."
5735
- }),
5736
- /** User who made this change */
5743
+ /** User who made this change (= MetadataEvent.actor). */
5737
5744
  recorded_by: Field.lookup("sys_user", {
5738
5745
  label: "Recorded By",
5739
5746
  required: false,
@@ -5747,21 +5754,21 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5747
5754
  })
5748
5755
  },
5749
5756
  indexes: [
5750
- { fields: ["metadata_id", "version"], unique: true },
5751
- { fields: ["metadata_id", "recorded_at"] },
5757
+ { fields: ["organization_id", "event_seq"], unique: true },
5758
+ { fields: ["organization_id", "type", "name", "version"], unique: true },
5759
+ { fields: ["organization_id", "type", "name", "recorded_at"] },
5760
+ // ADR-0009: getByHash() lookup — execution-pinned types resolve a
5761
+ // historical body by content hash via this index.
5762
+ { fields: ["organization_id", "type", "name", "checksum"] },
5752
5763
  { fields: ["type", "name"] },
5753
5764
  { fields: ["recorded_at"] },
5754
- { fields: ["operation_type"] },
5755
- { fields: ["organization_id"] },
5756
- { fields: ["project_id"] }
5765
+ { fields: ["operation_type"] }
5757
5766
  ],
5758
5767
  enable: {
5759
5768
  trackHistory: false,
5760
- // Don't track history of history records
5761
5769
  searchable: false,
5762
5770
  apiEnabled: true,
5763
5771
  apiMethods: ["get", "list"],
5764
- // Read-only via API
5765
5772
  trash: false
5766
5773
  }
5767
5774
  });
@@ -9247,9 +9254,6 @@ var enObjects = {
9247
9254
  id: {
9248
9255
  label: "ID"
9249
9256
  },
9250
- metadata_id: {
9251
- label: "Metadata"
9252
- },
9253
9257
  name: {
9254
9258
  label: "Name"
9255
9259
  },
@@ -12289,9 +12293,6 @@ var zhCNObjects = {
12289
12293
  id: {
12290
12294
  label: "ID"
12291
12295
  },
12292
- metadata_id: {
12293
- label: "\u5143\u6570\u636E"
12294
- },
12295
12296
  name: {
12296
12297
  label: "\u540D\u79F0"
12297
12298
  },
@@ -15277,9 +15278,6 @@ var jaJPObjects = {
15277
15278
  id: {
15278
15279
  label: "ID"
15279
15280
  },
15280
- metadata_id: {
15281
- label: "\u30E1\u30BF\u30C7\u30FC\u30BF"
15282
- },
15283
15281
  name: {
15284
15282
  label: "\u540D\u524D"
15285
15283
  },
@@ -18265,9 +18263,6 @@ var esESObjects = {
18265
18263
  id: {
18266
18264
  label: "ID"
18267
18265
  },
18268
- metadata_id: {
18269
- label: "Metadatos"
18270
- },
18271
18266
  name: {
18272
18267
  label: "Nombre"
18273
18268
  },