@elizaos/plugin-sql 2.0.0-alpha.8 → 2.0.0-beta.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.
Files changed (93) hide show
  1. package/README.md +24 -20
  2. package/package.json +79 -74
  3. package/src/dist/base.d.ts +1152 -0
  4. package/src/dist/browser/index.browser.d.ts +2 -0
  5. package/{dist → src/dist}/browser/index.browser.js +7492 -5015
  6. package/src/dist/browser/index.browser.js.map +72 -0
  7. package/src/dist/browser/index.d.ts +2 -0
  8. package/src/dist/cjs/index.d.ts +2 -0
  9. package/src/dist/cjs/index.node.cjs +9154 -0
  10. package/src/dist/cjs/index.node.cjs.map +70 -0
  11. package/src/dist/cjs/index.node.d.cts +2 -0
  12. package/src/dist/connector-credential-store.d.ts +48 -0
  13. package/src/dist/drizzle/index.d.ts +1 -0
  14. package/src/dist/drizzle/index.js +1 -0
  15. package/src/dist/index.d.ts +4 -0
  16. package/src/dist/index.js +2 -0
  17. package/src/dist/index.node.d.ts +20 -0
  18. package/src/dist/migration-service.d.ts +17 -0
  19. package/src/dist/migrations.d.ts +15 -0
  20. package/src/dist/node/index.d.ts +2 -0
  21. package/src/dist/node/index.node.d.ts +2 -0
  22. package/src/dist/node/index.node.js +9175 -0
  23. package/src/dist/node/index.node.js.map +70 -0
  24. package/src/dist/pg/adapter.d.ts +42 -0
  25. package/src/dist/pg/manager.d.ts +17 -0
  26. package/src/dist/pglite/adapter.d.ts +24 -0
  27. package/src/dist/pglite/errors.d.ts +20 -0
  28. package/src/dist/pglite/manager.d.ts +32 -0
  29. package/src/dist/rls.d.ts +13 -0
  30. package/src/dist/runtime-migrator/crypto-utils.d.ts +25 -0
  31. package/src/dist/runtime-migrator/drizzle-adapters/database-introspector.d.ts +58 -0
  32. package/src/dist/runtime-migrator/drizzle-adapters/diff-calculator.d.ts +77 -0
  33. package/src/dist/runtime-migrator/drizzle-adapters/snapshot-generator.d.ts +21 -0
  34. package/src/dist/runtime-migrator/drizzle-adapters/sql-generator.d.ts +38 -0
  35. package/src/dist/runtime-migrator/extension-manager.d.ts +6 -0
  36. package/src/dist/runtime-migrator/index.d.ts +8 -0
  37. package/src/dist/runtime-migrator/runtime-migrator.d.ts +95 -0
  38. package/src/dist/runtime-migrator/schema-transformer.d.ts +18 -0
  39. package/src/dist/runtime-migrator/storage/journal-storage.d.ts +10 -0
  40. package/src/dist/runtime-migrator/storage/migration-tracker.d.ts +13 -0
  41. package/src/dist/runtime-migrator/storage/snapshot-storage.d.ts +9 -0
  42. package/src/dist/runtime-migrator/types.d.ts +157 -0
  43. package/src/dist/schema/agent.d.ts +344 -0
  44. package/src/dist/schema/approvalRequests.d.ts +277 -0
  45. package/src/dist/schema/authAuditEvent.d.ts +153 -0
  46. package/src/dist/schema/authBootstrapJti.d.ts +49 -0
  47. package/src/dist/schema/authIdentity.d.ts +121 -0
  48. package/src/dist/schema/authOwnerBinding.d.ts +168 -0
  49. package/src/dist/schema/authOwnerLoginToken.d.ts +122 -0
  50. package/src/dist/schema/authSession.d.ts +225 -0
  51. package/src/dist/schema/cache.d.ts +97 -0
  52. package/src/dist/schema/channel.d.ts +177 -0
  53. package/src/dist/schema/channelParticipant.d.ts +41 -0
  54. package/src/dist/schema/component.d.ts +163 -0
  55. package/src/dist/schema/connectorAccounts.d.ts +981 -0
  56. package/src/dist/schema/embedding.d.ts +204 -0
  57. package/src/dist/schema/entity.d.ts +125 -0
  58. package/src/dist/schema/entityIdentity.d.ts +577 -0
  59. package/src/dist/schema/index.d.ts +35 -0
  60. package/src/dist/schema/index.js +1 -0
  61. package/src/dist/schema/log.d.ts +114 -0
  62. package/src/dist/schema/longTermMemories.d.ts +254 -0
  63. package/src/dist/schema/memory.d.ts +185 -0
  64. package/src/dist/schema/memoryAccessLogs.d.ts +109 -0
  65. package/src/dist/schema/message.d.ts +194 -0
  66. package/src/dist/schema/messageServer.d.ts +126 -0
  67. package/src/dist/schema/messageServerAgent.d.ts +41 -0
  68. package/src/dist/schema/pairingAllowlist.d.ts +113 -0
  69. package/src/dist/schema/pairingRequest.d.ts +147 -0
  70. package/src/dist/schema/participant.d.ts +114 -0
  71. package/src/dist/schema/relationship.d.ts +156 -0
  72. package/src/dist/schema/room.d.ts +195 -0
  73. package/src/dist/schema/server.d.ts +64 -0
  74. package/src/dist/schema/sessionSummaries.d.ts +273 -0
  75. package/src/dist/schema/tasks.d.ts +225 -0
  76. package/src/dist/schema/types.d.ts +68 -0
  77. package/src/dist/schema/world.d.ts +114 -0
  78. package/src/dist/services/advanced-memory-storage.d.ts +36 -0
  79. package/src/dist/stores/connectorAccount.store.d.ts +64 -0
  80. package/src/dist/stores/types.d.ts +25 -0
  81. package/src/dist/types.d.ts +13 -0
  82. package/src/dist/utils/string-to-uuid.d.ts +2 -0
  83. package/src/dist/utils.d.ts +4 -0
  84. package/src/dist/utils.node.d.ts +4 -0
  85. package/LICENSE +0 -21
  86. package/dist/browser/index.browser.js.map +0 -69
  87. package/dist/browser/index.d.ts +0 -2
  88. package/dist/browser/tsconfig.build.tsbuildinfo +0 -1
  89. package/dist/index.d.ts +0 -2
  90. package/dist/node/index.d.ts +0 -2
  91. package/dist/node/index.node.js +0 -21203
  92. package/dist/node/index.node.js.map +0 -187
  93. package/dist/node/tsconfig.build.node.tsbuildinfo +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DrizzleDatabaseAdapter
2
2
 
3
- A PostgreSQL database adapter built with Drizzle ORM for the ElizaOS ecosystem.
3
+ A PostgreSQL database adapter built with Drizzle ORM for the elizaOS ecosystem.
4
4
 
5
5
  ## Installation
6
6
 
@@ -56,26 +56,28 @@ The plugin uses a structured schema with the following main tables:
56
56
  - **Cache**: Provides a caching mechanism for frequently accessed data
57
57
  - **World**: Manages world settings and configurations
58
58
 
59
- Each table is defined using Drizzle ORM schema definitions in the `src/schema` directory. The schema is designed to support the ElizaOS ecosystem's requirements for agent-based systems.
59
+ Each table is defined using Drizzle ORM schema definitions in the `src/schema` directory. The schema is designed to support the elizaOS ecosystem's requirements for agent-based systems.
60
60
 
61
61
  ## Usage
62
62
 
63
- The adapter is typically used as part of the ElizaOS runtime:
63
+ The adapter is typically used as part of the elizaOS runtime:
64
64
 
65
65
  ```typescript
66
66
  async function findDatabaseAdapter(runtime: IAgentRuntime) {
67
67
  let adapter = runtime;
68
68
 
69
69
  if (!adapter) {
70
- const drizzleAdapterPlugin = await import('@elizaos/plugin-sql');
70
+ const drizzleAdapterPlugin = await import("@elizaos/plugin-sql");
71
71
  const drizzleAdapterPluginDefault = drizzleAdapterPlugin.default;
72
72
  adapter = drizzleAdapterPluginDefault.adapter;
73
73
  if (!adapter) {
74
- throw new Error('Internal error: No database adapter found for default plugin-sql');
74
+ throw new Error(
75
+ "Internal error: No database adapter found for default plugin-sql",
76
+ );
75
77
  }
76
78
  } else if (!adapter) {
77
79
  throw new Error(
78
- 'Multiple database adapters found. You must have no more than one. Adjust your plugins configuration.'
80
+ "Multiple database adapters found. You must have no more than one. Adjust your plugins configuration.",
79
81
  );
80
82
  }
81
83
 
@@ -130,7 +132,7 @@ Default pool configuration:
130
132
 
131
133
  ## Migration Support
132
134
 
133
- ElizaOS v1.0.0 introduces **dynamic runtime migrations** - automatic schema management that runs at startup without manual intervention. Plugins can define their schemas and the system handles all migrations automatically.
135
+ elizaOS v1.0.0 introduces **dynamic runtime migrations** - automatic schema management that runs at startup without manual intervention. Plugins can define their schemas and the system handles all migrations automatically.
134
136
 
135
137
  ### TLDR: What Changed?
136
138
 
@@ -151,16 +153,16 @@ ElizaOS v1.0.0 introduces **dynamic runtime migrations** - automatic schema mana
151
153
 
152
154
  ```typescript
153
155
  // In your plugin's schema.ts
154
- import { pgTable, text, uuid } from 'drizzle-orm/pg-core';
156
+ import { pgTable, text, uuid } from "drizzle-orm/pg-core";
155
157
 
156
- export const myTable = pgTable('my_table', {
157
- id: uuid('id').primaryKey(),
158
- name: text('name').notNull(),
158
+ export const myTable = pgTable("my_table", {
159
+ id: uuid("id").primaryKey(),
160
+ name: text("name").notNull(),
159
161
  });
160
162
 
161
163
  // Export schema in your plugin
162
164
  export const plugin = {
163
- name: '@your-org/plugin-name',
165
+ name: "@your-org/plugin-name",
164
166
  schema: schema, // Your Drizzle schema object
165
167
  // ... rest of plugin
166
168
  };
@@ -244,10 +246,10 @@ Plugins automatically get namespaced schemas for isolation:
244
246
  To use a custom schema:
245
247
 
246
248
  ```typescript
247
- import { pgSchema } from 'drizzle-orm/pg-core';
249
+ import { pgSchema } from "drizzle-orm/pg-core";
248
250
 
249
- const mySchema = pgSchema('my_custom_schema');
250
- export const myTable = mySchema.table('my_table', {
251
+ const mySchema = pgSchema("my_custom_schema");
252
+ export const myTable = mySchema.table("my_table", {
251
253
  // ... columns
252
254
  });
253
255
  ```
@@ -258,7 +260,7 @@ Check migration status:
258
260
 
259
261
  ```typescript
260
262
  const migrator = migrationService.getMigrator();
261
- const status = await migrator.getStatus('@your-org/plugin-name');
263
+ const status = await migrator.getStatus("@your-org/plugin-name");
262
264
  console.log(status);
263
265
  // {
264
266
  // hasRun: true,
@@ -271,9 +273,9 @@ console.log(status);
271
273
  Preview changes without applying:
272
274
 
273
275
  ```typescript
274
- const check = await migrator.checkMigration('@your-org/plugin-name', schema);
276
+ const check = await migrator.checkMigration("@your-org/plugin-name", schema);
275
277
  if (check?.hasDataLoss) {
276
- console.log('Warning: Destructive changes:', check.warnings);
278
+ console.log("Warning: Destructive changes:", check.warnings);
277
279
  }
278
280
  ```
279
281
 
@@ -339,7 +341,7 @@ This pattern is particularly important in monorepo setups or when the package is
339
341
 
340
342
  ```typescript
341
343
  // Example of the singleton pattern implementation
342
- const GLOBAL_SINGLETONS = Symbol.for('@elizaos/plugin-sql/global-singletons');
344
+ const GLOBAL_SINGLETONS = Symbol.for("@elizaos/plugin-sql/global-singletons");
343
345
 
344
346
  // Store managers in a global symbol registry
345
347
  if (!globalSymbols[GLOBAL_SINGLETONS]) {
@@ -348,7 +350,9 @@ if (!globalSymbols[GLOBAL_SINGLETONS]) {
348
350
 
349
351
  // Reuse existing managers or create new ones when needed
350
352
  if (!globalSingletons.postgresConnectionManager) {
351
- globalSingletons.postgresConnectionManager = new PostgresConnectionManager(config.postgresUrl);
353
+ globalSingletons.postgresConnectionManager = new PostgresConnectionManager(
354
+ config.postgresUrl,
355
+ );
352
356
  }
353
357
  ```
354
358
 
package/package.json CHANGED
@@ -1,97 +1,102 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-sql",
3
- "version": "2.0.0-alpha.8",
3
+ "version": "2.0.0-beta.1",
4
+ "description": "",
4
5
  "type": "module",
5
- "main": "dist/node/index.node.js",
6
- "module": "dist/node/index.node.js",
7
- "types": "dist/index.d.ts",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/elizaos-plugins/plugin-sql"
11
- },
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "browser": "dist/browser/index.browser.js",
6
+ "main": "src/dist/index.js",
7
+ "types": "src/dist/index.d.ts",
16
8
  "exports": {
17
9
  "./package.json": "./package.json",
18
10
  ".": {
19
- "types": "./types/index.d.ts",
11
+ "types": "./src/dist/index.node.d.ts",
12
+ "bun": {
13
+ "types": "./src/index.ts",
14
+ "import": "./src/index.ts",
15
+ "default": "./src/index.ts"
16
+ },
20
17
  "browser": {
21
- "types": "./dist/browser/index.d.ts",
22
- "import": "./dist/browser/index.browser.js",
23
- "default": "./dist/browser/index.browser.js"
18
+ "types": "./src/dist/index.d.ts",
19
+ "import": "./src/dist/browser/index.browser.js",
20
+ "default": "./src/dist/browser/index.browser.js"
24
21
  },
25
22
  "node": {
26
- "types": "./dist/node/index.d.ts",
27
- "import": "./dist/node/index.node.js",
28
- "default": "./dist/node/index.node.js"
23
+ "types": "./src/dist/index.d.ts",
24
+ "import": "./src/dist/node/index.node.js",
25
+ "default": "./src/dist/node/index.node.js"
29
26
  },
27
+ "import": "./src/dist/index.js",
28
+ "default": "./src/dist/index.js"
29
+ },
30
+ "./drizzle": {
31
+ "types": "./src/dist/drizzle/index.d.ts",
30
32
  "bun": {
31
- "types": "./dist/node/index.d.ts",
32
- "default": "./dist/node/index.node.js"
33
+ "types": "./src/drizzle/index.ts",
34
+ "import": "./src/drizzle/index.ts",
35
+ "default": "./src/drizzle/index.ts"
33
36
  },
34
- "default": "./dist/node/index.node.js"
35
- },
36
- "./node": {
37
- "types": "./dist/node/index.d.ts",
38
- "import": "./dist/node/index.node.js",
39
- "default": "./dist/node/index.node.js"
37
+ "import": "./src/dist/drizzle/index.js",
38
+ "default": "./src/dist/drizzle/index.js"
40
39
  },
41
- "./browser": {
42
- "types": "./dist/browser/index.d.ts",
43
- "import": "./dist/browser/index.browser.js",
44
- "default": "./dist/browser/index.browser.js"
40
+ "./schema": {
41
+ "types": "./src/dist/schema/index.d.ts",
42
+ "bun": {
43
+ "types": "./src/schema/index.ts",
44
+ "import": "./src/schema/index.ts",
45
+ "default": "./src/schema/index.ts"
46
+ },
47
+ "import": "./src/dist/schema/index.js",
48
+ "default": "./src/dist/schema/index.js"
45
49
  }
46
50
  },
47
- "sideEffects": false,
48
51
  "files": [
49
- "dist",
50
- "drizzle",
51
- "types"
52
+ "src/dist",
53
+ "README.md",
54
+ "dist"
52
55
  ],
56
+ "keywords": [],
57
+ "author": "elizaOS",
58
+ "license": "MIT",
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "https://github.com/elizaos-plugins/plugin-sql"
62
+ },
63
+ "scripts": {
64
+ "build": "cd src && bun run build.ts",
65
+ "dev": "cd src && bun --hot build.ts",
66
+ "test": "cd src && vitest run",
67
+ "typecheck": "tsc --noEmit -p src/tsconfig.json",
68
+ "lint": "cd src && bun run lint",
69
+ "lint:check": "cd src && bun run lint:check",
70
+ "clean": "rm -rf src/dist .turbo",
71
+ "format": "cd src && bun run format",
72
+ "format:check": "cd src && bun run format:check",
73
+ "test:e2e": "node ../../packages/app-core/scripts/run-local-plugin-live-smoke.mjs",
74
+ "test:live": "bun run test:e2e"
75
+ },
53
76
  "dependencies": {
54
- "@electric-sql/pglite": "^0.3.3",
55
- "@elizaos/core": "workspace:*",
56
- "@neondatabase/serverless": "^1.0.2",
57
- "dotenv": "^17.2.3",
58
- "drizzle-kit": "^0.31.1",
59
- "drizzle-orm": "^0.45.0",
60
- "pg": "^8.13.3",
61
- "uuid": "^13.0.0",
62
- "ws": "^8.19.0"
77
+ "@electric-sql/pglite": "^0.4.0",
78
+ "@neondatabase/serverless": "^1.1.0",
79
+ "drizzle-orm": "0.45.2",
80
+ "pg": "^8.16.3",
81
+ "uuid": "^14.0.0",
82
+ "ws": "^8.18.3"
63
83
  },
64
84
  "devDependencies": {
65
- "@elizaos/config": "workspace:*",
66
- "@eslint/js": "^9.28.0",
67
- "@types/node": "^25.0.9",
68
- "@types/pg": "^8.15.6",
69
- "eslint": "^9.28.0",
70
- "prettier": "^3.7.4",
71
- "typescript": "^5.9.3",
72
- "typescript-eslint": "^8.48.1"
85
+ "@biomejs/biome": "^2.4.14",
86
+ "@types/bun": "^1.3.5",
87
+ "@types/node": "^25.0.3",
88
+ "@types/pg": "^8.15.2",
89
+ "@types/ws": "^8.18.1",
90
+ "dotenv": "^17.2.3",
91
+ "drizzle-kit": "^0.31.8",
92
+ "typescript": "^6.0.3",
93
+ "vitest": "^4.0.0"
73
94
  },
74
- "scripts": {
75
- "build": "bun run build.ts && tsc -p tsconfig.build.json && tsc -p tsconfig.build.node.json",
76
- "dev": "bun run build.ts --watch",
77
- "migrate:generate": "drizzle-kit generate",
78
- "migrate": "drizzle-kit migrate",
79
- "lint": "eslint . && prettier --write .",
80
- "lint:check": "eslint .",
81
- "clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json *.tsbuildinfo",
82
- "format": "prettier --write .",
83
- "format:check": "prettier --check ./src",
84
- "test": "bun run test:unit && bun run test:integration",
85
- "test:unit": "bun test src/__tests__/unit/",
86
- "test:integration": "bash scripts/run-integration-tests.sh",
87
- "test:integration:postgres": "bash scripts/run-integration-tests.sh --postgres",
88
- "test:migration": "bun test src/__tests__/migration/",
89
- "test:migration:postgres": "bun test src/__tests__/migration/ --serial",
90
- "test:e2e:upgrade": "bash src/__tests__/migration/e2e/run-upgrade-test.sh",
91
- "test:watch": "bun test --watch",
92
- "test:coverage": "bun test --coverage",
93
- "build:clean": "rm -rf dist",
94
- "lint:fix": "eslint . --fix"
95
+ "peerDependencies": {
96
+ "@elizaos/core": "2.0.0-beta.1"
95
97
  },
96
- "gitHead": "255e37c0e4a76da0b776219db5ebb9dadf20e89f"
98
+ "gitHead": "05d4ca11d769db8c7f54a722ee24b2ce2b951543",
99
+ "publishConfig": {
100
+ "access": "public"
101
+ }
97
102
  }