@objectstack/objectql 4.0.1 → 4.0.2
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 +11 -11
- package/CHANGELOG.md +9 -0
- package/dist/index.d.mts +22 -62
- package/dist/index.d.ts +22 -62
- package/dist/index.js +45 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/plugin.integration.test.ts +75 -13
- package/src/plugin.ts +25 -45
- package/src/protocol.ts +11 -7
- package/src/registry.test.ts +16 -5
- package/src/registry.ts +30 -21
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/objectql@4.0.
|
|
2
|
+
> @objectstack/objectql@4.0.2 build /home/runner/work/framework/framework/packages/objectql
|
|
3
3
|
> tsup --config ../../tsup.config.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
|
-
[34mCLI[39m Using tsup config: /home/runner/work/
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/framework/framework/tsup.config.ts
|
|
9
9
|
[34mCLI[39m Target: es2020
|
|
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
|
+
[32mCJS[39m [1mdist/index.js [22m[32m104.57 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m212.32 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 297ms
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m102.83 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m211.02 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 297ms
|
|
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 20150ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m77.34 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m77.34 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -130,15 +130,13 @@ declare class SchemaRegistry {
|
|
|
130
130
|
private static objectContributors;
|
|
131
131
|
/** FQN → Merged ServiceObject (cached, invalidated on changes) */
|
|
132
132
|
private static mergedObjectCache;
|
|
133
|
-
/** Namespace → PackageId (
|
|
133
|
+
/** Namespace → Set<PackageId> (multiple packages can share a namespace) */
|
|
134
134
|
private static namespaceRegistry;
|
|
135
135
|
/** Type → Name/ID → MetadataItem */
|
|
136
136
|
private static metadata;
|
|
137
137
|
/**
|
|
138
138
|
* Register a namespace for a package.
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* @throws Error if namespace is already registered to a different package
|
|
139
|
+
* Multiple packages can share the same namespace (e.g. 'sys').
|
|
142
140
|
*/
|
|
143
141
|
static registerNamespace(namespace: string, packageId: string): void;
|
|
144
142
|
/**
|
|
@@ -146,9 +144,13 @@ declare class SchemaRegistry {
|
|
|
146
144
|
*/
|
|
147
145
|
static unregisterNamespace(namespace: string, packageId: string): void;
|
|
148
146
|
/**
|
|
149
|
-
* Get the
|
|
147
|
+
* Get the packages that use a namespace.
|
|
150
148
|
*/
|
|
151
149
|
static getNamespaceOwner(namespace: string): string | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Get all packages that share a namespace.
|
|
152
|
+
*/
|
|
153
|
+
static getNamespaceOwners(namespace: string): string[];
|
|
152
154
|
/**
|
|
153
155
|
* Register an object with ownership semantics.
|
|
154
156
|
*
|
|
@@ -471,11 +473,7 @@ declare class SchemaRegistry {
|
|
|
471
473
|
keyPrefix?: string | undefined;
|
|
472
474
|
actions?: {
|
|
473
475
|
name: string;
|
|
474
|
-
label: string
|
|
475
|
-
key: string;
|
|
476
|
-
defaultValue?: string | undefined;
|
|
477
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
478
|
-
};
|
|
476
|
+
label: string;
|
|
479
477
|
type: "url" | "script" | "modal" | "flow" | "api";
|
|
480
478
|
refreshAfter: boolean;
|
|
481
479
|
objectName?: string | undefined;
|
|
@@ -486,63 +484,35 @@ declare class SchemaRegistry {
|
|
|
486
484
|
execute?: string | undefined;
|
|
487
485
|
params?: {
|
|
488
486
|
name: string;
|
|
489
|
-
label: string
|
|
490
|
-
key: string;
|
|
491
|
-
defaultValue?: string | undefined;
|
|
492
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
493
|
-
};
|
|
487
|
+
label: string;
|
|
494
488
|
type: "number" | "boolean" | "date" | "lookup" | "file" | "url" | "json" | "text" | "textarea" | "email" | "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" | "tags" | "vector";
|
|
495
489
|
required: boolean;
|
|
496
490
|
options?: {
|
|
497
|
-
label: string
|
|
498
|
-
key: string;
|
|
499
|
-
defaultValue?: string | undefined;
|
|
500
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
501
|
-
};
|
|
491
|
+
label: string;
|
|
502
492
|
value: string;
|
|
503
493
|
}[] | undefined;
|
|
504
494
|
}[] | undefined;
|
|
505
495
|
variant?: "link" | "primary" | "secondary" | "danger" | "ghost" | undefined;
|
|
506
|
-
confirmText?: string |
|
|
507
|
-
|
|
508
|
-
defaultValue?: string | undefined;
|
|
509
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
510
|
-
} | undefined;
|
|
511
|
-
successMessage?: string | {
|
|
512
|
-
key: string;
|
|
513
|
-
defaultValue?: string | undefined;
|
|
514
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
515
|
-
} | undefined;
|
|
496
|
+
confirmText?: string | undefined;
|
|
497
|
+
successMessage?: string | undefined;
|
|
516
498
|
visible?: string | undefined;
|
|
517
499
|
disabled?: string | boolean | undefined;
|
|
518
500
|
shortcut?: string | undefined;
|
|
519
501
|
bulkEnabled?: boolean | undefined;
|
|
520
502
|
timeout?: number | undefined;
|
|
521
503
|
aria?: {
|
|
522
|
-
ariaLabel?: string |
|
|
523
|
-
key: string;
|
|
524
|
-
defaultValue?: string | undefined;
|
|
525
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
526
|
-
} | undefined;
|
|
504
|
+
ariaLabel?: string | undefined;
|
|
527
505
|
ariaDescribedBy?: string | undefined;
|
|
528
506
|
role?: string | undefined;
|
|
529
507
|
} | undefined;
|
|
530
508
|
}[] | undefined;
|
|
531
509
|
} | {
|
|
532
510
|
name: string;
|
|
533
|
-
label: string
|
|
534
|
-
key: string;
|
|
535
|
-
defaultValue?: string | undefined;
|
|
536
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
537
|
-
};
|
|
511
|
+
label: string;
|
|
538
512
|
active: boolean;
|
|
539
513
|
isDefault: boolean;
|
|
540
514
|
version?: string | undefined;
|
|
541
|
-
description?: string |
|
|
542
|
-
key: string;
|
|
543
|
-
defaultValue?: string | undefined;
|
|
544
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
545
|
-
} | undefined;
|
|
515
|
+
description?: string | undefined;
|
|
546
516
|
icon?: string | undefined;
|
|
547
517
|
branding?: {
|
|
548
518
|
primaryColor?: string | undefined;
|
|
@@ -552,19 +522,11 @@ declare class SchemaRegistry {
|
|
|
552
522
|
navigation?: any[] | undefined;
|
|
553
523
|
areas?: {
|
|
554
524
|
id: string;
|
|
555
|
-
label: string
|
|
556
|
-
key: string;
|
|
557
|
-
defaultValue?: string | undefined;
|
|
558
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
559
|
-
};
|
|
525
|
+
label: string;
|
|
560
526
|
navigation: any[];
|
|
561
527
|
icon?: string | undefined;
|
|
562
528
|
order?: number | undefined;
|
|
563
|
-
description?: string |
|
|
564
|
-
key: string;
|
|
565
|
-
defaultValue?: string | undefined;
|
|
566
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
567
|
-
} | undefined;
|
|
529
|
+
description?: string | undefined;
|
|
568
530
|
visible?: string | undefined;
|
|
569
531
|
requiredPermissions?: string[] | undefined;
|
|
570
532
|
}[] | undefined;
|
|
@@ -594,11 +556,7 @@ declare class SchemaRegistry {
|
|
|
594
556
|
bottomNavItems?: string[] | undefined;
|
|
595
557
|
} | undefined;
|
|
596
558
|
aria?: {
|
|
597
|
-
ariaLabel?: string |
|
|
598
|
-
key: string;
|
|
599
|
-
defaultValue?: string | undefined;
|
|
600
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
601
|
-
} | undefined;
|
|
559
|
+
ariaLabel?: string | undefined;
|
|
602
560
|
ariaDescribedBy?: string | undefined;
|
|
603
561
|
role?: string | undefined;
|
|
604
562
|
} | undefined;
|
|
@@ -1306,7 +1264,8 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1306
1264
|
};
|
|
1307
1265
|
services: Record<string, {
|
|
1308
1266
|
enabled: boolean;
|
|
1309
|
-
status: "degraded" | "stub" | "available" | "unavailable";
|
|
1267
|
+
status: "degraded" | "stub" | "available" | "registered" | "unavailable";
|
|
1268
|
+
handlerReady?: boolean | undefined;
|
|
1310
1269
|
route?: string | undefined;
|
|
1311
1270
|
provider?: string | undefined;
|
|
1312
1271
|
version?: string | undefined;
|
|
@@ -1328,6 +1287,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1328
1287
|
}>;
|
|
1329
1288
|
getMetaItems(request: {
|
|
1330
1289
|
type: string;
|
|
1290
|
+
packageId?: string;
|
|
1331
1291
|
}): Promise<{
|
|
1332
1292
|
type: string;
|
|
1333
1293
|
items: unknown[];
|
|
@@ -1335,6 +1295,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1335
1295
|
getMetaItem(request: {
|
|
1336
1296
|
type: string;
|
|
1337
1297
|
name: string;
|
|
1298
|
+
packageId?: string;
|
|
1338
1299
|
}): Promise<{
|
|
1339
1300
|
type: string;
|
|
1340
1301
|
name: string;
|
|
@@ -1384,7 +1345,6 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1384
1345
|
query?: any;
|
|
1385
1346
|
}): Promise<{
|
|
1386
1347
|
object: string;
|
|
1387
|
-
value: any[];
|
|
1388
1348
|
records: any[];
|
|
1389
1349
|
total: number;
|
|
1390
1350
|
hasMore: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -130,15 +130,13 @@ declare class SchemaRegistry {
|
|
|
130
130
|
private static objectContributors;
|
|
131
131
|
/** FQN → Merged ServiceObject (cached, invalidated on changes) */
|
|
132
132
|
private static mergedObjectCache;
|
|
133
|
-
/** Namespace → PackageId (
|
|
133
|
+
/** Namespace → Set<PackageId> (multiple packages can share a namespace) */
|
|
134
134
|
private static namespaceRegistry;
|
|
135
135
|
/** Type → Name/ID → MetadataItem */
|
|
136
136
|
private static metadata;
|
|
137
137
|
/**
|
|
138
138
|
* Register a namespace for a package.
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* @throws Error if namespace is already registered to a different package
|
|
139
|
+
* Multiple packages can share the same namespace (e.g. 'sys').
|
|
142
140
|
*/
|
|
143
141
|
static registerNamespace(namespace: string, packageId: string): void;
|
|
144
142
|
/**
|
|
@@ -146,9 +144,13 @@ declare class SchemaRegistry {
|
|
|
146
144
|
*/
|
|
147
145
|
static unregisterNamespace(namespace: string, packageId: string): void;
|
|
148
146
|
/**
|
|
149
|
-
* Get the
|
|
147
|
+
* Get the packages that use a namespace.
|
|
150
148
|
*/
|
|
151
149
|
static getNamespaceOwner(namespace: string): string | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Get all packages that share a namespace.
|
|
152
|
+
*/
|
|
153
|
+
static getNamespaceOwners(namespace: string): string[];
|
|
152
154
|
/**
|
|
153
155
|
* Register an object with ownership semantics.
|
|
154
156
|
*
|
|
@@ -471,11 +473,7 @@ declare class SchemaRegistry {
|
|
|
471
473
|
keyPrefix?: string | undefined;
|
|
472
474
|
actions?: {
|
|
473
475
|
name: string;
|
|
474
|
-
label: string
|
|
475
|
-
key: string;
|
|
476
|
-
defaultValue?: string | undefined;
|
|
477
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
478
|
-
};
|
|
476
|
+
label: string;
|
|
479
477
|
type: "url" | "script" | "modal" | "flow" | "api";
|
|
480
478
|
refreshAfter: boolean;
|
|
481
479
|
objectName?: string | undefined;
|
|
@@ -486,63 +484,35 @@ declare class SchemaRegistry {
|
|
|
486
484
|
execute?: string | undefined;
|
|
487
485
|
params?: {
|
|
488
486
|
name: string;
|
|
489
|
-
label: string
|
|
490
|
-
key: string;
|
|
491
|
-
defaultValue?: string | undefined;
|
|
492
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
493
|
-
};
|
|
487
|
+
label: string;
|
|
494
488
|
type: "number" | "boolean" | "date" | "lookup" | "file" | "url" | "json" | "text" | "textarea" | "email" | "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" | "tags" | "vector";
|
|
495
489
|
required: boolean;
|
|
496
490
|
options?: {
|
|
497
|
-
label: string
|
|
498
|
-
key: string;
|
|
499
|
-
defaultValue?: string | undefined;
|
|
500
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
501
|
-
};
|
|
491
|
+
label: string;
|
|
502
492
|
value: string;
|
|
503
493
|
}[] | undefined;
|
|
504
494
|
}[] | undefined;
|
|
505
495
|
variant?: "link" | "primary" | "secondary" | "danger" | "ghost" | undefined;
|
|
506
|
-
confirmText?: string |
|
|
507
|
-
|
|
508
|
-
defaultValue?: string | undefined;
|
|
509
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
510
|
-
} | undefined;
|
|
511
|
-
successMessage?: string | {
|
|
512
|
-
key: string;
|
|
513
|
-
defaultValue?: string | undefined;
|
|
514
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
515
|
-
} | undefined;
|
|
496
|
+
confirmText?: string | undefined;
|
|
497
|
+
successMessage?: string | undefined;
|
|
516
498
|
visible?: string | undefined;
|
|
517
499
|
disabled?: string | boolean | undefined;
|
|
518
500
|
shortcut?: string | undefined;
|
|
519
501
|
bulkEnabled?: boolean | undefined;
|
|
520
502
|
timeout?: number | undefined;
|
|
521
503
|
aria?: {
|
|
522
|
-
ariaLabel?: string |
|
|
523
|
-
key: string;
|
|
524
|
-
defaultValue?: string | undefined;
|
|
525
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
526
|
-
} | undefined;
|
|
504
|
+
ariaLabel?: string | undefined;
|
|
527
505
|
ariaDescribedBy?: string | undefined;
|
|
528
506
|
role?: string | undefined;
|
|
529
507
|
} | undefined;
|
|
530
508
|
}[] | undefined;
|
|
531
509
|
} | {
|
|
532
510
|
name: string;
|
|
533
|
-
label: string
|
|
534
|
-
key: string;
|
|
535
|
-
defaultValue?: string | undefined;
|
|
536
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
537
|
-
};
|
|
511
|
+
label: string;
|
|
538
512
|
active: boolean;
|
|
539
513
|
isDefault: boolean;
|
|
540
514
|
version?: string | undefined;
|
|
541
|
-
description?: string |
|
|
542
|
-
key: string;
|
|
543
|
-
defaultValue?: string | undefined;
|
|
544
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
545
|
-
} | undefined;
|
|
515
|
+
description?: string | undefined;
|
|
546
516
|
icon?: string | undefined;
|
|
547
517
|
branding?: {
|
|
548
518
|
primaryColor?: string | undefined;
|
|
@@ -552,19 +522,11 @@ declare class SchemaRegistry {
|
|
|
552
522
|
navigation?: any[] | undefined;
|
|
553
523
|
areas?: {
|
|
554
524
|
id: string;
|
|
555
|
-
label: string
|
|
556
|
-
key: string;
|
|
557
|
-
defaultValue?: string | undefined;
|
|
558
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
559
|
-
};
|
|
525
|
+
label: string;
|
|
560
526
|
navigation: any[];
|
|
561
527
|
icon?: string | undefined;
|
|
562
528
|
order?: number | undefined;
|
|
563
|
-
description?: string |
|
|
564
|
-
key: string;
|
|
565
|
-
defaultValue?: string | undefined;
|
|
566
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
567
|
-
} | undefined;
|
|
529
|
+
description?: string | undefined;
|
|
568
530
|
visible?: string | undefined;
|
|
569
531
|
requiredPermissions?: string[] | undefined;
|
|
570
532
|
}[] | undefined;
|
|
@@ -594,11 +556,7 @@ declare class SchemaRegistry {
|
|
|
594
556
|
bottomNavItems?: string[] | undefined;
|
|
595
557
|
} | undefined;
|
|
596
558
|
aria?: {
|
|
597
|
-
ariaLabel?: string |
|
|
598
|
-
key: string;
|
|
599
|
-
defaultValue?: string | undefined;
|
|
600
|
-
params?: Record<string, string | number | boolean> | undefined;
|
|
601
|
-
} | undefined;
|
|
559
|
+
ariaLabel?: string | undefined;
|
|
602
560
|
ariaDescribedBy?: string | undefined;
|
|
603
561
|
role?: string | undefined;
|
|
604
562
|
} | undefined;
|
|
@@ -1306,7 +1264,8 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1306
1264
|
};
|
|
1307
1265
|
services: Record<string, {
|
|
1308
1266
|
enabled: boolean;
|
|
1309
|
-
status: "degraded" | "stub" | "available" | "unavailable";
|
|
1267
|
+
status: "degraded" | "stub" | "available" | "registered" | "unavailable";
|
|
1268
|
+
handlerReady?: boolean | undefined;
|
|
1310
1269
|
route?: string | undefined;
|
|
1311
1270
|
provider?: string | undefined;
|
|
1312
1271
|
version?: string | undefined;
|
|
@@ -1328,6 +1287,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1328
1287
|
}>;
|
|
1329
1288
|
getMetaItems(request: {
|
|
1330
1289
|
type: string;
|
|
1290
|
+
packageId?: string;
|
|
1331
1291
|
}): Promise<{
|
|
1332
1292
|
type: string;
|
|
1333
1293
|
items: unknown[];
|
|
@@ -1335,6 +1295,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1335
1295
|
getMetaItem(request: {
|
|
1336
1296
|
type: string;
|
|
1337
1297
|
name: string;
|
|
1298
|
+
packageId?: string;
|
|
1338
1299
|
}): Promise<{
|
|
1339
1300
|
type: string;
|
|
1340
1301
|
name: string;
|
|
@@ -1384,7 +1345,6 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1384
1345
|
query?: any;
|
|
1385
1346
|
}): Promise<{
|
|
1386
1347
|
object: string;
|
|
1387
|
-
value: any[];
|
|
1388
1348
|
records: any[];
|
|
1389
1349
|
total: number;
|
|
1390
1350
|
hasMore: boolean;
|
package/dist/index.js
CHANGED
|
@@ -93,36 +93,45 @@ var SchemaRegistry = class {
|
|
|
93
93
|
// ==========================================
|
|
94
94
|
/**
|
|
95
95
|
* Register a namespace for a package.
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @throws Error if namespace is already registered to a different package
|
|
96
|
+
* Multiple packages can share the same namespace (e.g. 'sys').
|
|
99
97
|
*/
|
|
100
98
|
static registerNamespace(namespace, packageId) {
|
|
101
99
|
if (!namespace) return;
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
);
|
|
100
|
+
let owners = this.namespaceRegistry.get(namespace);
|
|
101
|
+
if (!owners) {
|
|
102
|
+
owners = /* @__PURE__ */ new Set();
|
|
103
|
+
this.namespaceRegistry.set(namespace, owners);
|
|
107
104
|
}
|
|
108
|
-
|
|
105
|
+
owners.add(packageId);
|
|
109
106
|
this.log(`[Registry] Registered namespace: ${namespace} \u2192 ${packageId}`);
|
|
110
107
|
}
|
|
111
108
|
/**
|
|
112
109
|
* Unregister a namespace when a package is uninstalled.
|
|
113
110
|
*/
|
|
114
111
|
static unregisterNamespace(namespace, packageId) {
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
const owners = this.namespaceRegistry.get(namespace);
|
|
113
|
+
if (owners) {
|
|
114
|
+
owners.delete(packageId);
|
|
115
|
+
if (owners.size === 0) {
|
|
116
|
+
this.namespaceRegistry.delete(namespace);
|
|
117
|
+
}
|
|
118
|
+
this.log(`[Registry] Unregistered namespace: ${namespace} \u2190 ${packageId}`);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
|
-
* Get the
|
|
122
|
+
* Get the packages that use a namespace.
|
|
123
123
|
*/
|
|
124
124
|
static getNamespaceOwner(namespace) {
|
|
125
|
-
|
|
125
|
+
const owners = this.namespaceRegistry.get(namespace);
|
|
126
|
+
if (!owners || owners.size === 0) return void 0;
|
|
127
|
+
return owners.values().next().value;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get all packages that share a namespace.
|
|
131
|
+
*/
|
|
132
|
+
static getNamespaceOwners(namespace) {
|
|
133
|
+
const owners = this.namespaceRegistry.get(namespace);
|
|
134
|
+
return owners ? Array.from(owners) : [];
|
|
126
135
|
}
|
|
127
136
|
// ==========================================
|
|
128
137
|
// Object Registration (Ownership Model)
|
|
@@ -534,7 +543,7 @@ SchemaRegistry._logLevel = "info";
|
|
|
534
543
|
SchemaRegistry.objectContributors = /* @__PURE__ */ new Map();
|
|
535
544
|
/** FQN → Merged ServiceObject (cached, invalidated on changes) */
|
|
536
545
|
SchemaRegistry.mergedObjectCache = /* @__PURE__ */ new Map();
|
|
537
|
-
/** Namespace → PackageId (
|
|
546
|
+
/** Namespace → Set<PackageId> (multiple packages can share a namespace) */
|
|
538
547
|
SchemaRegistry.namespaceRegistry = /* @__PURE__ */ new Map();
|
|
539
548
|
// ==========================================
|
|
540
549
|
// Generic metadata storage (non-object types)
|
|
@@ -676,15 +685,18 @@ var ObjectStackProtocolImplementation = class {
|
|
|
676
685
|
};
|
|
677
686
|
}
|
|
678
687
|
async getMetaItems(request) {
|
|
679
|
-
|
|
688
|
+
const { packageId } = request;
|
|
689
|
+
let items = SchemaRegistry.listItems(request.type, packageId);
|
|
680
690
|
if (items.length === 0) {
|
|
681
691
|
const alt = request.type.endsWith("s") ? request.type.slice(0, -1) : request.type + "s";
|
|
682
|
-
items = SchemaRegistry.listItems(alt);
|
|
692
|
+
items = SchemaRegistry.listItems(alt, packageId);
|
|
683
693
|
}
|
|
684
694
|
if (items.length === 0) {
|
|
685
695
|
try {
|
|
696
|
+
const whereClause = { type: request.type, state: "active" };
|
|
697
|
+
if (packageId) whereClause._packageId = packageId;
|
|
686
698
|
const allRecords = await this.engine.find("sys_metadata", {
|
|
687
|
-
where:
|
|
699
|
+
where: whereClause
|
|
688
700
|
});
|
|
689
701
|
if (allRecords && allRecords.length > 0) {
|
|
690
702
|
items = allRecords.map((record) => {
|
|
@@ -912,10 +924,7 @@ var ObjectStackProtocolImplementation = class {
|
|
|
912
924
|
const records = await this.engine.find(request.object, options);
|
|
913
925
|
return {
|
|
914
926
|
object: request.object,
|
|
915
|
-
value: records,
|
|
916
|
-
// OData compatibility
|
|
917
927
|
records,
|
|
918
|
-
// Legacy
|
|
919
928
|
total: records.length,
|
|
920
929
|
hasMore: false
|
|
921
930
|
};
|
|
@@ -2720,38 +2729,18 @@ var ObjectQLPlugin = class {
|
|
|
2720
2729
|
this.ql = new ObjectQL(hostCtx);
|
|
2721
2730
|
}
|
|
2722
2731
|
ctx.registerService("objectql", this.ql);
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
} catch (e) {
|
|
2731
|
-
}
|
|
2732
|
-
if (!hasMetadata) {
|
|
2733
|
-
try {
|
|
2734
|
-
const metadataFacade = new MetadataFacade();
|
|
2735
|
-
ctx.registerService("metadata", metadataFacade);
|
|
2736
|
-
ctx.logger.info("MetadataFacade registered as metadata service", {
|
|
2737
|
-
mode: "in-memory",
|
|
2738
|
-
features: ["registry", "fast-lookup"]
|
|
2732
|
+
ctx.registerService("data", this.ql);
|
|
2733
|
+
const ql = this.ql;
|
|
2734
|
+
ctx.registerService("manifest", {
|
|
2735
|
+
register: (manifest) => {
|
|
2736
|
+
ql.registerApp(manifest);
|
|
2737
|
+
ctx.logger.debug("Manifest registered via manifest service", {
|
|
2738
|
+
id: manifest.id || manifest.name
|
|
2739
2739
|
});
|
|
2740
|
-
} catch (e) {
|
|
2741
|
-
if (!e.message?.includes("already registered")) {
|
|
2742
|
-
throw e;
|
|
2743
|
-
}
|
|
2744
2740
|
}
|
|
2745
|
-
}
|
|
2746
|
-
ctx.logger.info("External metadata service detected", {
|
|
2747
|
-
provider: metadataProvider,
|
|
2748
|
-
mode: "will-sync-in-start-phase"
|
|
2749
|
-
});
|
|
2750
|
-
}
|
|
2751
|
-
ctx.registerService("data", this.ql);
|
|
2741
|
+
});
|
|
2752
2742
|
ctx.logger.info("ObjectQL engine registered", {
|
|
2753
|
-
services: ["objectql", "data"]
|
|
2754
|
-
metadataProvider
|
|
2743
|
+
services: ["objectql", "data", "manifest"]
|
|
2755
2744
|
});
|
|
2756
2745
|
const protocolShim = new ObjectStackProtocolImplementation(
|
|
2757
2746
|
this.ql,
|
|
@@ -2764,7 +2753,7 @@ var ObjectQLPlugin = class {
|
|
|
2764
2753
|
ctx.logger.info("ObjectQL engine starting...");
|
|
2765
2754
|
try {
|
|
2766
2755
|
const metadataService = ctx.getService("metadata");
|
|
2767
|
-
if (metadataService &&
|
|
2756
|
+
if (metadataService && typeof metadataService.loadMany === "function" && this.ql) {
|
|
2768
2757
|
await this.loadMetadataFromService(metadataService, ctx);
|
|
2769
2758
|
}
|
|
2770
2759
|
} catch (e) {
|
|
@@ -2778,8 +2767,11 @@ var ObjectQLPlugin = class {
|
|
|
2778
2767
|
ctx.logger.debug("Discovered and registered driver service", { serviceName: name });
|
|
2779
2768
|
}
|
|
2780
2769
|
if (name.startsWith("app.")) {
|
|
2770
|
+
ctx.logger.warn(
|
|
2771
|
+
`[DEPRECATED] Service "${name}" uses legacy app.* convention. Migrate to ctx.getService('manifest').register(data).`
|
|
2772
|
+
);
|
|
2781
2773
|
this.ql.registerApp(service);
|
|
2782
|
-
ctx.logger.debug("Discovered and registered app service", { serviceName: name });
|
|
2774
|
+
ctx.logger.debug("Discovered and registered app service (legacy)", { serviceName: name });
|
|
2783
2775
|
}
|
|
2784
2776
|
}
|
|
2785
2777
|
}
|