@better-openclaw/db 1.0.0 → 1.0.24

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/schema.d.mts CHANGED
@@ -2,7 +2,7 @@ import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
2
2
 
3
3
  //#region src/schema.d.ts
4
4
  declare namespace schema_d_exports {
5
- export { Favorite, SavedStack, Session, User, account, favorite, savedStack, session, user, verification };
5
+ export { AnalyticsEvent, Favorite, NewAnalyticsEvent, SavedStack, Session, User, account, analyticsEvent, favorite, savedStack, session, user, verification };
6
6
  }
7
7
  declare const user: drizzle_orm_pg_core0.PgTableWithColumns<{
8
8
  name: "user";
@@ -832,10 +832,312 @@ declare const favorite: drizzle_orm_pg_core0.PgTableWithColumns<{
832
832
  };
833
833
  dialect: "pg";
834
834
  }>;
835
+ declare const analyticsEvent: drizzle_orm_pg_core0.PgTableWithColumns<{
836
+ name: "analytics_event";
837
+ schema: undefined;
838
+ columns: {
839
+ id: drizzle_orm_pg_core0.PgColumn<{
840
+ name: "id";
841
+ tableName: "analytics_event";
842
+ dataType: "string";
843
+ columnType: "PgUUID";
844
+ data: string;
845
+ driverParam: string;
846
+ notNull: true;
847
+ hasDefault: true;
848
+ isPrimaryKey: true;
849
+ isAutoincrement: false;
850
+ hasRuntimeDefault: false;
851
+ enumValues: undefined;
852
+ baseColumn: never;
853
+ identity: undefined;
854
+ generated: undefined;
855
+ }, {}, {}>;
856
+ source: drizzle_orm_pg_core0.PgColumn<{
857
+ name: "source";
858
+ tableName: "analytics_event";
859
+ dataType: "string";
860
+ columnType: "PgText";
861
+ data: string;
862
+ driverParam: string;
863
+ notNull: true;
864
+ hasDefault: false;
865
+ isPrimaryKey: false;
866
+ isAutoincrement: false;
867
+ hasRuntimeDefault: false;
868
+ enumValues: [string, ...string[]];
869
+ baseColumn: never;
870
+ identity: undefined;
871
+ generated: undefined;
872
+ }, {}, {}>;
873
+ buildMethod: drizzle_orm_pg_core0.PgColumn<{
874
+ name: "build_method";
875
+ tableName: "analytics_event";
876
+ dataType: "string";
877
+ columnType: "PgText";
878
+ data: string;
879
+ driverParam: string;
880
+ notNull: true;
881
+ hasDefault: false;
882
+ isPrimaryKey: false;
883
+ isAutoincrement: false;
884
+ hasRuntimeDefault: false;
885
+ enumValues: [string, ...string[]];
886
+ baseColumn: never;
887
+ identity: undefined;
888
+ generated: undefined;
889
+ }, {}, {}>;
890
+ presetId: drizzle_orm_pg_core0.PgColumn<{
891
+ name: "preset_id";
892
+ tableName: "analytics_event";
893
+ dataType: "string";
894
+ columnType: "PgText";
895
+ data: string;
896
+ driverParam: string;
897
+ notNull: false;
898
+ hasDefault: false;
899
+ isPrimaryKey: false;
900
+ isAutoincrement: false;
901
+ hasRuntimeDefault: false;
902
+ enumValues: [string, ...string[]];
903
+ baseColumn: never;
904
+ identity: undefined;
905
+ generated: undefined;
906
+ }, {}, {}>;
907
+ services: drizzle_orm_pg_core0.PgColumn<{
908
+ name: "services";
909
+ tableName: "analytics_event";
910
+ dataType: "json";
911
+ columnType: "PgJsonb";
912
+ data: string[];
913
+ driverParam: unknown;
914
+ notNull: true;
915
+ hasDefault: false;
916
+ isPrimaryKey: false;
917
+ isAutoincrement: false;
918
+ hasRuntimeDefault: false;
919
+ enumValues: undefined;
920
+ baseColumn: never;
921
+ identity: undefined;
922
+ generated: undefined;
923
+ }, {}, {
924
+ $type: string[];
925
+ }>;
926
+ skillPacks: drizzle_orm_pg_core0.PgColumn<{
927
+ name: "skill_packs";
928
+ tableName: "analytics_event";
929
+ dataType: "json";
930
+ columnType: "PgJsonb";
931
+ data: string[];
932
+ driverParam: unknown;
933
+ notNull: true;
934
+ hasDefault: true;
935
+ isPrimaryKey: false;
936
+ isAutoincrement: false;
937
+ hasRuntimeDefault: false;
938
+ enumValues: undefined;
939
+ baseColumn: never;
940
+ identity: undefined;
941
+ generated: undefined;
942
+ }, {}, {
943
+ $type: string[];
944
+ }>;
945
+ serviceCount: drizzle_orm_pg_core0.PgColumn<{
946
+ name: "service_count";
947
+ tableName: "analytics_event";
948
+ dataType: "number";
949
+ columnType: "PgInteger";
950
+ data: number;
951
+ driverParam: string | number;
952
+ notNull: true;
953
+ hasDefault: false;
954
+ isPrimaryKey: false;
955
+ isAutoincrement: false;
956
+ hasRuntimeDefault: false;
957
+ enumValues: undefined;
958
+ baseColumn: never;
959
+ identity: undefined;
960
+ generated: undefined;
961
+ }, {}, {}>;
962
+ proxy: drizzle_orm_pg_core0.PgColumn<{
963
+ name: "proxy";
964
+ tableName: "analytics_event";
965
+ dataType: "string";
966
+ columnType: "PgText";
967
+ data: string;
968
+ driverParam: string;
969
+ notNull: true;
970
+ hasDefault: false;
971
+ isPrimaryKey: false;
972
+ isAutoincrement: false;
973
+ hasRuntimeDefault: false;
974
+ enumValues: [string, ...string[]];
975
+ baseColumn: never;
976
+ identity: undefined;
977
+ generated: undefined;
978
+ }, {}, {}>;
979
+ deployment: drizzle_orm_pg_core0.PgColumn<{
980
+ name: "deployment";
981
+ tableName: "analytics_event";
982
+ dataType: "string";
983
+ columnType: "PgText";
984
+ data: string;
985
+ driverParam: string;
986
+ notNull: true;
987
+ hasDefault: false;
988
+ isPrimaryKey: false;
989
+ isAutoincrement: false;
990
+ hasRuntimeDefault: false;
991
+ enumValues: [string, ...string[]];
992
+ baseColumn: never;
993
+ identity: undefined;
994
+ generated: undefined;
995
+ }, {}, {}>;
996
+ deploymentType: drizzle_orm_pg_core0.PgColumn<{
997
+ name: "deployment_type";
998
+ tableName: "analytics_event";
999
+ dataType: "string";
1000
+ columnType: "PgText";
1001
+ data: string;
1002
+ driverParam: string;
1003
+ notNull: true;
1004
+ hasDefault: false;
1005
+ isPrimaryKey: false;
1006
+ isAutoincrement: false;
1007
+ hasRuntimeDefault: false;
1008
+ enumValues: [string, ...string[]];
1009
+ baseColumn: never;
1010
+ identity: undefined;
1011
+ generated: undefined;
1012
+ }, {}, {}>;
1013
+ platform: drizzle_orm_pg_core0.PgColumn<{
1014
+ name: "platform";
1015
+ tableName: "analytics_event";
1016
+ dataType: "string";
1017
+ columnType: "PgText";
1018
+ data: string;
1019
+ driverParam: string;
1020
+ notNull: true;
1021
+ hasDefault: false;
1022
+ isPrimaryKey: false;
1023
+ isAutoincrement: false;
1024
+ hasRuntimeDefault: false;
1025
+ enumValues: [string, ...string[]];
1026
+ baseColumn: never;
1027
+ identity: undefined;
1028
+ generated: undefined;
1029
+ }, {}, {}>;
1030
+ gpu: drizzle_orm_pg_core0.PgColumn<{
1031
+ name: "gpu";
1032
+ tableName: "analytics_event";
1033
+ dataType: "boolean";
1034
+ columnType: "PgBoolean";
1035
+ data: boolean;
1036
+ driverParam: boolean;
1037
+ notNull: true;
1038
+ hasDefault: true;
1039
+ isPrimaryKey: false;
1040
+ isAutoincrement: false;
1041
+ hasRuntimeDefault: false;
1042
+ enumValues: undefined;
1043
+ baseColumn: never;
1044
+ identity: undefined;
1045
+ generated: undefined;
1046
+ }, {}, {}>;
1047
+ monitoring: drizzle_orm_pg_core0.PgColumn<{
1048
+ name: "monitoring";
1049
+ tableName: "analytics_event";
1050
+ dataType: "boolean";
1051
+ columnType: "PgBoolean";
1052
+ data: boolean;
1053
+ driverParam: boolean;
1054
+ notNull: true;
1055
+ hasDefault: true;
1056
+ isPrimaryKey: false;
1057
+ isAutoincrement: false;
1058
+ hasRuntimeDefault: false;
1059
+ enumValues: undefined;
1060
+ baseColumn: never;
1061
+ identity: undefined;
1062
+ generated: undefined;
1063
+ }, {}, {}>;
1064
+ hasDomain: drizzle_orm_pg_core0.PgColumn<{
1065
+ name: "has_domain";
1066
+ tableName: "analytics_event";
1067
+ dataType: "boolean";
1068
+ columnType: "PgBoolean";
1069
+ data: boolean;
1070
+ driverParam: boolean;
1071
+ notNull: true;
1072
+ hasDefault: true;
1073
+ isPrimaryKey: false;
1074
+ isAutoincrement: false;
1075
+ hasRuntimeDefault: false;
1076
+ enumValues: undefined;
1077
+ baseColumn: never;
1078
+ identity: undefined;
1079
+ generated: undefined;
1080
+ }, {}, {}>;
1081
+ openclawImage: drizzle_orm_pg_core0.PgColumn<{
1082
+ name: "openclaw_image";
1083
+ tableName: "analytics_event";
1084
+ dataType: "string";
1085
+ columnType: "PgText";
1086
+ data: string;
1087
+ driverParam: string;
1088
+ notNull: true;
1089
+ hasDefault: false;
1090
+ isPrimaryKey: false;
1091
+ isAutoincrement: false;
1092
+ hasRuntimeDefault: false;
1093
+ enumValues: [string, ...string[]];
1094
+ baseColumn: never;
1095
+ identity: undefined;
1096
+ generated: undefined;
1097
+ }, {}, {}>;
1098
+ estimatedMemoryMB: drizzle_orm_pg_core0.PgColumn<{
1099
+ name: "estimated_memory_mb";
1100
+ tableName: "analytics_event";
1101
+ dataType: "number";
1102
+ columnType: "PgInteger";
1103
+ data: number;
1104
+ driverParam: string | number;
1105
+ notNull: true;
1106
+ hasDefault: false;
1107
+ isPrimaryKey: false;
1108
+ isAutoincrement: false;
1109
+ hasRuntimeDefault: false;
1110
+ enumValues: undefined;
1111
+ baseColumn: never;
1112
+ identity: undefined;
1113
+ generated: undefined;
1114
+ }, {}, {}>;
1115
+ createdAt: drizzle_orm_pg_core0.PgColumn<{
1116
+ name: "created_at";
1117
+ tableName: "analytics_event";
1118
+ dataType: "date";
1119
+ columnType: "PgTimestamp";
1120
+ data: Date;
1121
+ driverParam: string;
1122
+ notNull: true;
1123
+ hasDefault: true;
1124
+ isPrimaryKey: false;
1125
+ isAutoincrement: false;
1126
+ hasRuntimeDefault: false;
1127
+ enumValues: undefined;
1128
+ baseColumn: never;
1129
+ identity: undefined;
1130
+ generated: undefined;
1131
+ }, {}, {}>;
1132
+ };
1133
+ dialect: "pg";
1134
+ }>;
835
1135
  type User = typeof user.$inferSelect;
836
1136
  type Session = typeof session.$inferSelect;
837
1137
  type SavedStack = typeof savedStack.$inferSelect;
838
1138
  type Favorite = typeof favorite.$inferSelect;
1139
+ type AnalyticsEvent = typeof analyticsEvent.$inferSelect;
1140
+ type NewAnalyticsEvent = typeof analyticsEvent.$inferInsert;
839
1141
  //#endregion
840
- export { Favorite, SavedStack, Session, User, account, favorite, savedStack, session, schema_d_exports as t, user, verification };
1142
+ export { AnalyticsEvent, Favorite, NewAnalyticsEvent, SavedStack, Session, User, account, analyticsEvent, favorite, savedStack, session, schema_d_exports as t, user, verification };
841
1143
  //# sourceMappingURL=schema.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.mts","names":[],"sources":["../src/schema.ts"],"mappings":";;;;;;cAIa,IAAA,uBAAI,kBAAA;;;;QAQf,oBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,OAAA,uBAAO,kBAAA;;;;QAWlB,oBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,OAAA,uBAAO,kBAAA;;;;QAgBlB,oBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,YAAA,uBAAY,kBAAA;;;;QAOvB,oBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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QAAA,CAAS,YAAA;AAAA,KAC3B,cAAA,UAAwB,cAAA,CAAe,YAAA;AAAA,KACvC,iBAAA,UAA2B,cAAA,CAAe,YAAA"}
package/dist/schema.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { t as __exportAll } from "./chunk-DQk6qfdC.mjs";
2
- import { boolean, jsonb, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
3
-
1
+ import { t as __exportAll } from "./chunk-CfYAbeIz.mjs";
2
+ import { boolean, index, integer, jsonb, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
4
3
  //#region src/schema.ts
5
4
  var schema_exports = /* @__PURE__ */ __exportAll({
6
5
  account: () => account,
6
+ analyticsEvent: () => analyticsEvent,
7
7
  favorite: () => favorite,
8
8
  savedStack: () => savedStack,
9
9
  session: () => session,
@@ -68,7 +68,26 @@ const favorite = pgTable("favorite", {
68
68
  stackId: uuid("stack_id").notNull().references(() => savedStack.id, { onDelete: "cascade" }),
69
69
  createdAt: timestamp("created_at").notNull().defaultNow()
70
70
  });
71
-
71
+ const analyticsEvent = pgTable("analytics_event", {
72
+ id: uuid("id").primaryKey().defaultRandom(),
73
+ source: text("source").notNull(),
74
+ buildMethod: text("build_method").notNull(),
75
+ presetId: text("preset_id"),
76
+ services: jsonb("services").notNull().$type(),
77
+ skillPacks: jsonb("skill_packs").notNull().$type().default([]),
78
+ serviceCount: integer("service_count").notNull(),
79
+ proxy: text("proxy").notNull(),
80
+ deployment: text("deployment").notNull(),
81
+ deploymentType: text("deployment_type").notNull(),
82
+ platform: text("platform").notNull(),
83
+ gpu: boolean("gpu").notNull().default(false),
84
+ monitoring: boolean("monitoring").notNull().default(false),
85
+ hasDomain: boolean("has_domain").notNull().default(false),
86
+ openclawImage: text("openclaw_image").notNull(),
87
+ estimatedMemoryMB: integer("estimated_memory_mb").notNull(),
88
+ createdAt: timestamp("created_at").notNull().defaultNow()
89
+ }, (table) => [index("analytics_event_created_at_idx").on(table.createdAt), index("analytics_event_source_idx").on(table.source)]);
72
90
  //#endregion
73
- export { account, favorite, savedStack, session, schema_exports as t, user, verification };
91
+ export { account, analyticsEvent, favorite, savedStack, session, schema_exports as t, user, verification };
92
+
74
93
  //# sourceMappingURL=schema.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.mjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { pgTable, text, timestamp, boolean, jsonb, uuid } 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\nexport type User = typeof user.$inferSelect;\nexport type Session = typeof session.$inferSelect;\nexport type SavedStack = typeof savedStack.$inferSelect;\nexport type Favorite = typeof favorite.$inferSelect;\n"],"mappings":";;;;;;;;;;;;AAIA,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,iB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U,aAAa;CAClC,CAAC;AAIF,MAAa,aAAa,QAAQ,eAAe;CAChD,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC,eAAe;CAC3C,QAAQ,KAAK,UAAU,CACrB,SAAS,CACT,iBAAiB,KAAK,IAAI,EAAE,UAAU,WAAW,CAAC;CACpD,MAAM,KAAK,OAAO,CAAC,SAAS;CAC5B,aAAa,KAAK,cAAc;CAEhC,UAAU,MAAM,WAAW,CAAC,SAAS,CAAC,OAAiB,CAAC,QAAQ,EAAE,CAAC;CAEnE,QAAQ,MAAM,SAAS,CAAC,SAAS,CAAC,OAAgC,CAAC,QAAQ,EAAE,CAAC;CAC9E,WAAW,UAAU,aAAa,CAAC,SAAS,CAAC,YAAY;CACzD,WAAW,UAAU,aAAa,CAAC,SAAS,CAAC,YAAY;CACzD,CAAC;AAEF,MAAa,WAAW,QAAQ,YAAY;CAC3C,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC,eAAe;CAC3C,QAAQ,KAAK,UAAU,CACrB,SAAS,CACT,iBAAiB,KAAK,IAAI,EAAE,UAAU,WAAW,CAAC;CACpD,SAAS,KAAK,WAAW,CACvB,SAAS,CACT,iBAAiB,WAAW,IAAI,EAAE,UAAU,WAAW,CAAC;CAC1D,WAAW,UAAU,aAAa,CAAC,SAAS,CAAC,YAAY;CACzD,CAAC"}
1
+ {"version":3,"file":"schema.mjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { boolean, index, integer, jsonb, pgTable, text, timestamp, uuid } 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":";;;;;;;;;;;;AAIA,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,0BAA0B;CAC1D,uBAAuB,UAAU,2BAA2B;CAC5D,O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AK,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.0",
3
+ "version": "1.0.24",
4
4
  "private": false,
5
5
  "description": "Shared database client and schema for better-openclaw",
6
6
  "author": "bidew.io <bachir@bidew.io>",
@@ -33,21 +33,26 @@
33
33
  "scripts": {
34
34
  "build": "tsdown",
35
35
  "build:tsc": "tsc",
36
+ "lint": "biome check src/",
37
+ "lint:fix": "biome check --write src/",
38
+ "typecheck": "tsc --noEmit",
39
+ "test": "vitest run",
36
40
  "db:generate": "drizzle-kit generate",
37
41
  "db:migrate": "drizzle-kit migrate",
38
42
  "db:push": "drizzle-kit push",
39
43
  "db:studio": "drizzle-kit studio"
40
44
  },
41
45
  "dependencies": {
42
- "better-auth": "^1.5.2",
46
+ "@better-auth/drizzle-adapter": "^1.5.4",
47
+ "better-auth": "^1.5.4",
43
48
  "drizzle-orm": "^0.45.1",
44
49
  "postgres": "^3.4.8"
45
50
  },
46
51
  "devDependencies": {
47
52
  "@types/node": "^25.3.3",
48
- "drizzle-kit": "^0.31.0",
53
+ "drizzle-kit": "^0.31.9",
49
54
  "@biomejs/biome": "^2.4.4",
50
- "tsdown": "^0.20.3",
55
+ "tsdown": "^0.21.0",
51
56
  "typescript": "^5.9.3",
52
57
  "vitest": "^4.0.18"
53
58
  }
@@ -0,0 +1,27 @@
1
+ import { getTableColumns, getTableName } from "drizzle-orm";
2
+ import { describe, expect, it } from "vitest";
3
+
4
+ import { account, favorite, savedStack, session, user, verification } from "./schema";
5
+
6
+ describe("database schema", () => {
7
+ it("exports the expected table names", () => {
8
+ expect(getTableName(user)).toBe("user");
9
+ expect(getTableName(session)).toBe("session");
10
+ expect(getTableName(account)).toBe("account");
11
+ expect(getTableName(verification)).toBe("verification");
12
+ expect(getTableName(savedStack)).toBe("saved_stack");
13
+ expect(getTableName(favorite)).toBe("favorite");
14
+ });
15
+
16
+ it("includes the saved stack columns used by the app", () => {
17
+ expect(Object.keys(getTableColumns(savedStack))).toEqual(
18
+ expect.arrayContaining(["id", "userId", "name", "description", "services", "config"]),
19
+ );
20
+ });
21
+
22
+ it("includes the favorite relationship columns", () => {
23
+ expect(Object.keys(getTableColumns(favorite))).toEqual(
24
+ expect.arrayContaining(["id", "userId", "stackId", "createdAt"]),
25
+ );
26
+ });
27
+ });
package/src/schema.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { pgTable, text, timestamp, boolean, jsonb, uuid } from "drizzle-orm/pg-core";
1
+ import { boolean, index, integer, jsonb, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
2
2
 
3
3
  // ── better-auth required tables ────────────────────────────────────────────────
4
4
 
@@ -80,7 +80,38 @@ export const favorite = pgTable("favorite", {
80
80
  createdAt: timestamp("created_at").notNull().defaultNow(),
81
81
  });
82
82
 
83
+ // ── Analytics ───────────────────────────────────────────────────────────────────
84
+
85
+ export const analyticsEvent = pgTable(
86
+ "analytics_event",
87
+ {
88
+ id: uuid("id").primaryKey().defaultRandom(),
89
+ source: text("source").notNull(), // "cli" | "web" | "api" | "mcp"
90
+ buildMethod: text("build_method").notNull(), // "preset" | "custom"
91
+ presetId: text("preset_id"),
92
+ services: jsonb("services").notNull().$type<string[]>(),
93
+ skillPacks: jsonb("skill_packs").notNull().$type<string[]>().default([]),
94
+ serviceCount: integer("service_count").notNull(),
95
+ proxy: text("proxy").notNull(),
96
+ deployment: text("deployment").notNull(),
97
+ deploymentType: text("deployment_type").notNull(),
98
+ platform: text("platform").notNull(),
99
+ gpu: boolean("gpu").notNull().default(false),
100
+ monitoring: boolean("monitoring").notNull().default(false),
101
+ hasDomain: boolean("has_domain").notNull().default(false),
102
+ openclawImage: text("openclaw_image").notNull(),
103
+ estimatedMemoryMB: integer("estimated_memory_mb").notNull(),
104
+ createdAt: timestamp("created_at").notNull().defaultNow(),
105
+ },
106
+ (table) => [
107
+ index("analytics_event_created_at_idx").on(table.createdAt),
108
+ index("analytics_event_source_idx").on(table.source),
109
+ ],
110
+ );
111
+
83
112
  export type User = typeof user.$inferSelect;
84
113
  export type Session = typeof session.$inferSelect;
85
114
  export type SavedStack = typeof savedStack.$inferSelect;
86
115
  export type Favorite = typeof favorite.$inferSelect;
116
+ export type AnalyticsEvent = typeof analyticsEvent.$inferSelect;
117
+ export type NewAnalyticsEvent = typeof analyticsEvent.$inferInsert;
package/tsdown.config.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineConfig } from "tsdown";
2
2
 
3
3
  export default defineConfig({
4
- entry: "src/**/*.ts",
4
+ entry: ["src/index.ts", "src/schema.ts"],
5
5
  format: ["esm", "cjs"],
6
6
  sourcemap: true,
7
7
  clean: true,
@@ -1,18 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
5
- for (var name in all) {
6
- __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
10
- }
11
- if (!no_symbols) {
12
- __defProp(target, Symbol.toStringTag, { value: "Module" });
13
- }
14
- return target;
15
- };
16
-
17
- //#endregion
18
- export { __exportAll as t };
@@ -1,53 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) {
11
- __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- }
16
- if (!no_symbols) {
17
- __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- }
19
- return target;
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
24
- key = keys[i];
25
- if (!__hasOwnProp.call(to, key) && key !== except) {
26
- __defProp(to, key, {
27
- get: ((k) => from[k]).bind(null, key),
28
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
- });
30
- }
31
- }
32
- }
33
- return to;
34
- };
35
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
36
- value: mod,
37
- enumerable: true
38
- }) : target, mod));
39
-
40
- //#endregion
41
-
42
- Object.defineProperty(exports, '__exportAll', {
43
- enumerable: true,
44
- get: function () {
45
- return __exportAll;
46
- }
47
- });
48
- Object.defineProperty(exports, '__toESM', {
49
- enumerable: true,
50
- get: function () {
51
- return __toESM;
52
- }
53
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.cjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { pgTable, text, timestamp, boolean, jsonb, uuid } 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\nexport type User = typeof user.$inferSelect;\nexport type Session = typeof session.$inferSelect;\nexport type SavedStack = typeof savedStack.$inferSelect;\nexport type Favorite = typeof favorite.$inferSelect;\n"],"mappings":";;;;;;;;;;;;;AAIA,MAAa,wCAAe,QAAQ;CACnC,kCAAS,KAAK,CAAC,YAAY;CAC3B,oCAAW,OAAO,CAAC,SAAS;CAC5B,qCAAY,QAAQ,CAAC,SAAS,CAAC,QAAQ;CACvC,gDAAuB,iBAAiB,CAAC,SAAS;CAClD,qCAAY,QAAQ;CACpB,8CAAqB,aAAa,CAAC,SAAS;CAC5C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