@objectstack/objectql 8.0.1 → 9.0.1
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 +177 -5
- package/dist/index.d.ts +177 -5
- package/dist/index.js +892 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +882 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ServiceObject, ObjectOwnership, HookContext, QueryAST, EngineQueryOptions, DataEngineInsertOptions, EngineUpdateOptions, EngineDeleteOptions, EngineCountOptions, EngineAggregateOptions, DateGranularityValue, Hook } from '@objectstack/spec/data';
|
|
1
|
+
import { ServiceObject, ObjectOwnership, HookContext, QueryAST, EngineQueryOptions, DataEngineInsertOptions, EngineUpdateOptions, EngineDeleteOptions, EngineCountOptions, EngineAggregateOptions, DateGranularityValue, Hook, SeedLoaderRequest, SeedLoaderResult, ObjectDependencyGraph, Seed, SeedLoaderConfigInput } from '@objectstack/spec/data';
|
|
2
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, InstallPackageRequest, InstallPackageResponse } from '@objectstack/spec/api';
|
|
6
|
-
import { IDataEngine, DriverInterface, Logger, Plugin, PluginContext, ObjectKernel } from '@objectstack/core';
|
|
7
|
-
import { IFeedService, IRealtimeService, ICryptoProvider } from '@objectstack/spec/contracts';
|
|
6
|
+
import { IDataEngine, DriverInterface, Logger as Logger$1, Plugin, PluginContext, ObjectKernel } from '@objectstack/core';
|
|
7
|
+
import { IFeedService, IRealtimeService, ICryptoProvider, ISeedLoaderService, IDataEngine as IDataEngine$1, IMetadataService } from '@objectstack/spec/contracts';
|
|
8
8
|
import { Expression } from '@objectstack/spec';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -358,6 +358,81 @@ declare class SchemaRegistry {
|
|
|
358
358
|
reset(): void;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
/** One runtime-verification finding (ADR-0038 BuildIssue, layer 'runtime'). */
|
|
362
|
+
interface RuntimeBuildIssue {
|
|
363
|
+
layer: 'runtime';
|
|
364
|
+
severity: 'error' | 'warning';
|
|
365
|
+
/** The artifact whose runtime behaviour is broken. */
|
|
366
|
+
artifact: {
|
|
367
|
+
type: string;
|
|
368
|
+
name: string;
|
|
369
|
+
};
|
|
370
|
+
/** What it exercised, when narrower than the artifact (e.g. a widget). */
|
|
371
|
+
ref?: {
|
|
372
|
+
type: string;
|
|
373
|
+
name: string;
|
|
374
|
+
member?: string;
|
|
375
|
+
};
|
|
376
|
+
/** 'seed_not_applied' | 'view_read_failed' | 'empty_query' | 'widget_query_failed' | 'probes_unavailable' */
|
|
377
|
+
code: string;
|
|
378
|
+
message: string;
|
|
379
|
+
fix?: string;
|
|
380
|
+
}
|
|
381
|
+
/** Aggregate result of one post-publish probe pass. */
|
|
382
|
+
interface BuildProbeReport {
|
|
383
|
+
/** Findings, empty when every probe passed. */
|
|
384
|
+
issues: RuntimeBuildIssue[];
|
|
385
|
+
/** How many probes actually ran, per plane (0s mean nothing to probe). */
|
|
386
|
+
checked: {
|
|
387
|
+
seeds: number;
|
|
388
|
+
views: number;
|
|
389
|
+
widgets: number;
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/** The single read the probes need from the data engine. */
|
|
393
|
+
interface ProbeEngine {
|
|
394
|
+
find(objectName: string, query: unknown): Promise<Array<Record<string, unknown>>>;
|
|
395
|
+
}
|
|
396
|
+
/** Optional analytics surface — when absent, widget probes degrade to a warning. */
|
|
397
|
+
interface ProbeAnalytics {
|
|
398
|
+
queryDataset(dataset: unknown, selection: unknown, context?: unknown): Promise<unknown>;
|
|
399
|
+
}
|
|
400
|
+
interface RunBuildProbesOptions {
|
|
401
|
+
engine: ProbeEngine;
|
|
402
|
+
/** Read an ACTIVE (published) item body by type+name; undefined when absent. */
|
|
403
|
+
getItem: (type: string, name: string) => Promise<unknown | undefined>;
|
|
404
|
+
/** The just-published artifact set (publishPackageDrafts' `published`). */
|
|
405
|
+
published: Array<{
|
|
406
|
+
type: string;
|
|
407
|
+
name: string;
|
|
408
|
+
}>;
|
|
409
|
+
/**
|
|
410
|
+
* The kernel's analytics service, when one is mounted. Widget probes run
|
|
411
|
+
* the SAME `queryDataset` path the dashboard renderer hits — absent
|
|
412
|
+
* service means widgets can't be probed (one aggregate warning, not
|
|
413
|
+
* per-widget noise).
|
|
414
|
+
*/
|
|
415
|
+
analytics?: ProbeAnalytics;
|
|
416
|
+
/** Threaded into engine/analytics reads (tenant scoping). */
|
|
417
|
+
organizationId?: string | null;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Run the L3 runtime probes over a just-published artifact set:
|
|
421
|
+
*
|
|
422
|
+
* • per published `seed` — its target object must have rows now
|
|
423
|
+
* (`seed_not_applied`: the rows were promised but never materialized);
|
|
424
|
+
* • per published `view` — a limit-1 read through the same engine the
|
|
425
|
+
* renderer uses must not throw (`view_read_failed`);
|
|
426
|
+
* • per published `dashboard` widget — its real dataset selection must
|
|
427
|
+
* execute (`widget_query_failed`) and must not return empty on an object
|
|
428
|
+
* that HAS rows (`empty_query` — the four-layer staging incident class).
|
|
429
|
+
*
|
|
430
|
+
* All probes are reads (limit-1 / single aggregate); a probe crash is
|
|
431
|
+
* reported, never thrown — verification must not break the publish it
|
|
432
|
+
* verifies.
|
|
433
|
+
*/
|
|
434
|
+
declare function runBuildProbes(opts: RunBuildProbesOptions): Promise<BuildProbeReport>;
|
|
435
|
+
|
|
361
436
|
/**
|
|
362
437
|
* Re-export the canonical validation-result type so callers in this
|
|
363
438
|
* package don't need to dual-import from `@objectstack/spec/kernel`.
|
|
@@ -1250,12 +1325,40 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1250
1325
|
organizationId?: string;
|
|
1251
1326
|
actor?: string;
|
|
1252
1327
|
message?: string;
|
|
1328
|
+
/**
|
|
1329
|
+
* INTERNAL — `publishPackageDrafts` publishes many drafts and batch-applies
|
|
1330
|
+
* every seed body in ONE loader pass afterwards (cross-seed references need
|
|
1331
|
+
* multi-pass over the whole set), so it suppresses the per-item apply here.
|
|
1332
|
+
*/
|
|
1333
|
+
_skipSeedApply?: boolean;
|
|
1253
1334
|
}): Promise<{
|
|
1254
1335
|
success: boolean;
|
|
1255
1336
|
version: string;
|
|
1256
1337
|
seq: number;
|
|
1257
1338
|
message?: string;
|
|
1339
|
+
/**
|
|
1340
|
+
* Present when a `seed` draft was published: the result of materializing
|
|
1341
|
+
* its rows. Publishing the metadata ALWAYS succeeds independently — a
|
|
1342
|
+
* seed-load problem is surfaced here, never thrown, so callers (and UIs)
|
|
1343
|
+
* must check `seedApplied.success` instead of assuming data went live.
|
|
1344
|
+
*/
|
|
1345
|
+
seedApplied?: {
|
|
1346
|
+
success: boolean;
|
|
1347
|
+
inserted: number;
|
|
1348
|
+
updated: number;
|
|
1349
|
+
error?: string;
|
|
1350
|
+
errors?: unknown[];
|
|
1351
|
+
};
|
|
1258
1352
|
}>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Materialize published `seed` bodies into data rows via the SeedLoaderService
|
|
1355
|
+
* (externalId-keyed upsert, multi-pass for cross-seed references). Passing ALL
|
|
1356
|
+
* of a publish's seed bodies in ONE call lets a child seed reference a parent
|
|
1357
|
+
* seed's rows regardless of publish order. Best-effort: any failure is
|
|
1358
|
+
* returned, never thrown — publishing metadata must not be blocked by a data
|
|
1359
|
+
* problem, but the caller surfaces `seedApplied` so the failure is LOUD.
|
|
1360
|
+
*/
|
|
1361
|
+
private applySeedBodies;
|
|
1259
1362
|
/**
|
|
1260
1363
|
* List pending DRAFT metadata (ADR-0033) for the org, optionally narrowed
|
|
1261
1364
|
* by `packageId` and/or `type`. The list reads of `getMetaItems` only see
|
|
@@ -1304,6 +1407,23 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1304
1407
|
error: string;
|
|
1305
1408
|
code?: string;
|
|
1306
1409
|
}>;
|
|
1410
|
+
/** Aggregate result of materializing every published `seed` (absent when no seeds). */
|
|
1411
|
+
seedApplied?: {
|
|
1412
|
+
success: boolean;
|
|
1413
|
+
inserted: number;
|
|
1414
|
+
updated: number;
|
|
1415
|
+
error?: string;
|
|
1416
|
+
errors?: unknown[];
|
|
1417
|
+
};
|
|
1418
|
+
/**
|
|
1419
|
+
* ADR-0038 L3 — post-publish runtime probe report (absent when nothing
|
|
1420
|
+
* was publishable). One real read per published artifact: seeded
|
|
1421
|
+
* objects must have rows, views must be readable, dashboard widgets'
|
|
1422
|
+
* dataset selections must execute and return data. `issues` carries
|
|
1423
|
+
* BuildIssue-shaped findings (layer 'runtime') for the agent / chat
|
|
1424
|
+
* health surfaces; probes never fail the publish itself.
|
|
1425
|
+
*/
|
|
1426
|
+
probes?: BuildProbeReport;
|
|
1307
1427
|
}>;
|
|
1308
1428
|
/**
|
|
1309
1429
|
* Discard every pending DRAFT bound to a package — the NON-destructive
|
|
@@ -1799,7 +1919,7 @@ type EngineMiddleware = (ctx: OperationContext, next: () => Promise<void>) => Pr
|
|
|
1799
1919
|
*/
|
|
1800
1920
|
interface ObjectQLHostContext {
|
|
1801
1921
|
ql: ObjectQL;
|
|
1802
|
-
logger: Logger;
|
|
1922
|
+
logger: Logger$1;
|
|
1803
1923
|
[key: string]: any;
|
|
1804
1924
|
}
|
|
1805
1925
|
declare class ObjectQL implements IDataEngine {
|
|
@@ -3107,4 +3227,56 @@ declare function convertIntrospectedSchemaToObjects(introspectedSchema: Introspe
|
|
|
3107
3227
|
skipSystemColumns?: boolean;
|
|
3108
3228
|
}): ServiceObject[];
|
|
3109
3229
|
|
|
3110
|
-
|
|
3230
|
+
interface Logger {
|
|
3231
|
+
info(message: string, meta?: Record<string, any>): void;
|
|
3232
|
+
warn(message: string, meta?: Record<string, any>): void;
|
|
3233
|
+
error(message: string, error?: Error, meta?: Record<string, any>): void;
|
|
3234
|
+
debug(message: string, meta?: Record<string, any>): void;
|
|
3235
|
+
}
|
|
3236
|
+
/**
|
|
3237
|
+
* SeedLoaderService — Runtime implementation of ISeedLoaderService
|
|
3238
|
+
*
|
|
3239
|
+
* Provides metadata-driven seed data loading with:
|
|
3240
|
+
* - Automatic lookup/master_detail reference resolution via externalId
|
|
3241
|
+
* - Topological dependency ordering (parents before children)
|
|
3242
|
+
* - Multi-pass loading for circular references
|
|
3243
|
+
* - Dry-run validation mode
|
|
3244
|
+
* - Upsert support honoring SeedSchema mode
|
|
3245
|
+
* - Actionable error reporting
|
|
3246
|
+
*/
|
|
3247
|
+
declare class SeedLoaderService implements ISeedLoaderService {
|
|
3248
|
+
private engine;
|
|
3249
|
+
private metadata;
|
|
3250
|
+
private logger;
|
|
3251
|
+
constructor(engine: IDataEngine$1, metadata: IMetadataService, logger: Logger);
|
|
3252
|
+
load(request: SeedLoaderRequest): Promise<SeedLoaderResult>;
|
|
3253
|
+
buildDependencyGraph(objectNames: string[]): Promise<ObjectDependencyGraph>;
|
|
3254
|
+
validate(datasets: Seed[], config?: SeedLoaderConfigInput): Promise<SeedLoaderResult>;
|
|
3255
|
+
private loadDataset;
|
|
3256
|
+
private resolveFromDatabase;
|
|
3257
|
+
private resolveDeferredUpdates;
|
|
3258
|
+
/**
|
|
3259
|
+
* Seed writes always run as a privileged system context. This bypasses
|
|
3260
|
+
* RBAC checks (so seeds can target system tables like `sys_*`) and
|
|
3261
|
+
* disables the SecurityPlugin's auto-injection of `organization_id` /
|
|
3262
|
+
* `owner_id` — seeds either declare those fields explicitly per
|
|
3263
|
+
* record, or are intentionally cross-tenant / global.
|
|
3264
|
+
*/
|
|
3265
|
+
private static readonly SEED_OPTIONS;
|
|
3266
|
+
private writeRecord;
|
|
3267
|
+
/**
|
|
3268
|
+
* Kahn's algorithm for topological sort with cycle detection.
|
|
3269
|
+
*/
|
|
3270
|
+
private topologicalSort;
|
|
3271
|
+
private findCycles;
|
|
3272
|
+
private filterByEnv;
|
|
3273
|
+
private orderDatasets;
|
|
3274
|
+
private buildReferenceMap;
|
|
3275
|
+
private loadExistingRecords;
|
|
3276
|
+
private looksLikeInternalId;
|
|
3277
|
+
private extractId;
|
|
3278
|
+
private buildEmptyResult;
|
|
3279
|
+
private buildResult;
|
|
3280
|
+
}
|
|
3281
|
+
|
|
3282
|
+
export { type BindHooksOptions, type BindHooksResult, type BuildProbeReport, DEFAULT_EXTENDER_PRIORITY, DEFAULT_OWNER_PRIORITY, type EngineMiddleware, type EvaluateRulesOptions, type FieldValidationError, type HookEntry, type HookHandler, type HookMetricLabel, type HookMetricOutcome, type HookMetricsRecorder, type HookSkipReason, InMemoryHookMetricsRecorder, type IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedSchema, type IntrospectedTable, MetadataFacade, type ObjectContributor, ObjectQL, type ObjectQLHostContext, type ObjectQLKernelOptions, ObjectQLPlugin, ObjectRepository, ObjectStackProtocolImplementation, type OperationContext, RESERVED_NAMESPACES, type RunBuildProbesOptions, type RuntimeBuildIssue, SECRET_MASK, SECRET_REF_PREFIX, SchemaRegistry, type SchemaRegistryOptions, ScopedContext, SeedLoaderService, type SysMetadataEngine, SysMetadataRepository, type SysMetadataRepositoryOptions, ValidationError, type WrapDeclarativeOptions, applyInMemoryAggregation, applySystemFields, bindHooksToEngine, bucketDateValue, collectSecretFields, computeFQN, convertIntrospectedSchemaToObjects, createObjectQLKernel, evaluateValidationRules, isSecretRef, legalNextStates, makeSecretRef, needsPriorRecord, noopHookMetricsRecorder, parseFQN, parseSecretRef, runBuildProbes, toTitleCase, validateRecord, wrapDeclarativeHook };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ServiceObject, ObjectOwnership, HookContext, QueryAST, EngineQueryOptions, DataEngineInsertOptions, EngineUpdateOptions, EngineDeleteOptions, EngineCountOptions, EngineAggregateOptions, DateGranularityValue, Hook } from '@objectstack/spec/data';
|
|
1
|
+
import { ServiceObject, ObjectOwnership, HookContext, QueryAST, EngineQueryOptions, DataEngineInsertOptions, EngineUpdateOptions, EngineDeleteOptions, EngineCountOptions, EngineAggregateOptions, DateGranularityValue, Hook, SeedLoaderRequest, SeedLoaderResult, ObjectDependencyGraph, Seed, SeedLoaderConfigInput } from '@objectstack/spec/data';
|
|
2
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, InstallPackageRequest, InstallPackageResponse } from '@objectstack/spec/api';
|
|
6
|
-
import { IDataEngine, DriverInterface, Logger, Plugin, PluginContext, ObjectKernel } from '@objectstack/core';
|
|
7
|
-
import { IFeedService, IRealtimeService, ICryptoProvider } from '@objectstack/spec/contracts';
|
|
6
|
+
import { IDataEngine, DriverInterface, Logger as Logger$1, Plugin, PluginContext, ObjectKernel } from '@objectstack/core';
|
|
7
|
+
import { IFeedService, IRealtimeService, ICryptoProvider, ISeedLoaderService, IDataEngine as IDataEngine$1, IMetadataService } from '@objectstack/spec/contracts';
|
|
8
8
|
import { Expression } from '@objectstack/spec';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -358,6 +358,81 @@ declare class SchemaRegistry {
|
|
|
358
358
|
reset(): void;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
/** One runtime-verification finding (ADR-0038 BuildIssue, layer 'runtime'). */
|
|
362
|
+
interface RuntimeBuildIssue {
|
|
363
|
+
layer: 'runtime';
|
|
364
|
+
severity: 'error' | 'warning';
|
|
365
|
+
/** The artifact whose runtime behaviour is broken. */
|
|
366
|
+
artifact: {
|
|
367
|
+
type: string;
|
|
368
|
+
name: string;
|
|
369
|
+
};
|
|
370
|
+
/** What it exercised, when narrower than the artifact (e.g. a widget). */
|
|
371
|
+
ref?: {
|
|
372
|
+
type: string;
|
|
373
|
+
name: string;
|
|
374
|
+
member?: string;
|
|
375
|
+
};
|
|
376
|
+
/** 'seed_not_applied' | 'view_read_failed' | 'empty_query' | 'widget_query_failed' | 'probes_unavailable' */
|
|
377
|
+
code: string;
|
|
378
|
+
message: string;
|
|
379
|
+
fix?: string;
|
|
380
|
+
}
|
|
381
|
+
/** Aggregate result of one post-publish probe pass. */
|
|
382
|
+
interface BuildProbeReport {
|
|
383
|
+
/** Findings, empty when every probe passed. */
|
|
384
|
+
issues: RuntimeBuildIssue[];
|
|
385
|
+
/** How many probes actually ran, per plane (0s mean nothing to probe). */
|
|
386
|
+
checked: {
|
|
387
|
+
seeds: number;
|
|
388
|
+
views: number;
|
|
389
|
+
widgets: number;
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/** The single read the probes need from the data engine. */
|
|
393
|
+
interface ProbeEngine {
|
|
394
|
+
find(objectName: string, query: unknown): Promise<Array<Record<string, unknown>>>;
|
|
395
|
+
}
|
|
396
|
+
/** Optional analytics surface — when absent, widget probes degrade to a warning. */
|
|
397
|
+
interface ProbeAnalytics {
|
|
398
|
+
queryDataset(dataset: unknown, selection: unknown, context?: unknown): Promise<unknown>;
|
|
399
|
+
}
|
|
400
|
+
interface RunBuildProbesOptions {
|
|
401
|
+
engine: ProbeEngine;
|
|
402
|
+
/** Read an ACTIVE (published) item body by type+name; undefined when absent. */
|
|
403
|
+
getItem: (type: string, name: string) => Promise<unknown | undefined>;
|
|
404
|
+
/** The just-published artifact set (publishPackageDrafts' `published`). */
|
|
405
|
+
published: Array<{
|
|
406
|
+
type: string;
|
|
407
|
+
name: string;
|
|
408
|
+
}>;
|
|
409
|
+
/**
|
|
410
|
+
* The kernel's analytics service, when one is mounted. Widget probes run
|
|
411
|
+
* the SAME `queryDataset` path the dashboard renderer hits — absent
|
|
412
|
+
* service means widgets can't be probed (one aggregate warning, not
|
|
413
|
+
* per-widget noise).
|
|
414
|
+
*/
|
|
415
|
+
analytics?: ProbeAnalytics;
|
|
416
|
+
/** Threaded into engine/analytics reads (tenant scoping). */
|
|
417
|
+
organizationId?: string | null;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Run the L3 runtime probes over a just-published artifact set:
|
|
421
|
+
*
|
|
422
|
+
* • per published `seed` — its target object must have rows now
|
|
423
|
+
* (`seed_not_applied`: the rows were promised but never materialized);
|
|
424
|
+
* • per published `view` — a limit-1 read through the same engine the
|
|
425
|
+
* renderer uses must not throw (`view_read_failed`);
|
|
426
|
+
* • per published `dashboard` widget — its real dataset selection must
|
|
427
|
+
* execute (`widget_query_failed`) and must not return empty on an object
|
|
428
|
+
* that HAS rows (`empty_query` — the four-layer staging incident class).
|
|
429
|
+
*
|
|
430
|
+
* All probes are reads (limit-1 / single aggregate); a probe crash is
|
|
431
|
+
* reported, never thrown — verification must not break the publish it
|
|
432
|
+
* verifies.
|
|
433
|
+
*/
|
|
434
|
+
declare function runBuildProbes(opts: RunBuildProbesOptions): Promise<BuildProbeReport>;
|
|
435
|
+
|
|
361
436
|
/**
|
|
362
437
|
* Re-export the canonical validation-result type so callers in this
|
|
363
438
|
* package don't need to dual-import from `@objectstack/spec/kernel`.
|
|
@@ -1250,12 +1325,40 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1250
1325
|
organizationId?: string;
|
|
1251
1326
|
actor?: string;
|
|
1252
1327
|
message?: string;
|
|
1328
|
+
/**
|
|
1329
|
+
* INTERNAL — `publishPackageDrafts` publishes many drafts and batch-applies
|
|
1330
|
+
* every seed body in ONE loader pass afterwards (cross-seed references need
|
|
1331
|
+
* multi-pass over the whole set), so it suppresses the per-item apply here.
|
|
1332
|
+
*/
|
|
1333
|
+
_skipSeedApply?: boolean;
|
|
1253
1334
|
}): Promise<{
|
|
1254
1335
|
success: boolean;
|
|
1255
1336
|
version: string;
|
|
1256
1337
|
seq: number;
|
|
1257
1338
|
message?: string;
|
|
1339
|
+
/**
|
|
1340
|
+
* Present when a `seed` draft was published: the result of materializing
|
|
1341
|
+
* its rows. Publishing the metadata ALWAYS succeeds independently — a
|
|
1342
|
+
* seed-load problem is surfaced here, never thrown, so callers (and UIs)
|
|
1343
|
+
* must check `seedApplied.success` instead of assuming data went live.
|
|
1344
|
+
*/
|
|
1345
|
+
seedApplied?: {
|
|
1346
|
+
success: boolean;
|
|
1347
|
+
inserted: number;
|
|
1348
|
+
updated: number;
|
|
1349
|
+
error?: string;
|
|
1350
|
+
errors?: unknown[];
|
|
1351
|
+
};
|
|
1258
1352
|
}>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Materialize published `seed` bodies into data rows via the SeedLoaderService
|
|
1355
|
+
* (externalId-keyed upsert, multi-pass for cross-seed references). Passing ALL
|
|
1356
|
+
* of a publish's seed bodies in ONE call lets a child seed reference a parent
|
|
1357
|
+
* seed's rows regardless of publish order. Best-effort: any failure is
|
|
1358
|
+
* returned, never thrown — publishing metadata must not be blocked by a data
|
|
1359
|
+
* problem, but the caller surfaces `seedApplied` so the failure is LOUD.
|
|
1360
|
+
*/
|
|
1361
|
+
private applySeedBodies;
|
|
1259
1362
|
/**
|
|
1260
1363
|
* List pending DRAFT metadata (ADR-0033) for the org, optionally narrowed
|
|
1261
1364
|
* by `packageId` and/or `type`. The list reads of `getMetaItems` only see
|
|
@@ -1304,6 +1407,23 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1304
1407
|
error: string;
|
|
1305
1408
|
code?: string;
|
|
1306
1409
|
}>;
|
|
1410
|
+
/** Aggregate result of materializing every published `seed` (absent when no seeds). */
|
|
1411
|
+
seedApplied?: {
|
|
1412
|
+
success: boolean;
|
|
1413
|
+
inserted: number;
|
|
1414
|
+
updated: number;
|
|
1415
|
+
error?: string;
|
|
1416
|
+
errors?: unknown[];
|
|
1417
|
+
};
|
|
1418
|
+
/**
|
|
1419
|
+
* ADR-0038 L3 — post-publish runtime probe report (absent when nothing
|
|
1420
|
+
* was publishable). One real read per published artifact: seeded
|
|
1421
|
+
* objects must have rows, views must be readable, dashboard widgets'
|
|
1422
|
+
* dataset selections must execute and return data. `issues` carries
|
|
1423
|
+
* BuildIssue-shaped findings (layer 'runtime') for the agent / chat
|
|
1424
|
+
* health surfaces; probes never fail the publish itself.
|
|
1425
|
+
*/
|
|
1426
|
+
probes?: BuildProbeReport;
|
|
1307
1427
|
}>;
|
|
1308
1428
|
/**
|
|
1309
1429
|
* Discard every pending DRAFT bound to a package — the NON-destructive
|
|
@@ -1799,7 +1919,7 @@ type EngineMiddleware = (ctx: OperationContext, next: () => Promise<void>) => Pr
|
|
|
1799
1919
|
*/
|
|
1800
1920
|
interface ObjectQLHostContext {
|
|
1801
1921
|
ql: ObjectQL;
|
|
1802
|
-
logger: Logger;
|
|
1922
|
+
logger: Logger$1;
|
|
1803
1923
|
[key: string]: any;
|
|
1804
1924
|
}
|
|
1805
1925
|
declare class ObjectQL implements IDataEngine {
|
|
@@ -3107,4 +3227,56 @@ declare function convertIntrospectedSchemaToObjects(introspectedSchema: Introspe
|
|
|
3107
3227
|
skipSystemColumns?: boolean;
|
|
3108
3228
|
}): ServiceObject[];
|
|
3109
3229
|
|
|
3110
|
-
|
|
3230
|
+
interface Logger {
|
|
3231
|
+
info(message: string, meta?: Record<string, any>): void;
|
|
3232
|
+
warn(message: string, meta?: Record<string, any>): void;
|
|
3233
|
+
error(message: string, error?: Error, meta?: Record<string, any>): void;
|
|
3234
|
+
debug(message: string, meta?: Record<string, any>): void;
|
|
3235
|
+
}
|
|
3236
|
+
/**
|
|
3237
|
+
* SeedLoaderService — Runtime implementation of ISeedLoaderService
|
|
3238
|
+
*
|
|
3239
|
+
* Provides metadata-driven seed data loading with:
|
|
3240
|
+
* - Automatic lookup/master_detail reference resolution via externalId
|
|
3241
|
+
* - Topological dependency ordering (parents before children)
|
|
3242
|
+
* - Multi-pass loading for circular references
|
|
3243
|
+
* - Dry-run validation mode
|
|
3244
|
+
* - Upsert support honoring SeedSchema mode
|
|
3245
|
+
* - Actionable error reporting
|
|
3246
|
+
*/
|
|
3247
|
+
declare class SeedLoaderService implements ISeedLoaderService {
|
|
3248
|
+
private engine;
|
|
3249
|
+
private metadata;
|
|
3250
|
+
private logger;
|
|
3251
|
+
constructor(engine: IDataEngine$1, metadata: IMetadataService, logger: Logger);
|
|
3252
|
+
load(request: SeedLoaderRequest): Promise<SeedLoaderResult>;
|
|
3253
|
+
buildDependencyGraph(objectNames: string[]): Promise<ObjectDependencyGraph>;
|
|
3254
|
+
validate(datasets: Seed[], config?: SeedLoaderConfigInput): Promise<SeedLoaderResult>;
|
|
3255
|
+
private loadDataset;
|
|
3256
|
+
private resolveFromDatabase;
|
|
3257
|
+
private resolveDeferredUpdates;
|
|
3258
|
+
/**
|
|
3259
|
+
* Seed writes always run as a privileged system context. This bypasses
|
|
3260
|
+
* RBAC checks (so seeds can target system tables like `sys_*`) and
|
|
3261
|
+
* disables the SecurityPlugin's auto-injection of `organization_id` /
|
|
3262
|
+
* `owner_id` — seeds either declare those fields explicitly per
|
|
3263
|
+
* record, or are intentionally cross-tenant / global.
|
|
3264
|
+
*/
|
|
3265
|
+
private static readonly SEED_OPTIONS;
|
|
3266
|
+
private writeRecord;
|
|
3267
|
+
/**
|
|
3268
|
+
* Kahn's algorithm for topological sort with cycle detection.
|
|
3269
|
+
*/
|
|
3270
|
+
private topologicalSort;
|
|
3271
|
+
private findCycles;
|
|
3272
|
+
private filterByEnv;
|
|
3273
|
+
private orderDatasets;
|
|
3274
|
+
private buildReferenceMap;
|
|
3275
|
+
private loadExistingRecords;
|
|
3276
|
+
private looksLikeInternalId;
|
|
3277
|
+
private extractId;
|
|
3278
|
+
private buildEmptyResult;
|
|
3279
|
+
private buildResult;
|
|
3280
|
+
}
|
|
3281
|
+
|
|
3282
|
+
export { type BindHooksOptions, type BindHooksResult, type BuildProbeReport, DEFAULT_EXTENDER_PRIORITY, DEFAULT_OWNER_PRIORITY, type EngineMiddleware, type EvaluateRulesOptions, type FieldValidationError, type HookEntry, type HookHandler, type HookMetricLabel, type HookMetricOutcome, type HookMetricsRecorder, type HookSkipReason, InMemoryHookMetricsRecorder, type IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedSchema, type IntrospectedTable, MetadataFacade, type ObjectContributor, ObjectQL, type ObjectQLHostContext, type ObjectQLKernelOptions, ObjectQLPlugin, ObjectRepository, ObjectStackProtocolImplementation, type OperationContext, RESERVED_NAMESPACES, type RunBuildProbesOptions, type RuntimeBuildIssue, SECRET_MASK, SECRET_REF_PREFIX, SchemaRegistry, type SchemaRegistryOptions, ScopedContext, SeedLoaderService, type SysMetadataEngine, SysMetadataRepository, type SysMetadataRepositoryOptions, ValidationError, type WrapDeclarativeOptions, applyInMemoryAggregation, applySystemFields, bindHooksToEngine, bucketDateValue, collectSecretFields, computeFQN, convertIntrospectedSchemaToObjects, createObjectQLKernel, evaluateValidationRules, isSecretRef, legalNextStates, makeSecretRef, needsPriorRecord, noopHookMetricsRecorder, parseFQN, parseSecretRef, runBuildProbes, toTitleCase, validateRecord, wrapDeclarativeHook };
|