@objectstack/platform-objects 4.2.0 → 5.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/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,24 @@ 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."
5665
+ }),
5666
+ /**
5667
+ * Parent `sys_metadata.id` at insertion time (plain text, no FK).
5668
+ * Null for events whose parent row no longer exists (e.g. some
5669
+ * delete records). Forensic only — joins should go through
5670
+ * `(organization_id, type, name)`.
5671
+ */
5672
+ metadata_id: Field.text({
5673
+ label: "Metadata ID",
5674
+ required: false,
5675
+ readonly: true,
5676
+ maxLength: 64
5664
5677
  }),
5665
5678
  /** Machine name (denormalized for easier querying) */
5666
5679
  name: Field.text({
@@ -5678,7 +5691,7 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5678
5691
  readonly: true,
5679
5692
  maxLength: 100
5680
5693
  }),
5681
- /** Version number at this snapshot */
5694
+ /** Per-(org,type,name) lineage counter at this snapshot. */
5682
5695
  version: Field.number({
5683
5696
  label: "Version",
5684
5697
  required: true,
@@ -5690,33 +5703,47 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5690
5703
  required: true,
5691
5704
  readonly: true
5692
5705
  }),
5693
- /** Historical metadata snapshot (JSON payload) */
5706
+ /**
5707
+ * Historical metadata snapshot (JSON payload).
5708
+ * Null for `operation_type = 'delete'` — the row carries no body.
5709
+ */
5694
5710
  metadata: Field.textarea({
5695
5711
  label: "Metadata",
5696
- required: true,
5712
+ required: false,
5697
5713
  readonly: true,
5698
- description: "JSON-serialized metadata snapshot at this version"
5714
+ description: "JSON-serialized metadata snapshot at this version (null for deletes)."
5699
5715
  }),
5700
- /** SHA-256 checksum of metadata content */
5716
+ /** SHA-256 checksum of metadata content (null for deletes). */
5701
5717
  checksum: Field.text({
5702
5718
  label: "Checksum",
5703
- required: true,
5719
+ required: false,
5704
5720
  readonly: true,
5705
- maxLength: 64
5721
+ maxLength: 80
5706
5722
  }),
5707
- /** Checksum of the previous version */
5723
+ /** Checksum of the previous version (null for the first event). */
5708
5724
  previous_checksum: Field.text({
5709
5725
  label: "Previous Checksum",
5710
5726
  required: false,
5711
5727
  readonly: true,
5712
- maxLength: 64
5728
+ maxLength: 80
5713
5729
  }),
5714
- /** Human-readable description of changes */
5730
+ /** Human-readable description of changes (= MetadataEvent.message). */
5715
5731
  change_note: Field.textarea({
5716
5732
  label: "Change Note",
5717
5733
  required: false,
5718
5734
  readonly: true,
5719
- description: "Description of what changed in this version"
5735
+ description: "Description of what changed in this version."
5736
+ }),
5737
+ /**
5738
+ * Producer of the event ('sys-metadata-repo', 'fs', 'studio',
5739
+ * 'api', …). Defaults to 'sys-metadata-repo' on the canonical
5740
+ * write path; preserved on history() reads as MetadataEvent.source.
5741
+ */
5742
+ source: Field.text({
5743
+ label: "Source",
5744
+ required: false,
5745
+ readonly: true,
5746
+ maxLength: 64
5720
5747
  }),
5721
5748
  /** Organization ID for multi-tenant isolation */
5722
5749
  organization_id: Field.lookup("sys_organization", {
@@ -5725,15 +5752,7 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5725
5752
  readonly: true,
5726
5753
  description: "Organization for multi-tenant isolation."
5727
5754
  }),
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 */
5755
+ /** User who made this change (= MetadataEvent.actor). */
5737
5756
  recorded_by: Field.lookup("sys_user", {
5738
5757
  label: "Recorded By",
5739
5758
  required: false,
@@ -5747,21 +5766,18 @@ var SysMetadataHistoryObject = ObjectSchema.create({
5747
5766
  })
5748
5767
  },
5749
5768
  indexes: [
5750
- { fields: ["metadata_id", "version"], unique: true },
5751
- { fields: ["metadata_id", "recorded_at"] },
5769
+ { fields: ["organization_id", "event_seq"], unique: true },
5770
+ { fields: ["organization_id", "type", "name", "version"], unique: true },
5771
+ { fields: ["organization_id", "type", "name", "recorded_at"] },
5752
5772
  { fields: ["type", "name"] },
5753
5773
  { fields: ["recorded_at"] },
5754
- { fields: ["operation_type"] },
5755
- { fields: ["organization_id"] },
5756
- { fields: ["project_id"] }
5774
+ { fields: ["operation_type"] }
5757
5775
  ],
5758
5776
  enable: {
5759
5777
  trackHistory: false,
5760
- // Don't track history of history records
5761
5778
  searchable: false,
5762
5779
  apiEnabled: true,
5763
5780
  apiMethods: ["get", "list"],
5764
- // Read-only via API
5765
5781
  trash: false
5766
5782
  }
5767
5783
  });