@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.
@@ -609,6 +609,12 @@ declare const SysWebhook: Omit<{
609
609
  recordTypes?: string[] | undefined;
610
610
  sharingModel?: "read" | "full" | "private" | "read_write" | undefined;
611
611
  keyPrefix?: string | undefined;
612
+ detail?: {
613
+ [x: string]: unknown;
614
+ renderViaSchema?: boolean | undefined;
615
+ hideReferenceRail?: boolean | undefined;
616
+ hideRelatedTab?: boolean | undefined;
617
+ } | undefined;
612
618
  actions?: {
613
619
  name: string;
614
620
  label: string;
@@ -609,6 +609,12 @@ declare const SysWebhook: Omit<{
609
609
  recordTypes?: string[] | undefined;
610
610
  sharingModel?: "read" | "full" | "private" | "read_write" | undefined;
611
611
  keyPrefix?: string | undefined;
612
+ detail?: {
613
+ [x: string]: unknown;
614
+ renderViaSchema?: boolean | undefined;
615
+ hideReferenceRail?: boolean | undefined;
616
+ hideRelatedTab?: boolean | undefined;
617
+ } | undefined;
612
618
  actions?: {
613
619
  name: string;
614
620
  label: string;
@@ -598,6 +598,12 @@ declare const SysMetadataObject: Omit<{
598
598
  recordTypes?: string[] | undefined;
599
599
  sharingModel?: "read" | "full" | "private" | "read_write" | undefined;
600
600
  keyPrefix?: string | undefined;
601
+ detail?: {
602
+ [x: string]: unknown;
603
+ renderViaSchema?: boolean | undefined;
604
+ hideReferenceRail?: boolean | undefined;
605
+ hideRelatedTab?: boolean | undefined;
606
+ } | undefined;
601
607
  actions?: {
602
608
  name: string;
603
609
  label: string;
@@ -3506,7 +3512,7 @@ declare const SysMetadataObject: Omit<{
3506
3512
  readonly index?: boolean | undefined;
3507
3513
  readonly type: "number";
3508
3514
  };
3509
- /** Content checksum for change detection */
3515
+ /** Content checksum for change detection (e.g. `sha256:<64 hex>` = 71 chars) */
3510
3516
  readonly checksum: {
3511
3517
  readonly readonly?: boolean | undefined;
3512
3518
  readonly format?: string | undefined;
@@ -4763,18 +4769,43 @@ declare const SysMetadataObject: Omit<{
4763
4769
  }, "fields">;
4764
4770
 
4765
4771
  /**
4766
- * sys_metadata_history — Metadata Version History Object
4772
+ * sys_metadata_history — Metadata Version History / Event Log
4767
4773
  *
4768
- * Stores historical snapshots of metadata changes for version tracking,
4769
- * audit trail, and rollback capabilities.
4774
+ * Append-only durable log of every overlay change made through
4775
+ * `SysMetadataRepository.put` / `delete` (ADR-0008 §10 M1). Each row is a
4776
+ * single event in the per-organisation event log; rows are NEVER
4777
+ * mutated after insertion. The legacy `DatabaseLoader` writes the same
4778
+ * shape from its own put/restore code paths.
4770
4779
  *
4771
- * This is a system object (isSystem: true) — protected from deletion and
4772
- * automatically provisioned when metadata history is enabled.
4780
+ * ─────────────────────────────────────────────────────────────────────
4781
+ * Key design points (ADR-0008 §0 amendment + M1):
4782
+ *
4783
+ * • Keyed by `(organization_id, type, name)` only — `project_id` was
4784
+ * removed in the branch/project-removal amendment.
4785
+ *
4786
+ * • `event_seq` is the per-org monotonic event-log cursor. Producers
4787
+ * compute `MAX(event_seq) + 1 WHERE organization_id = X` inside the
4788
+ * same transaction as the parent `sys_metadata` write.
4789
+ *
4790
+ * • `version` is the per-(org,type,name) lineage counter. Producers
4791
+ * compute `MAX(version) + 1 WHERE organization_id = X AND type = T
4792
+ * AND name = N` so delete + recreate continues incrementing instead
4793
+ * of restarting at 1.
4794
+ *
4795
+ * • `metadata_id` is plain `text` (not a `lookup`) so DELETE rows can
4796
+ * keep the now-orphaned parent id for forensic auditing without a
4797
+ * foreign-key constraint blocking the hard delete.
4798
+ *
4799
+ * • `metadata` / `checksum` are nullable — DELETE rows have no body or
4800
+ * hash. Readers must tolerate null on both columns.
4773
4801
  *
4774
- * Each record represents a single version snapshot of a metadata item,
4775
- * created whenever the metadata is modified, published, or reverted.
4802
+ * `source` records the producer ('sys-metadata-repo', 'fs',
4803
+ * 'studio', …) and feeds MetadataEvent.source on history() reads.
4776
4804
  *
4777
- * @see MetadataHistoryRecordSchema in metadata-persistence.zod.ts
4805
+ * Indexes are purpose-built for the two dominant read patterns:
4806
+ * 1. per-item history view → `(organization_id, type, name, version)`
4807
+ * 2. org-wide event replay → `(organization_id, event_seq)`
4808
+ * ─────────────────────────────────────────────────────────────────────
4778
4809
  */
4779
4810
  declare const SysMetadataHistoryObject: Omit<{
4780
4811
  name: string;
@@ -5360,6 +5391,12 @@ declare const SysMetadataHistoryObject: Omit<{
5360
5391
  recordTypes?: string[] | undefined;
5361
5392
  sharingModel?: "read" | "full" | "private" | "read_write" | undefined;
5362
5393
  keyPrefix?: string | undefined;
5394
+ detail?: {
5395
+ [x: string]: unknown;
5396
+ renderViaSchema?: boolean | undefined;
5397
+ hideReferenceRail?: boolean | undefined;
5398
+ hideRelatedTab?: boolean | undefined;
5399
+ } | undefined;
5363
5400
  actions?: {
5364
5401
  name: string;
5365
5402
  label: string;
@@ -5442,7 +5479,7 @@ declare const SysMetadataHistoryObject: Omit<{
5442
5479
  readonly icon: "history";
5443
5480
  readonly isSystem: true;
5444
5481
  readonly managedBy: "system";
5445
- readonly description: "Version history and audit trail for metadata changes";
5482
+ readonly description: "Durable event log of metadata overlay changes (per-org, append-only)";
5446
5483
  readonly fields: {
5447
5484
  /** Primary Key (UUID) */
5448
5485
  readonly id: {
@@ -5620,7 +5657,188 @@ declare const SysMetadataHistoryObject: Omit<{
5620
5657
  readonly index?: boolean | undefined;
5621
5658
  readonly type: "text";
5622
5659
  };
5623
- /** Foreign key to sys_metadata.id */
5660
+ /** Per-org monotonic event sequence (durable cursor for replay). */
5661
+ readonly event_seq: {
5662
+ readonly readonly?: boolean | undefined;
5663
+ readonly format?: string | undefined;
5664
+ readonly options?: {
5665
+ label: string;
5666
+ value: string;
5667
+ color?: string | undefined;
5668
+ default?: boolean | undefined;
5669
+ }[] | undefined;
5670
+ readonly description?: string | undefined;
5671
+ readonly label?: string | undefined;
5672
+ readonly name?: string | undefined;
5673
+ readonly precision?: number | undefined;
5674
+ readonly required?: boolean | undefined;
5675
+ readonly multiple?: boolean | undefined;
5676
+ readonly dependencies?: string[] | undefined;
5677
+ readonly theme?: string | undefined;
5678
+ readonly externalId?: boolean | undefined;
5679
+ readonly system?: boolean | undefined;
5680
+ readonly min?: number | undefined;
5681
+ readonly max?: number | undefined;
5682
+ readonly group?: string | undefined;
5683
+ readonly encryptionConfig?: {
5684
+ enabled: boolean;
5685
+ algorithm: "aes-256-gcm" | "aes-256-cbc" | "chacha20-poly1305";
5686
+ keyManagement: {
5687
+ provider: "local" | "aws-kms" | "azure-key-vault" | "gcp-kms" | "hashicorp-vault";
5688
+ keyId?: string | undefined;
5689
+ rotationPolicy?: {
5690
+ enabled: boolean;
5691
+ frequencyDays: number;
5692
+ retainOldVersions: number;
5693
+ autoRotate: boolean;
5694
+ } | undefined;
5695
+ };
5696
+ scope: "record" | "field" | "table" | "database";
5697
+ deterministicEncryption: boolean;
5698
+ searchableEncryption: boolean;
5699
+ } | undefined;
5700
+ readonly columnName?: string | undefined;
5701
+ readonly searchable?: boolean | undefined;
5702
+ readonly unique?: boolean | undefined;
5703
+ readonly defaultValue?: unknown;
5704
+ readonly maxLength?: number | undefined;
5705
+ readonly minLength?: number | undefined;
5706
+ readonly scale?: number | undefined;
5707
+ readonly reference?: string | undefined;
5708
+ readonly referenceFilters?: string[] | undefined;
5709
+ readonly writeRequiresMasterRead?: boolean | undefined;
5710
+ readonly deleteBehavior?: "set_null" | "cascade" | "restrict" | undefined;
5711
+ readonly expression?: {
5712
+ dialect: "cel" | "js" | "cron" | "template";
5713
+ source?: string | undefined;
5714
+ ast?: unknown;
5715
+ meta?: {
5716
+ rationale?: string | undefined;
5717
+ generatedBy?: string | undefined;
5718
+ } | undefined;
5719
+ } | undefined;
5720
+ readonly summaryOperations?: {
5721
+ object: string;
5722
+ field: string;
5723
+ function: "min" | "max" | "count" | "sum" | "avg";
5724
+ } | undefined;
5725
+ readonly language?: string | undefined;
5726
+ readonly lineNumbers?: boolean | undefined;
5727
+ readonly maxRating?: number | undefined;
5728
+ readonly allowHalf?: boolean | undefined;
5729
+ readonly displayMap?: boolean | undefined;
5730
+ readonly allowGeocoding?: boolean | undefined;
5731
+ readonly addressFormat?: "us" | "uk" | "international" | undefined;
5732
+ readonly colorFormat?: "hex" | "rgb" | "rgba" | "hsl" | undefined;
5733
+ readonly allowAlpha?: boolean | undefined;
5734
+ readonly presetColors?: string[] | undefined;
5735
+ readonly step?: number | undefined;
5736
+ readonly showValue?: boolean | undefined;
5737
+ readonly marks?: Record<string, string> | undefined;
5738
+ readonly barcodeFormat?: "qr" | "ean13" | "ean8" | "code128" | "code39" | "upca" | "upce" | undefined;
5739
+ readonly qrErrorCorrection?: "L" | "M" | "Q" | "H" | undefined;
5740
+ readonly displayValue?: boolean | undefined;
5741
+ readonly allowScanning?: boolean | undefined;
5742
+ readonly currencyConfig?: {
5743
+ precision: number;
5744
+ currencyMode: "fixed" | "dynamic";
5745
+ defaultCurrency: string;
5746
+ } | undefined;
5747
+ readonly vectorConfig?: {
5748
+ dimensions: number;
5749
+ distanceMetric: "cosine" | "euclidean" | "dotProduct" | "manhattan";
5750
+ normalized: boolean;
5751
+ indexed: boolean;
5752
+ indexType?: "flat" | "hnsw" | "ivfflat" | undefined;
5753
+ } | undefined;
5754
+ readonly fileAttachmentConfig?: {
5755
+ virusScan: boolean;
5756
+ virusScanOnUpload: boolean;
5757
+ quarantineOnThreat: boolean;
5758
+ allowMultiple: boolean;
5759
+ allowReplace: boolean;
5760
+ allowDelete: boolean;
5761
+ requireUpload: boolean;
5762
+ extractMetadata: boolean;
5763
+ extractText: boolean;
5764
+ versioningEnabled: boolean;
5765
+ publicRead: boolean;
5766
+ presignedUrlExpiry: number;
5767
+ minSize?: number | undefined;
5768
+ maxSize?: number | undefined;
5769
+ allowedTypes?: string[] | undefined;
5770
+ blockedTypes?: string[] | undefined;
5771
+ allowedMimeTypes?: string[] | undefined;
5772
+ blockedMimeTypes?: string[] | undefined;
5773
+ virusScanProvider?: "custom" | "clamav" | "virustotal" | "metadefender" | undefined;
5774
+ storageProvider?: string | undefined;
5775
+ storageBucket?: string | undefined;
5776
+ storagePrefix?: string | undefined;
5777
+ imageValidation?: {
5778
+ generateThumbnails: boolean;
5779
+ preserveMetadata: boolean;
5780
+ autoRotate: boolean;
5781
+ minWidth?: number | undefined;
5782
+ maxWidth?: number | undefined;
5783
+ minHeight?: number | undefined;
5784
+ maxHeight?: number | undefined;
5785
+ aspectRatio?: string | undefined;
5786
+ thumbnailSizes?: {
5787
+ name: string;
5788
+ width: number;
5789
+ height: number;
5790
+ crop: boolean;
5791
+ }[] | undefined;
5792
+ } | undefined;
5793
+ maxVersions?: number | undefined;
5794
+ } | undefined;
5795
+ readonly maskingRule?: {
5796
+ field: string;
5797
+ strategy: "partial" | "hash" | "redact" | "tokenize" | "randomize" | "nullify" | "substitute";
5798
+ preserveFormat: boolean;
5799
+ preserveLength: boolean;
5800
+ pattern?: string | undefined;
5801
+ roles?: string[] | undefined;
5802
+ exemptRoles?: string[] | undefined;
5803
+ } | undefined;
5804
+ readonly auditTrail?: boolean | undefined;
5805
+ readonly cached?: {
5806
+ enabled: boolean;
5807
+ ttl: number;
5808
+ invalidateOn: string[];
5809
+ } | undefined;
5810
+ readonly dataQuality?: {
5811
+ uniqueness: boolean;
5812
+ completeness: number;
5813
+ accuracy?: {
5814
+ source: string;
5815
+ threshold: number;
5816
+ } | undefined;
5817
+ } | undefined;
5818
+ readonly conditionalRequired?: {
5819
+ dialect: "cel" | "js" | "cron" | "template";
5820
+ source?: string | undefined;
5821
+ ast?: unknown;
5822
+ meta?: {
5823
+ rationale?: string | undefined;
5824
+ generatedBy?: string | undefined;
5825
+ } | undefined;
5826
+ } | undefined;
5827
+ readonly hidden?: boolean | undefined;
5828
+ readonly sortable?: boolean | undefined;
5829
+ readonly inlineHelpText?: string | undefined;
5830
+ readonly trackFeedHistory?: boolean | undefined;
5831
+ readonly caseSensitive?: boolean | undefined;
5832
+ readonly autonumberFormat?: string | undefined;
5833
+ readonly index?: boolean | undefined;
5834
+ readonly type: "number";
5835
+ };
5836
+ /**
5837
+ * Parent `sys_metadata.id` at insertion time (plain text, no FK).
5838
+ * Null for events whose parent row no longer exists (e.g. some
5839
+ * delete records). Forensic only — joins should go through
5840
+ * `(organization_id, type, name)`.
5841
+ */
5624
5842
  readonly metadata_id: {
5625
5843
  readonly readonly?: boolean | undefined;
5626
5844
  readonly format?: string | undefined;
@@ -5667,7 +5885,7 @@ declare const SysMetadataHistoryObject: Omit<{
5667
5885
  readonly maxLength?: number | undefined;
5668
5886
  readonly minLength?: number | undefined;
5669
5887
  readonly scale?: number | undefined;
5670
- reference: string;
5888
+ readonly reference?: string | undefined;
5671
5889
  readonly referenceFilters?: string[] | undefined;
5672
5890
  readonly writeRequiresMasterRead?: boolean | undefined;
5673
5891
  readonly deleteBehavior?: "set_null" | "cascade" | "restrict" | undefined;
@@ -5794,7 +6012,7 @@ declare const SysMetadataHistoryObject: Omit<{
5794
6012
  readonly caseSensitive?: boolean | undefined;
5795
6013
  readonly autonumberFormat?: string | undefined;
5796
6014
  readonly index?: boolean | undefined;
5797
- readonly type: "lookup";
6015
+ readonly type: "text";
5798
6016
  };
5799
6017
  /** Machine name (denormalized for easier querying) */
5800
6018
  readonly name: {
@@ -6148,7 +6366,7 @@ declare const SysMetadataHistoryObject: Omit<{
6148
6366
  readonly index?: boolean | undefined;
6149
6367
  readonly type: "text";
6150
6368
  };
6151
- /** Version number at this snapshot */
6369
+ /** Per-(org,type,name) lineage counter at this snapshot. */
6152
6370
  readonly version: {
6153
6371
  readonly readonly?: boolean | undefined;
6154
6372
  readonly format?: string | undefined;
@@ -6500,7 +6718,10 @@ declare const SysMetadataHistoryObject: Omit<{
6500
6718
  readonly index?: boolean | undefined;
6501
6719
  readonly type: "select";
6502
6720
  };
6503
- /** Historical metadata snapshot (JSON payload) */
6721
+ /**
6722
+ * Historical metadata snapshot (JSON payload).
6723
+ * Null for `operation_type = 'delete'` — the row carries no body.
6724
+ */
6504
6725
  readonly metadata: {
6505
6726
  readonly readonly?: boolean | undefined;
6506
6727
  readonly format?: string | undefined;
@@ -6676,7 +6897,7 @@ declare const SysMetadataHistoryObject: Omit<{
6676
6897
  readonly index?: boolean | undefined;
6677
6898
  readonly type: "textarea";
6678
6899
  };
6679
- /** SHA-256 checksum of metadata content */
6900
+ /** SHA-256 checksum of metadata content (null for deletes). */
6680
6901
  readonly checksum: {
6681
6902
  readonly readonly?: boolean | undefined;
6682
6903
  readonly format?: string | undefined;
@@ -6852,7 +7073,7 @@ declare const SysMetadataHistoryObject: Omit<{
6852
7073
  readonly index?: boolean | undefined;
6853
7074
  readonly type: "text";
6854
7075
  };
6855
- /** Checksum of the previous version */
7076
+ /** Checksum of the previous version (null for the first event). */
6856
7077
  readonly previous_checksum: {
6857
7078
  readonly readonly?: boolean | undefined;
6858
7079
  readonly format?: string | undefined;
@@ -7028,7 +7249,7 @@ declare const SysMetadataHistoryObject: Omit<{
7028
7249
  readonly index?: boolean | undefined;
7029
7250
  readonly type: "text";
7030
7251
  };
7031
- /** Human-readable description of changes */
7252
+ /** Human-readable description of changes (= MetadataEvent.message). */
7032
7253
  readonly change_note: {
7033
7254
  readonly readonly?: boolean | undefined;
7034
7255
  readonly format?: string | undefined;
@@ -7204,8 +7425,12 @@ declare const SysMetadataHistoryObject: Omit<{
7204
7425
  readonly index?: boolean | undefined;
7205
7426
  readonly type: "textarea";
7206
7427
  };
7207
- /** Organization ID for multi-tenant isolation */
7208
- readonly organization_id: {
7428
+ /**
7429
+ * Producer of the event ('sys-metadata-repo', 'fs', 'studio',
7430
+ * 'api', …). Defaults to 'sys-metadata-repo' on the canonical
7431
+ * write path; preserved on history() reads as MetadataEvent.source.
7432
+ */
7433
+ readonly source: {
7209
7434
  readonly readonly?: boolean | undefined;
7210
7435
  readonly format?: string | undefined;
7211
7436
  readonly options?: {
@@ -7251,7 +7476,7 @@ declare const SysMetadataHistoryObject: Omit<{
7251
7476
  readonly maxLength?: number | undefined;
7252
7477
  readonly minLength?: number | undefined;
7253
7478
  readonly scale?: number | undefined;
7254
- reference: string;
7479
+ readonly reference?: string | undefined;
7255
7480
  readonly referenceFilters?: string[] | undefined;
7256
7481
  readonly writeRequiresMasterRead?: boolean | undefined;
7257
7482
  readonly deleteBehavior?: "set_null" | "cascade" | "restrict" | undefined;
@@ -7378,10 +7603,10 @@ declare const SysMetadataHistoryObject: Omit<{
7378
7603
  readonly caseSensitive?: boolean | undefined;
7379
7604
  readonly autonumberFormat?: string | undefined;
7380
7605
  readonly index?: boolean | undefined;
7381
- readonly type: "lookup";
7606
+ readonly type: "text";
7382
7607
  };
7383
- /** Environment ID null = platform-global, set = env-scoped */
7384
- readonly project_id: {
7608
+ /** Organization ID for multi-tenant isolation */
7609
+ readonly organization_id: {
7385
7610
  readonly readonly?: boolean | undefined;
7386
7611
  readonly format?: string | undefined;
7387
7612
  readonly options?: {
@@ -7427,7 +7652,7 @@ declare const SysMetadataHistoryObject: Omit<{
7427
7652
  readonly maxLength?: number | undefined;
7428
7653
  readonly minLength?: number | undefined;
7429
7654
  readonly scale?: number | undefined;
7430
- readonly reference?: string | undefined;
7655
+ reference: string;
7431
7656
  readonly referenceFilters?: string[] | undefined;
7432
7657
  readonly writeRequiresMasterRead?: boolean | undefined;
7433
7658
  readonly deleteBehavior?: "set_null" | "cascade" | "restrict" | undefined;
@@ -7554,9 +7779,9 @@ declare const SysMetadataHistoryObject: Omit<{
7554
7779
  readonly caseSensitive?: boolean | undefined;
7555
7780
  readonly autonumberFormat?: string | undefined;
7556
7781
  readonly index?: boolean | undefined;
7557
- readonly type: "text";
7782
+ readonly type: "lookup";
7558
7783
  };
7559
- /** User who made this change */
7784
+ /** User who made this change (= MetadataEvent.actor). */
7560
7785
  readonly recorded_by: {
7561
7786
  readonly readonly?: boolean | undefined;
7562
7787
  readonly format?: string | undefined;
@@ -7910,20 +8135,19 @@ declare const SysMetadataHistoryObject: Omit<{
7910
8135
  };
7911
8136
  };
7912
8137
  readonly indexes: [{
7913
- readonly fields: ["metadata_id", "version"];
8138
+ readonly fields: ["organization_id", "event_seq"];
8139
+ readonly unique: true;
8140
+ }, {
8141
+ readonly fields: ["organization_id", "type", "name", "version"];
7914
8142
  readonly unique: true;
7915
8143
  }, {
7916
- readonly fields: ["metadata_id", "recorded_at"];
8144
+ readonly fields: ["organization_id", "type", "name", "recorded_at"];
7917
8145
  }, {
7918
8146
  readonly fields: ["type", "name"];
7919
8147
  }, {
7920
8148
  readonly fields: ["recorded_at"];
7921
8149
  }, {
7922
8150
  readonly fields: ["operation_type"];
7923
- }, {
7924
- readonly fields: ["organization_id"];
7925
- }, {
7926
- readonly fields: ["project_id"];
7927
8151
  }];
7928
8152
  readonly enable: {
7929
8153
  readonly trackHistory: false;