@objectstack/driver-memory 0.1.1 → 0.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @objectstack/driver-memory
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @objectstack/spec@1.0.0
9
+
10
+ ## 0.2.0
11
+
12
+ ### Minor Changes
13
+
14
+ - Initial release of ObjectStack Protocol & Specification packages
15
+
16
+ This is the first public release of the ObjectStack ecosystem, providing:
17
+
18
+ - Core protocol definitions and TypeScript types
19
+ - ObjectQL query language and runtime
20
+ - Memory driver for in-memory data storage
21
+ - Client library for interacting with ObjectStack
22
+ - Hono server plugin for REST API endpoints
23
+ - Complete JSON schema generation for all specifications
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies
28
+ - @objectstack/spec@0.2.0
29
+
3
30
  ## 0.1.1
4
31
 
5
32
  ### Patch Changes
@@ -1,3 +1,3 @@
1
- import { ObjectStackManifest } from '@objectstack/spec';
1
+ import { ObjectStackManifest } from '@objectstack/spec/system';
2
2
  declare const MemoryDriverPlugin: ObjectStackManifest;
3
3
  export default MemoryDriverPlugin;
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  const MemoryDriverPlugin = {
4
2
  id: 'com.objectstack.driver.memory',
5
3
  name: 'In-Memory Driver',
@@ -21,4 +19,4 @@ const MemoryDriverPlugin = {
21
19
  // For now, we register via code (src/index.ts)
22
20
  }
23
21
  };
24
- exports.default = MemoryDriverPlugin;
22
+ export default MemoryDriverPlugin;
package/dist/src/index.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InMemoryDriver = void 0;
4
- const memory_driver_1 = require("./memory-driver");
5
- Object.defineProperty(exports, "InMemoryDriver", { enumerable: true, get: function () { return memory_driver_1.InMemoryDriver; } });
1
+ import { InMemoryDriver } from './memory-driver';
2
+ export { InMemoryDriver }; // Export class for direct usage
6
3
  // Note: In a real environment, you would import these from @objectstack/spec
7
4
  // But distinct PluginDefinition interface might not be strictly defined in schema yet,
8
5
  // usually it mimics the Manifest structure + runtime hooks.
@@ -10,7 +7,7 @@ Object.defineProperty(exports, "InMemoryDriver", { enumerable: true, get: functi
10
7
  // In plugin-bi it imported: import { PluginDefinition, PluginContextData } from '@objectstack/spec';
11
8
  // Let's rely on the environment being set up like plugin-bi.
12
9
  // If types are missing, this is just an example file.
13
- exports.default = {
10
+ export default {
14
11
  id: 'com.objectstack.driver.memory',
15
12
  version: '1.0.0',
16
13
  onEnable: async (context) => {
@@ -19,7 +16,7 @@ exports.default = {
19
16
  // Simulate driver registration
20
17
  // This assumes the runtime exposes a 'drivers' registry
21
18
  if (context.drivers) {
22
- const driver = new memory_driver_1.InMemoryDriver();
19
+ const driver = new InMemoryDriver();
23
20
  context.drivers.register(driver);
24
21
  logger.info(`[Memory Driver] Registered driver: ${driver.name}`);
25
22
  }
@@ -1,4 +1,5 @@
1
- import { DriverInterface, DriverOptions, QueryInput } from '@objectstack/spec';
1
+ import { QueryInput } from '@objectstack/spec/data';
2
+ import { DriverInterface, DriverOptions } from '@objectstack/spec/system';
2
3
  /**
3
4
  * Example: In-Memory Driver
4
5
  *
@@ -11,6 +12,12 @@ export declare class InMemoryDriver implements DriverInterface {
11
12
  install(ctx: any): void;
12
13
  supports: {
13
14
  transactions: boolean;
15
+ queryFilters: boolean;
16
+ queryAggregations: boolean;
17
+ querySorting: boolean;
18
+ queryPagination: boolean;
19
+ queryWindowFunctions: boolean;
20
+ querySubqueries: boolean;
14
21
  joins: boolean;
15
22
  fullTextSearch: boolean;
16
23
  jsonFields: boolean;
@@ -1,22 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InMemoryDriver = void 0;
4
1
  /**
5
2
  * Example: In-Memory Driver
6
3
  *
7
4
  * A minimal reference implementation of the ObjectStack Driver Protocol.
8
5
  * This driver stores data in a simple JavaScript object (Heap).
9
6
  */
10
- class InMemoryDriver {
7
+ export class InMemoryDriver {
11
8
  constructor() {
12
9
  this.name = 'in-memory-driver';
13
10
  this.version = '0.0.1';
14
11
  this.supports = {
12
+ // Transaction & Connection Management
15
13
  transactions: false,
16
- joins: false,
17
- fullTextSearch: false,
18
- jsonFields: true,
19
- arrayFields: true,
14
+ // Query Operations
15
+ queryFilters: false, // TODO: Not implemented - basic find() doesn't handle filters
16
+ queryAggregations: false, // TODO: Not implemented - count() only returns total
17
+ querySorting: false, // TODO: Not implemented - find() doesn't handle sorting
18
+ queryPagination: true, // Basic pagination via 'top' is implemented
19
+ queryWindowFunctions: false, // TODO: Not implemented
20
+ querySubqueries: false, // TODO: Not implemented
21
+ joins: false, // TODO: Not implemented
22
+ // Advanced Features
23
+ fullTextSearch: false, // TODO: Not implemented
24
+ jsonFields: true, // Native JS object support
25
+ arrayFields: true, // Native JS array support
20
26
  };
21
27
  /**
22
28
  * The "Database": A map of TableName -> Array of Records
@@ -68,6 +74,7 @@ class InMemoryDriver {
68
74
  }
69
75
  async create(object, data, options) {
70
76
  const table = this.getTable(object);
77
+ // COMPATIBILITY: Driver must return 'id' as string
71
78
  const newRecord = {
72
79
  id: this.generateId(),
73
80
  ...data,
@@ -146,4 +153,3 @@ class InMemoryDriver {
146
153
  return Math.random().toString(36).substring(2, 15);
147
154
  }
148
155
  }
149
- exports.InMemoryDriver = InMemoryDriver;
@@ -1,4 +1,4 @@
1
- import { ObjectStackManifest } from '@objectstack/spec';
1
+ import { ObjectStackManifest } from '@objectstack/spec/system';
2
2
 
3
3
  const MemoryDriverPlugin: ObjectStackManifest = {
4
4
  id: 'com.objectstack.driver.memory',
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@objectstack/driver-memory",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "In-Memory Driver for ObjectStack (Reference Implementation)",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
7
7
  "dependencies": {
8
- "@objectstack/spec": "0.1.2"
8
+ "@objectstack/spec": "0.3.0"
9
9
  },
10
10
  "devDependencies": {
11
11
  "typescript": "^5.0.0"
@@ -1,9 +1,5 @@
1
- import {
2
- DriverInterface,
3
- DriverOptions,
4
- QueryAST,
5
- QueryInput
6
- } from '@objectstack/spec';
1
+ import { QueryAST, QueryInput } from '@objectstack/spec/data';
2
+ import { DriverInterface, DriverOptions } from '@objectstack/spec/system';
7
3
 
8
4
  /**
9
5
  * Example: In-Memory Driver
@@ -23,11 +19,22 @@ export class InMemoryDriver implements DriverInterface {
23
19
  }
24
20
 
25
21
  supports = {
22
+ // Transaction & Connection Management
26
23
  transactions: false,
27
- joins: false,
28
- fullTextSearch: false,
29
- jsonFields: true,
30
- arrayFields: true,
24
+
25
+ // Query Operations
26
+ queryFilters: false, // TODO: Not implemented - basic find() doesn't handle filters
27
+ queryAggregations: false, // TODO: Not implemented - count() only returns total
28
+ querySorting: false, // TODO: Not implemented - find() doesn't handle sorting
29
+ queryPagination: true, // Basic pagination via 'top' is implemented
30
+ queryWindowFunctions: false, // TODO: Not implemented
31
+ querySubqueries: false, // TODO: Not implemented
32
+ joins: false, // TODO: Not implemented
33
+
34
+ // Advanced Features
35
+ fullTextSearch: false, // TODO: Not implemented
36
+ jsonFields: true, // Native JS object support
37
+ arrayFields: true, // Native JS array support
31
38
  };
32
39
 
33
40
  /**
@@ -87,6 +94,7 @@ export class InMemoryDriver implements DriverInterface {
87
94
  async create(object: string, data: Record<string, any>, options?: DriverOptions) {
88
95
  const table = this.getTable(object);
89
96
 
97
+ // COMPATIBILITY: Driver must return 'id' as string
90
98
  const newRecord = {
91
99
  id: this.generateId(),
92
100
  ...data,
package/tsconfig.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "ES2020",
4
- "module": "commonjs",
4
+ "module": "ES2020",
5
+ "moduleResolution": "bundler",
5
6
  "declaration": true,
6
7
  "outDir": "./dist",
7
8
  "strict": true,