@objectstack/objectql 2.0.3 → 2.0.4
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 +10 -0
- package/dist/index.d.mts +26 -93
- package/dist/index.d.ts +26 -93
- package/dist/index.js +151 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +151 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/plugin.integration.test.ts +241 -0
- package/src/plugin.ts +87 -5
- package/src/protocol-discovery.test.ts +137 -0
- package/src/protocol.ts +107 -41
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/objectql@2.0.
|
|
2
|
+
> @objectstack/objectql@2.0.4 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
|
+
[32mCJS[39m [1mdist/index.js [22m[32m62.77 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m126.84 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 81ms
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m61.35 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m126.13 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 94ms
|
|
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 12002ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m66.66 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m66.66 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @objectstack/objectql
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Patch release for maintenance and stability improvements
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @objectstack/spec@2.0.4
|
|
10
|
+
- @objectstack/core@2.0.4
|
|
11
|
+
- @objectstack/types@2.0.4
|
|
12
|
+
|
|
3
13
|
## 2.0.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1121,7 +1121,8 @@ declare class SchemaRegistry {
|
|
|
1121
1121
|
|
|
1122
1122
|
declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
1123
1123
|
private engine;
|
|
1124
|
-
|
|
1124
|
+
private getServicesRegistry?;
|
|
1125
|
+
constructor(engine: IDataEngine, getServicesRegistry?: () => Map<string, any>);
|
|
1125
1126
|
getDiscovery(): Promise<{
|
|
1126
1127
|
version: string;
|
|
1127
1128
|
apiName: string;
|
|
@@ -1139,99 +1140,26 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1139
1140
|
endpoints: {
|
|
1140
1141
|
data: string;
|
|
1141
1142
|
metadata: string;
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
status: "available";
|
|
1155
|
-
route: string;
|
|
1156
|
-
provider: string;
|
|
1157
|
-
};
|
|
1158
|
-
analytics: {
|
|
1159
|
-
enabled: boolean;
|
|
1160
|
-
status: "available";
|
|
1161
|
-
route: string;
|
|
1162
|
-
provider: string;
|
|
1163
|
-
};
|
|
1164
|
-
auth: {
|
|
1165
|
-
enabled: boolean;
|
|
1166
|
-
status: "unavailable";
|
|
1167
|
-
message: string;
|
|
1168
|
-
};
|
|
1169
|
-
automation: {
|
|
1170
|
-
enabled: boolean;
|
|
1171
|
-
status: "unavailable";
|
|
1172
|
-
message: string;
|
|
1173
|
-
};
|
|
1174
|
-
cache: {
|
|
1175
|
-
enabled: boolean;
|
|
1176
|
-
status: "unavailable";
|
|
1177
|
-
message: string;
|
|
1178
|
-
};
|
|
1179
|
-
queue: {
|
|
1180
|
-
enabled: boolean;
|
|
1181
|
-
status: "unavailable";
|
|
1182
|
-
message: string;
|
|
1183
|
-
};
|
|
1184
|
-
job: {
|
|
1185
|
-
enabled: boolean;
|
|
1186
|
-
status: "unavailable";
|
|
1187
|
-
message: string;
|
|
1188
|
-
};
|
|
1189
|
-
ui: {
|
|
1190
|
-
enabled: boolean;
|
|
1191
|
-
status: "unavailable";
|
|
1192
|
-
message: string;
|
|
1193
|
-
};
|
|
1194
|
-
workflow: {
|
|
1195
|
-
enabled: boolean;
|
|
1196
|
-
status: "unavailable";
|
|
1197
|
-
message: string;
|
|
1198
|
-
};
|
|
1199
|
-
realtime: {
|
|
1200
|
-
enabled: boolean;
|
|
1201
|
-
status: "unavailable";
|
|
1202
|
-
message: string;
|
|
1203
|
-
};
|
|
1204
|
-
notification: {
|
|
1205
|
-
enabled: boolean;
|
|
1206
|
-
status: "unavailable";
|
|
1207
|
-
message: string;
|
|
1208
|
-
};
|
|
1209
|
-
ai: {
|
|
1210
|
-
enabled: boolean;
|
|
1211
|
-
status: "unavailable";
|
|
1212
|
-
message: string;
|
|
1213
|
-
};
|
|
1214
|
-
i18n: {
|
|
1215
|
-
enabled: boolean;
|
|
1216
|
-
status: "unavailable";
|
|
1217
|
-
message: string;
|
|
1218
|
-
};
|
|
1219
|
-
graphql: {
|
|
1220
|
-
enabled: boolean;
|
|
1221
|
-
status: "unavailable";
|
|
1222
|
-
message: string;
|
|
1223
|
-
};
|
|
1224
|
-
'file-storage': {
|
|
1225
|
-
enabled: boolean;
|
|
1226
|
-
status: "unavailable";
|
|
1227
|
-
message: string;
|
|
1228
|
-
};
|
|
1229
|
-
search: {
|
|
1230
|
-
enabled: boolean;
|
|
1231
|
-
status: "unavailable";
|
|
1232
|
-
message: string;
|
|
1233
|
-
};
|
|
1143
|
+
ui?: string | undefined;
|
|
1144
|
+
auth?: string | undefined;
|
|
1145
|
+
automation?: string | undefined;
|
|
1146
|
+
storage?: string | undefined;
|
|
1147
|
+
analytics?: string | undefined;
|
|
1148
|
+
graphql?: string | undefined;
|
|
1149
|
+
packages?: string | undefined;
|
|
1150
|
+
workflow?: string | undefined;
|
|
1151
|
+
realtime?: string | undefined;
|
|
1152
|
+
notifications?: string | undefined;
|
|
1153
|
+
ai?: string | undefined;
|
|
1154
|
+
i18n?: string | undefined;
|
|
1234
1155
|
};
|
|
1156
|
+
services: Record<string, {
|
|
1157
|
+
enabled: boolean;
|
|
1158
|
+
status: "degraded" | "available" | "unavailable" | "stub";
|
|
1159
|
+
route?: string | undefined;
|
|
1160
|
+
provider?: string | undefined;
|
|
1161
|
+
message?: string | undefined;
|
|
1162
|
+
}>;
|
|
1235
1163
|
}>;
|
|
1236
1164
|
getMetaTypes(): Promise<{
|
|
1237
1165
|
types: string[];
|
|
@@ -1736,6 +1664,11 @@ declare class ObjectQLPlugin implements Plugin {
|
|
|
1736
1664
|
constructor(ql?: ObjectQL, hostContext?: Record<string, any>);
|
|
1737
1665
|
init: (ctx: PluginContext) => Promise<void>;
|
|
1738
1666
|
start: (ctx: PluginContext) => Promise<void>;
|
|
1667
|
+
/**
|
|
1668
|
+
* Load metadata from external metadata service into ObjectQL registry
|
|
1669
|
+
* This enables ObjectQL to use file-based or remote metadata
|
|
1670
|
+
*/
|
|
1671
|
+
private loadMetadataFromService;
|
|
1739
1672
|
}
|
|
1740
1673
|
|
|
1741
1674
|
export { DEFAULT_EXTENDER_PRIORITY, DEFAULT_OWNER_PRIORITY, type HookHandler, type ObjectContributor, ObjectQL, type ObjectQLHostContext, ObjectQLPlugin, ObjectStackProtocolImplementation, RESERVED_NAMESPACES, SchemaRegistry, computeFQN, parseFQN };
|
package/dist/index.d.ts
CHANGED
|
@@ -1121,7 +1121,8 @@ declare class SchemaRegistry {
|
|
|
1121
1121
|
|
|
1122
1122
|
declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
1123
1123
|
private engine;
|
|
1124
|
-
|
|
1124
|
+
private getServicesRegistry?;
|
|
1125
|
+
constructor(engine: IDataEngine, getServicesRegistry?: () => Map<string, any>);
|
|
1125
1126
|
getDiscovery(): Promise<{
|
|
1126
1127
|
version: string;
|
|
1127
1128
|
apiName: string;
|
|
@@ -1139,99 +1140,26 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
1139
1140
|
endpoints: {
|
|
1140
1141
|
data: string;
|
|
1141
1142
|
metadata: string;
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
status: "available";
|
|
1155
|
-
route: string;
|
|
1156
|
-
provider: string;
|
|
1157
|
-
};
|
|
1158
|
-
analytics: {
|
|
1159
|
-
enabled: boolean;
|
|
1160
|
-
status: "available";
|
|
1161
|
-
route: string;
|
|
1162
|
-
provider: string;
|
|
1163
|
-
};
|
|
1164
|
-
auth: {
|
|
1165
|
-
enabled: boolean;
|
|
1166
|
-
status: "unavailable";
|
|
1167
|
-
message: string;
|
|
1168
|
-
};
|
|
1169
|
-
automation: {
|
|
1170
|
-
enabled: boolean;
|
|
1171
|
-
status: "unavailable";
|
|
1172
|
-
message: string;
|
|
1173
|
-
};
|
|
1174
|
-
cache: {
|
|
1175
|
-
enabled: boolean;
|
|
1176
|
-
status: "unavailable";
|
|
1177
|
-
message: string;
|
|
1178
|
-
};
|
|
1179
|
-
queue: {
|
|
1180
|
-
enabled: boolean;
|
|
1181
|
-
status: "unavailable";
|
|
1182
|
-
message: string;
|
|
1183
|
-
};
|
|
1184
|
-
job: {
|
|
1185
|
-
enabled: boolean;
|
|
1186
|
-
status: "unavailable";
|
|
1187
|
-
message: string;
|
|
1188
|
-
};
|
|
1189
|
-
ui: {
|
|
1190
|
-
enabled: boolean;
|
|
1191
|
-
status: "unavailable";
|
|
1192
|
-
message: string;
|
|
1193
|
-
};
|
|
1194
|
-
workflow: {
|
|
1195
|
-
enabled: boolean;
|
|
1196
|
-
status: "unavailable";
|
|
1197
|
-
message: string;
|
|
1198
|
-
};
|
|
1199
|
-
realtime: {
|
|
1200
|
-
enabled: boolean;
|
|
1201
|
-
status: "unavailable";
|
|
1202
|
-
message: string;
|
|
1203
|
-
};
|
|
1204
|
-
notification: {
|
|
1205
|
-
enabled: boolean;
|
|
1206
|
-
status: "unavailable";
|
|
1207
|
-
message: string;
|
|
1208
|
-
};
|
|
1209
|
-
ai: {
|
|
1210
|
-
enabled: boolean;
|
|
1211
|
-
status: "unavailable";
|
|
1212
|
-
message: string;
|
|
1213
|
-
};
|
|
1214
|
-
i18n: {
|
|
1215
|
-
enabled: boolean;
|
|
1216
|
-
status: "unavailable";
|
|
1217
|
-
message: string;
|
|
1218
|
-
};
|
|
1219
|
-
graphql: {
|
|
1220
|
-
enabled: boolean;
|
|
1221
|
-
status: "unavailable";
|
|
1222
|
-
message: string;
|
|
1223
|
-
};
|
|
1224
|
-
'file-storage': {
|
|
1225
|
-
enabled: boolean;
|
|
1226
|
-
status: "unavailable";
|
|
1227
|
-
message: string;
|
|
1228
|
-
};
|
|
1229
|
-
search: {
|
|
1230
|
-
enabled: boolean;
|
|
1231
|
-
status: "unavailable";
|
|
1232
|
-
message: string;
|
|
1233
|
-
};
|
|
1143
|
+
ui?: string | undefined;
|
|
1144
|
+
auth?: string | undefined;
|
|
1145
|
+
automation?: string | undefined;
|
|
1146
|
+
storage?: string | undefined;
|
|
1147
|
+
analytics?: string | undefined;
|
|
1148
|
+
graphql?: string | undefined;
|
|
1149
|
+
packages?: string | undefined;
|
|
1150
|
+
workflow?: string | undefined;
|
|
1151
|
+
realtime?: string | undefined;
|
|
1152
|
+
notifications?: string | undefined;
|
|
1153
|
+
ai?: string | undefined;
|
|
1154
|
+
i18n?: string | undefined;
|
|
1234
1155
|
};
|
|
1156
|
+
services: Record<string, {
|
|
1157
|
+
enabled: boolean;
|
|
1158
|
+
status: "degraded" | "available" | "unavailable" | "stub";
|
|
1159
|
+
route?: string | undefined;
|
|
1160
|
+
provider?: string | undefined;
|
|
1161
|
+
message?: string | undefined;
|
|
1162
|
+
}>;
|
|
1235
1163
|
}>;
|
|
1236
1164
|
getMetaTypes(): Promise<{
|
|
1237
1165
|
types: string[];
|
|
@@ -1736,6 +1664,11 @@ declare class ObjectQLPlugin implements Plugin {
|
|
|
1736
1664
|
constructor(ql?: ObjectQL, hostContext?: Record<string, any>);
|
|
1737
1665
|
init: (ctx: PluginContext) => Promise<void>;
|
|
1738
1666
|
start: (ctx: PluginContext) => Promise<void>;
|
|
1667
|
+
/**
|
|
1668
|
+
* Load metadata from external metadata service into ObjectQL registry
|
|
1669
|
+
* This enables ObjectQL to use file-based or remote metadata
|
|
1670
|
+
*/
|
|
1671
|
+
private loadMetadataFromService;
|
|
1739
1672
|
}
|
|
1740
1673
|
|
|
1741
1674
|
export { DEFAULT_EXTENDER_PRIORITY, DEFAULT_OWNER_PRIORITY, type HookHandler, type ObjectContributor, ObjectQL, type ObjectQLHostContext, ObjectQLPlugin, ObjectStackProtocolImplementation, RESERVED_NAMESPACES, SchemaRegistry, computeFQN, parseFQN };
|
package/dist/index.js
CHANGED
|
@@ -534,53 +534,97 @@ function simpleHash(str) {
|
|
|
534
534
|
}
|
|
535
535
|
return Math.abs(hash).toString(16);
|
|
536
536
|
}
|
|
537
|
+
var SERVICE_CONFIG = {
|
|
538
|
+
auth: { route: "/api/v1/auth", plugin: "plugin-auth" },
|
|
539
|
+
automation: { route: "/api/v1/automation", plugin: "plugin-automation", capability: "workflow" },
|
|
540
|
+
cache: { route: "/api/v1/cache", plugin: "plugin-redis" },
|
|
541
|
+
queue: { route: "/api/v1/queue", plugin: "plugin-bullmq" },
|
|
542
|
+
job: { route: "/api/v1/jobs", plugin: "job-scheduler" },
|
|
543
|
+
ui: { route: "/api/v1/ui", plugin: "ui-plugin" },
|
|
544
|
+
workflow: { route: "/api/v1/workflow", plugin: "plugin-workflow", capability: "workflow" },
|
|
545
|
+
realtime: { route: "/api/v1/realtime", plugin: "plugin-realtime", capability: "websockets" },
|
|
546
|
+
notification: { route: "/api/v1/notifications", plugin: "plugin-notifications", capability: "notifications" },
|
|
547
|
+
ai: { route: "/api/v1/ai", plugin: "plugin-ai", capability: "ai" },
|
|
548
|
+
i18n: { route: "/api/v1/i18n", plugin: "plugin-i18n", capability: "i18n" },
|
|
549
|
+
graphql: { route: "/graphql", plugin: "plugin-graphql", capability: "graphql" },
|
|
550
|
+
"file-storage": { route: "/api/v1/storage", plugin: "plugin-storage", capability: "files" },
|
|
551
|
+
search: { route: "/api/v1/search", plugin: "plugin-search", capability: "search" }
|
|
552
|
+
};
|
|
537
553
|
var ObjectStackProtocolImplementation = class {
|
|
538
|
-
constructor(engine) {
|
|
554
|
+
constructor(engine, getServicesRegistry) {
|
|
539
555
|
this.engine = engine;
|
|
556
|
+
this.getServicesRegistry = getServicesRegistry;
|
|
540
557
|
}
|
|
541
558
|
async getDiscovery() {
|
|
559
|
+
const registeredServices = this.getServicesRegistry ? this.getServicesRegistry() : /* @__PURE__ */ new Map();
|
|
560
|
+
const services = {
|
|
561
|
+
// --- Kernel-provided (objectql is an example kernel implementation) ---
|
|
562
|
+
metadata: { enabled: true, status: "degraded", route: "/api/meta", provider: "objectql", message: "In-memory registry only; DB persistence not yet implemented" },
|
|
563
|
+
data: { enabled: true, status: "available", route: "/api/data", provider: "objectql" },
|
|
564
|
+
analytics: { enabled: true, status: "available", route: "/api/analytics", provider: "objectql" }
|
|
565
|
+
};
|
|
566
|
+
for (const [serviceName, config] of Object.entries(SERVICE_CONFIG)) {
|
|
567
|
+
if (registeredServices.has(serviceName)) {
|
|
568
|
+
services[serviceName] = {
|
|
569
|
+
enabled: true,
|
|
570
|
+
status: "available",
|
|
571
|
+
route: config.route,
|
|
572
|
+
provider: config.plugin
|
|
573
|
+
};
|
|
574
|
+
} else {
|
|
575
|
+
services[serviceName] = {
|
|
576
|
+
enabled: false,
|
|
577
|
+
status: "unavailable",
|
|
578
|
+
message: `Install ${config.plugin} to enable`
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
const capabilities = {
|
|
583
|
+
graphql: registeredServices.has("graphql"),
|
|
584
|
+
search: registeredServices.has("search"),
|
|
585
|
+
websockets: registeredServices.has("realtime"),
|
|
586
|
+
files: registeredServices.has("file-storage"),
|
|
587
|
+
analytics: true,
|
|
588
|
+
// Always available via objectql
|
|
589
|
+
ai: registeredServices.has("ai"),
|
|
590
|
+
workflow: registeredServices.has("workflow") || registeredServices.has("automation"),
|
|
591
|
+
notifications: registeredServices.has("notification"),
|
|
592
|
+
i18n: registeredServices.has("i18n")
|
|
593
|
+
};
|
|
594
|
+
const serviceToEndpointKey = {
|
|
595
|
+
auth: "auth",
|
|
596
|
+
automation: "automation",
|
|
597
|
+
ui: "ui",
|
|
598
|
+
workflow: "workflow",
|
|
599
|
+
realtime: "realtime",
|
|
600
|
+
notification: "notifications",
|
|
601
|
+
ai: "ai",
|
|
602
|
+
i18n: "i18n",
|
|
603
|
+
graphql: "graphql",
|
|
604
|
+
"file-storage": "storage"
|
|
605
|
+
};
|
|
606
|
+
const optionalEndpoints = {
|
|
607
|
+
analytics: "/api/analytics"
|
|
608
|
+
};
|
|
609
|
+
for (const [serviceName, config] of Object.entries(SERVICE_CONFIG)) {
|
|
610
|
+
if (registeredServices.has(serviceName)) {
|
|
611
|
+
const endpointKey = serviceToEndpointKey[serviceName];
|
|
612
|
+
if (endpointKey) {
|
|
613
|
+
optionalEndpoints[endpointKey] = config.route;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
const endpoints = {
|
|
618
|
+
data: "/api/data",
|
|
619
|
+
metadata: "/api/meta",
|
|
620
|
+
...optionalEndpoints
|
|
621
|
+
};
|
|
542
622
|
return {
|
|
543
623
|
version: "1.0",
|
|
544
624
|
apiName: "ObjectStack API",
|
|
545
|
-
capabilities
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
websockets: false,
|
|
549
|
-
files: false,
|
|
550
|
-
analytics: true,
|
|
551
|
-
ai: false,
|
|
552
|
-
workflow: false,
|
|
553
|
-
notifications: false,
|
|
554
|
-
i18n: false
|
|
555
|
-
},
|
|
556
|
-
endpoints: {
|
|
557
|
-
data: "/api/data",
|
|
558
|
-
metadata: "/api/meta",
|
|
559
|
-
analytics: "/api/analytics"
|
|
560
|
-
},
|
|
561
|
-
services: {
|
|
562
|
-
// --- Kernel-provided (objectql is an example kernel implementation) ---
|
|
563
|
-
metadata: { enabled: true, status: "degraded", route: "/api/meta", provider: "objectql", message: "In-memory registry only; DB persistence not yet implemented" },
|
|
564
|
-
data: { enabled: true, status: "available", route: "/api/data", provider: "objectql" },
|
|
565
|
-
analytics: { enabled: true, status: "available", route: "/api/analytics", provider: "objectql" },
|
|
566
|
-
// --- Plugin-provided (kernel does NOT handle these) ---
|
|
567
|
-
auth: { enabled: false, status: "unavailable", message: "Install an auth plugin (e.g. plugin-auth) to enable" },
|
|
568
|
-
automation: { enabled: false, status: "unavailable", message: "Install an automation plugin (e.g. plugin-automation) to enable" },
|
|
569
|
-
// --- Core infrastructure (plugin-provided) ---
|
|
570
|
-
cache: { enabled: false, status: "unavailable", message: "Install a cache plugin (e.g. plugin-redis) to enable" },
|
|
571
|
-
queue: { enabled: false, status: "unavailable", message: "Install a queue plugin (e.g. plugin-bullmq) to enable" },
|
|
572
|
-
job: { enabled: false, status: "unavailable", message: "Install a job scheduler plugin to enable" },
|
|
573
|
-
// --- Optional services (all plugin-provided) ---
|
|
574
|
-
ui: { enabled: false, status: "unavailable", message: "Install a UI plugin to enable" },
|
|
575
|
-
workflow: { enabled: false, status: "unavailable", message: "Install a workflow plugin to enable" },
|
|
576
|
-
realtime: { enabled: false, status: "unavailable", message: "Install a realtime plugin to enable" },
|
|
577
|
-
notification: { enabled: false, status: "unavailable", message: "Install a notification plugin to enable" },
|
|
578
|
-
ai: { enabled: false, status: "unavailable", message: "Install an AI plugin to enable" },
|
|
579
|
-
i18n: { enabled: false, status: "unavailable", message: "Install an i18n plugin to enable" },
|
|
580
|
-
graphql: { enabled: false, status: "unavailable", message: "Install a GraphQL plugin to enable" },
|
|
581
|
-
"file-storage": { enabled: false, status: "unavailable", message: "Install a file-storage plugin to enable" },
|
|
582
|
-
search: { enabled: false, status: "unavailable", message: "Install a search plugin to enable" }
|
|
583
|
-
}
|
|
625
|
+
capabilities,
|
|
626
|
+
endpoints,
|
|
627
|
+
services
|
|
584
628
|
};
|
|
585
629
|
}
|
|
586
630
|
async getMetaTypes() {
|
|
@@ -1687,32 +1731,54 @@ var ObjectQLPlugin = class {
|
|
|
1687
1731
|
}
|
|
1688
1732
|
ctx.registerService("objectql", this.ql);
|
|
1689
1733
|
let hasMetadata = false;
|
|
1734
|
+
let metadataProvider = "objectql";
|
|
1690
1735
|
try {
|
|
1691
1736
|
if (ctx.getService("metadata")) {
|
|
1692
1737
|
hasMetadata = true;
|
|
1738
|
+
metadataProvider = "external";
|
|
1693
1739
|
}
|
|
1694
1740
|
} catch (e) {
|
|
1695
1741
|
}
|
|
1696
1742
|
if (!hasMetadata) {
|
|
1697
1743
|
try {
|
|
1698
1744
|
ctx.registerService("metadata", this.ql);
|
|
1745
|
+
ctx.logger.info("ObjectQL providing metadata service (fallback mode)", {
|
|
1746
|
+
mode: "in-memory",
|
|
1747
|
+
features: ["registry", "fast-lookup"]
|
|
1748
|
+
});
|
|
1699
1749
|
} catch (e) {
|
|
1700
1750
|
if (!e.message?.includes("already registered")) {
|
|
1701
1751
|
throw e;
|
|
1702
1752
|
}
|
|
1703
1753
|
}
|
|
1754
|
+
} else {
|
|
1755
|
+
ctx.logger.info("External metadata service detected", {
|
|
1756
|
+
provider: metadataProvider,
|
|
1757
|
+
mode: "will-sync-in-start-phase"
|
|
1758
|
+
});
|
|
1704
1759
|
}
|
|
1705
1760
|
ctx.registerService("data", this.ql);
|
|
1706
|
-
ctx.
|
|
1707
|
-
|
|
1708
|
-
|
|
1761
|
+
ctx.logger.info("ObjectQL engine registered", {
|
|
1762
|
+
services: ["objectql", "data"],
|
|
1763
|
+
metadataProvider
|
|
1709
1764
|
});
|
|
1710
|
-
const protocolShim = new ObjectStackProtocolImplementation(
|
|
1765
|
+
const protocolShim = new ObjectStackProtocolImplementation(
|
|
1766
|
+
this.ql,
|
|
1767
|
+
() => ctx.getServices ? ctx.getServices() : /* @__PURE__ */ new Map()
|
|
1768
|
+
);
|
|
1711
1769
|
ctx.registerService("protocol", protocolShim);
|
|
1712
1770
|
ctx.logger.info("Protocol service registered");
|
|
1713
1771
|
};
|
|
1714
1772
|
this.start = async (ctx) => {
|
|
1715
|
-
ctx.logger.info("ObjectQL engine
|
|
1773
|
+
ctx.logger.info("ObjectQL engine starting...");
|
|
1774
|
+
try {
|
|
1775
|
+
const metadataService = ctx.getService("metadata");
|
|
1776
|
+
if (metadataService && metadataService !== this.ql && this.ql) {
|
|
1777
|
+
await this.loadMetadataFromService(metadataService, ctx);
|
|
1778
|
+
}
|
|
1779
|
+
} catch (e) {
|
|
1780
|
+
ctx.logger.debug("No external metadata service to sync from");
|
|
1781
|
+
}
|
|
1716
1782
|
if (ctx.getServices && this.ql) {
|
|
1717
1783
|
const services = ctx.getServices();
|
|
1718
1784
|
for (const [name, service] of services.entries()) {
|
|
@@ -1726,6 +1792,10 @@ var ObjectQLPlugin = class {
|
|
|
1726
1792
|
}
|
|
1727
1793
|
}
|
|
1728
1794
|
}
|
|
1795
|
+
ctx.logger.info("ObjectQL engine started", {
|
|
1796
|
+
driversRegistered: this.ql?.["drivers"]?.size || 0,
|
|
1797
|
+
objectsRegistered: this.ql?.registry?.getAllObjects?.()?.length || 0
|
|
1798
|
+
});
|
|
1729
1799
|
};
|
|
1730
1800
|
if (ql) {
|
|
1731
1801
|
this.ql = ql;
|
|
@@ -1733,6 +1803,42 @@ var ObjectQLPlugin = class {
|
|
|
1733
1803
|
this.hostContext = hostContext;
|
|
1734
1804
|
}
|
|
1735
1805
|
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Load metadata from external metadata service into ObjectQL registry
|
|
1808
|
+
* This enables ObjectQL to use file-based or remote metadata
|
|
1809
|
+
*/
|
|
1810
|
+
async loadMetadataFromService(metadataService, ctx) {
|
|
1811
|
+
ctx.logger.info("Syncing metadata from external service into ObjectQL registry...");
|
|
1812
|
+
const metadataTypes = ["object", "view", "app", "flow", "workflow", "function"];
|
|
1813
|
+
let totalLoaded = 0;
|
|
1814
|
+
for (const type of metadataTypes) {
|
|
1815
|
+
try {
|
|
1816
|
+
if (typeof metadataService.loadMany === "function") {
|
|
1817
|
+
const items = await metadataService.loadMany(type);
|
|
1818
|
+
if (items && items.length > 0) {
|
|
1819
|
+
items.forEach((item) => {
|
|
1820
|
+
const keyField = item.id ? "id" : "name";
|
|
1821
|
+
if (type === "object" && this.ql) {
|
|
1822
|
+
return;
|
|
1823
|
+
}
|
|
1824
|
+
if (this.ql?.registry?.registerItem) {
|
|
1825
|
+
this.ql.registry.registerItem(type, item, keyField);
|
|
1826
|
+
}
|
|
1827
|
+
});
|
|
1828
|
+
totalLoaded += items.length;
|
|
1829
|
+
ctx.logger.info(`Synced ${items.length} ${type}(s) from metadata service`);
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
} catch (e) {
|
|
1833
|
+
ctx.logger.debug(`No ${type} metadata found or error loading`, {
|
|
1834
|
+
error: e.message
|
|
1835
|
+
});
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
if (totalLoaded > 0) {
|
|
1839
|
+
ctx.logger.info(`Metadata sync complete: ${totalLoaded} items loaded into ObjectQL registry`);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1736
1842
|
};
|
|
1737
1843
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1738
1844
|
0 && (module.exports = {
|