@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @objectstack/objectql@4.0.2 build /home/runner/work/framework/framework/packages/objectql
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
  CLI Building entry: src/index.ts
@@ -10,13 +10,13 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/index.js 104.57 KB
14
- CJS dist/index.js.map 212.32 KB
15
- CJS ⚡️ Build success in 297ms
16
- ESM dist/index.mjs 102.83 KB
17
- ESM dist/index.mjs.map 211.02 KB
18
- ESM ⚡️ Build success in 297ms
13
+ ESM dist/index.mjs 112.91 KB
14
+ ESM dist/index.mjs.map 230.31 KB
15
+ ESM ⚡️ Build success in 125ms
16
+ CJS dist/index.js 114.81 KB
17
+ CJS dist/index.js.map 231.61 KB
18
+ CJS ⚡️ Build success in 160ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 20150ms
21
- DTS dist/index.d.mts 77.34 KB
22
- DTS dist/index.d.ts 77.34 KB
20
+ DTS ⚡️ Build success in 21312ms
21
+ DTS dist/index.d.mts 78.76 KB
22
+ DTS dist/index.d.ts 78.76 KB
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" | "script" | "modal" | "flow" | "api";
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" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
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" | "widget" | "hook" | "transformer" | "validator" | "decorator";
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" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
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" | "widget" | "hook" | "transformer" | "validator" | "decorator";
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" | "script" | "modal" | "flow" | "api";
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" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
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" | "widget" | "hook" | "transformer" | "validator" | "decorator";
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" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
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" | "widget" | "hook" | "transformer" | "validator" | "decorator";
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