@better-openclaw/db 1.0.24 → 1.0.30
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-C-ReM-az.cjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"schema-C-ReM-az.cjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import {\n\tboolean,\n\tindex,\n\tinteger,\n\tjsonb,\n\tpgTable,\n\ttext,\n\ttimestamp,\n\tuuid,\n} from \"drizzle-orm/pg-core\";\n\n// ── better-auth required tables ────────────────────────────────────────────────\n\nexport const user = pgTable(\"user\", {\n\tid: text(\"id\").primaryKey(),\n\tname: text(\"name\").notNull(),\n\temail: text(\"email\").notNull().unique(),\n\temailVerified: boolean(\"email_verified\").notNull(),\n\timage: text(\"image\"),\n\tcreatedAt: timestamp(\"created_at\").notNull(),\n\tupdatedAt: timestamp(\"updated_at\").notNull(),\n});\n\nexport const session = pgTable(\"session\", {\n\tid: text(\"id\").primaryKey(),\n\texpiresAt: timestamp(\"expires_at\").notNull(),\n\ttoken: text(\"token\").notNull().unique(),\n\tcreatedAt: timestamp(\"created_at\").notNull(),\n\tupdatedAt: timestamp(\"updated_at\").notNull(),\n\tipAddress: text(\"ip_address\"),\n\tuserAgent: text(\"user_agent\"),\n\tuserId: text(\"user_id\")\n\t\t.notNull()\n\t\t.references(() => user.id, { onDelete: \"cascade\" }),\n});\n\nexport const account = pgTable(\"account\", {\n\tid: text(\"id\").primaryKey(),\n\taccountId: text(\"account_id\").notNull(),\n\tproviderId: text(\"provider_id\").notNull(),\n\tuserId: text(\"user_id\")\n\t\t.notNull()\n\t\t.references(() => user.id, { onDelete: \"cascade\" }),\n\taccessToken: text(\"access_token\"),\n\trefreshToken: text(\"refresh_token\"),\n\tidToken: text(\"id_token\"),\n\taccessTokenExpiresAt: timestamp(\"access_token_expires_at\"),\n\trefreshTokenExpiresAt: timestamp(\"refresh_token_expires_at\"),\n\tscope: text(\"scope\"),\n\tpassword: text(\"password\"),\n\tcreatedAt: timestamp(\"created_at\").notNull(),\n\tupdatedAt: timestamp(\"updated_at\").notNull(),\n});\n\nexport const verification = pgTable(\"verification\", {\n\tid: text(\"id\").primaryKey(),\n\tidentifier: text(\"identifier\").notNull(),\n\tvalue: text(\"value\").notNull(),\n\texpiresAt: timestamp(\"expires_at\").notNull(),\n\tcreatedAt: timestamp(\"created_at\"),\n\tupdatedAt: timestamp(\"updated_at\"),\n});\n\n// ── App-specific tables ─────────────────────────────────────────────────────────\n\nexport const savedStack = pgTable(\"saved_stack\", {\n\tid: uuid(\"id\").primaryKey().defaultRandom(),\n\tuserId: text(\"user_id\")\n\t\t.notNull()\n\t\t.references(() => user.id, { onDelete: \"cascade\" }),\n\tname: text(\"name\").notNull(),\n\tdescription: text(\"description\"),\n\t/** Array of selected service IDs */\n\tservices: jsonb(\"services\").notNull().$type<string[]>().default([]),\n\t/** The full GenerationInput config stored as JSON */\n\tconfig: jsonb(\"config\").notNull().$type<Record<string, unknown>>().default({}),\n\tcreatedAt: timestamp(\"created_at\").notNull().defaultNow(),\n\tupdatedAt: timestamp(\"updated_at\").notNull().defaultNow(),\n});\n\nexport const favorite = pgTable(\"favorite\", {\n\tid: uuid(\"id\").primaryKey().defaultRandom(),\n\tuserId: text(\"user_id\")\n\t\t.notNull()\n\t\t.references(() => user.id, { onDelete: \"cascade\" }),\n\tstackId: uuid(\"stack_id\")\n\t\t.notNull()\n\t\t.references(() => savedStack.id, { onDelete: \"cascade\" }),\n\tcreatedAt: timestamp(\"created_at\").notNull().defaultNow(),\n});\n\n// ── Analytics ───────────────────────────────────────────────────────────────────\n\nexport const analyticsEvent = pgTable(\n\t\"analytics_event\",\n\t{\n\t\tid: uuid(\"id\").primaryKey().defaultRandom(),\n\t\tsource: text(\"source\").notNull(), // \"cli\" | \"web\" | \"api\" | \"mcp\"\n\t\tbuildMethod: text(\"build_method\").notNull(), // \"preset\" | \"custom\"\n\t\tpresetId: text(\"preset_id\"),\n\t\tservices: jsonb(\"services\").notNull().$type<string[]>(),\n\t\tskillPacks: jsonb(\"skill_packs\").notNull().$type<string[]>().default([]),\n\t\tserviceCount: integer(\"service_count\").notNull(),\n\t\tproxy: text(\"proxy\").notNull(),\n\t\tdeployment: text(\"deployment\").notNull(),\n\t\tdeploymentType: text(\"deployment_type\").notNull(),\n\t\tplatform: text(\"platform\").notNull(),\n\t\tgpu: boolean(\"gpu\").notNull().default(false),\n\t\tmonitoring: boolean(\"monitoring\").notNull().default(false),\n\t\thasDomain: boolean(\"has_domain\").notNull().default(false),\n\t\topenclawImage: text(\"openclaw_image\").notNull(),\n\t\testimatedMemoryMB: integer(\"estimated_memory_mb\").notNull(),\n\t\tcreatedAt: timestamp(\"created_at\").notNull().defaultNow(),\n\t},\n\t(table) => [\n\t\tindex(\"analytics_event_created_at_idx\").on(table.createdAt),\n\t\tindex(\"analytics_event_source_idx\").on(table.source),\n\t],\n);\n\nexport type User = typeof user.$inferSelect;\nexport type Session = typeof session.$inferSelect;\nexport type SavedStack = typeof savedStack.$inferSelect;\nexport type Favorite = typeof favorite.$inferSelect;\nexport type AnalyticsEvent = typeof analyticsEvent.$inferSelect;\nexport type NewAnalyticsEvent = typeof analyticsEvent.$inferInsert;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAa,QAAA,GAAA,oBAAA,SAAe,QAAQ;CACnC,KAAA,GAAA,oBAAA,MAAS,KAAK,CAAC,YAAY;CAC3B,OAAA,GAAA,oBAAA,MAAW,OAAO,CAAC,SAAS;CAC5B,QAAA,GAAA,oBAAA,MAAY,QAAQ,CAAC,SAAS,CAAC,QAAQ;CACvC,gBAAA,GAAA,oBAAA,SAAuB,iBAAiB,CAAC,SAAS;CAClD,QAAA,GAAA,oBAAA,MAAY,QAAQ;CACpB,YAAA,GAAA,oBAAA,WAAqB,aAAa,CAAC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;;;QAarB,oBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,QAAA,uBAAQ,kBAAA;;;;QASnB,oBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAIW,cAAA,uBAAc,kBAAA;;;;QAyB1B,oBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEW,IAAA,UAAc,IAAA,CAAK,YAAA;AAAA,KACnB,OAAA,UAAiB,OAAA,CAAQ,YAAA;AAAA,KACzB,UAAA,UAAoB,UAAA,CAAW,YAAA;AAAA,KAC/B,QAAA,UAAkB,QAAA,CAAS,YAAA;AAAA,KAC3B,cAAA,UAAwB,cAAA,CAAe,YAAA;AAAA,KACvC,iBAAA,UAA2B,cAAA,CAAe,YAAA"}
|
package/dist/schema.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.mts","names":[],"sources":["../src/schema.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"schema.d.mts","names":[],"sources":["../src/schema.ts"],"mappings":";;;;;;cAaa,IAAA,uBAAI,kBAAA;;;;Q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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAIW,cAAA,uBAAc,kBAAA;;;;QAyB1B,oBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEW,IAAA,UAAc,IAAA,CAAK,YAAA;AAAA,KACnB,OAAA,UAAiB,OAAA,CAAQ,YAAA;AAAA,KACzB,UAAA,UAAoB,UAAA,CAAW,YAAA;AAAA,KAC/B,QAAA,UAAkB,QAAA,CAAS,YAAA;AAAA,KAC3B,cAAA,UAAwB,cAAA,CAAe,YAAA;AAAA,KACvC,iBAAA,UAA2B,cAAA,CAAe,YAAA"}
|
package/dist/schema.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.mjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"schema.mjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import {\n\tboolean,\n\tindex,\n\tinteger,\n\tjsonb,\n\tpgTable,\n\ttext,\n\ttimestamp,\n\tuuid,\n} from \"drizzle-orm/pg-core\";\n\n// ── better-auth required tables ────────────────────────────────────────────────\n\nexport const user = pgTable(\"user\", {\n\tid: text(\"id\").primaryKey(),\n\tname: text(\"name\").notNull(),\n\temail: text(\"email\").notNull().unique(),\n\temailVerified: boolean(\"email_verified\").notNull(),\n\timage: text(\"image\"),\n\tcreatedAt: timestamp(\"created_at\").notNull(),\n\tupdatedAt: timestamp(\"updated_at\").notNull(),\n});\n\nexport const session = pgTable(\"session\", {\n\tid: text(\"id\").primaryKey(),\n\texpiresAt: timestamp(\"expires_at\").notNull(),\n\ttoken: text(\"token\").notNull().unique(),\n\tcreatedAt: timestamp(\"created_at\").notNull(),\n\tupdatedAt: timestamp(\"updated_at\").notNull(),\n\tipAddress: text(\"ip_address\"),\n\tuserAgent: text(\"user_agent\"),\n\tuserId: text(\"user_id\")\n\t\t.notNull()\n\t\t.references(() => user.id, { onDelete: \"cascade\" }),\n});\n\nexport const account = pgTable(\"account\", {\n\tid: text(\"id\").primaryKey(),\n\taccountId: text(\"account_id\").notNull(),\n\tproviderId: text(\"provider_id\").notNull(),\n\tuserId: text(\"user_id\")\n\t\t.notNull()\n\t\t.references(() => user.id, { onDelete: \"cascade\" }),\n\taccessToken: text(\"access_token\"),\n\trefreshToken: text(\"refresh_token\"),\n\tidToken: text(\"id_token\"),\n\taccessTokenExpiresAt: timestamp(\"access_token_expires_at\"),\n\trefreshTokenExpiresAt: timestamp(\"refresh_token_expires_at\"),\n\tscope: text(\"scope\"),\n\tpassword: text(\"password\"),\n\tcreatedAt: timestamp(\"created_at\").notNull(),\n\tupdatedAt: timestamp(\"updated_at\").notNull(),\n});\n\nexport const verification = pgTable(\"verification\", {\n\tid: text(\"id\").primaryKey(),\n\tidentifier: text(\"identifier\").notNull(),\n\tvalue: text(\"value\").notNull(),\n\texpiresAt: timestamp(\"expires_at\").notNull(),\n\tcreatedAt: timestamp(\"created_at\"),\n\tupdatedAt: timestamp(\"updated_at\"),\n});\n\n// ── App-specific tables ─────────────────────────────────────────────────────────\n\nexport const savedStack = pgTable(\"saved_stack\", {\n\tid: uuid(\"id\").primaryKey().defaultRandom(),\n\tuserId: text(\"user_id\")\n\t\t.notNull()\n\t\t.references(() => user.id, { onDelete: \"cascade\" }),\n\tname: text(\"name\").notNull(),\n\tdescription: text(\"description\"),\n\t/** Array of selected service IDs */\n\tservices: jsonb(\"services\").notNull().$type<string[]>().default([]),\n\t/** The full GenerationInput config stored as JSON */\n\tconfig: jsonb(\"config\").notNull().$type<Record<string, unknown>>().default({}),\n\tcreatedAt: timestamp(\"created_at\").notNull().defaultNow(),\n\tupdatedAt: timestamp(\"updated_at\").notNull().defaultNow(),\n});\n\nexport const favorite = pgTable(\"favorite\", {\n\tid: uuid(\"id\").primaryKey().defaultRandom(),\n\tuserId: text(\"user_id\")\n\t\t.notNull()\n\t\t.references(() => user.id, { onDelete: \"cascade\" }),\n\tstackId: uuid(\"stack_id\")\n\t\t.notNull()\n\t\t.references(() => savedStack.id, { onDelete: \"cascade\" }),\n\tcreatedAt: timestamp(\"created_at\").notNull().defaultNow(),\n});\n\n// ── Analytics ───────────────────────────────────────────────────────────────────\n\nexport const analyticsEvent = pgTable(\n\t\"analytics_event\",\n\t{\n\t\tid: uuid(\"id\").primaryKey().defaultRandom(),\n\t\tsource: text(\"source\").notNull(), // \"cli\" | \"web\" | \"api\" | \"mcp\"\n\t\tbuildMethod: text(\"build_method\").notNull(), // \"preset\" | \"custom\"\n\t\tpresetId: text(\"preset_id\"),\n\t\tservices: jsonb(\"services\").notNull().$type<string[]>(),\n\t\tskillPacks: jsonb(\"skill_packs\").notNull().$type<string[]>().default([]),\n\t\tserviceCount: integer(\"service_count\").notNull(),\n\t\tproxy: text(\"proxy\").notNull(),\n\t\tdeployment: text(\"deployment\").notNull(),\n\t\tdeploymentType: text(\"deployment_type\").notNull(),\n\t\tplatform: text(\"platform\").notNull(),\n\t\tgpu: boolean(\"gpu\").notNull().default(false),\n\t\tmonitoring: boolean(\"monitoring\").notNull().default(false),\n\t\thasDomain: boolean(\"has_domain\").notNull().default(false),\n\t\topenclawImage: text(\"openclaw_image\").notNull(),\n\t\testimatedMemoryMB: integer(\"estimated_memory_mb\").notNull(),\n\t\tcreatedAt: timestamp(\"created_at\").notNull().defaultNow(),\n\t},\n\t(table) => [\n\t\tindex(\"analytics_event_created_at_idx\").on(table.createdAt),\n\t\tindex(\"analytics_event_source_idx\").on(table.source),\n\t],\n);\n\nexport type User = typeof user.$inferSelect;\nexport type Session = typeof session.$inferSelect;\nexport type SavedStack = typeof savedStack.$inferSelect;\nexport type Favorite = typeof favorite.$inferSelect;\nexport type AnalyticsEvent = typeof analyticsEvent.$inferSelect;\nexport type NewAnalyticsEvent = typeof analyticsEvent.$inferInsert;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,OAAO,QAAQ,QAAQ;CACnC,IAAI,KAAK,KAAK,CAAC,YAAY;CAC3B,MAAM,KAAK,OAAO,CAAC,SAAS;CAC5B,OAAO,KAAK,QAAQ,CAAC,SAAS,CAAC,QAAQ;CACvC,eAAe,QAAQ,iBAAiB,CAAC,SAAS;CAClD,OAAO,KAAK,QAAQ;CACpB,WAAW,UAAU,aAAa,CAAC,SAAS;CAC5C,WAAW,UAAU,aAAa,CAAC,SAAS;CAC5C,CAAC;AAEF,MAAa,UAAU,QAAQ,WAAW;CACzC,IAAI,KAAK,KAAK,CAAC,YAAY;CAC3B,WAAW,UAAU,aAAa,CAAC,SAAS;CAC5C,OAAO,KAAK,QAAQ,CAAC,SAAS,CAAC,QAAQ;CACvC,WAAW,UAAU,aAAa,CAAC,SAAS;CAC5C,WAAW,UAAU,aAAa,CAAC,SAAS;CAC5C,WAAW,KAAK,aAAa;CAC7B,WAAW,KAAK,aAAa;CAC7B,QAAQ,KAAK,UAAU,CACrB,SAAS,CACT,iBAAiB,KAAK,IAAI,EAAE,UAAU,WAAW,CAAC;CACpD,CAAC;AAEF,MAAa,UAAU,QAAQ,WAAW;CACzC,IAAI,KAAK,KAAK,CAAC,YAAY;CAC3B,WAAW,KAAK,aAAa,CAAC,SAAS;CACvC,YAAY,KAAK,cAAc,CAAC,SAAS;CACzC,QAAQ,KAAK,UAAU,CACrB,SAAS,CACT,iBAAiB,KAAK,IAAI,EAAE,UAAU,WAAW,CAAC;CACpD,aAAa,KAAK,eAAe;CACjC,cAAc,KAAK,gBAAgB;CACnC,SAAS,KAAK,WAAW;CACzB,sBAAsB,UAAU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,MAAa,iBAAiB,QAC7B,mBACA;CACC,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC,eAAe;CAC3C,QAAQ,KAAK,SAAS,CAAC,SAAS;CAChC,aAAa,KAAK,eAAe,CAAC,SAAS;CAC3C,UAAU,KAAK,YAAY;CAC3B,UAAU,MAAM,WAAW,CAAC,SAAS,CAAC,OAAiB;CACvD,YAAY,MAAM,cAAc,CAAC,SAAS,CAAC,OAAiB,CAAC,QAAQ,EAAE,CAAC;CACxE,cAAc,QAAQ,gBAAgB,CAAC,SAAS;CAChD,OAAO,KAAK,QAAQ,CAAC,SAAS;CAC9B,YAAY,KAAK,aAAa,CAAC,SAAS;CACxC,gBAAgB,KAAK,kBAAkB,CAAC,SAAS;CACjD,UAAU,KAAK,WAAW,CAAC,SAAS;CACpC,KAAK,QAAQ,MAAM,CAAC,SAAS,CAAC,QAAQ,MAAM;CAC5C,YAAY,QAAQ,aAAa,CAAC,SAAS,CAAC,QAAQ,MAAM;CAC1D,WAAW,QAAQ,aAAa,CAAC,SAAS,CAAC,QAAQ,MAAM;CACzD,eAAe,KAAK,iBAAiB,CAAC,SAAS;CAC/C,mBAAmB,QAAQ,sBAAsB,CAAC,SAAS;CAC3D,WAAW,UAAU,aAAa,CAAC,SAAS,CAAC,YAAY;CACzD,GACA,UAAU,CACV,MAAM,iCAAiC,CAAC,GAAG,MAAM,UAAU,EAC3D,MAAM,6BAA6B,CAAC,GAAG,MAAM,OAAO,CACpD,CACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-openclaw/db",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared database client and schema for better-openclaw",
|
|
6
6
|
"author": "bidew.io <bachir@bidew.io>",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"postgres": "^3.4.8"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/node": "^25.3.
|
|
52
|
+
"@types/node": "^25.3.5",
|
|
53
53
|
"drizzle-kit": "^0.31.9",
|
|
54
|
-
"@biomejs/biome": "^2.4.
|
|
55
|
-
"tsdown": "^0.21.
|
|
54
|
+
"@biomejs/biome": "^2.4.6",
|
|
55
|
+
"tsdown": "^0.21.1",
|
|
56
56
|
"typescript": "^5.9.3",
|
|
57
57
|
"vitest": "^4.0.18"
|
|
58
58
|
}
|
package/src/schema.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
boolean,
|
|
3
|
+
index,
|
|
4
|
+
integer,
|
|
5
|
+
jsonb,
|
|
6
|
+
pgTable,
|
|
7
|
+
text,
|
|
8
|
+
timestamp,
|
|
9
|
+
uuid,
|
|
10
|
+
} from "drizzle-orm/pg-core";
|
|
2
11
|
|
|
3
12
|
// ── better-auth required tables ────────────────────────────────────────────────
|
|
4
13
|
|