@dimah-s3/db 1.7.1 → 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 (120) hide show
  1. package/README.md +62 -17
  2. package/dist/adapters/drizzle.d.ts +8 -0
  3. package/dist/adapters/drizzle.d.ts.map +1 -0
  4. package/dist/adapters/drizzle.js +3 -0
  5. package/dist/adapters/drizzle.js.map +1 -0
  6. package/dist/adapters/kysely.d.ts +7 -0
  7. package/dist/adapters/kysely.d.ts.map +1 -0
  8. package/dist/adapters/kysely.js +3 -0
  9. package/dist/adapters/kysely.js.map +1 -0
  10. package/dist/adapters/prisma.d.ts +7 -0
  11. package/dist/adapters/prisma.d.ts.map +1 -0
  12. package/dist/adapters/prisma.js +3 -0
  13. package/dist/adapters/prisma.js.map +1 -0
  14. package/dist/cli.d.ts +32 -4
  15. package/dist/cli.d.ts.map +1 -1
  16. package/dist/cli.js +135 -4
  17. package/dist/cli.js.map +1 -1
  18. package/dist/client/db-client.d.ts +9 -85
  19. package/dist/client/db-client.d.ts.map +1 -1
  20. package/dist/client/db-object-source.d.ts +25 -0
  21. package/dist/client/db-object-source.d.ts.map +1 -0
  22. package/dist/client/index.d.ts +3 -3
  23. package/dist/client/index.d.ts.map +1 -1
  24. package/dist/client/index.js +96 -42
  25. package/dist/client/index.js.map +1 -1
  26. package/dist/drizzle/mysql.d.ts +1025 -0
  27. package/dist/drizzle/mysql.d.ts.map +1 -0
  28. package/dist/drizzle/mysql.js +117 -0
  29. package/dist/drizzle/mysql.js.map +1 -0
  30. package/dist/drizzle/pg.d.ts +964 -0
  31. package/dist/drizzle/pg.d.ts.map +1 -0
  32. package/dist/drizzle/pg.js +98 -0
  33. package/dist/drizzle/pg.js.map +1 -0
  34. package/dist/drizzle/shared.d.ts +7 -0
  35. package/dist/drizzle/shared.d.ts.map +1 -0
  36. package/dist/drizzle/sqlite.d.ts +1024 -0
  37. package/dist/drizzle/sqlite.d.ts.map +1 -0
  38. package/dist/drizzle/sqlite.js +101 -0
  39. package/dist/drizzle/sqlite.js.map +1 -0
  40. package/dist/folder-path.d.ts +32 -0
  41. package/dist/folder-path.d.ts.map +1 -0
  42. package/dist/fuma-db.d.ts +30 -9
  43. package/dist/fuma-db.d.ts.map +1 -1
  44. package/dist/index.d.ts +9 -13
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1419 -623
  47. package/dist/index.js.map +1 -1
  48. package/dist/plugin/create-database-endpoints.d.ts +105 -21
  49. package/dist/plugin/create-database-endpoints.d.ts.map +1 -1
  50. package/dist/plugin/create-database-lifecycle-hooks.d.ts +37 -19
  51. package/dist/plugin/create-database-lifecycle-hooks.d.ts.map +1 -1
  52. package/dist/plugin/db.d.ts +29 -118
  53. package/dist/plugin/db.d.ts.map +1 -1
  54. package/dist/plugin/object-access.d.ts +46 -0
  55. package/dist/plugin/object-access.d.ts.map +1 -0
  56. package/dist/plugin/public-stores.d.ts +33 -0
  57. package/dist/plugin/public-stores.d.ts.map +1 -0
  58. package/dist/plugin/purge.d.ts +49 -0
  59. package/dist/plugin/purge.d.ts.map +1 -0
  60. package/dist/plugin/quota.d.ts +25 -0
  61. package/dist/plugin/quota.d.ts.map +1 -0
  62. package/dist/plugin/schemas.d.ts +69 -0
  63. package/dist/plugin/schemas.d.ts.map +1 -0
  64. package/dist/plugin/scope.d.ts +31 -0
  65. package/dist/plugin/scope.d.ts.map +1 -0
  66. package/dist/plugin/to-db-client-object.d.ts +8 -4
  67. package/dist/plugin/to-db-client-object.d.ts.map +1 -1
  68. package/dist/schema/schema.d.ts +73 -0
  69. package/dist/schema/schema.d.ts.map +1 -0
  70. package/dist/standard-schema.d.ts +42 -0
  71. package/dist/standard-schema.d.ts.map +1 -0
  72. package/dist/store/create-db-store.d.ts +17 -0
  73. package/dist/store/create-db-store.d.ts.map +1 -0
  74. package/dist/store/folder-store.d.ts +36 -0
  75. package/dist/store/folder-store.d.ts.map +1 -0
  76. package/dist/store/list-cursor.d.ts +26 -4
  77. package/dist/store/list-cursor.d.ts.map +1 -1
  78. package/dist/store/map-row.d.ts +17 -8
  79. package/dist/store/map-row.d.ts.map +1 -1
  80. package/dist/store/object-store.d.ts +208 -0
  81. package/dist/store/object-store.d.ts.map +1 -0
  82. package/dist/store/schema-version.d.ts +7 -0
  83. package/dist/store/schema-version.d.ts.map +1 -0
  84. package/dist/types/client.d.ts +209 -0
  85. package/dist/types/client.d.ts.map +1 -0
  86. package/dist/types/plugin.d.ts +112 -0
  87. package/dist/types/plugin.d.ts.map +1 -0
  88. package/dist/types/storage-object.d.ts +40 -85
  89. package/dist/types/storage-object.d.ts.map +1 -1
  90. package/package.json +53 -11
  91. package/prisma/dimah-s3.prisma +80 -0
  92. package/sql/mysql.sql +59 -0
  93. package/sql/pg.sql +53 -0
  94. package/sql/sqlite.sql +54 -0
  95. package/src/drizzle/mysql.ts +172 -0
  96. package/src/drizzle/pg.ts +140 -0
  97. package/src/drizzle/sqlite.ts +144 -0
  98. package/dist/client/db-object-list-accessors.d.ts +0 -36
  99. package/dist/client/db-object-list-accessors.d.ts.map +0 -1
  100. package/dist/client/db-object-query.d.ts +0 -40
  101. package/dist/client/db-object-query.d.ts.map +0 -1
  102. package/dist/errors.d.ts +0 -6
  103. package/dist/errors.d.ts.map +0 -1
  104. package/dist/hooks/create-object-access-guard.d.ts +0 -51
  105. package/dist/hooks/create-object-access-guard.d.ts.map +0 -1
  106. package/dist/hooks/create-quota-guard.d.ts +0 -28
  107. package/dist/hooks/create-quota-guard.d.ts.map +0 -1
  108. package/dist/jobs/purge-stale-pending.d.ts +0 -31
  109. package/dist/jobs/purge-stale-pending.d.ts.map +0 -1
  110. package/dist/plugin/list-query-schema.d.ts +0 -21
  111. package/dist/plugin/list-query-schema.d.ts.map +0 -1
  112. package/dist/plugin/memoize-scope-resolver.d.ts +0 -8
  113. package/dist/plugin/memoize-scope-resolver.d.ts.map +0 -1
  114. package/dist/schema/v1.d.ts +0 -31
  115. package/dist/schema/v1.d.ts.map +0 -1
  116. package/dist/store/storage-object-store.d.ts +0 -137
  117. package/dist/store/storage-object-store.d.ts.map +0 -1
  118. package/src/schema/examples/README.md +0 -10
  119. package/src/schema/examples/drizzle.ts +0 -92
  120. package/src/schema/examples/schema.prisma +0 -55
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Drizzle schema for @dimah-s3/db on SQLite. Copy this file into your app
3
+ * (`db/schema.ts`) to own the tables and add columns. Keep the table names,
4
+ * the column names, and the `dimahS3Tables` keys: the adapter finds the
5
+ * tables by those keys. A column you add must be nullable or have a default.
6
+ * The plugin does not read or write it.
7
+ *
8
+ * Import `dimahS3Tables` from `@dimah-s3/db/drizzle/sqlite` when the tables
9
+ * stay as they are. `drizzle-kit` then follows that import, and a later push
10
+ * drops a column that is not part of it.
11
+ *
12
+ * Timestamps are epoch milliseconds and sizes are integers, matching
13
+ * `sql/sqlite.sql`. Requires `drizzle-orm` and `@paralleldrive/cuid2`.
14
+ */
15
+ import { createId } from "@paralleldrive/cuid2";
16
+ import { sql } from "drizzle-orm";
17
+ import {
18
+ index,
19
+ integer,
20
+ sqliteTable,
21
+ text,
22
+ uniqueIndex,
23
+ } from "drizzle-orm/sqlite-core";
24
+
25
+ type StorageObjectStatus = "pending" | "active" | "deleted" | "purging";
26
+
27
+ const SCHEMA_VERSION = "2.0.0";
28
+
29
+ function id() {
30
+ return text("id")
31
+ .primaryKey()
32
+ .$defaultFn(() => createId());
33
+ }
34
+
35
+ function timestamp(name: string) {
36
+ return integer(name, { mode: "timestamp_ms" });
37
+ }
38
+
39
+ function timestampNow(name: string) {
40
+ return timestamp(name)
41
+ .notNull()
42
+ .default(sql`(strftime('%s', 'now') * 1000)`)
43
+ .$defaultFn(() => new Date());
44
+ }
45
+
46
+ function byteCount(name: string) {
47
+ return integer(name, { mode: "number" });
48
+ }
49
+
50
+ /** The `storage_object` table: one row per tracked object. */
51
+ export const storageObject = sqliteTable(
52
+ "storage_object",
53
+ {
54
+ id: id(),
55
+ scope: text("scope").notNull(),
56
+ bucket: text("bucket").notNull(),
57
+ key: text("key").notNull(),
58
+ route: text("route").notNull(),
59
+ folder: text("folder"),
60
+ filename: text("filename").notNull(),
61
+ contentType: text("content_type"),
62
+ size: byteCount("size"),
63
+ declaredSize: byteCount("declared_size"),
64
+ eTag: text("e_tag"),
65
+ status: text("status").$type<StorageObjectStatus>().notNull(),
66
+ s3Metadata: text("s3_metadata", { mode: "json" }).$type<
67
+ Record<string, string>
68
+ >(),
69
+ attributes: text("attributes", { mode: "json" }),
70
+ acl: text("acl"),
71
+ uploadId: text("upload_id"),
72
+ uploadToken: text("upload_token"),
73
+ expiresAt: timestamp("expires_at"),
74
+ confirmedAt: timestamp("confirmed_at"),
75
+ createdAt: timestampNow("created_at"),
76
+ updatedAt: timestampNow("updated_at"),
77
+ deletedAt: timestamp("deleted_at"),
78
+ },
79
+ (table) => [
80
+ uniqueIndex("storage_object_bucket_key_uk").on(table.bucket, table.key),
81
+ index("storage_object_scope_folder_idx").on(
82
+ table.scope,
83
+ table.status,
84
+ table.folder,
85
+ table.createdAt,
86
+ ),
87
+ index("storage_object_scope_updated_idx").on(
88
+ table.scope,
89
+ table.status,
90
+ table.updatedAt,
91
+ ),
92
+ index("storage_object_scope_filename_idx").on(
93
+ table.scope,
94
+ table.status,
95
+ table.filename,
96
+ ),
97
+ index("storage_object_scope_size_idx").on(
98
+ table.scope,
99
+ table.status,
100
+ table.size,
101
+ ),
102
+ index("storage_object_status_expires_idx").on(
103
+ table.status,
104
+ table.expiresAt,
105
+ ),
106
+ ],
107
+ );
108
+
109
+ /** The `storage_folder` table: one row per folder, so empty folders list. */
110
+ export const storageFolder = sqliteTable(
111
+ "storage_folder",
112
+ {
113
+ id: id(),
114
+ scope: text("scope").notNull(),
115
+ path: text("path").notNull(),
116
+ parent: text("parent"),
117
+ name: text("name").notNull(),
118
+ createdAt: timestampNow("created_at"),
119
+ },
120
+ (table) => [
121
+ uniqueIndex("storage_folder_scope_path_uk").on(table.scope, table.path),
122
+ index("storage_folder_scope_parent_idx").on(table.scope, table.parent),
123
+ ],
124
+ );
125
+
126
+ /**
127
+ * The FumaDB settings table. The Drizzle adapter reads the schema version
128
+ * from the default of its `version` column, which is stored as `value`.
129
+ */
130
+ export const dimahS3Settings = sqliteTable("private_dimah_s3_settings", {
131
+ key: text("key").primaryKey(),
132
+ version: text("value").notNull().default(SCHEMA_VERSION),
133
+ });
134
+
135
+ /**
136
+ * Every @dimah-s3/db table. Spread it into your Drizzle schema and keep its
137
+ * keys, because the FumaDB Drizzle adapter finds tables by them:
138
+ * `drizzle({ client, relations: defineRelations({ ...dimahS3Tables }) })`.
139
+ */
140
+ export const dimahS3Tables = {
141
+ storageObject,
142
+ storageFolder,
143
+ private_dimah_s3_settings: dimahS3Settings,
144
+ };
@@ -1,36 +0,0 @@
1
- import type { DbClientObject } from "../types/storage-object.js";
2
- /** Accessors that map a `listObjects` row onto `ObjectList`. */
3
- export type DbObjectListAccessors = {
4
- /** Row id. */
5
- getKey: (object: DbClientObject) => string;
6
- /** Stored object key. Bulk delete uses this. */
7
- getObjectKey: (object: DbClientObject) => string;
8
- /** Filename, or the last segment of the key. */
9
- getLabel: (object: DbClientObject) => string;
10
- /** Same name the type glyph uses. */
11
- getFileName: (object: DbClientObject) => string;
12
- getFileType: (object: DbClientObject) => string | null;
13
- /** Verified size. `null` while the object is still pending. */
14
- getDescription: (object: DbClientObject) => string | null;
15
- };
16
- /** Options for {@link dbObjectListAccessors}. */
17
- export type DbObjectListAccessorsOptions = {
18
- /**
19
- * Size label for `getDescription`. In React, pass `useFormatFileSize()`
20
- * from `@dimah-s3/react` to follow the `S3Provider` `locale`.
21
- */
22
- formatSize?: (bytes: number) => string;
23
- };
24
- /**
25
- * Map `api.db.listObjects` rows onto `ObjectList` accessors.
26
- *
27
- * This does not invent folders. Pass the result of `dbObjectQuery` as `list`.
28
- *
29
- * ```tsx
30
- * const files = dbObjectListAccessors();
31
- *
32
- * <ObjectList list={list} {...files} />
33
- * ```
34
- */
35
- export declare function dbObjectListAccessors(options?: DbObjectListAccessorsOptions): DbObjectListAccessors;
36
- //# sourceMappingURL=db-object-list-accessors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"db-object-list-accessors.d.ts","sourceRoot":"","sources":["../../src/client/db-object-list-accessors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAAG;IAClC,cAAc;IACd,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,MAAM,CAAC;IAC3C,gDAAgD;IAChD,YAAY,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,MAAM,CAAC;IACjD,gDAAgD;IAChD,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,MAAM,CAAC;IAC7C,qCAAqC;IACrC,WAAW,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,MAAM,CAAC;IAChD,WAAW,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,MAAM,GAAG,IAAI,CAAC;IACvD,+DAA+D;IAC/D,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,MAAM,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG;IACzC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC,CAAC;AAMF;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,4BAAiC,GACzC,qBAAqB,CAYvB"}
@@ -1,40 +0,0 @@
1
- import type { DbClientListInput, DbClientListResponse, DbClientObject, StorageObjectStatus } from "../types/storage-object.js";
2
- /** `listObjects` plus an optional abort signal. Matches `dbClient()`. */
3
- export type DbObjectListSource = (input?: DbClientListInput, init?: {
4
- signal?: AbortSignal;
5
- }) => Promise<DbClientListResponse>;
6
- export type DbObjectQueryOptions = {
7
- route?: string;
8
- status?: StorageObjectStatus;
9
- contentType?: string;
10
- limit?: number;
11
- };
12
- export type DbObjectQueryInput = {
13
- parent: string | null;
14
- cursor: string | null;
15
- signal: AbortSignal;
16
- };
17
- export type DbObjectQueryPage = {
18
- items: DbClientObject[];
19
- nextCursor: string | null;
20
- /** Scope totals from `listObjects`. Not limited to the open folder. */
21
- usage: DbClientListResponse["usage"];
22
- };
23
- /**
24
- * Adapt `api.db.listObjects` to a `useObjectList` query.
25
- *
26
- * `parent` is sent as the key `prefix`. This does not invent folder rows:
27
- * default object keys contain a uuid segment, so a delimiter over the key
28
- * is not a folder tree. Return `folders` from your own query when the
29
- * catalog has them. `usage` is the scope total from `listObjects`, not the
30
- * open folder.
31
- *
32
- * ```ts
33
- * const list = useObjectList({
34
- * query: dbObjectQuery(api.db.listObjects, { route: "docs" }),
35
- * queryKey: ["docs"],
36
- * });
37
- * ```
38
- */
39
- export declare function dbObjectQuery(listObjects: DbObjectListSource, options?: DbObjectQueryOptions): (input: DbObjectQueryInput) => Promise<DbObjectQueryPage>;
40
- //# sourceMappingURL=db-object-query.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"db-object-query.d.ts","sourceRoot":"","sources":["../../src/client/db-object-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG,CAC/B,KAAK,CAAC,EAAE,iBAAiB,EACzB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KAC5B,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAEnC,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uEAAuE;IACvE,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,kBAAkB,EAC/B,OAAO,CAAC,EAAE,oBAAoB,WAGrB,kBAAkB,KACxB,OAAO,CAAC,iBAAiB,CAAC,CAgB9B"}
package/dist/errors.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { APIError } from "@dimah-s3/core";
2
- export declare function unauthorized(message?: string): APIError;
3
- export declare function forbidden(message?: string): APIError;
4
- export declare function notFound(message?: string): APIError;
5
- export declare function conflict(message?: string): APIError;
6
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,gBAAgB,CAAC;AAE1D,wBAAgB,YAAY,CAC1B,OAAO,GAAE,MAA4C,GACpD,QAAQ,CAKV;AAED,wBAAgB,SAAS,CACvB,OAAO,GAAE,MAAyC,GACjD,QAAQ,CAKV;AAED,wBAAgB,QAAQ,CACtB,OAAO,GAAE,MAAgD,GACxD,QAAQ,CAKV;AAED,wBAAgB,QAAQ,CACtB,OAAO,GAAE,MAAwC,GAChD,QAAQ,CAKV"}
@@ -1,51 +0,0 @@
1
- import { type DimahS3DbClient, type StorageObjectStore } from "../store/storage-object-store.js";
2
- import type { ScopeOperation, ScopeResolver, StorageObject, StorageObjectStatus } from "../types/storage-object.js";
3
- /** Minimal context the guard needs — matches every key-bearing server hook context. */
4
- export type ObjectAccessGuardContext = {
5
- request: Request;
6
- key: string;
7
- bucket: string;
8
- /** Named route. Passed on to `resolveScope`. */
9
- route?: string;
10
- /** Multipart session id — required when {@link CreateObjectAccessGuardOptions.requireUploadId} is set. */
11
- uploadId?: string;
12
- };
13
- export type CreateObjectAccessGuardOptions = {
14
- /** FumaDB client (`DimahS3DB.client(adapter)`) or a prebuilt objects store. */
15
- client: DimahS3DbClient | StorageObjectStore;
16
- resolveScope: ScopeResolver;
17
- /**
18
- * The operation this guard protects, passed to `resolveScope`. Create one
19
- * guard per hook, such as `"download"` for `download.guard` and
20
- * `"delete"` for `delete.guard`.
21
- */
22
- operation: ScopeOperation;
23
- /**
24
- * Which rows count as accessible.
25
- * `"any"` means pending or active (not deleted).
26
- * @default "active"
27
- */
28
- requireStatus?: StorageObjectStatus | "any";
29
- /**
30
- * Require `context.uploadId` to match the pending row's `uploadId`.
31
- * Use for `upload.multipart.guard`.
32
- */
33
- requireUploadId?: boolean;
34
- /**
35
- * Replace the default `object.scope === scope` ownership check —
36
- * e.g. also allow objects whose metadata marks them public.
37
- */
38
- authorize?: (object: StorageObject, context: ObjectAccessGuardContext & {
39
- scope: string;
40
- }) => boolean | Promise<boolean>;
41
- };
42
- export declare function resolveStore(client: DimahS3DbClient | StorageObjectStore): StorageObjectStore;
43
- /**
44
- * Guard that checks the requested object exists in the DB and belongs to the
45
- * caller's scope. Throws `APIError` (401 / 404 / 403) to reject.
46
- *
47
- * Usable as `download.guard`, `delete.guard`,
48
- * `upload.confirmGuard`, `upload.multipart.guard`, or in your own routes.
49
- */
50
- export declare function createObjectAccessGuard(options: CreateObjectAccessGuardOptions): (context: ObjectAccessGuardContext) => Promise<void>;
51
- //# sourceMappingURL=create-object-access-guard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-object-access-guard.d.ts","sourceRoot":"","sources":["../../src/hooks/create-object-access-guard.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,uFAAuF;AACvF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,+EAA+E;IAC/E,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAAC;IAC7C,YAAY,EAAE,aAAa,CAAC;IAC5B;;;;OAIG;IACH,SAAS,EAAE,cAAc,CAAC;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC;IAC5C;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,CACV,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,wBAAwB,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAClD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF,wBAAgB,YAAY,CAC1B,MAAM,EAAE,eAAe,GAAG,kBAAkB,GAC3C,kBAAkB,CAEpB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,8BAA8B,GACtC,CAAC,OAAO,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAiCtD"}
@@ -1,28 +0,0 @@
1
- import type { DimahS3DbClient, StorageObjectStore } from "../store/storage-object-store.js";
2
- import type { ScopeResolver } from "../types/storage-object.js";
3
- export type CreateQuotaGuardOptions = {
4
- client: DimahS3DbClient | StorageObjectStore;
5
- resolveScope: ScopeResolver;
6
- maxBytes?: number;
7
- maxFiles?: number;
8
- };
9
- export type QuotaGuardContext = {
10
- request: Request;
11
- /** Named route. Passed on to `resolveScope`. */
12
- route?: string;
13
- /** Client extras from the presign body. Passed on to `resolveScope`. */
14
- clientMetadata?: Record<string, string>;
15
- file?: {
16
- size?: number;
17
- };
18
- replace?: "overwrite";
19
- key?: string;
20
- bucket?: string;
21
- };
22
- /**
23
- * Reject uploads that would exceed scope usage.
24
- * Wire as `upload.guard` (after `db()` so ownership still runs), or pass
25
- * `quota` on {@link db}.
26
- */
27
- export declare function createQuotaGuard(options: CreateQuotaGuardOptions): (context: QuotaGuardContext) => Promise<void>;
28
- //# sourceMappingURL=create-quota-guard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-quota-guard.d.ts","sourceRoot":"","sources":["../../src/hooks/create-quota-guard.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAAC;IAC7C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AASF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,uBAAuB,GAC/B,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAwC/C"}
@@ -1,31 +0,0 @@
1
- import { type S3Client } from "@aws-sdk/client-s3";
2
- import type { DimahS3DbClient, StorageObjectStore } from "../store/storage-object-store.js";
3
- import type { StorageObject } from "../types/storage-object.js";
4
- export type PurgeStalePendingOptions = {
5
- /** FumaDB client (`DimahS3DB.client(adapter)`) or a prebuilt store. */
6
- client: DimahS3DbClient | StorageObjectStore;
7
- /**
8
- * Fallback age for pending rows that have no `expiresAt`.
9
- * @default 86_400_000 (24h)
10
- */
11
- olderThanMs?: number;
12
- /**
13
- * When set, abort in-progress multipart uploads and `DeleteObject` for
14
- * each stale pending key before rows are removed.
15
- */
16
- s3?: S3Client;
17
- /**
18
- * Runs before rows are deleted. Throwing keeps all rows for the next run.
19
- * Prefer `s3` unless you need a custom cleanup.
20
- */
21
- onBeforePurge?: (objects: StorageObject[]) => Promise<void> | void;
22
- };
23
- export type PurgeStalePendingResult = {
24
- purged: StorageObject[];
25
- };
26
- /**
27
- * Delete stale `pending` rows — uploads that were presigned but never
28
- * confirmed. Run it on a schedule (cron, queue worker, route handler).
29
- */
30
- export declare function purgeStalePendingObjects(options: PurgeStalePendingOptions): Promise<PurgeStalePendingResult>;
31
- //# sourceMappingURL=purge-stale-pending.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"purge-stale-pending.d.ts","sourceRoot":"","sources":["../../src/jobs/purge-stale-pending.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAI5D,MAAM,MAAM,wBAAwB,GAAG;IACrC,uEAAuE;IACvE,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAAC;IAC7C;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACpE,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB,CAAC;AAiCF;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAclC"}
@@ -1,21 +0,0 @@
1
- import * as z from "zod";
2
- export declare const DB_LIST_DEFAULT_LIMIT = 50;
3
- export declare const DB_LIST_MAX_LIMIT = 100;
4
- export declare const dbListQuerySchema: z.ZodObject<{
5
- status: z.ZodOptional<z.ZodEnum<{
6
- active: "active";
7
- deleted: "deleted";
8
- pending: "pending";
9
- }>>;
10
- limit: z.ZodDefault<z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>, z.ZodInt>>;
11
- offset: z.ZodOptional<z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>, z.ZodInt>>;
12
- cursor: z.ZodOptional<z.ZodString>;
13
- route: z.ZodOptional<z.ZodString>;
14
- contentType: z.ZodOptional<z.ZodString>;
15
- prefix: z.ZodOptional<z.ZodString>;
16
- }, z.core.$strip>;
17
- export declare const dbGetQuerySchema: z.ZodObject<{
18
- key: z.ZodString;
19
- bucket: z.ZodOptional<z.ZodString>;
20
- }, z.core.$strip>;
21
- //# sourceMappingURL=list-query-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-query-schema.d.ts","sourceRoot":"","sources":["../../src/plugin/list-query-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAkBrC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBAU5B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { ScopeResolver } from "../types/storage-object.js";
2
- /**
3
- * Resolve each (request, operation, route, key) once. Presign runs the
4
- * ownership guard, the quota guard, and `onPresigned` on one request; they
5
- * share a single `resolveScope` call. A batch delete still resolves per key.
6
- */
7
- export declare function memoizeScopeResolver(resolve: ScopeResolver): ScopeResolver;
8
- //# sourceMappingURL=memoize-scope-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memoize-scope-resolver.d.ts","sourceRoot":"","sources":["../../src/plugin/memoize-scope-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE1E;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAoB1E"}
@@ -1,31 +0,0 @@
1
- export declare const v1: import("fumadb/schema").Schema<"1.0.0", {
2
- storageObject: import("fumadb/schema").Table<{
3
- id: import("fumadb/schema").IdColumn<"varchar(255)", string | null, string>;
4
- scope: import("fumadb/schema").Column<"string", string, string>;
5
- bucket: import("fumadb/schema").Column<"string", string, string>;
6
- key: import("fumadb/schema").Column<"string", string, string>;
7
- /** Named dimah-s3 route that created the object. */
8
- route: import("fumadb/schema").Column<"string", string, string>;
9
- contentType: import("fumadb/schema").Column<"string", string | null, string | null>;
10
- /** Verified size from HeadObject after confirm. */
11
- size: import("fumadb/schema").Column<"bigint", bigint | null, bigint | null>;
12
- eTag: import("fumadb/schema").Column<"string", string | null, string | null>;
13
- filename: import("fumadb/schema").Column<"string", string | null, string | null>;
14
- status: import("fumadb/schema").Column<"string", string, string>;
15
- /** App-specific labels, visibility, publicUrl, etc. */
16
- metadata: import("fumadb/schema").Column<"json", unknown, unknown>;
17
- acl: import("fumadb/schema").Column<"string", string | null, string | null>;
18
- /** Multipart upload ID while status = pending. */
19
- uploadId: import("fumadb/schema").Column<"string", string | null, string | null>;
20
- /** Client-declared size before confirm (quota reservation). */
21
- declaredSize: import("fumadb/schema").Column<"bigint", bigint | null, bigint | null>;
22
- confirmedAt: import("fumadb/schema").Column<"timestamp", Date | null, Date | null>;
23
- /** Pending TTL or temporary object expiry. */
24
- expiresAt: import("fumadb/schema").Column<"timestamp", Date | null, Date | null>;
25
- createdAt: import("fumadb/schema").Column<"timestamp", Date | null, Date>;
26
- updatedAt: import("fumadb/schema").Column<"timestamp", Date | null, Date>;
27
- deletedAt: import("fumadb/schema").Column<"timestamp", Date | null, Date | null>;
28
- }, {}>;
29
- }>;
30
- export type { StorageObjectStatus } from "../types/storage-object.js";
31
- //# sourceMappingURL=v1.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"v1.d.ts","sourceRoot":"","sources":["../../src/schema/v1.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,EAAE;;;;;;QAvBb,oDAAoD;;;QAGpD,mDAAmD;;;;;QAKnD,uDAAuD;;;QAGvD,kDAAkD;;QAElD,+DAA+D;;;QAG/D,8CAA8C;;;;;;EAY9C,CAAC;AAEH,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1,137 +0,0 @@
1
- import type { InferFumaDB } from "fumadb";
2
- import type { DimahS3DB } from "../fuma-db.js";
3
- import type { StorageObject, StorageObjectStatus } from "../types/storage-object.js";
4
- /** FumaDB client for the @dimah-s3/db schema. */
5
- export type DimahS3DbClient = InferFumaDB<typeof DimahS3DB>;
6
- /** Identifies one object row — `(bucket, key)` is unique. */
7
- export type ObjectRef = {
8
- bucket: string;
9
- key: string;
10
- };
11
- export type UpsertPendingInput = ObjectRef & {
12
- scope: string;
13
- route: string;
14
- contentType?: string | null;
15
- /** Client-declared size in bytes (quota reservation — not verified). */
16
- declaredSize?: number | null;
17
- metadata?: Record<string, unknown> | null;
18
- acl?: string | null;
19
- filename?: string | null;
20
- /** Multipart upload ID, when the pending upload is multipart. */
21
- uploadId?: string | null;
22
- /** Pending TTL — stale rows past this are eligible for purge. */
23
- expiresAt?: Date | null;
24
- };
25
- export type MarkActiveInput = ObjectRef & {
26
- /** Verified size in bytes (from HeadObject). */
27
- size: number;
28
- eTag?: string | null;
29
- contentType?: string | null;
30
- acl?: string | null;
31
- filename?: string | null;
32
- metadata?: Record<string, unknown> | null;
33
- };
34
- export type ListByScopeInput = {
35
- scope: string;
36
- /**
37
- * Filter by exact status. When omitted, only `active` rows are returned.
38
- */
39
- status?: StorageObjectStatus;
40
- route?: string;
41
- contentType?: string;
42
- /** Key prefix. Applied in the query (`starts with`), so pages stay full. */
43
- prefix?: string;
44
- limit?: number;
45
- offset?: number;
46
- cursor?: string;
47
- };
48
- export type ScopeUsage = {
49
- /** Sum of verified size (fallback: declared size) of non-deleted rows. */
50
- totalBytes: number;
51
- /** Non-deleted row count. */
52
- objectCount: number;
53
- };
54
- /**
55
- * Minimal multipart resume payload — structurally matches
56
- * `@dimah-s3/react` `StoredUpload` so a custom client `UploadStore` can
57
- * return it from `get()` without importing react types.
58
- */
59
- export type PendingMultipartResume = {
60
- uploadId: string;
61
- key: string;
62
- /** Declared file size in bytes (must match the File being resumed). */
63
- fileSize: number;
64
- bucket: string;
65
- };
66
- export type FindPendingMultipartInput = ObjectRef & {
67
- /** Must equal the pending row's `declaredSize`. */
68
- fileSize: number;
69
- };
70
- /**
71
- * Map a `storage_object` row to a client resume payload.
72
- * Returns `null` unless the row is `pending` with `uploadId` and `declaredSize`.
73
- */
74
- export declare function toPendingMultipartResume(object: StorageObject): PendingMultipartResume | null;
75
- /** Data-access layer for the `storage_object` table. */
76
- export type StorageObjectStore = {
77
- /**
78
- * Insert or reset a row to `pending` (presign / multipart init).
79
- * Returns the written row.
80
- */
81
- upsertPending: (input: UpsertPendingInput) => Promise<StorageObject>;
82
- /**
83
- * Promote a pending row to `active` with verified fields (confirm / complete).
84
- * Also refreshes an already-active row (overwrite). Returns the active row.
85
- */
86
- markActive: (input: MarkActiveInput) => Promise<StorageObject>;
87
- /** Load one row by `bucket` + `key` (any status). */
88
- find: (ref: ObjectRef) => Promise<StorageObject | null>;
89
- /** Load one row by scope + key (any status). */
90
- findByScopeKey: (input: {
91
- scope: string;
92
- key: string;
93
- bucket?: string;
94
- }) => Promise<StorageObject | null>;
95
- /** Load one row — only when `status` is `active`. */
96
- findActive: (ref: ObjectRef) => Promise<StorageObject | null>;
97
- /**
98
- * Pending multipart row for resume: `pending` + `uploadId` + matching
99
- * `declaredSize`. Returns the full row so callers can enforce scope.
100
- */
101
- findPendingMultipart: (input: FindPendingMultipartInput) => Promise<StorageObject | null>;
102
- /**
103
- * List rows for a scope (pass `scope` explicitly — admin routes, jobs, etc.).
104
- * Defaults to `active`. Server-side listing; browser apps use
105
- * `api.db.listObjects` instead (scope from `resolveScope`, no HTTP from server code).
106
- */
107
- listByScope: (input: ListByScopeInput) => Promise<StorageObject[]>;
108
- /** Total bytes and row count for a scope — quota checks (`pending` uses `declaredSize`). */
109
- getScopeUsage: (scope: string) => Promise<ScopeUsage>;
110
- /** Row count for a scope; optional `status` filter (same defaults as `listByScope`). */
111
- countByScope: (scope: string, status?: StorageObjectStatus) => Promise<number>;
112
- /**
113
- * Mark a row `deleted` (keeps the record). DB-only — does not delete from S3.
114
- * Not a substitute for `api.delete`; the plugin calls this from `onDeleted`
115
- * when `deleteMode` is `"soft"`.
116
- */
117
- softDelete: (ref: ObjectRef) => Promise<void>;
118
- /**
119
- * Remove the row entirely. DB-only — does not delete from S3.
120
- * Not a substitute for `api.delete`; used by the plugin when `deleteMode` is
121
- * `"hard"`, or by admin jobs to prune soft-deleted audit rows.
122
- */
123
- hardDelete: (ref: ObjectRef) => Promise<void>;
124
- /** Remove a `pending` row (multipart abort path). Optional `uploadId` must match. */
125
- deletePending: (ref: ObjectRef & {
126
- uploadId?: string;
127
- }) => Promise<void>;
128
- /** Pending rows past `expiresAt`, or with no TTL and `createdAt` before `olderThan`. */
129
- findStalePending: (input: {
130
- olderThan: Date;
131
- }) => Promise<StorageObject[]>;
132
- /** Delete rows by ID (used by the purge job after `findStalePending`). */
133
- deleteByIds: (ids: string[]) => Promise<void>;
134
- };
135
- /** Create a store bound to schema v1 (`db.orm("1.0.0")`). */
136
- export declare function createStorageObjectStore(db: DimahS3DbClient): StorageObjectStore;
137
- //# sourceMappingURL=storage-object-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage-object-store.d.ts","sourceRoot":"","sources":["../../src/store/storage-object-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAYhC,iDAAiD;AACjD,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,SAAS,CAAC,CAAC;AAE5D,6DAA6D;AAC7D,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1C,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iEAAiE;IACjE,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG;IAClD,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,aAAa,GACpB,sBAAsB,GAAG,IAAI,CAc/B;AAED,wDAAwD;AACxD,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACrE;;;OAGG;IACH,UAAU,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/D,qDAAqD;IACrD,IAAI,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACxD,gDAAgD;IAChD,cAAc,EAAE,CAAC,KAAK,EAAE;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,KAAK,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACpC,qDAAqD;IACrD,UAAU,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAC9D;;;OAGG;IACH,oBAAoB,EAAE,CACpB,KAAK,EAAE,yBAAyB,KAC7B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACnC;;;;OAIG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACnE,4FAA4F;IAC5F,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACtD,wFAAwF;IACxF,YAAY,EAAE,CACZ,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,mBAAmB,KACzB,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB;;;;OAIG;IACH,UAAU,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;;;;OAIG;IACH,UAAU,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,qFAAqF;IACrF,aAAa,EAAE,CAAC,GAAG,EAAE,SAAS,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,wFAAwF;IACxF,gBAAgB,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,IAAI,CAAA;KAAE,KAAK,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAC3E,0EAA0E;IAC1E,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C,CAAC;AAoDF,6DAA6D;AAC7D,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,eAAe,GAClB,kBAAkB,CAwPpB"}
@@ -1,10 +0,0 @@
1
- # Schema examples
2
-
3
- Copy-paste `storage_object` + recommended indexes. Not imported at runtime.
4
-
5
- | File | ORM |
6
- | ---------------------------------- | -------------------- |
7
- | [`drizzle.ts`](./drizzle.ts) | Drizzle 1.x (SQLite) |
8
- | [`schema.prisma`](./schema.prisma) | Prisma |
9
-
10
- Docs: [Database Setup](https://s3.dimah.dev/docs/db/setup). Drizzle needs `fumadb/cuid` → `@paralleldrive/cuid2` in tsconfig paths.