@objectstack/objectql 2.0.7 → 3.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +22 -0
- package/dist/index.d.mts +151 -266
- package/dist/index.d.ts +151 -266
- package/dist/index.js +261 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +261 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/engine.ts +326 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/objectql@
|
|
2
|
+
> @objectstack/objectql@3.0.1 build /home/runner/work/spec/spec/packages/objectql
|
|
3
3
|
> tsup --config ../../tsup.config.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m79.69 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m160.22 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 128ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m81.23 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m161.10 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 131ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 13628ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m66.76 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m66.76 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @objectstack/objectql
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [389725a]
|
|
8
|
+
- @objectstack/spec@3.0.1
|
|
9
|
+
- @objectstack/core@3.0.1
|
|
10
|
+
- @objectstack/types@3.0.1
|
|
11
|
+
|
|
12
|
+
## 3.0.0
|
|
13
|
+
|
|
14
|
+
### Major Changes
|
|
15
|
+
|
|
16
|
+
- Release v3.0.0 — unified version bump for all ObjectStack packages.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @objectstack/spec@3.0.0
|
|
22
|
+
- @objectstack/core@3.0.0
|
|
23
|
+
- @objectstack/types@3.0.0
|
|
24
|
+
|
|
3
25
|
## 2.0.7
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -204,7 +204,7 @@ declare class SchemaRegistry {
|
|
|
204
204
|
abstract: boolean;
|
|
205
205
|
datasource: string;
|
|
206
206
|
fields: Record<string, {
|
|
207
|
-
type: "number" | "boolean" | "tags" | "date" | "lookup" | "file" | "json" | "
|
|
207
|
+
type: "number" | "boolean" | "tags" | "date" | "lookup" | "file" | "json" | "text" | "textarea" | "email" | "url" | "phone" | "password" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "time" | "toggle" | "select" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "image" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "location" | "address" | "code" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
|
|
208
208
|
required: boolean;
|
|
209
209
|
searchable: boolean;
|
|
210
210
|
multiple: boolean;
|
|
@@ -262,7 +262,7 @@ declare class SchemaRegistry {
|
|
|
262
262
|
allowScanning?: boolean | undefined;
|
|
263
263
|
currencyConfig?: {
|
|
264
264
|
precision: number;
|
|
265
|
-
currencyMode: "
|
|
265
|
+
currencyMode: "dynamic" | "fixed";
|
|
266
266
|
defaultCurrency: string;
|
|
267
267
|
} | undefined;
|
|
268
268
|
vectorConfig?: {
|
|
@@ -270,7 +270,7 @@ declare class SchemaRegistry {
|
|
|
270
270
|
distanceMetric: "cosine" | "euclidean" | "dotProduct" | "manhattan";
|
|
271
271
|
normalized: boolean;
|
|
272
272
|
indexed: boolean;
|
|
273
|
-
indexType?: "
|
|
273
|
+
indexType?: "hnsw" | "ivfflat" | "flat" | undefined;
|
|
274
274
|
} | undefined;
|
|
275
275
|
fileAttachmentConfig?: {
|
|
276
276
|
virusScan: boolean;
|
|
@@ -332,7 +332,7 @@ declare class SchemaRegistry {
|
|
|
332
332
|
} | undefined;
|
|
333
333
|
maskingRule?: {
|
|
334
334
|
field: string;
|
|
335
|
-
strategy: "
|
|
335
|
+
strategy: "redact" | "partial" | "hash" | "tokenize" | "randomize" | "nullify" | "substitute";
|
|
336
336
|
preserveFormat: boolean;
|
|
337
337
|
preserveLength: boolean;
|
|
338
338
|
pattern?: string | undefined;
|
|
@@ -353,6 +353,8 @@ declare class SchemaRegistry {
|
|
|
353
353
|
threshold: number;
|
|
354
354
|
} | undefined;
|
|
355
355
|
} | undefined;
|
|
356
|
+
group?: string | undefined;
|
|
357
|
+
conditionalRequired?: string | undefined;
|
|
356
358
|
inlineHelpText?: string | undefined;
|
|
357
359
|
trackFeedHistory?: boolean | undefined;
|
|
358
360
|
caseSensitive?: boolean | undefined;
|
|
@@ -430,6 +432,12 @@ declare class SchemaRegistry {
|
|
|
430
432
|
description?: string | undefined;
|
|
431
433
|
}[]> | undefined;
|
|
432
434
|
}> | undefined;
|
|
435
|
+
displayNameField?: string | undefined;
|
|
436
|
+
recordName?: {
|
|
437
|
+
type: "text" | "autonumber";
|
|
438
|
+
displayFormat?: string | undefined;
|
|
439
|
+
startNumber?: number | undefined;
|
|
440
|
+
} | undefined;
|
|
433
441
|
titleFormat?: string | undefined;
|
|
434
442
|
compactLayout?: string[] | undefined;
|
|
435
443
|
search?: {
|
|
@@ -457,7 +465,7 @@ declare class SchemaRegistry {
|
|
|
457
465
|
label: string | {
|
|
458
466
|
key: string;
|
|
459
467
|
defaultValue?: string | undefined;
|
|
460
|
-
params?: Record<string,
|
|
468
|
+
params?: Record<string, string | number | boolean> | undefined;
|
|
461
469
|
};
|
|
462
470
|
active: boolean;
|
|
463
471
|
isDefault: boolean;
|
|
@@ -465,7 +473,7 @@ declare class SchemaRegistry {
|
|
|
465
473
|
description?: string | {
|
|
466
474
|
key: string;
|
|
467
475
|
defaultValue?: string | undefined;
|
|
468
|
-
params?: Record<string,
|
|
476
|
+
params?: Record<string, string | number | boolean> | undefined;
|
|
469
477
|
} | undefined;
|
|
470
478
|
icon?: string | undefined;
|
|
471
479
|
branding?: {
|
|
@@ -486,7 +494,7 @@ declare class SchemaRegistry {
|
|
|
486
494
|
ariaLabel?: string | {
|
|
487
495
|
key: string;
|
|
488
496
|
defaultValue?: string | undefined;
|
|
489
|
-
params?: Record<string,
|
|
497
|
+
params?: Record<string, string | number | boolean> | undefined;
|
|
490
498
|
} | undefined;
|
|
491
499
|
ariaDescribedBy?: string | undefined;
|
|
492
500
|
role?: string | undefined;
|
|
@@ -797,10 +805,12 @@ declare class SchemaRegistry {
|
|
|
797
805
|
} | undefined;
|
|
798
806
|
} | undefined;
|
|
799
807
|
};
|
|
800
|
-
status: "error" | "disabled" | "installed" | "installing" | "uninstalling";
|
|
808
|
+
status: "error" | "disabled" | "installed" | "installing" | "upgrading" | "uninstalling";
|
|
801
809
|
enabled: boolean;
|
|
802
810
|
installedAt?: string | undefined;
|
|
803
811
|
updatedAt?: string | undefined;
|
|
812
|
+
installedVersion?: string | undefined;
|
|
813
|
+
previousVersion?: string | undefined;
|
|
804
814
|
statusChangedAt?: string | undefined;
|
|
805
815
|
errorMessage?: string | undefined;
|
|
806
816
|
settings?: Record<string, unknown> | undefined;
|
|
@@ -1230,7 +1240,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1230
1240
|
label: string | undefined;
|
|
1231
1241
|
required: boolean;
|
|
1232
1242
|
readonly: boolean;
|
|
1233
|
-
type: "number" | "boolean" | "tags" | "date" | "lookup" | "file" | "json" | "
|
|
1243
|
+
type: "number" | "boolean" | "tags" | "date" | "lookup" | "file" | "json" | "text" | "textarea" | "email" | "url" | "phone" | "password" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "time" | "toggle" | "select" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "image" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "location" | "address" | "code" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
|
|
1234
1244
|
colSpan: number;
|
|
1235
1245
|
}[];
|
|
1236
1246
|
}[];
|
|
@@ -1317,6 +1327,7 @@ interface HookEntry {
|
|
|
1317
1327
|
handler: HookHandler;
|
|
1318
1328
|
object?: string | string[];
|
|
1319
1329
|
priority: number;
|
|
1330
|
+
packageId?: string;
|
|
1320
1331
|
}
|
|
1321
1332
|
/**
|
|
1322
1333
|
* Operation Context for Middleware Chain
|
|
@@ -1356,6 +1367,7 @@ declare class ObjectQL implements IDataEngine {
|
|
|
1356
1367
|
private logger;
|
|
1357
1368
|
private hooks;
|
|
1358
1369
|
private middlewares;
|
|
1370
|
+
private actions;
|
|
1359
1371
|
private hostContext;
|
|
1360
1372
|
constructor(hostContext?: Record<string, any>);
|
|
1361
1373
|
/**
|
|
@@ -1385,8 +1397,27 @@ declare class ObjectQL implements IDataEngine {
|
|
|
1385
1397
|
registerHook(event: string, handler: HookHandler, options?: {
|
|
1386
1398
|
object?: string | string[];
|
|
1387
1399
|
priority?: number;
|
|
1400
|
+
packageId?: string;
|
|
1388
1401
|
}): void;
|
|
1389
1402
|
triggerHooks(event: string, context: HookContext): Promise<void>;
|
|
1403
|
+
/**
|
|
1404
|
+
* Register a named action on an object.
|
|
1405
|
+
* Actions are custom business logic callable via `repo.execute(actionName, params)`.
|
|
1406
|
+
*
|
|
1407
|
+
* @param objectName Target object
|
|
1408
|
+
* @param actionName Unique action name within the object
|
|
1409
|
+
* @param handler Handler function
|
|
1410
|
+
* @param packageName Optional package owner (for cleanup)
|
|
1411
|
+
*/
|
|
1412
|
+
registerAction(objectName: string, actionName: string, handler: (ctx: any) => Promise<any> | any, packageName?: string): void;
|
|
1413
|
+
/**
|
|
1414
|
+
* Execute a named action on an object.
|
|
1415
|
+
*/
|
|
1416
|
+
executeAction(objectName: string, actionName: string, ctx: any): Promise<any>;
|
|
1417
|
+
/**
|
|
1418
|
+
* Remove all actions registered by a specific package.
|
|
1419
|
+
*/
|
|
1420
|
+
removeActionsByPackage(packageName: string): void;
|
|
1390
1421
|
/**
|
|
1391
1422
|
* Register a middleware function
|
|
1392
1423
|
* Middlewares execute in onion model around every data operation.
|
|
@@ -1434,262 +1465,7 @@ declare class ObjectQL implements IDataEngine {
|
|
|
1434
1465
|
/**
|
|
1435
1466
|
* Helper to get object definition
|
|
1436
1467
|
*/
|
|
1437
|
-
getSchema(objectName: string):
|
|
1438
|
-
name: string;
|
|
1439
|
-
active: boolean;
|
|
1440
|
-
isSystem: boolean;
|
|
1441
|
-
abstract: boolean;
|
|
1442
|
-
datasource: string;
|
|
1443
|
-
fields: Record<string, {
|
|
1444
|
-
type: "number" | "boolean" | "tags" | "date" | "lookup" | "file" | "json" | "code" | "text" | "textarea" | "email" | "url" | "phone" | "password" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "time" | "toggle" | "select" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "image" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "location" | "address" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
|
|
1445
|
-
required: boolean;
|
|
1446
|
-
searchable: boolean;
|
|
1447
|
-
multiple: boolean;
|
|
1448
|
-
unique: boolean;
|
|
1449
|
-
deleteBehavior: "set_null" | "cascade" | "restrict";
|
|
1450
|
-
auditTrail: boolean;
|
|
1451
|
-
hidden: boolean;
|
|
1452
|
-
readonly: boolean;
|
|
1453
|
-
sortable: boolean;
|
|
1454
|
-
index: boolean;
|
|
1455
|
-
externalId: boolean;
|
|
1456
|
-
name?: string | undefined;
|
|
1457
|
-
label?: string | undefined;
|
|
1458
|
-
description?: string | undefined;
|
|
1459
|
-
format?: string | undefined;
|
|
1460
|
-
defaultValue?: unknown;
|
|
1461
|
-
maxLength?: number | undefined;
|
|
1462
|
-
minLength?: number | undefined;
|
|
1463
|
-
precision?: number | undefined;
|
|
1464
|
-
scale?: number | undefined;
|
|
1465
|
-
min?: number | undefined;
|
|
1466
|
-
max?: number | undefined;
|
|
1467
|
-
options?: {
|
|
1468
|
-
label: string;
|
|
1469
|
-
value: string;
|
|
1470
|
-
color?: string | undefined;
|
|
1471
|
-
default?: boolean | undefined;
|
|
1472
|
-
}[] | undefined;
|
|
1473
|
-
reference?: string | undefined;
|
|
1474
|
-
referenceFilters?: string[] | undefined;
|
|
1475
|
-
writeRequiresMasterRead?: boolean | undefined;
|
|
1476
|
-
expression?: string | undefined;
|
|
1477
|
-
summaryOperations?: {
|
|
1478
|
-
object: string;
|
|
1479
|
-
field: string;
|
|
1480
|
-
function: "min" | "max" | "count" | "sum" | "avg";
|
|
1481
|
-
} | undefined;
|
|
1482
|
-
language?: string | undefined;
|
|
1483
|
-
theme?: string | undefined;
|
|
1484
|
-
lineNumbers?: boolean | undefined;
|
|
1485
|
-
maxRating?: number | undefined;
|
|
1486
|
-
allowHalf?: boolean | undefined;
|
|
1487
|
-
displayMap?: boolean | undefined;
|
|
1488
|
-
allowGeocoding?: boolean | undefined;
|
|
1489
|
-
addressFormat?: "us" | "uk" | "international" | undefined;
|
|
1490
|
-
colorFormat?: "hex" | "rgb" | "rgba" | "hsl" | undefined;
|
|
1491
|
-
allowAlpha?: boolean | undefined;
|
|
1492
|
-
presetColors?: string[] | undefined;
|
|
1493
|
-
step?: number | undefined;
|
|
1494
|
-
showValue?: boolean | undefined;
|
|
1495
|
-
marks?: Record<string, string> | undefined;
|
|
1496
|
-
barcodeFormat?: "qr" | "ean13" | "ean8" | "code128" | "code39" | "upca" | "upce" | undefined;
|
|
1497
|
-
qrErrorCorrection?: "L" | "M" | "Q" | "H" | undefined;
|
|
1498
|
-
displayValue?: boolean | undefined;
|
|
1499
|
-
allowScanning?: boolean | undefined;
|
|
1500
|
-
currencyConfig?: {
|
|
1501
|
-
precision: number;
|
|
1502
|
-
currencyMode: "fixed" | "dynamic";
|
|
1503
|
-
defaultCurrency: string;
|
|
1504
|
-
} | undefined;
|
|
1505
|
-
vectorConfig?: {
|
|
1506
|
-
dimensions: number;
|
|
1507
|
-
distanceMetric: "cosine" | "euclidean" | "dotProduct" | "manhattan";
|
|
1508
|
-
normalized: boolean;
|
|
1509
|
-
indexed: boolean;
|
|
1510
|
-
indexType?: "flat" | "hnsw" | "ivfflat" | undefined;
|
|
1511
|
-
} | undefined;
|
|
1512
|
-
fileAttachmentConfig?: {
|
|
1513
|
-
virusScan: boolean;
|
|
1514
|
-
virusScanOnUpload: boolean;
|
|
1515
|
-
quarantineOnThreat: boolean;
|
|
1516
|
-
allowMultiple: boolean;
|
|
1517
|
-
allowReplace: boolean;
|
|
1518
|
-
allowDelete: boolean;
|
|
1519
|
-
requireUpload: boolean;
|
|
1520
|
-
extractMetadata: boolean;
|
|
1521
|
-
extractText: boolean;
|
|
1522
|
-
versioningEnabled: boolean;
|
|
1523
|
-
publicRead: boolean;
|
|
1524
|
-
presignedUrlExpiry: number;
|
|
1525
|
-
minSize?: number | undefined;
|
|
1526
|
-
maxSize?: number | undefined;
|
|
1527
|
-
allowedTypes?: string[] | undefined;
|
|
1528
|
-
blockedTypes?: string[] | undefined;
|
|
1529
|
-
allowedMimeTypes?: string[] | undefined;
|
|
1530
|
-
blockedMimeTypes?: string[] | undefined;
|
|
1531
|
-
virusScanProvider?: "custom" | "clamav" | "virustotal" | "metadefender" | undefined;
|
|
1532
|
-
storageProvider?: string | undefined;
|
|
1533
|
-
storageBucket?: string | undefined;
|
|
1534
|
-
storagePrefix?: string | undefined;
|
|
1535
|
-
imageValidation?: {
|
|
1536
|
-
generateThumbnails: boolean;
|
|
1537
|
-
preserveMetadata: boolean;
|
|
1538
|
-
autoRotate: boolean;
|
|
1539
|
-
minWidth?: number | undefined;
|
|
1540
|
-
maxWidth?: number | undefined;
|
|
1541
|
-
minHeight?: number | undefined;
|
|
1542
|
-
maxHeight?: number | undefined;
|
|
1543
|
-
aspectRatio?: string | undefined;
|
|
1544
|
-
thumbnailSizes?: {
|
|
1545
|
-
name: string;
|
|
1546
|
-
width: number;
|
|
1547
|
-
height: number;
|
|
1548
|
-
crop: boolean;
|
|
1549
|
-
}[] | undefined;
|
|
1550
|
-
} | undefined;
|
|
1551
|
-
maxVersions?: number | undefined;
|
|
1552
|
-
} | undefined;
|
|
1553
|
-
encryptionConfig?: {
|
|
1554
|
-
enabled: boolean;
|
|
1555
|
-
algorithm: "aes-256-gcm" | "aes-256-cbc" | "chacha20-poly1305";
|
|
1556
|
-
keyManagement: {
|
|
1557
|
-
provider: "local" | "aws-kms" | "azure-key-vault" | "gcp-kms" | "hashicorp-vault";
|
|
1558
|
-
keyId?: string | undefined;
|
|
1559
|
-
rotationPolicy?: {
|
|
1560
|
-
enabled: boolean;
|
|
1561
|
-
frequencyDays: number;
|
|
1562
|
-
retainOldVersions: number;
|
|
1563
|
-
autoRotate: boolean;
|
|
1564
|
-
} | undefined;
|
|
1565
|
-
};
|
|
1566
|
-
scope: "field" | "table" | "record" | "database";
|
|
1567
|
-
deterministicEncryption: boolean;
|
|
1568
|
-
searchableEncryption: boolean;
|
|
1569
|
-
} | undefined;
|
|
1570
|
-
maskingRule?: {
|
|
1571
|
-
field: string;
|
|
1572
|
-
strategy: "hash" | "redact" | "partial" | "tokenize" | "randomize" | "nullify" | "substitute";
|
|
1573
|
-
preserveFormat: boolean;
|
|
1574
|
-
preserveLength: boolean;
|
|
1575
|
-
pattern?: string | undefined;
|
|
1576
|
-
roles?: string[] | undefined;
|
|
1577
|
-
exemptRoles?: string[] | undefined;
|
|
1578
|
-
} | undefined;
|
|
1579
|
-
dependencies?: string[] | undefined;
|
|
1580
|
-
cached?: {
|
|
1581
|
-
enabled: boolean;
|
|
1582
|
-
ttl: number;
|
|
1583
|
-
invalidateOn: string[];
|
|
1584
|
-
} | undefined;
|
|
1585
|
-
dataQuality?: {
|
|
1586
|
-
uniqueness: boolean;
|
|
1587
|
-
completeness: number;
|
|
1588
|
-
accuracy?: {
|
|
1589
|
-
source: string;
|
|
1590
|
-
threshold: number;
|
|
1591
|
-
} | undefined;
|
|
1592
|
-
} | undefined;
|
|
1593
|
-
inlineHelpText?: string | undefined;
|
|
1594
|
-
trackFeedHistory?: boolean | undefined;
|
|
1595
|
-
caseSensitive?: boolean | undefined;
|
|
1596
|
-
autonumberFormat?: string | undefined;
|
|
1597
|
-
}>;
|
|
1598
|
-
label?: string | undefined;
|
|
1599
|
-
pluralLabel?: string | undefined;
|
|
1600
|
-
description?: string | undefined;
|
|
1601
|
-
icon?: string | undefined;
|
|
1602
|
-
tags?: string[] | undefined;
|
|
1603
|
-
tableName?: string | undefined;
|
|
1604
|
-
indexes?: {
|
|
1605
|
-
fields: string[];
|
|
1606
|
-
type: "hash" | "btree" | "gin" | "gist" | "fulltext";
|
|
1607
|
-
unique: boolean;
|
|
1608
|
-
name?: string | undefined;
|
|
1609
|
-
partial?: string | undefined;
|
|
1610
|
-
}[] | undefined;
|
|
1611
|
-
tenancy?: {
|
|
1612
|
-
enabled: boolean;
|
|
1613
|
-
strategy: "shared" | "isolated" | "hybrid";
|
|
1614
|
-
tenantField: string;
|
|
1615
|
-
crossTenantAccess: boolean;
|
|
1616
|
-
} | undefined;
|
|
1617
|
-
softDelete?: {
|
|
1618
|
-
enabled: boolean;
|
|
1619
|
-
field: string;
|
|
1620
|
-
cascadeDelete: boolean;
|
|
1621
|
-
} | undefined;
|
|
1622
|
-
versioning?: {
|
|
1623
|
-
enabled: boolean;
|
|
1624
|
-
strategy: "snapshot" | "delta" | "event-sourcing";
|
|
1625
|
-
versionField: string;
|
|
1626
|
-
retentionDays?: number | undefined;
|
|
1627
|
-
} | undefined;
|
|
1628
|
-
partitioning?: {
|
|
1629
|
-
enabled: boolean;
|
|
1630
|
-
strategy: "hash" | "range" | "list";
|
|
1631
|
-
key: string;
|
|
1632
|
-
interval?: string | undefined;
|
|
1633
|
-
} | undefined;
|
|
1634
|
-
cdc?: {
|
|
1635
|
-
enabled: boolean;
|
|
1636
|
-
events: ("update" | "delete" | "insert")[];
|
|
1637
|
-
destination: string;
|
|
1638
|
-
} | undefined;
|
|
1639
|
-
validations?: _objectstack_spec_data.BaseValidationRuleShape[] | undefined;
|
|
1640
|
-
stateMachines?: Record<string, {
|
|
1641
|
-
id: string;
|
|
1642
|
-
initial: string;
|
|
1643
|
-
states: Record<string, StateNodeConfig>;
|
|
1644
|
-
description?: string | undefined;
|
|
1645
|
-
contextSchema?: Record<string, unknown> | undefined;
|
|
1646
|
-
on?: Record<string, string | {
|
|
1647
|
-
target?: string | undefined;
|
|
1648
|
-
cond?: string | {
|
|
1649
|
-
type: string;
|
|
1650
|
-
params?: Record<string, unknown> | undefined;
|
|
1651
|
-
} | undefined;
|
|
1652
|
-
actions?: (string | {
|
|
1653
|
-
type: string;
|
|
1654
|
-
params?: Record<string, unknown> | undefined;
|
|
1655
|
-
})[] | undefined;
|
|
1656
|
-
description?: string | undefined;
|
|
1657
|
-
} | {
|
|
1658
|
-
target?: string | undefined;
|
|
1659
|
-
cond?: string | {
|
|
1660
|
-
type: string;
|
|
1661
|
-
params?: Record<string, unknown> | undefined;
|
|
1662
|
-
} | undefined;
|
|
1663
|
-
actions?: (string | {
|
|
1664
|
-
type: string;
|
|
1665
|
-
params?: Record<string, unknown> | undefined;
|
|
1666
|
-
})[] | undefined;
|
|
1667
|
-
description?: string | undefined;
|
|
1668
|
-
}[]> | undefined;
|
|
1669
|
-
}> | undefined;
|
|
1670
|
-
titleFormat?: string | undefined;
|
|
1671
|
-
compactLayout?: string[] | undefined;
|
|
1672
|
-
search?: {
|
|
1673
|
-
fields: string[];
|
|
1674
|
-
displayFields?: string[] | undefined;
|
|
1675
|
-
filters?: string[] | undefined;
|
|
1676
|
-
} | undefined;
|
|
1677
|
-
enable?: {
|
|
1678
|
-
trackHistory: boolean;
|
|
1679
|
-
searchable: boolean;
|
|
1680
|
-
apiEnabled: boolean;
|
|
1681
|
-
files: boolean;
|
|
1682
|
-
feeds: boolean;
|
|
1683
|
-
activities: boolean;
|
|
1684
|
-
trash: boolean;
|
|
1685
|
-
mru: boolean;
|
|
1686
|
-
clone: boolean;
|
|
1687
|
-
apiMethods?: ("search" | "list" | "update" | "delete" | "upsert" | "history" | "get" | "create" | "bulk" | "aggregate" | "restore" | "purge" | "import" | "export")[] | undefined;
|
|
1688
|
-
} | undefined;
|
|
1689
|
-
recordTypes?: string[] | undefined;
|
|
1690
|
-
sharingModel?: "full" | "private" | "read" | "read_write" | undefined;
|
|
1691
|
-
keyPrefix?: string | undefined;
|
|
1692
|
-
} | undefined;
|
|
1468
|
+
getSchema(objectName: string): ServiceObject | undefined;
|
|
1693
1469
|
/**
|
|
1694
1470
|
* Resolve an object name to its Fully Qualified Name (FQN).
|
|
1695
1471
|
*
|
|
@@ -1719,6 +1495,58 @@ declare class ObjectQL implements IDataEngine {
|
|
|
1719
1495
|
count(object: string, query?: DataEngineCountOptions): Promise<number>;
|
|
1720
1496
|
aggregate(object: string, query: DataEngineAggregateOptions): Promise<any[]>;
|
|
1721
1497
|
execute(command: any, options?: Record<string, any>): Promise<any>;
|
|
1498
|
+
/**
|
|
1499
|
+
* Register a single object definition.
|
|
1500
|
+
*
|
|
1501
|
+
* Proxies to SchemaRegistry.registerObject() with sensible defaults.
|
|
1502
|
+
* Fields without a `name` property are auto-assigned from their key.
|
|
1503
|
+
*/
|
|
1504
|
+
registerObject(schema: ServiceObject, packageId?: string, namespace?: string): string;
|
|
1505
|
+
/**
|
|
1506
|
+
* Unregister a single object by name.
|
|
1507
|
+
*/
|
|
1508
|
+
unregisterObject(name: string, packageId?: string): void;
|
|
1509
|
+
/**
|
|
1510
|
+
* Get an object definition by name.
|
|
1511
|
+
* Alias for getSchema() — matches @objectql/core API.
|
|
1512
|
+
*/
|
|
1513
|
+
getObject(name: string): ServiceObject | undefined;
|
|
1514
|
+
/**
|
|
1515
|
+
* Get all registered object configs as a name→config map.
|
|
1516
|
+
* Matches @objectql/core getConfigs() API.
|
|
1517
|
+
*/
|
|
1518
|
+
getConfigs(): Record<string, ServiceObject>;
|
|
1519
|
+
/**
|
|
1520
|
+
* Get a registered driver by datasource name.
|
|
1521
|
+
*
|
|
1522
|
+
* Unlike the private getDriver() (which resolves by object name),
|
|
1523
|
+
* this method directly looks up a driver by its registered name.
|
|
1524
|
+
*/
|
|
1525
|
+
getDriverByName(name: string): DriverInterface | undefined;
|
|
1526
|
+
/**
|
|
1527
|
+
* Get a registered driver by datasource name.
|
|
1528
|
+
* Alias matching @objectql/core datasource() API.
|
|
1529
|
+
*
|
|
1530
|
+
* @throws Error if the datasource is not found
|
|
1531
|
+
*/
|
|
1532
|
+
datasource(name: string): DriverInterface;
|
|
1533
|
+
/**
|
|
1534
|
+
* Register a hook handler.
|
|
1535
|
+
* Convenience alias for registerHook() matching @objectql/core on() API.
|
|
1536
|
+
*
|
|
1537
|
+
* Usage:
|
|
1538
|
+
* ql.on('beforeInsert', 'user', async (ctx) => { ... });
|
|
1539
|
+
*/
|
|
1540
|
+
on(event: string, objectName: string, handler: (ctx: HookContext) => Promise<void> | void, packageId?: string): void;
|
|
1541
|
+
/**
|
|
1542
|
+
* Remove all hooks, actions, and objects contributed by a package.
|
|
1543
|
+
*/
|
|
1544
|
+
removePackage(packageId: string): void;
|
|
1545
|
+
/**
|
|
1546
|
+
* Gracefully shut down the engine, disconnecting all drivers.
|
|
1547
|
+
* Alias for destroy() — matches @objectql/core close() API.
|
|
1548
|
+
*/
|
|
1549
|
+
close(): Promise<void>;
|
|
1722
1550
|
/**
|
|
1723
1551
|
* Create a scoped execution context bound to this engine.
|
|
1724
1552
|
*
|
|
@@ -1728,24 +1556,65 @@ declare class ObjectQL implements IDataEngine {
|
|
|
1728
1556
|
* await users.find({ filter: { status: 'active' } });
|
|
1729
1557
|
*/
|
|
1730
1558
|
createContext(ctx: Partial<ExecutionContext>): ScopedContext;
|
|
1559
|
+
/**
|
|
1560
|
+
* Static factory: create a fully configured ObjectQL instance.
|
|
1561
|
+
*
|
|
1562
|
+
* Matches @objectql/core's `new ObjectQL(config)` pattern but also
|
|
1563
|
+
* registers drivers and objects, then calls init().
|
|
1564
|
+
*
|
|
1565
|
+
* Usage:
|
|
1566
|
+
* const ql = await ObjectQL.create({
|
|
1567
|
+
* datasources: { default: myDriver },
|
|
1568
|
+
* objects: { user: { name: 'user', fields: { ... } } }
|
|
1569
|
+
* });
|
|
1570
|
+
*/
|
|
1571
|
+
static create(config: {
|
|
1572
|
+
datasources?: Record<string, DriverInterface>;
|
|
1573
|
+
objects?: Record<string, ServiceObject>;
|
|
1574
|
+
hooks?: Array<{
|
|
1575
|
+
event: string;
|
|
1576
|
+
object: string;
|
|
1577
|
+
handler: (ctx: HookContext) => Promise<void> | void;
|
|
1578
|
+
}>;
|
|
1579
|
+
}): Promise<ObjectQL>;
|
|
1731
1580
|
}
|
|
1732
1581
|
/**
|
|
1733
1582
|
* Repository scoped to a single object, bound to an execution context.
|
|
1583
|
+
*
|
|
1584
|
+
* Provides both IDataEngine-style methods (find, insert, update, delete)
|
|
1585
|
+
* and convenience aliases (create, updateById, deleteById) matching
|
|
1586
|
+
* the @objectql/core ObjectRepository API.
|
|
1734
1587
|
*/
|
|
1735
1588
|
declare class ObjectRepository {
|
|
1736
1589
|
private objectName;
|
|
1737
1590
|
private context;
|
|
1738
1591
|
private engine;
|
|
1739
|
-
constructor(objectName: string, context: ExecutionContext, engine: IDataEngine
|
|
1592
|
+
constructor(objectName: string, context: ExecutionContext, engine: IDataEngine & {
|
|
1593
|
+
executeAction?: (o: string, a: string, c: any) => Promise<any>;
|
|
1594
|
+
});
|
|
1740
1595
|
find(query?: any): Promise<any[]>;
|
|
1741
1596
|
findOne(query?: any): Promise<any>;
|
|
1742
1597
|
insert(data: any): Promise<any>;
|
|
1598
|
+
/** Alias for insert() — matches @objectql/core convention */
|
|
1599
|
+
create(data: any): Promise<any>;
|
|
1743
1600
|
update(data: any, options?: any): Promise<any>;
|
|
1601
|
+
/** Update a single record by ID */
|
|
1602
|
+
updateById(id: string | number, data: any): Promise<any>;
|
|
1744
1603
|
delete(options?: any): Promise<any>;
|
|
1604
|
+
/** Delete a single record by ID */
|
|
1605
|
+
deleteById(id: string | number): Promise<any>;
|
|
1745
1606
|
count(query?: any): Promise<number>;
|
|
1607
|
+
/** Aggregate query */
|
|
1608
|
+
aggregate(query?: any): Promise<any[]>;
|
|
1609
|
+
/** Execute a named action registered on this object */
|
|
1610
|
+
execute(actionName: string, params?: any): Promise<any>;
|
|
1746
1611
|
}
|
|
1747
1612
|
/**
|
|
1748
1613
|
* Scoped execution context with object() accessor.
|
|
1614
|
+
*
|
|
1615
|
+
* Provides identity (userId, tenantId/spaceId, roles),
|
|
1616
|
+
* repository access via object(), privilege escalation via sudo(),
|
|
1617
|
+
* and transactional execution via transaction().
|
|
1749
1618
|
*/
|
|
1750
1619
|
declare class ScopedContext {
|
|
1751
1620
|
private executionContext;
|
|
@@ -1755,9 +1624,25 @@ declare class ScopedContext {
|
|
|
1755
1624
|
object(name: string): ObjectRepository;
|
|
1756
1625
|
/** Create an elevated (system) context */
|
|
1757
1626
|
sudo(): ScopedContext;
|
|
1627
|
+
/**
|
|
1628
|
+
* Execute a callback within a database transaction.
|
|
1629
|
+
*
|
|
1630
|
+
* The callback receives a new ScopedContext whose operations
|
|
1631
|
+
* share the same transaction handle. If the callback throws,
|
|
1632
|
+
* the transaction is rolled back; otherwise it is committed.
|
|
1633
|
+
*
|
|
1634
|
+
* Falls back to non-transactional execution if the driver
|
|
1635
|
+
* does not support transactions.
|
|
1636
|
+
*/
|
|
1637
|
+
transaction(callback: (trxCtx: ScopedContext) => Promise<any>): Promise<any>;
|
|
1758
1638
|
get userId(): string | undefined;
|
|
1759
1639
|
get tenantId(): string | undefined;
|
|
1640
|
+
/** Alias for tenantId — matches ObjectQLContext.spaceId convention */
|
|
1641
|
+
get spaceId(): string | undefined;
|
|
1760
1642
|
get roles(): string[];
|
|
1643
|
+
get isSystem(): boolean;
|
|
1644
|
+
/** Internal: expose the transaction handle for driver-level access */
|
|
1645
|
+
get transactionHandle(): unknown;
|
|
1761
1646
|
}
|
|
1762
1647
|
|
|
1763
1648
|
/**
|