@objectstack/objectql 4.0.2 → 4.0.3
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 +14 -0
- package/dist/index.d.mts +38 -6
- package/dist/index.d.ts +38 -6
- package/dist/index.js +292 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +292 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/engine.ts +116 -10
- package/src/plugin.integration.test.ts +170 -0
- package/src/plugin.ts +149 -1
- package/src/protocol.ts +100 -19
- package/src/registry.test.ts +11 -11
- package/src/registry.ts +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/objectql@4.0.
|
|
2
|
+
> @objectstack/objectql@4.0.3 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
|
|
@@ -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[32m112.91 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m230.31 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 125ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m114.81 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m231.61 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 160ms
|
|
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 21312ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m78.76 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m78.76 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @objectstack/objectql
|
|
2
2
|
|
|
3
|
+
## 4.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @objectstack/spec@4.0.3
|
|
8
|
+
- @objectstack/core@4.0.3
|
|
9
|
+
- @objectstack/types@4.0.3
|
|
10
|
+
|
|
11
|
+
## 4.0.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- fix: ObjectQL.init() now tracks and warns about failed driver connections instead of silently swallowing errors, improving debuggability for cold-start and serverless issues.
|
|
16
|
+
|
|
3
17
|
## 4.0.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { ObjectOwnership, ServiceObject, QueryAST, HookContext, EngineQueryOptio
|
|
|
4
4
|
import { ObjectStackManifest, InstalledPackage, ExecutionContext } from '@objectstack/spec/kernel';
|
|
5
5
|
import { ObjectStackProtocol, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, UpdateManyDataRequest, DeleteManyDataRequest } from '@objectstack/spec/api';
|
|
6
6
|
import { IDataEngine, DriverInterface, Logger, Plugin, PluginContext, ObjectKernel } from '@objectstack/core';
|
|
7
|
-
import { IFeedService } from '@objectstack/spec/contracts';
|
|
7
|
+
import { IFeedService, IRealtimeService } from '@objectstack/spec/contracts';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* XState-inspired State Machine Protocol
|
|
@@ -474,7 +474,7 @@ declare class SchemaRegistry {
|
|
|
474
474
|
actions?: {
|
|
475
475
|
name: string;
|
|
476
476
|
label: string;
|
|
477
|
-
type: "url" | "
|
|
477
|
+
type: "url" | "flow" | "api" | "script" | "modal";
|
|
478
478
|
refreshAfter: boolean;
|
|
479
479
|
objectName?: string | undefined;
|
|
480
480
|
icon?: string | undefined;
|
|
@@ -564,7 +564,7 @@ declare class SchemaRegistry {
|
|
|
564
564
|
manifest: {
|
|
565
565
|
id: string;
|
|
566
566
|
version: string;
|
|
567
|
-
type: "theme" | "
|
|
567
|
+
type: "theme" | "app" | "agent" | "driver" | "server" | "ui" | "module" | "objectql" | "plugin" | "gateway" | "adapter";
|
|
568
568
|
name: string;
|
|
569
569
|
namespace?: string | undefined;
|
|
570
570
|
description?: string | undefined;
|
|
@@ -709,7 +709,7 @@ declare class SchemaRegistry {
|
|
|
709
709
|
extensionPoints?: {
|
|
710
710
|
id: string;
|
|
711
711
|
name: string;
|
|
712
|
-
type: "provider" | "action" | "
|
|
712
|
+
type: "provider" | "action" | "hook" | "widget" | "transformer" | "validator" | "decorator";
|
|
713
713
|
cardinality: "multiple" | "single";
|
|
714
714
|
description?: string | undefined;
|
|
715
715
|
contract?: {
|
|
@@ -889,7 +889,7 @@ declare class SchemaRegistry {
|
|
|
889
889
|
} | {
|
|
890
890
|
id: string;
|
|
891
891
|
version: string;
|
|
892
|
-
type: "theme" | "
|
|
892
|
+
type: "theme" | "app" | "agent" | "driver" | "server" | "ui" | "module" | "objectql" | "plugin" | "gateway" | "adapter";
|
|
893
893
|
name: string;
|
|
894
894
|
namespace?: string | undefined;
|
|
895
895
|
description?: string | undefined;
|
|
@@ -1034,7 +1034,7 @@ declare class SchemaRegistry {
|
|
|
1034
1034
|
extensionPoints?: {
|
|
1035
1035
|
id: string;
|
|
1036
1036
|
name: string;
|
|
1037
|
-
type: "provider" | "action" | "
|
|
1037
|
+
type: "provider" | "action" | "hook" | "widget" | "transformer" | "validator" | "decorator";
|
|
1038
1038
|
cardinality: "multiple" | "single";
|
|
1039
1039
|
description?: string | undefined;
|
|
1040
1040
|
contract?: {
|
|
@@ -1491,6 +1491,7 @@ declare class ObjectQL implements IDataEngine {
|
|
|
1491
1491
|
private middlewares;
|
|
1492
1492
|
private actions;
|
|
1493
1493
|
private hostContext;
|
|
1494
|
+
private realtimeService?;
|
|
1494
1495
|
constructor(hostContext?: Record<string, any>);
|
|
1495
1496
|
/**
|
|
1496
1497
|
* Service Status Report
|
|
@@ -1584,6 +1585,13 @@ declare class ObjectQL implements IDataEngine {
|
|
|
1584
1585
|
* Register a new storage driver
|
|
1585
1586
|
*/
|
|
1586
1587
|
registerDriver(driver: DriverInterface, isDefault?: boolean): void;
|
|
1588
|
+
/**
|
|
1589
|
+
* Set the realtime service for publishing data change events.
|
|
1590
|
+
* Should be called after kernel resolves the realtime service.
|
|
1591
|
+
*
|
|
1592
|
+
* @param service - An IRealtimeService instance for event publishing
|
|
1593
|
+
*/
|
|
1594
|
+
setRealtimeService(service: IRealtimeService): void;
|
|
1587
1595
|
/**
|
|
1588
1596
|
* Helper to get object definition
|
|
1589
1597
|
*/
|
|
@@ -1879,6 +1887,30 @@ declare class ObjectQLPlugin implements Plugin {
|
|
|
1879
1887
|
* Drivers that do not implement `syncSchema` are silently skipped.
|
|
1880
1888
|
*/
|
|
1881
1889
|
private syncRegisteredSchemas;
|
|
1890
|
+
/**
|
|
1891
|
+
* Restore persisted metadata from the database (sys_metadata) on startup.
|
|
1892
|
+
*
|
|
1893
|
+
* Calls `protocol.loadMetaFromDb()` to bulk-load all active metadata
|
|
1894
|
+
* records (objects, views, apps, etc.) into the in-memory SchemaRegistry.
|
|
1895
|
+
* This closes the persistence loop so that user-created schemas survive
|
|
1896
|
+
* kernel cold starts and redeployments.
|
|
1897
|
+
*
|
|
1898
|
+
* Gracefully degrades when:
|
|
1899
|
+
* - The protocol service is unavailable (e.g., in-memory-only mode).
|
|
1900
|
+
* - `loadMetaFromDb` is not implemented by the protocol shim.
|
|
1901
|
+
* - The underlying driver/table does not exist yet (first-run scenario).
|
|
1902
|
+
*/
|
|
1903
|
+
private restoreMetadataFromDb;
|
|
1904
|
+
/**
|
|
1905
|
+
* Bridge all SchemaRegistry objects to the metadata service.
|
|
1906
|
+
*
|
|
1907
|
+
* This ensures objects registered by plugins and loaded from sys_metadata
|
|
1908
|
+
* are visible to AI tools and other consumers that query IMetadataService.
|
|
1909
|
+
*
|
|
1910
|
+
* Runs after both restoreMetadataFromDb() and syncRegisteredSchemas() to
|
|
1911
|
+
* catch all objects in the SchemaRegistry regardless of their source.
|
|
1912
|
+
*/
|
|
1913
|
+
private bridgeObjectsToMetadataService;
|
|
1882
1914
|
/**
|
|
1883
1915
|
* Load metadata from external metadata service into ObjectQL registry
|
|
1884
1916
|
* This enables ObjectQL to use file-based or remote metadata
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ObjectOwnership, ServiceObject, QueryAST, HookContext, EngineQueryOptio
|
|
|
4
4
|
import { ObjectStackManifest, InstalledPackage, ExecutionContext } from '@objectstack/spec/kernel';
|
|
5
5
|
import { ObjectStackProtocol, MetadataCacheRequest, MetadataCacheResponse, BatchUpdateRequest, BatchUpdateResponse, UpdateManyDataRequest, DeleteManyDataRequest } from '@objectstack/spec/api';
|
|
6
6
|
import { IDataEngine, DriverInterface, Logger, Plugin, PluginContext, ObjectKernel } from '@objectstack/core';
|
|
7
|
-
import { IFeedService } from '@objectstack/spec/contracts';
|
|
7
|
+
import { IFeedService, IRealtimeService } from '@objectstack/spec/contracts';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* XState-inspired State Machine Protocol
|
|
@@ -474,7 +474,7 @@ declare class SchemaRegistry {
|
|
|
474
474
|
actions?: {
|
|
475
475
|
name: string;
|
|
476
476
|
label: string;
|
|
477
|
-
type: "url" | "
|
|
477
|
+
type: "url" | "flow" | "api" | "script" | "modal";
|
|
478
478
|
refreshAfter: boolean;
|
|
479
479
|
objectName?: string | undefined;
|
|
480
480
|
icon?: string | undefined;
|
|
@@ -564,7 +564,7 @@ declare class SchemaRegistry {
|
|
|
564
564
|
manifest: {
|
|
565
565
|
id: string;
|
|
566
566
|
version: string;
|
|
567
|
-
type: "theme" | "
|
|
567
|
+
type: "theme" | "app" | "agent" | "driver" | "server" | "ui" | "module" | "objectql" | "plugin" | "gateway" | "adapter";
|
|
568
568
|
name: string;
|
|
569
569
|
namespace?: string | undefined;
|
|
570
570
|
description?: string | undefined;
|
|
@@ -709,7 +709,7 @@ declare class SchemaRegistry {
|
|
|
709
709
|
extensionPoints?: {
|
|
710
710
|
id: string;
|
|
711
711
|
name: string;
|
|
712
|
-
type: "provider" | "action" | "
|
|
712
|
+
type: "provider" | "action" | "hook" | "widget" | "transformer" | "validator" | "decorator";
|
|
713
713
|
cardinality: "multiple" | "single";
|
|
714
714
|
description?: string | undefined;
|
|
715
715
|
contract?: {
|
|
@@ -889,7 +889,7 @@ declare class SchemaRegistry {
|
|
|
889
889
|
} | {
|
|
890
890
|
id: string;
|
|
891
891
|
version: string;
|
|
892
|
-
type: "theme" | "
|
|
892
|
+
type: "theme" | "app" | "agent" | "driver" | "server" | "ui" | "module" | "objectql" | "plugin" | "gateway" | "adapter";
|
|
893
893
|
name: string;
|
|
894
894
|
namespace?: string | undefined;
|
|
895
895
|
description?: string | undefined;
|
|
@@ -1034,7 +1034,7 @@ declare class SchemaRegistry {
|
|
|
1034
1034
|
extensionPoints?: {
|
|
1035
1035
|
id: string;
|
|
1036
1036
|
name: string;
|
|
1037
|
-
type: "provider" | "action" | "
|
|
1037
|
+
type: "provider" | "action" | "hook" | "widget" | "transformer" | "validator" | "decorator";
|
|
1038
1038
|
cardinality: "multiple" | "single";
|
|
1039
1039
|
description?: string | undefined;
|
|
1040
1040
|
contract?: {
|
|
@@ -1491,6 +1491,7 @@ declare class ObjectQL implements IDataEngine {
|
|
|
1491
1491
|
private middlewares;
|
|
1492
1492
|
private actions;
|
|
1493
1493
|
private hostContext;
|
|
1494
|
+
private realtimeService?;
|
|
1494
1495
|
constructor(hostContext?: Record<string, any>);
|
|
1495
1496
|
/**
|
|
1496
1497
|
* Service Status Report
|
|
@@ -1584,6 +1585,13 @@ declare class ObjectQL implements IDataEngine {
|
|
|
1584
1585
|
* Register a new storage driver
|
|
1585
1586
|
*/
|
|
1586
1587
|
registerDriver(driver: DriverInterface, isDefault?: boolean): void;
|
|
1588
|
+
/**
|
|
1589
|
+
* Set the realtime service for publishing data change events.
|
|
1590
|
+
* Should be called after kernel resolves the realtime service.
|
|
1591
|
+
*
|
|
1592
|
+
* @param service - An IRealtimeService instance for event publishing
|
|
1593
|
+
*/
|
|
1594
|
+
setRealtimeService(service: IRealtimeService): void;
|
|
1587
1595
|
/**
|
|
1588
1596
|
* Helper to get object definition
|
|
1589
1597
|
*/
|
|
@@ -1879,6 +1887,30 @@ declare class ObjectQLPlugin implements Plugin {
|
|
|
1879
1887
|
* Drivers that do not implement `syncSchema` are silently skipped.
|
|
1880
1888
|
*/
|
|
1881
1889
|
private syncRegisteredSchemas;
|
|
1890
|
+
/**
|
|
1891
|
+
* Restore persisted metadata from the database (sys_metadata) on startup.
|
|
1892
|
+
*
|
|
1893
|
+
* Calls `protocol.loadMetaFromDb()` to bulk-load all active metadata
|
|
1894
|
+
* records (objects, views, apps, etc.) into the in-memory SchemaRegistry.
|
|
1895
|
+
* This closes the persistence loop so that user-created schemas survive
|
|
1896
|
+
* kernel cold starts and redeployments.
|
|
1897
|
+
*
|
|
1898
|
+
* Gracefully degrades when:
|
|
1899
|
+
* - The protocol service is unavailable (e.g., in-memory-only mode).
|
|
1900
|
+
* - `loadMetaFromDb` is not implemented by the protocol shim.
|
|
1901
|
+
* - The underlying driver/table does not exist yet (first-run scenario).
|
|
1902
|
+
*/
|
|
1903
|
+
private restoreMetadataFromDb;
|
|
1904
|
+
/**
|
|
1905
|
+
* Bridge all SchemaRegistry objects to the metadata service.
|
|
1906
|
+
*
|
|
1907
|
+
* This ensures objects registered by plugins and loaded from sys_metadata
|
|
1908
|
+
* are visible to AI tools and other consumers that query IMetadataService.
|
|
1909
|
+
*
|
|
1910
|
+
* Runs after both restoreMetadataFromDb() and syncRegisteredSchemas() to
|
|
1911
|
+
* catch all objects in the SchemaRegistry regardless of their source.
|
|
1912
|
+
*/
|
|
1913
|
+
private bridgeObjectsToMetadataService;
|
|
1882
1914
|
/**
|
|
1883
1915
|
* Load metadata from external metadata service into ObjectQL registry
|
|
1884
1916
|
* This enables ObjectQL to use file-based or remote metadata
|