@objectql/types 4.1.0 → 4.2.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/dist/edge.d.ts ADDED
@@ -0,0 +1,86 @@
1
+ /**
2
+ * ObjectQL
3
+ * Copyright (c) 2026-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ /**
9
+ * Supported edge runtime environments.
10
+ */
11
+ export type EdgeRuntime = 'cloudflare-workers' | 'deno-deploy' | 'vercel-edge' | 'bun' | 'node';
12
+ /**
13
+ * Edge-specific driver binding.
14
+ *
15
+ * Maps an ObjectQL driver to an edge-platform-native storage primitive.
16
+ * For example, Cloudflare Workers binds `driver-sqlite-wasm` to D1.
17
+ */
18
+ export interface EdgeDriverBinding {
19
+ /**
20
+ * The ObjectQL driver package name.
21
+ * e.g., `'@objectql/driver-memory'`, `'@objectql/driver-sqlite-wasm'`
22
+ */
23
+ readonly driver: string;
24
+ /**
25
+ * Edge-platform binding name (environment variable or resource identifier).
26
+ * e.g., `'D1_DATABASE'` for Cloudflare D1, `'POSTGRES_URL'` for Deno Postgres.
27
+ */
28
+ readonly binding?: string;
29
+ /**
30
+ * Driver-specific configuration overrides for the edge environment.
31
+ */
32
+ readonly config?: Record<string, unknown>;
33
+ }
34
+ /**
35
+ * Edge runtime adapter configuration.
36
+ *
37
+ * Declares how ObjectQL should adapt to a specific edge runtime.
38
+ * Used by the edge adapter packages (e.g., `@objectql/adapter-cloudflare`).
39
+ */
40
+ export interface EdgeAdapterConfig {
41
+ /** Target edge runtime */
42
+ readonly runtime: EdgeRuntime;
43
+ /**
44
+ * Driver bindings for this edge environment.
45
+ * Maps datasource names to edge-specific driver bindings.
46
+ */
47
+ readonly bindings?: Record<string, EdgeDriverBinding>;
48
+ /**
49
+ * Maximum execution time in milliseconds.
50
+ * Edge runtimes impose strict CPU time limits.
51
+ * Default varies by runtime (e.g., 30000 for Cloudflare Workers).
52
+ */
53
+ readonly maxExecutionTime?: number;
54
+ /**
55
+ * Enable request-scoped driver connections.
56
+ * Edge runtimes are stateless; connections are created per-request.
57
+ * Default: true
58
+ */
59
+ readonly requestScoped?: boolean;
60
+ }
61
+ /**
62
+ * Edge runtime environment capabilities.
63
+ *
64
+ * Declares what platform APIs are available in the target edge runtime.
65
+ * Used by ObjectQL to select compatible code paths.
66
+ */
67
+ export interface EdgeCapabilities {
68
+ /** WebAssembly support */
69
+ readonly wasm: boolean;
70
+ /** Persistent storage available (OPFS, KV, D1, etc.) */
71
+ readonly persistentStorage: boolean;
72
+ /** WebSocket support for real-time sync */
73
+ readonly webSocket: boolean;
74
+ /** Cron/scheduled trigger support */
75
+ readonly scheduledTriggers: boolean;
76
+ /** Maximum request body size in bytes */
77
+ readonly maxRequestBodySize?: number;
78
+ /** Maximum execution time in milliseconds */
79
+ readonly maxExecutionTime?: number;
80
+ /** Available storage primitives */
81
+ readonly storagePrimitives: readonly string[];
82
+ }
83
+ /**
84
+ * Predefined edge capability profiles for known runtimes.
85
+ */
86
+ export declare const EDGE_CAPABILITIES: Readonly<Record<EdgeRuntime, EdgeCapabilities>>;
package/dist/edge.js ADDED
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * ObjectQL
4
+ * Copyright (c) 2026-present ObjectStack Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.EDGE_CAPABILITIES = void 0;
11
+ /**
12
+ * Predefined edge capability profiles for known runtimes.
13
+ */
14
+ exports.EDGE_CAPABILITIES = {
15
+ 'cloudflare-workers': {
16
+ wasm: true,
17
+ persistentStorage: true,
18
+ webSocket: true,
19
+ scheduledTriggers: true,
20
+ maxRequestBodySize: 100 * 1024 * 1024, // 100MB
21
+ maxExecutionTime: 30000,
22
+ storagePrimitives: ['D1', 'KV', 'R2', 'Durable Objects'],
23
+ },
24
+ 'deno-deploy': {
25
+ wasm: true,
26
+ persistentStorage: true,
27
+ webSocket: true,
28
+ scheduledTriggers: true,
29
+ maxRequestBodySize: 512 * 1024, // 512KB
30
+ maxExecutionTime: 50000,
31
+ storagePrimitives: ['Deno KV', 'Deno Postgres'],
32
+ },
33
+ 'vercel-edge': {
34
+ wasm: true,
35
+ persistentStorage: false,
36
+ webSocket: false,
37
+ scheduledTriggers: false,
38
+ maxRequestBodySize: 4 * 1024 * 1024, // 4MB
39
+ maxExecutionTime: 25000,
40
+ storagePrimitives: ['KV (via Vercel KV)', 'Postgres (via Vercel Postgres)'],
41
+ },
42
+ 'bun': {
43
+ wasm: true,
44
+ persistentStorage: true,
45
+ webSocket: true,
46
+ scheduledTriggers: false,
47
+ maxRequestBodySize: Infinity,
48
+ maxExecutionTime: Infinity,
49
+ storagePrimitives: ['SQLite (bun:sqlite)', 'File System'],
50
+ },
51
+ 'node': {
52
+ wasm: true,
53
+ persistentStorage: true,
54
+ webSocket: true,
55
+ scheduledTriggers: false,
56
+ maxRequestBodySize: Infinity,
57
+ maxExecutionTime: Infinity,
58
+ storagePrimitives: ['All drivers'],
59
+ },
60
+ };
61
+ //# sourceMappingURL=edge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge.js","sourceRoot":"","sources":["../src/edge.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAqGH;;GAEG;AACU,QAAA,iBAAiB,GAAoD;IAC9E,oBAAoB,EAAE;QAClB,IAAI,EAAE,IAAI;QACV,iBAAiB,EAAE,IAAI;QACvB,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,IAAI;QACvB,kBAAkB,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,EAAE,QAAQ;QAC/C,gBAAgB,EAAE,KAAM;QACxB,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,CAAC;KAC3D;IACD,aAAa,EAAE;QACX,IAAI,EAAE,IAAI;QACV,iBAAiB,EAAE,IAAI;QACvB,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,IAAI;QACvB,kBAAkB,EAAE,GAAG,GAAG,IAAI,EAAE,QAAQ;QACxC,gBAAgB,EAAE,KAAM;QACxB,iBAAiB,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC;KAClD;IACD,aAAa,EAAE;QACX,IAAI,EAAE,IAAI;QACV,iBAAiB,EAAE,KAAK;QACxB,SAAS,EAAE,KAAK;QAChB,iBAAiB,EAAE,KAAK;QACxB,kBAAkB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,EAAE,MAAM;QAC3C,gBAAgB,EAAE,KAAM;QACxB,iBAAiB,EAAE,CAAC,oBAAoB,EAAE,gCAAgC,CAAC;KAC9E;IACD,KAAK,EAAE;QACH,IAAI,EAAE,IAAI;QACV,iBAAiB,EAAE,IAAI;QACvB,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,KAAK;QACxB,kBAAkB,EAAE,QAAQ;QAC5B,gBAAgB,EAAE,QAAQ;QAC1B,iBAAiB,EAAE,CAAC,qBAAqB,EAAE,aAAa,CAAC;KAC5D;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,IAAI;QACV,iBAAiB,EAAE,IAAI;QACvB,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,KAAK;QACxB,kBAAkB,EAAE,QAAQ;QAC5B,gBAAgB,EAAE,QAAQ;QAC1B,iBAAiB,EAAE,CAAC,aAAa,CAAC;KACrC;CACJ,CAAC"}
package/dist/field.d.ts CHANGED
@@ -6,9 +6,10 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  import { Data } from '@objectstack/spec';
9
- type ProtocolFieldType = Data.FieldType;
10
- type Field = Data.Field;
11
- type SpecSelectOption = Data.SelectOption;
9
+ import { z } from 'zod';
10
+ type ProtocolFieldType = z.infer<typeof Data.FieldType>;
11
+ type Field = z.infer<typeof Data.FieldSchema>;
12
+ type SpecSelectOption = z.infer<typeof Data.SelectOption>;
12
13
  /**
13
14
  * Re-export Protocol Types from the Constitution
14
15
  * These are the wire-protocol standard types defined in @objectstack/spec
@@ -69,10 +70,10 @@ export interface ImageAttachmentData extends AttachmentData {
69
70
  * Runtime Field Type
70
71
  *
71
72
  * Extends the Protocol FieldType with runtime-specific types.
72
- * The Protocol Constitution defines the core field types.
73
- * We add runtime-specific types like 'vector', 'grid', 'location', 'object' here.
73
+ * The Protocol Constitution defines the core field types (including 'location' and 'vector').
74
+ * We add runtime-specific types like 'grid' and 'object' here.
74
75
  */
75
- export type FieldType = ProtocolFieldType | 'location' | 'object' | 'vector' | 'grid';
76
+ export type FieldType = ProtocolFieldType | 'object' | 'grid';
76
77
  /**
77
78
  * Runtime Field Option
78
79
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formula.js","sourceRoot":"","sources":["../src/formula.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;;;;;;GAQG;AAEH,+BAAoD;AA0OpD;;GAEG;AACH,IAAY,gBAwBX;AAxBD,WAAY,gBAAgB;IACxB,qCAAqC;IACrC,iDAA6B,CAAA;IAE7B,sCAAsC;IACtC,uDAAmC,CAAA;IAEnC,iCAAiC;IACjC,6CAAyB,CAAA;IAEzB,uBAAuB;IACvB,yDAAqC,CAAA;IAErC,2CAA2C;IAC3C,qDAAiC,CAAA;IAEjC,yBAAyB;IACzB,uCAAmB,CAAA;IAEnB,gDAAgD;IAChD,6DAAyC,CAAA;IAEzC,4BAA4B;IAC5B,mDAA+B,CAAA;AACnC,CAAC,EAxBW,gBAAgB,gCAAhB,gBAAgB,QAwB3B;AAmBD;;;GAGG;AACH,MAAa,YAAa,SAAQ,mBAAa;IAK3C,YACI,IAAsB,EACtB,OAAe,EACf,UAAmB,EACnB,OAA6B;QAE7B,KAAK,CAAC;YACF,IAAI,EAAE,IAAc;YACpB,OAAO;YACP,OAAO,EAAE;gBACL,kBAAkB,EAAE,IAAI;gBACxB,UAAU;gBACV,GAAG,OAAO;aACb;SACJ,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;IAChC,CAAC;CACJ;AAzBD,oCAyBC"}
1
+ {"version":3,"file":"formula.js","sourceRoot":"","sources":["../src/formula.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;;;;;;GAQG;AAEH,+BAAsC;AA0OtC;;GAEG;AACH,IAAY,gBAwBX;AAxBD,WAAY,gBAAgB;IACxB,qCAAqC;IACrC,iDAA6B,CAAA;IAE7B,sCAAsC;IACtC,uDAAmC,CAAA;IAEnC,iCAAiC;IACjC,6CAAyB,CAAA;IAEzB,uBAAuB;IACvB,yDAAqC,CAAA;IAErC,2CAA2C;IAC3C,qDAAiC,CAAA;IAEjC,yBAAyB;IACzB,uCAAmB,CAAA;IAEnB,gDAAgD;IAChD,6DAAyC,CAAA;IAEzC,4BAA4B;IAC5B,mDAA+B,CAAA;AACnC,CAAC,EAxBW,gBAAgB,gCAAhB,gBAAgB,QAwB3B;AAmBD;;;GAGG;AACH,MAAa,YAAa,SAAQ,mBAAa;IAK3C,YACI,IAAsB,EACtB,OAAe,EACf,UAAmB,EACnB,OAA6B;QAE7B,KAAK,CAAC;YACF,IAAI,EAAE,IAAc;YACpB,OAAO;YACP,OAAO,EAAE;gBACL,kBAAkB,EAAE,IAAI;gBACxB,UAAU;gBACV,GAAG,OAAO;aACb;SACJ,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;IAChC,CAAC;CACJ;AAzBD,oCAyBC"}
package/dist/gateway.d.ts CHANGED
@@ -10,14 +10,14 @@ export interface ApiRequest {
10
10
  path: string;
11
11
  method: ApiMethod;
12
12
  headers: Record<string, string | string[] | undefined>;
13
- query: Record<string, any>;
14
- body?: any;
13
+ query: Record<string, unknown>;
14
+ body?: unknown;
15
15
  protocol?: string;
16
16
  }
17
17
  export interface ApiResponse {
18
18
  status: number;
19
19
  headers?: Record<string, string | string[]>;
20
- body: any;
20
+ body: unknown;
21
21
  }
22
22
  export interface GatewayProtocol {
23
23
  name: string;
package/dist/hook.d.ts CHANGED
@@ -17,17 +17,17 @@ export type HookTiming = 'before' | 'after';
17
17
  * Minimal API surface exposed to hooks for performing side-effects or checks.
18
18
  */
19
19
  export interface HookAPI {
20
- find(objectName: string, query?: any): Promise<any[]>;
21
- findOne(objectName: string, id: string | number): Promise<any>;
22
- count(objectName: string, query?: any): Promise<number>;
23
- create(objectName: string, data: any): Promise<any>;
24
- update(objectName: string, id: string | number, data: any): Promise<any>;
25
- delete(objectName: string, id: string | number): Promise<any>;
20
+ find(objectName: string, query?: Record<string, unknown>): Promise<Record<string, unknown>[]>;
21
+ findOne(objectName: string, id: string | number): Promise<Record<string, unknown> | null>;
22
+ count(objectName: string, query?: Record<string, unknown>): Promise<number>;
23
+ create(objectName: string, data: Record<string, unknown>): Promise<Record<string, unknown>>;
24
+ update(objectName: string, id: string | number, data: Record<string, unknown>): Promise<Record<string, unknown>>;
25
+ delete(objectName: string, id: string | number): Promise<Record<string, unknown>>;
26
26
  }
27
27
  /**
28
28
  * Base context available in all hooks.
29
29
  */
30
- export interface BaseHookContext<T = any> {
30
+ export interface BaseHookContext<_T = Record<string, unknown>> {
31
31
  /** The name of the object (entity) being acted upon. */
32
32
  objectName: string;
33
33
  /** The triggering operation. */
@@ -37,28 +37,32 @@ export interface BaseHookContext<T = any> {
37
37
  /** User/Session context (Authentication info). */
38
38
  user?: {
39
39
  id: string | number;
40
- [key: string]: any;
40
+ [key: string]: unknown;
41
41
  };
42
42
  /**
43
43
  * Shared state for passing data between matching 'before' and 'after' hooks.
44
44
  * e.g. Calculate a diff in 'beforeUpdate' and read it in 'afterUpdate'.
45
45
  */
46
- state: Record<string, any>;
46
+ state: Record<string, unknown>;
47
47
  }
48
48
  /**
49
49
  * Context for Retrieval operations (Find, Count).
50
50
  */
51
- export interface RetrievalHookContext<T = any> extends BaseHookContext<T> {
51
+ export interface RetrievalHookContext<T = Record<string, unknown>> extends BaseHookContext<T> {
52
52
  operation: 'find' | 'count';
53
- /** The query criteria being executed. Modifiable in 'before' hooks. */
54
- query: any;
53
+ /**
54
+ * The query criteria being executed. Modifiable in 'before' hooks.
55
+ * Typed as `object` (not `Record<string, unknown>`) because named interfaces
56
+ * like UnifiedQuery lack index signatures and aren't assignable to Record types.
57
+ */
58
+ query: object;
55
59
  /** The result of the query. Only available in 'after' hooks. */
56
60
  result?: T[] | number;
57
61
  }
58
62
  /**
59
63
  * Context for Modification operations (Create, Update, Delete).
60
64
  */
61
- export interface MutationHookContext<T = any> extends BaseHookContext<T> {
65
+ export interface MutationHookContext<T = Record<string, unknown>> extends BaseHookContext<T> {
62
66
  operation: 'create' | 'update' | 'delete';
63
67
  /** The record ID. Undefined for 'create'. */
64
68
  id?: string | number;
@@ -83,7 +87,7 @@ export interface MutationHookContext<T = any> extends BaseHookContext<T> {
83
87
  /**
84
88
  * Specialized context for Updates, including change tracking.
85
89
  */
86
- export interface UpdateHookContext<T = any> extends MutationHookContext<T> {
90
+ export interface UpdateHookContext<T = Record<string, unknown>> extends MutationHookContext<T> {
87
91
  operation: 'update';
88
92
  /**
89
93
  * Helper to check if a specific field is being modified.
@@ -94,7 +98,7 @@ export interface UpdateHookContext<T = any> extends MutationHookContext<T> {
94
98
  /**
95
99
  * Definition interface for a set of hooks for a specific object.
96
100
  */
97
- export interface ObjectHookDefinition<T = any> {
101
+ export interface ObjectHookDefinition<T = Record<string, unknown>> {
98
102
  beforeFind?: (ctx: RetrievalHookContext<T>) => Promise<void> | void;
99
103
  afterFind?: (ctx: RetrievalHookContext<T>) => Promise<void> | void;
100
104
  beforeCount?: (ctx: RetrievalHookContext<T>) => Promise<void> | void;
@@ -107,5 +111,5 @@ export interface ObjectHookDefinition<T = any> {
107
111
  afterUpdate?: (ctx: UpdateHookContext<T>) => Promise<void> | void;
108
112
  }
109
113
  export type HookName = keyof ObjectHookDefinition;
110
- export type HookContext<T = any> = RetrievalHookContext<T> | MutationHookContext<T> | UpdateHookContext<T>;
111
- export type HookHandler<T = any> = (ctx: HookContext<T>) => Promise<void> | void;
114
+ export type HookContext<T = Record<string, unknown>> = RetrievalHookContext<T> | MutationHookContext<T> | UpdateHookContext<T>;
115
+ export type HookHandler<T = Record<string, unknown>> = (ctx: HookContext<T>) => Promise<void> | void;
package/dist/index.d.ts CHANGED
@@ -33,3 +33,8 @@ export * from './workflow';
33
33
  export * from './formula';
34
34
  export * from './plugin';
35
35
  export * from './gateway';
36
+ export * from './logger';
37
+ export * from './ai';
38
+ export * from './sync';
39
+ export * from './edge';
40
+ export * from './kernel-service';
package/dist/index.js CHANGED
@@ -49,4 +49,9 @@ __exportStar(require("./workflow"), exports);
49
49
  __exportStar(require("./formula"), exports);
50
50
  __exportStar(require("./plugin"), exports);
51
51
  __exportStar(require("./gateway"), exports);
52
+ __exportStar(require("./logger"), exports);
53
+ __exportStar(require("./ai"), exports);
54
+ __exportStar(require("./sync"), exports);
55
+ __exportStar(require("./edge"), exports);
56
+ __exportStar(require("./kernel-service"), exports);
52
57
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;AAEH;;;;;;GAMG;AACH,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B;AAC7B,wCAAsB;AACtB,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,+CAA6B;AAC7B,2CAAyB;AACzB,gDAA8B;AAC9B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B;AAC3B,4CAA0B;AAC1B,2CAAyB;AACzB,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;AAEH;;;;;;GAMG;AACH,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B;AAC7B,wCAAsB;AACtB,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B;AAC7B,+CAA6B;AAC7B,2CAAyB;AACzB,gDAA8B;AAC9B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B;AAC3B,4CAA0B;AAC1B,2CAAyB;AACzB,4CAA0B;AAC1B,2CAAyB;AACzB,uCAAqB;AACrB,yCAAuB;AACvB,yCAAuB;AACvB,mDAAiC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * ObjectQL
3
+ * Copyright (c) 2026-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ /**
9
+ * Kernel Service Types
10
+ *
11
+ * Defines the 17 kernel services specified by the ObjectStack protocol.
12
+ * Each service maps to a set of protocol methods governed by the ObjectStackProtocol interface.
13
+ *
14
+ * @see https://protocol.objectstack.ai/docs/guides/kernel-services
15
+ */
16
+ /**
17
+ * The 17 kernel services registered via CoreServiceName.
18
+ * Each service maps to a set of protocol methods.
19
+ */
20
+ export type CoreServiceName = 'metadata' | 'data' | 'analytics' | 'auth' | 'ui' | 'workflow' | 'automation' | 'realtime' | 'notification' | 'ai' | 'i18n' | 'file-storage' | 'search' | 'cache' | 'queue' | 'job' | 'graphql';
21
+ /**
22
+ * Criticality levels for kernel services.
23
+ * - required: System cannot start without this service
24
+ * - core: Falls back to in-memory implementation with a warning if missing
25
+ * - optional: Feature disabled; API returns 501 Not Implemented if missing
26
+ */
27
+ export type ServiceCriticality = 'required' | 'core' | 'optional';
28
+ /**
29
+ * Service availability status reported via the discovery endpoint.
30
+ */
31
+ export type ServiceStatusValue = 'available' | 'degraded' | 'unavailable';
32
+ /**
33
+ * Per-service status entry in the discovery response.
34
+ */
35
+ export interface ServiceStatus {
36
+ /** Whether the service is enabled */
37
+ readonly enabled: boolean;
38
+ /** Current operational status */
39
+ readonly status: ServiceStatusValue;
40
+ /** Route mount point (if available) */
41
+ readonly route?: string;
42
+ /** Provider name (e.g., 'kernel', plugin name) */
43
+ readonly provider?: string;
44
+ /** Human-readable status message */
45
+ readonly message?: string;
46
+ }
47
+ /**
48
+ * Service criticality mapping per the kernel-services specification.
49
+ */
50
+ export declare const SERVICE_CRITICALITY: Readonly<Record<CoreServiceName, ServiceCriticality>>;
51
+ /**
52
+ * Discovery response structure returned by getDiscovery.
53
+ * Clients use this to determine which services are available and adapt UI accordingly.
54
+ */
55
+ export interface KernelDiscoveryResponse {
56
+ /** Engine name */
57
+ readonly name: string;
58
+ /** API name identifier for the spec discovery endpoint */
59
+ readonly apiName: string;
60
+ /** Engine version */
61
+ readonly version: string;
62
+ /** Supported protocol transports */
63
+ readonly protocols: readonly string[];
64
+ /** Per-service status map */
65
+ readonly services: Readonly<Record<CoreServiceName, ServiceStatus>>;
66
+ /** Optional capabilities flags */
67
+ readonly capabilities?: {
68
+ readonly search: boolean;
69
+ readonly files: boolean;
70
+ readonly graphql: boolean;
71
+ readonly notifications: boolean;
72
+ readonly analytics: boolean;
73
+ readonly ai: boolean;
74
+ readonly i18n: boolean;
75
+ readonly workflow: boolean;
76
+ readonly websockets: boolean;
77
+ };
78
+ /** Optional endpoint URLs */
79
+ readonly endpoints?: {
80
+ readonly rest?: string;
81
+ readonly graphql?: string;
82
+ readonly websocket?: string;
83
+ };
84
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * ObjectQL
4
+ * Copyright (c) 2026-present ObjectStack Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.SERVICE_CRITICALITY = void 0;
11
+ /**
12
+ * Service criticality mapping per the kernel-services specification.
13
+ */
14
+ exports.SERVICE_CRITICALITY = {
15
+ metadata: 'required',
16
+ data: 'required',
17
+ analytics: 'optional',
18
+ auth: 'required',
19
+ ui: 'optional',
20
+ workflow: 'optional',
21
+ automation: 'optional',
22
+ realtime: 'optional',
23
+ notification: 'optional',
24
+ ai: 'optional',
25
+ i18n: 'optional',
26
+ 'file-storage': 'optional',
27
+ search: 'optional',
28
+ cache: 'core',
29
+ queue: 'core',
30
+ job: 'core',
31
+ graphql: 'optional',
32
+ };
33
+ //# sourceMappingURL=kernel-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel-service.js","sourceRoot":"","sources":["../src/kernel-service.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA+DH;;GAEG;AACU,QAAA,mBAAmB,GAA0D;IACtF,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,UAAU;IAChB,SAAS,EAAE,UAAU;IACrB,IAAI,EAAE,UAAU;IAChB,EAAE,EAAE,UAAU;IACd,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,UAAU;IACtB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,UAAU;IACxB,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,cAAc,EAAE,UAAU;IAC1B,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,UAAU;CACtB,CAAC"}
package/dist/loader.d.ts CHANGED
@@ -17,5 +17,5 @@ export interface LoaderPlugin {
17
17
  name: string;
18
18
  glob: string[];
19
19
  handler: LoaderHandler;
20
- options?: any;
20
+ options?: Record<string, unknown>;
21
21
  }
@@ -0,0 +1,126 @@
1
+ /**
2
+ * ObjectQL - Logger Type Definitions
3
+ * Copyright (c) 2026-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * Defines the canonical Logger interface for the ObjectQL ecosystem.
9
+ * All packages must use this interface instead of direct console.* calls.
10
+ */
11
+ /**
12
+ * Log severity levels (RFC 5424 Syslog)
13
+ */
14
+ export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
15
+ /**
16
+ * Log output format
17
+ */
18
+ export type LogFormat = 'json' | 'pretty' | 'compact';
19
+ /**
20
+ * Structured log entry for serialization
21
+ */
22
+ export interface LogEntry {
23
+ /** ISO 8601 timestamp */
24
+ readonly timestamp: string;
25
+ /** Log severity level */
26
+ readonly level: LogLevel;
27
+ /** Logger name / component identifier */
28
+ readonly name: string;
29
+ /** Human-readable message */
30
+ readonly message: string;
31
+ /** Structured metadata (key-value pairs) */
32
+ readonly data?: Record<string, unknown>;
33
+ /** Error object, if applicable */
34
+ readonly error?: {
35
+ readonly name: string;
36
+ readonly message: string;
37
+ readonly stack?: string;
38
+ };
39
+ }
40
+ /**
41
+ * Logger configuration
42
+ */
43
+ export interface LoggerConfig {
44
+ /** Logger name / component identifier */
45
+ readonly name: string;
46
+ /** Minimum log level to emit */
47
+ readonly level?: LogLevel;
48
+ /** Output format */
49
+ readonly format?: LogFormat;
50
+ }
51
+ /**
52
+ * Canonical Logger interface for the ObjectQL ecosystem
53
+ *
54
+ * All packages must program against this interface.
55
+ * Implementations are provided by the runtime layer (`@objectstack/core`
56
+ * or a custom adapter), keeping foundation packages runtime-agnostic.
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * class MyPlugin {
61
+ * private logger: Logger;
62
+ * constructor(logger: Logger) {
63
+ * this.logger = logger;
64
+ * }
65
+ * async process() {
66
+ * this.logger.info('Processing started', { batch: 42 });
67
+ * }
68
+ * }
69
+ * ```
70
+ */
71
+ export interface Logger {
72
+ /** Finest-grained informational events */
73
+ trace(message: string, data?: Record<string, unknown>): void;
74
+ /** Detailed debug information */
75
+ debug(message: string, data?: Record<string, unknown>): void;
76
+ /** Informational messages that highlight progress */
77
+ info(message: string, data?: Record<string, unknown>): void;
78
+ /** Potentially harmful situations */
79
+ warn(message: string, data?: Record<string, unknown>): void;
80
+ /** Error events that might still allow the application to continue */
81
+ error(message: string, error?: Error, data?: Record<string, unknown>): void;
82
+ /** Severe error events that will presumably lead to application abort */
83
+ fatal(message: string, error?: Error, data?: Record<string, unknown>): void;
84
+ }
85
+ /**
86
+ * Factory function signature for creating Logger instances.
87
+ * Typically provided by the runtime layer.
88
+ */
89
+ export type LoggerFactory = (config: LoggerConfig) => Logger;
90
+ /**
91
+ * Console-based Logger implementation
92
+ *
93
+ * A zero-dependency reference implementation suitable for:
94
+ * - Unit tests (without mocking an external logger library)
95
+ * - Development environments
96
+ * - Packages that cannot depend on `@objectstack/core`
97
+ *
98
+ * For production use, prefer the structured logger from `@objectstack/core`.
99
+ */
100
+ export declare class ConsoleLogger implements Logger {
101
+ private readonly name;
102
+ private readonly level;
103
+ private static readonly LEVELS;
104
+ constructor(config: LoggerConfig);
105
+ private shouldLog;
106
+ private format;
107
+ trace(message: string, data?: Record<string, unknown>): void;
108
+ debug(message: string, data?: Record<string, unknown>): void;
109
+ info(message: string, data?: Record<string, unknown>): void;
110
+ warn(message: string, data?: Record<string, unknown>): void;
111
+ error(message: string, error?: Error, data?: Record<string, unknown>): void;
112
+ fatal(message: string, error?: Error, data?: Record<string, unknown>): void;
113
+ }
114
+ /**
115
+ * No-op Logger implementation
116
+ *
117
+ * Useful for suppressing all log output (e.g., in benchmarks or silent tests).
118
+ */
119
+ export declare class NullLogger implements Logger {
120
+ trace(): void;
121
+ debug(): void;
122
+ info(): void;
123
+ warn(): void;
124
+ error(): void;
125
+ fatal(): void;
126
+ }