@dimah-s3/db 2.0.0-beta.5 → 2.0.0-beta.6

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 (41) hide show
  1. package/README.md +15 -6
  2. package/dist/adapters/drizzle.d.ts +2 -3
  3. package/dist/adapters/drizzle.d.ts.map +1 -1
  4. package/dist/adapters/kysely.d.ts +1 -1
  5. package/dist/adapters/prisma.d.ts +1 -1
  6. package/dist/cli.d.ts +17 -12
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +41 -74
  9. package/dist/cli.js.map +1 -1
  10. package/dist/fuma-db.d.ts +19 -22
  11. package/dist/fuma-db.d.ts.map +1 -1
  12. package/dist/index.js +59 -79
  13. package/dist/index.js.map +1 -1
  14. package/dist/schema/schema.d.ts +30 -50
  15. package/dist/schema/schema.d.ts.map +1 -1
  16. package/dist/store/folder-store.d.ts.map +1 -1
  17. package/dist/store/map-row.d.ts +2 -8
  18. package/dist/store/map-row.d.ts.map +1 -1
  19. package/dist/store/object-store.d.ts.map +1 -1
  20. package/package.json +8 -26
  21. package/dist/drizzle/mysql.d.ts +0 -1057
  22. package/dist/drizzle/mysql.d.ts.map +0 -1
  23. package/dist/drizzle/mysql.js +0 -120
  24. package/dist/drizzle/mysql.js.map +0 -1
  25. package/dist/drizzle/pg.d.ts +0 -994
  26. package/dist/drizzle/pg.d.ts.map +0 -1
  27. package/dist/drizzle/pg.js +0 -104
  28. package/dist/drizzle/pg.js.map +0 -1
  29. package/dist/drizzle/shared.d.ts +0 -7
  30. package/dist/drizzle/shared.d.ts.map +0 -1
  31. package/dist/drizzle/sqlite.d.ts +0 -1056
  32. package/dist/drizzle/sqlite.d.ts.map +0 -1
  33. package/dist/drizzle/sqlite.js +0 -107
  34. package/dist/drizzle/sqlite.js.map +0 -1
  35. package/prisma/dimah-s3.prisma +0 -81
  36. package/sql/mysql.sql +0 -60
  37. package/sql/pg.sql +0 -53
  38. package/sql/sqlite.sql +0 -55
  39. package/src/drizzle/mysql.ts +0 -175
  40. package/src/drizzle/pg.ts +0 -146
  41. package/src/drizzle/sqlite.ts +0 -150
@@ -1 +0,0 @@
1
- {"version":3,"file":"pg.d.ts","sourceRoot":"","sources":["../../src/drizzle/pg.ts"],"names":[],"mappings":"AA0BA,KAAK,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAqBxE,8DAA8D;AAC9D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDzB,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG1B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIzB,CAAC"}
@@ -1,104 +0,0 @@
1
- import { createId } from '@paralleldrive/cuid2';
2
- import { sql } from 'drizzle-orm';
3
- import { pgTable, timestamp, text, json, unique, index, varchar, bigint } from 'drizzle-orm/pg-core';
4
-
5
- // src/drizzle/pg.ts
6
- var SCHEMA_VERSION = "2.1.0";
7
- function id() {
8
- return varchar("id", { length: 255 }).primaryKey().$defaultFn(() => createId());
9
- }
10
- function timestampNow(name) {
11
- return timestamp(name).notNull().default(sql`CURRENT_TIMESTAMP`).$defaultFn(() => /* @__PURE__ */ new Date());
12
- }
13
- function byteCount(name) {
14
- return bigint(name, { mode: "number" });
15
- }
16
- var storageObject = pgTable(
17
- "storage_object",
18
- {
19
- id: id(),
20
- scope: text("scope").notNull(),
21
- bucket: text("bucket").notNull(),
22
- key: text("key").notNull(),
23
- route: text("route").notNull(),
24
- folderId: text("folder_id"),
25
- filename: text("filename").notNull(),
26
- contentType: text("content_type"),
27
- size: byteCount("size"),
28
- declaredSize: byteCount("declared_size"),
29
- eTag: text("e_tag"),
30
- status: text("status").$type().notNull(),
31
- s3Metadata: json("s3_metadata").$type(),
32
- attributes: json("attributes"),
33
- acl: text("acl"),
34
- uploadId: text("upload_id"),
35
- uploadToken: text("upload_token"),
36
- expiresAt: timestamp("expires_at"),
37
- confirmedAt: timestamp("confirmed_at"),
38
- createdAt: timestampNow("created_at"),
39
- updatedAt: timestampNow("updated_at"),
40
- deletedAt: timestamp("deleted_at")
41
- },
42
- (table) => [
43
- unique("storage_object_bucket_key_uk").on(table.bucket, table.key),
44
- index("storage_object_scope_folder_idx").on(
45
- table.scope,
46
- table.status,
47
- table.folderId,
48
- table.createdAt
49
- ),
50
- index("storage_object_scope_updated_idx").on(
51
- table.scope,
52
- table.status,
53
- table.updatedAt
54
- ),
55
- index("storage_object_scope_filename_idx").on(
56
- table.scope,
57
- table.status,
58
- table.filename
59
- ),
60
- index("storage_object_scope_size_idx").on(
61
- table.scope,
62
- table.status,
63
- table.size
64
- ),
65
- index("storage_object_status_expires_idx").on(
66
- table.status,
67
- table.expiresAt
68
- )
69
- ]
70
- );
71
- var storageFolder = pgTable(
72
- "storage_folder",
73
- {
74
- id: id(),
75
- scope: text("scope").notNull(),
76
- /** `""` is the root. */
77
- parentId: text("parent_id").notNull().default(""),
78
- name: text("name").notNull(),
79
- path: text("path").notNull(),
80
- createdAt: timestampNow("created_at"),
81
- updatedAt: timestampNow("updated_at")
82
- },
83
- (table) => [
84
- unique("storage_folder_scope_path_uk").on(table.scope, table.path),
85
- unique("storage_folder_scope_parent_name_uk").on(
86
- table.scope,
87
- table.parentId,
88
- table.name
89
- )
90
- ]
91
- );
92
- var dimahS3Settings = pgTable("private_dimah_s3_settings", {
93
- key: varchar("key", { length: 255 }).primaryKey(),
94
- version: text("value").notNull().default(SCHEMA_VERSION)
95
- });
96
- var dimahS3Tables = {
97
- storageObject,
98
- storageFolder,
99
- private_dimah_s3_settings: dimahS3Settings
100
- };
101
-
102
- export { dimahS3Settings, dimahS3Tables, storageFolder, storageObject };
103
- //# sourceMappingURL=pg.js.map
104
- //# sourceMappingURL=pg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/drizzle/pg.ts"],"names":[],"mappings":";;;;;AA4BA,IAAM,cAAA,GAAiB,OAAA;AAEvB,SAAS,EAAA,GAAK;AACZ,EAAA,OAAO,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,GAAgB,OAAA;AAAA,EAC3B,gBAAA;AAAA,EACA;AAAA,IACE,IAAI,EAAA,EAAG;AAAA,IACP,KAAA,EAAO,IAAA,CAAK,OAAO,CAAA,CAAE,OAAA,EAAQ;AAAA;AAAA,IAE7B,UAAU,IAAA,CAAK,WAAW,EAAE,OAAA,EAAQ,CAAE,QAAQ,EAAE,CAAA;AAAA,IAChD,IAAA,EAAM,IAAA,CAAK,MAAM,CAAA,CAAE,OAAA,EAAQ;AAAA,IAC3B,IAAA,EAAM,IAAA,CAAK,MAAM,CAAA,CAAE,OAAA,EAAQ;AAAA,IAC3B,SAAA,EAAW,aAAa,YAAY,CAAA;AAAA,IACpC,SAAA,EAAW,aAAa,YAAY;AAAA,GACtC;AAAA,EACA,CAAC,KAAA,KAAU;AAAA,IACT,OAAO,8BAA8B,CAAA,CAAE,GAAG,KAAA,CAAM,KAAA,EAAO,MAAM,IAAI,CAAA;AAAA,IACjE,MAAA,CAAO,qCAAqC,CAAA,CAAE,EAAA;AAAA,MAC5C,KAAA,CAAM,KAAA;AAAA,MACN,KAAA,CAAM,QAAA;AAAA,MACN,KAAA,CAAM;AAAA;AACR;AAEJ;AAMO,IAAM,eAAA,GAAkB,QAAQ,2BAAA,EAA6B;AAAA,EAClE,GAAA,EAAK,QAAQ,KAAA,EAAO,EAAE,QAAQ,GAAA,EAAK,EAAE,UAAA,EAAW;AAAA,EAChD,SAAS,IAAA,CAAK,OAAO,EAAE,OAAA,EAAQ,CAAE,QAAQ,cAAc;AACzD,CAAC;AAOM,IAAM,aAAA,GAAgB;AAAA,EAC3B,aAAA;AAAA,EACA,aAAA;AAAA,EACA,yBAAA,EAA2B;AAC7B","file":"pg.js","sourcesContent":["/**\n * Drizzle schema for @dimah-s3/db on PostgreSQL. Copy this file into your\n * app (`db/schema.ts`) to own the tables and add columns. Keep the table\n * names, the column names, and the `dimahS3Tables` keys: the adapter finds\n * the tables by those keys. A column you add must be nullable or have a\n * default. The plugin does not read or write it.\n *\n * Import `dimahS3Tables` from `@dimah-s3/db/drizzle/pg` when the tables stay\n * as they are. `drizzle-kit` then follows that import, and a later push\n * drops a column that is not part of it.\n *\n * Matches `sql/pg.sql`. Requires `drizzle-orm` and `@paralleldrive/cuid2`.\n */\nimport { createId } from \"@paralleldrive/cuid2\";\nimport { sql } from \"drizzle-orm\";\nimport {\n bigint,\n index,\n json,\n pgTable,\n text,\n timestamp,\n unique,\n varchar,\n} from \"drizzle-orm/pg-core\";\n\ntype StorageObjectStatus = \"pending\" | \"active\" | \"deleted\" | \"purging\";\n\nconst SCHEMA_VERSION = \"2.1.0\";\n\nfunction id() {\n return varchar(\"id\", { length: 255 })\n .primaryKey()\n .$defaultFn(() => createId());\n}\n\nfunction timestampNow(name: string) {\n return timestamp(name)\n .notNull()\n .default(sql`CURRENT_TIMESTAMP`)\n .$defaultFn(() => new Date());\n}\n\nfunction byteCount(name: string) {\n return bigint(name, { mode: \"number\" });\n}\n\n/** The `storage_object` table: one row per tracked object. */\nexport const storageObject = pgTable(\n \"storage_object\",\n {\n id: id(),\n scope: text(\"scope\").notNull(),\n bucket: text(\"bucket\").notNull(),\n key: text(\"key\").notNull(),\n route: text(\"route\").notNull(),\n folderId: text(\"folder_id\"),\n filename: text(\"filename\").notNull(),\n contentType: text(\"content_type\"),\n size: byteCount(\"size\"),\n declaredSize: byteCount(\"declared_size\"),\n eTag: text(\"e_tag\"),\n status: text(\"status\").$type<StorageObjectStatus>().notNull(),\n s3Metadata: json(\"s3_metadata\").$type<Record<string, string>>(),\n attributes: json(\"attributes\"),\n acl: text(\"acl\"),\n uploadId: text(\"upload_id\"),\n uploadToken: text(\"upload_token\"),\n expiresAt: timestamp(\"expires_at\"),\n confirmedAt: timestamp(\"confirmed_at\"),\n createdAt: timestampNow(\"created_at\"),\n updatedAt: timestampNow(\"updated_at\"),\n deletedAt: timestamp(\"deleted_at\"),\n },\n (table) => [\n unique(\"storage_object_bucket_key_uk\").on(table.bucket, table.key),\n index(\"storage_object_scope_folder_idx\").on(\n table.scope,\n table.status,\n table.folderId,\n table.createdAt,\n ),\n index(\"storage_object_scope_updated_idx\").on(\n table.scope,\n table.status,\n table.updatedAt,\n ),\n index(\"storage_object_scope_filename_idx\").on(\n table.scope,\n table.status,\n table.filename,\n ),\n index(\"storage_object_scope_size_idx\").on(\n table.scope,\n table.status,\n table.size,\n ),\n index(\"storage_object_status_expires_idx\").on(\n table.status,\n table.expiresAt,\n ),\n ],\n);\n\n/** The `storage_folder` table: one row per folder, so empty folders list. */\nexport const storageFolder = pgTable(\n \"storage_folder\",\n {\n id: id(),\n scope: text(\"scope\").notNull(),\n /** `\"\"` is the root. */\n parentId: text(\"parent_id\").notNull().default(\"\"),\n name: text(\"name\").notNull(),\n path: text(\"path\").notNull(),\n createdAt: timestampNow(\"created_at\"),\n updatedAt: timestampNow(\"updated_at\"),\n },\n (table) => [\n unique(\"storage_folder_scope_path_uk\").on(table.scope, table.path),\n unique(\"storage_folder_scope_parent_name_uk\").on(\n table.scope,\n table.parentId,\n table.name,\n ),\n ],\n);\n\n/**\n * The FumaDB settings table. The Drizzle adapter reads the schema version\n * from the default of its `version` column, which is stored as `value`.\n */\nexport const dimahS3Settings = pgTable(\"private_dimah_s3_settings\", {\n key: varchar(\"key\", { length: 255 }).primaryKey(),\n version: text(\"value\").notNull().default(SCHEMA_VERSION),\n});\n\n/**\n * Every @dimah-s3/db table. Spread it into your Drizzle schema and keep its\n * keys, because the FumaDB Drizzle adapter finds tables by them:\n * `drizzle({ client, relations: defineRelations({ ...dimahS3Tables }) })`.\n */\nexport const dimahS3Tables = {\n storageObject,\n storageFolder,\n private_dimah_s3_settings: dimahS3Settings,\n};\n"]}
@@ -1,7 +0,0 @@
1
- /**
2
- * Schema version the Drizzle tables describe. Each dialect file inlines the
3
- * same string so a copied schema does not import this module. The parity
4
- * test checks both against the FumaDB schema.
5
- */
6
- export declare const DIMAH_S3_SCHEMA_VERSION = "2.1.0";
7
- //# sourceMappingURL=shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/drizzle/shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,UAAU,CAAC"}