@objectstack/objectql 7.1.0 → 7.2.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.d.mts +104 -1
- package/dist/index.d.ts +104 -1
- package/dist/index.js +326 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +329 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServiceObject, ObjectOwnership, HookContext, QueryAST, EngineQueryOptions, DataEngineInsertOptions, EngineUpdateOptions, EngineDeleteOptions, EngineCountOptions, EngineAggregateOptions, DateGranularityValue, Hook } from '@objectstack/spec/data';
|
|
2
|
-
import { ObjectStackManifest, InstalledPackage, MetadataValidationResult, ExecutionContext } from '@objectstack/spec/kernel';
|
|
2
|
+
import { ObjectStackManifest, InstalledPackage, MetadataValidationResult, MetadataLock, MetadataProvenance, ExecutionContext } from '@objectstack/spec/kernel';
|
|
3
3
|
import * as _objectstack_metadata_core from '@objectstack/metadata-core';
|
|
4
4
|
import { MetadataRepository, MetaRef, MetadataItem, PutOptions, PutResult, DeleteOptions, DeleteResult, MetadataWriteIntent, ListFilter, MetadataItemHeader, HistoryOptions, MetadataEvent, WatchFilter } from '@objectstack/metadata-core';
|
|
5
5
|
import { ObjectStackProtocol, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, UpdateManyDataRequest, DeleteManyDataRequest } from '@objectstack/spec/api';
|
|
@@ -528,6 +528,16 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
528
528
|
total: number;
|
|
529
529
|
scannedTypes: number;
|
|
530
530
|
scannedItems: number;
|
|
531
|
+
/**
|
|
532
|
+
* Per-type aggregate stats — count of items and the list of
|
|
533
|
+
* packages contributing to each type. Computed in the same
|
|
534
|
+
* sweep so the Studio directory page can render tile counts
|
|
535
|
+
* and a package filter in one round-trip.
|
|
536
|
+
*/
|
|
537
|
+
stats: Record<string, {
|
|
538
|
+
count: number;
|
|
539
|
+
packages: string[];
|
|
540
|
+
}>;
|
|
531
541
|
}>;
|
|
532
542
|
getMetaItems(request: {
|
|
533
543
|
type: string;
|
|
@@ -544,9 +554,22 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
544
554
|
organizationId?: string;
|
|
545
555
|
state?: 'active' | 'draft';
|
|
546
556
|
}): Promise<{
|
|
557
|
+
type: string;
|
|
558
|
+
name: string;
|
|
559
|
+
item: {} | null;
|
|
560
|
+
} | {
|
|
561
|
+
editable: boolean;
|
|
562
|
+
deletable: boolean;
|
|
563
|
+
resettable: boolean;
|
|
564
|
+
packageVersion?: string | undefined;
|
|
565
|
+
packageId?: string | undefined;
|
|
566
|
+
provenance?: "package" | "env-forced" | "org" | undefined;
|
|
567
|
+
lockSource?: "artifact" | "package" | "env-forced" | undefined;
|
|
568
|
+
lockReason?: string | undefined;
|
|
547
569
|
type: string;
|
|
548
570
|
name: string;
|
|
549
571
|
item: unknown;
|
|
572
|
+
lock: "full" | "none" | "no-overlay" | "no-delete";
|
|
550
573
|
}>;
|
|
551
574
|
/**
|
|
552
575
|
* Phase 3a-layered-get: return the 3 layers of a metadata item
|
|
@@ -583,6 +606,49 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
583
606
|
* without a second round-trip.
|
|
584
607
|
*/
|
|
585
608
|
_diagnostics?: MetadataDiagnostics;
|
|
609
|
+
lock: MetadataLock;
|
|
610
|
+
lockReason?: string;
|
|
611
|
+
lockSource?: 'artifact' | 'package' | 'env-forced' | 'overlay';
|
|
612
|
+
provenance?: MetadataProvenance;
|
|
613
|
+
packageId?: string;
|
|
614
|
+
packageVersion?: string;
|
|
615
|
+
editable: boolean;
|
|
616
|
+
deletable: boolean;
|
|
617
|
+
resettable: boolean;
|
|
618
|
+
}>;
|
|
619
|
+
/**
|
|
620
|
+
* ADR-0010 §3.6 / Phase 4.1 — read the metadata-protection audit log
|
|
621
|
+
* for a single item. Returns the most-recent rows of
|
|
622
|
+
* `sys_metadata_audit` for this (type, name) tuple, sorted newest
|
|
623
|
+
* first. Refused (`denied`) and forced (`forced`) writes both appear
|
|
624
|
+
* here — they never reach the `history` endpoint, which only tracks
|
|
625
|
+
* successful body snapshots.
|
|
626
|
+
*
|
|
627
|
+
* The table is provisioned by `platform-objects` and is the
|
|
628
|
+
* compliance surface for the lock-enforcement story. When the
|
|
629
|
+
* environment has not yet provisioned the table (legacy install
|
|
630
|
+
* prior to ADR-0010) the call returns `{ events: [] }` instead of
|
|
631
|
+
* raising, keeping the Studio tab harmless.
|
|
632
|
+
*/
|
|
633
|
+
auditMetaItem(request: {
|
|
634
|
+
type: string;
|
|
635
|
+
name: string;
|
|
636
|
+
organizationId?: string | null;
|
|
637
|
+
limit?: number;
|
|
638
|
+
}): Promise<{
|
|
639
|
+
events: Array<{
|
|
640
|
+
id: unknown;
|
|
641
|
+
occurredAt: string;
|
|
642
|
+
actor: string;
|
|
643
|
+
source: string | null;
|
|
644
|
+
operation: 'save' | 'publish' | 'rollback' | 'delete' | 'reset';
|
|
645
|
+
outcome: 'allowed' | 'denied' | 'forced';
|
|
646
|
+
code: string;
|
|
647
|
+
lockState: MetadataLock | null;
|
|
648
|
+
lockOverridden: boolean;
|
|
649
|
+
requestId: string | null;
|
|
650
|
+
note: string | null;
|
|
651
|
+
}>;
|
|
586
652
|
}>;
|
|
587
653
|
getUiView(request: {
|
|
588
654
|
object: string;
|
|
@@ -851,6 +917,43 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
851
917
|
* "authoring a DB-only item" (requires only `allowRuntimeCreate`).
|
|
852
918
|
*/
|
|
853
919
|
private isArtifactBacked;
|
|
920
|
+
/**
|
|
921
|
+
* Look up an item from the artifact registry across both the requested
|
|
922
|
+
* type and its singular/plural twin. Returns `undefined` when the
|
|
923
|
+
* registry is unavailable or the item is not artifact-backed.
|
|
924
|
+
*/
|
|
925
|
+
private lookupArtifactItem;
|
|
926
|
+
/**
|
|
927
|
+
* Resolve the effective `_lock` for an item by consulting the
|
|
928
|
+
* artifact registry first, then the persisted overlay row. Artifact
|
|
929
|
+
* always wins — by design, an overlay cannot loosen a packaged
|
|
930
|
+
* lock (ADR-0010 §3.3).
|
|
931
|
+
*
|
|
932
|
+
* Returns `'none'` when nothing is locked, which is the common
|
|
933
|
+
* case. Safe to call when `environmentId` is undefined (control-
|
|
934
|
+
* plane bootstrap) — the lock check is only meaningful in tenant
|
|
935
|
+
* scope and the caller is expected to also gate on `environmentId`.
|
|
936
|
+
*/
|
|
937
|
+
private getEffectiveLock;
|
|
938
|
+
/**
|
|
939
|
+
* Best-effort audit-row writer (ADR-0010 §3.6). Failures here are
|
|
940
|
+
* logged but never block the underlying decision: an environment
|
|
941
|
+
* without the audit table provisioned (legacy installs before this
|
|
942
|
+
* ADR landed) still answers normal API calls, just without the
|
|
943
|
+
* compliance trail. Phase 2 will make the audit table a hard
|
|
944
|
+
* dependency.
|
|
945
|
+
*/
|
|
946
|
+
private recordMetadataAudit;
|
|
947
|
+
/**
|
|
948
|
+
* Phase 1 L3 enforcement for write operations (save / publish /
|
|
949
|
+
* rollback). Returns null on allow. Returns the structured `Error`
|
|
950
|
+
* the caller should `throw` on deny — also records the denial in
|
|
951
|
+
* the audit log so refused attempts are visible in compliance
|
|
952
|
+
* reports (refused writes never reach sys_metadata_history).
|
|
953
|
+
*/
|
|
954
|
+
private assertLockAllowsWrite;
|
|
955
|
+
/** Counterpart of {@link assertLockAllowsWrite} for delete. */
|
|
956
|
+
private assertLockAllowsDelete;
|
|
854
957
|
/**
|
|
855
958
|
* Mirror an object-type overlay write into the in-memory engine
|
|
856
959
|
* registry so subsequent CRUD finds the new schema. Idempotent and
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServiceObject, ObjectOwnership, HookContext, QueryAST, EngineQueryOptions, DataEngineInsertOptions, EngineUpdateOptions, EngineDeleteOptions, EngineCountOptions, EngineAggregateOptions, DateGranularityValue, Hook } from '@objectstack/spec/data';
|
|
2
|
-
import { ObjectStackManifest, InstalledPackage, MetadataValidationResult, ExecutionContext } from '@objectstack/spec/kernel';
|
|
2
|
+
import { ObjectStackManifest, InstalledPackage, MetadataValidationResult, MetadataLock, MetadataProvenance, ExecutionContext } from '@objectstack/spec/kernel';
|
|
3
3
|
import * as _objectstack_metadata_core from '@objectstack/metadata-core';
|
|
4
4
|
import { MetadataRepository, MetaRef, MetadataItem, PutOptions, PutResult, DeleteOptions, DeleteResult, MetadataWriteIntent, ListFilter, MetadataItemHeader, HistoryOptions, MetadataEvent, WatchFilter } from '@objectstack/metadata-core';
|
|
5
5
|
import { ObjectStackProtocol, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, UpdateManyDataRequest, DeleteManyDataRequest } from '@objectstack/spec/api';
|
|
@@ -528,6 +528,16 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
528
528
|
total: number;
|
|
529
529
|
scannedTypes: number;
|
|
530
530
|
scannedItems: number;
|
|
531
|
+
/**
|
|
532
|
+
* Per-type aggregate stats — count of items and the list of
|
|
533
|
+
* packages contributing to each type. Computed in the same
|
|
534
|
+
* sweep so the Studio directory page can render tile counts
|
|
535
|
+
* and a package filter in one round-trip.
|
|
536
|
+
*/
|
|
537
|
+
stats: Record<string, {
|
|
538
|
+
count: number;
|
|
539
|
+
packages: string[];
|
|
540
|
+
}>;
|
|
531
541
|
}>;
|
|
532
542
|
getMetaItems(request: {
|
|
533
543
|
type: string;
|
|
@@ -544,9 +554,22 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
544
554
|
organizationId?: string;
|
|
545
555
|
state?: 'active' | 'draft';
|
|
546
556
|
}): Promise<{
|
|
557
|
+
type: string;
|
|
558
|
+
name: string;
|
|
559
|
+
item: {} | null;
|
|
560
|
+
} | {
|
|
561
|
+
editable: boolean;
|
|
562
|
+
deletable: boolean;
|
|
563
|
+
resettable: boolean;
|
|
564
|
+
packageVersion?: string | undefined;
|
|
565
|
+
packageId?: string | undefined;
|
|
566
|
+
provenance?: "package" | "env-forced" | "org" | undefined;
|
|
567
|
+
lockSource?: "artifact" | "package" | "env-forced" | undefined;
|
|
568
|
+
lockReason?: string | undefined;
|
|
547
569
|
type: string;
|
|
548
570
|
name: string;
|
|
549
571
|
item: unknown;
|
|
572
|
+
lock: "full" | "none" | "no-overlay" | "no-delete";
|
|
550
573
|
}>;
|
|
551
574
|
/**
|
|
552
575
|
* Phase 3a-layered-get: return the 3 layers of a metadata item
|
|
@@ -583,6 +606,49 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
583
606
|
* without a second round-trip.
|
|
584
607
|
*/
|
|
585
608
|
_diagnostics?: MetadataDiagnostics;
|
|
609
|
+
lock: MetadataLock;
|
|
610
|
+
lockReason?: string;
|
|
611
|
+
lockSource?: 'artifact' | 'package' | 'env-forced' | 'overlay';
|
|
612
|
+
provenance?: MetadataProvenance;
|
|
613
|
+
packageId?: string;
|
|
614
|
+
packageVersion?: string;
|
|
615
|
+
editable: boolean;
|
|
616
|
+
deletable: boolean;
|
|
617
|
+
resettable: boolean;
|
|
618
|
+
}>;
|
|
619
|
+
/**
|
|
620
|
+
* ADR-0010 §3.6 / Phase 4.1 — read the metadata-protection audit log
|
|
621
|
+
* for a single item. Returns the most-recent rows of
|
|
622
|
+
* `sys_metadata_audit` for this (type, name) tuple, sorted newest
|
|
623
|
+
* first. Refused (`denied`) and forced (`forced`) writes both appear
|
|
624
|
+
* here — they never reach the `history` endpoint, which only tracks
|
|
625
|
+
* successful body snapshots.
|
|
626
|
+
*
|
|
627
|
+
* The table is provisioned by `platform-objects` and is the
|
|
628
|
+
* compliance surface for the lock-enforcement story. When the
|
|
629
|
+
* environment has not yet provisioned the table (legacy install
|
|
630
|
+
* prior to ADR-0010) the call returns `{ events: [] }` instead of
|
|
631
|
+
* raising, keeping the Studio tab harmless.
|
|
632
|
+
*/
|
|
633
|
+
auditMetaItem(request: {
|
|
634
|
+
type: string;
|
|
635
|
+
name: string;
|
|
636
|
+
organizationId?: string | null;
|
|
637
|
+
limit?: number;
|
|
638
|
+
}): Promise<{
|
|
639
|
+
events: Array<{
|
|
640
|
+
id: unknown;
|
|
641
|
+
occurredAt: string;
|
|
642
|
+
actor: string;
|
|
643
|
+
source: string | null;
|
|
644
|
+
operation: 'save' | 'publish' | 'rollback' | 'delete' | 'reset';
|
|
645
|
+
outcome: 'allowed' | 'denied' | 'forced';
|
|
646
|
+
code: string;
|
|
647
|
+
lockState: MetadataLock | null;
|
|
648
|
+
lockOverridden: boolean;
|
|
649
|
+
requestId: string | null;
|
|
650
|
+
note: string | null;
|
|
651
|
+
}>;
|
|
586
652
|
}>;
|
|
587
653
|
getUiView(request: {
|
|
588
654
|
object: string;
|
|
@@ -851,6 +917,43 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
851
917
|
* "authoring a DB-only item" (requires only `allowRuntimeCreate`).
|
|
852
918
|
*/
|
|
853
919
|
private isArtifactBacked;
|
|
920
|
+
/**
|
|
921
|
+
* Look up an item from the artifact registry across both the requested
|
|
922
|
+
* type and its singular/plural twin. Returns `undefined` when the
|
|
923
|
+
* registry is unavailable or the item is not artifact-backed.
|
|
924
|
+
*/
|
|
925
|
+
private lookupArtifactItem;
|
|
926
|
+
/**
|
|
927
|
+
* Resolve the effective `_lock` for an item by consulting the
|
|
928
|
+
* artifact registry first, then the persisted overlay row. Artifact
|
|
929
|
+
* always wins — by design, an overlay cannot loosen a packaged
|
|
930
|
+
* lock (ADR-0010 §3.3).
|
|
931
|
+
*
|
|
932
|
+
* Returns `'none'` when nothing is locked, which is the common
|
|
933
|
+
* case. Safe to call when `environmentId` is undefined (control-
|
|
934
|
+
* plane bootstrap) — the lock check is only meaningful in tenant
|
|
935
|
+
* scope and the caller is expected to also gate on `environmentId`.
|
|
936
|
+
*/
|
|
937
|
+
private getEffectiveLock;
|
|
938
|
+
/**
|
|
939
|
+
* Best-effort audit-row writer (ADR-0010 §3.6). Failures here are
|
|
940
|
+
* logged but never block the underlying decision: an environment
|
|
941
|
+
* without the audit table provisioned (legacy installs before this
|
|
942
|
+
* ADR landed) still answers normal API calls, just without the
|
|
943
|
+
* compliance trail. Phase 2 will make the audit table a hard
|
|
944
|
+
* dependency.
|
|
945
|
+
*/
|
|
946
|
+
private recordMetadataAudit;
|
|
947
|
+
/**
|
|
948
|
+
* Phase 1 L3 enforcement for write operations (save / publish /
|
|
949
|
+
* rollback). Returns null on allow. Returns the structured `Error`
|
|
950
|
+
* the caller should `throw` on deny — also records the denial in
|
|
951
|
+
* the audit log so refused attempts are visible in compliance
|
|
952
|
+
* reports (refused writes never reach sys_metadata_history).
|
|
953
|
+
*/
|
|
954
|
+
private assertLockAllowsWrite;
|
|
955
|
+
/** Counterpart of {@link assertLockAllowsWrite} for delete. */
|
|
956
|
+
private assertLockAllowsDelete;
|
|
854
957
|
/**
|
|
855
958
|
* Mirror an object-type overlay write into the in-memory engine
|
|
856
959
|
* registry so subsequent CRUD finds the new schema. Idempotent and
|