@dimah-s3/db 2.0.0-beta.0 → 2.0.0-beta.2
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/README.md +3 -3
- package/dist/adapters/drizzle.d.ts +2 -1
- package/dist/adapters/drizzle.d.ts.map +1 -1
- package/dist/cli.d.ts +8 -9
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +42 -103
- package/dist/cli.js.map +1 -1
- package/dist/client/db-client.d.ts +1 -1
- package/dist/client/db-client.d.ts.map +1 -1
- package/dist/client/db-object-source.d.ts +5 -4
- package/dist/client/db-object-source.d.ts.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +27 -12
- package/dist/client/index.js.map +1 -1
- package/dist/drizzle/mysql.d.ts +46 -13
- package/dist/drizzle/mysql.d.ts.map +1 -1
- package/dist/drizzle/mysql.js +15 -18
- package/dist/drizzle/mysql.js.map +1 -1
- package/dist/drizzle/pg.d.ts +44 -13
- package/dist/drizzle/pg.d.ts.map +1 -1
- package/dist/drizzle/pg.js +17 -17
- package/dist/drizzle/pg.js.map +1 -1
- package/dist/drizzle/shared.d.ts +4 -13
- package/dist/drizzle/shared.d.ts.map +1 -1
- package/dist/drizzle/sqlite.d.ts +46 -13
- package/dist/drizzle/sqlite.d.ts.map +1 -1
- package/dist/drizzle/sqlite.js +17 -17
- package/dist/drizzle/sqlite.js.map +1 -1
- package/dist/folder-path.d.ts +9 -2
- package/dist/folder-path.d.ts.map +1 -1
- package/dist/fuma-db.d.ts +10 -30
- package/dist/fuma-db.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +372 -231
- package/dist/index.js.map +1 -1
- package/dist/plugin/create-database-endpoints.d.ts +38 -18
- package/dist/plugin/create-database-endpoints.d.ts.map +1 -1
- package/dist/plugin/create-database-lifecycle-hooks.d.ts +1 -1
- package/dist/plugin/create-database-lifecycle-hooks.d.ts.map +1 -1
- package/dist/plugin/db.d.ts.map +1 -1
- package/dist/plugin/object-access.d.ts +1 -1
- package/dist/plugin/object-access.d.ts.map +1 -1
- package/dist/plugin/public-stores.d.ts +4 -7
- package/dist/plugin/public-stores.d.ts.map +1 -1
- package/dist/plugin/schemas.d.ts +21 -12
- package/dist/plugin/schemas.d.ts.map +1 -1
- package/dist/plugin/to-db-client-object.d.ts.map +1 -1
- package/dist/schema/{v2.d.ts → schema.d.ts} +23 -13
- package/dist/schema/schema.d.ts.map +1 -0
- package/dist/store/create-db-store.d.ts +2 -2
- package/dist/store/folder-store.d.ts +41 -14
- package/dist/store/folder-store.d.ts.map +1 -1
- package/dist/store/list-cursor.d.ts +1 -1
- package/dist/store/list-cursor.d.ts.map +1 -1
- package/dist/store/map-row.d.ts +2 -2
- package/dist/store/map-row.d.ts.map +1 -1
- package/dist/store/object-store.d.ts +9 -9
- package/dist/store/object-store.d.ts.map +1 -1
- package/dist/store/schema-version.d.ts +1 -1
- package/dist/types/client.d.ts +47 -18
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +6 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/storage-object.d.ts +8 -7
- package/dist/types/storage-object.d.ts.map +1 -1
- package/package.json +9 -6
- package/prisma/dimah-s3.prisma +14 -13
- package/sql/mysql.sql +12 -11
- package/sql/pg.sql +10 -10
- package/sql/sqlite.sql +10 -9
- package/src/drizzle/mysql.ts +175 -0
- package/src/drizzle/pg.ts +146 -0
- package/src/drizzle/sqlite.ts +150 -0
- package/dist/schema/v1.d.ts +0 -24
- package/dist/schema/v1.d.ts.map +0 -1
- package/dist/schema/v2.d.ts.map +0 -1
- package/sql/upgrade/1.0.0-2.0.0/mysql.sql +0 -71
- package/sql/upgrade/1.0.0-2.0.0/pg.sql +0 -47
- package/sql/upgrade/1.0.0-2.0.0/sqlite.sql +0 -119
package/dist/drizzle/sqlite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type StorageObjectStatus = "pending" | "active" | "deleted" | "purging";
|
|
2
2
|
/** The `storage_object` table: one row per tracked object. */
|
|
3
3
|
export declare const storageObject: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
4
4
|
name: "storage_object";
|
|
@@ -84,7 +84,7 @@ export declare const storageObject: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
84
84
|
identity: undefined;
|
|
85
85
|
generated: undefined;
|
|
86
86
|
}, {}>;
|
|
87
|
-
|
|
87
|
+
folderId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
88
88
|
name: string;
|
|
89
89
|
tableName: "storage_object";
|
|
90
90
|
dataType: "string";
|
|
@@ -397,14 +397,14 @@ export declare const storageFolder: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
397
397
|
identity: undefined;
|
|
398
398
|
generated: undefined;
|
|
399
399
|
}, {}>;
|
|
400
|
-
|
|
400
|
+
parentId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
401
401
|
name: string;
|
|
402
402
|
tableName: "storage_folder";
|
|
403
403
|
dataType: "string";
|
|
404
404
|
data: string;
|
|
405
405
|
driverParam: string;
|
|
406
406
|
notNull: true;
|
|
407
|
-
hasDefault:
|
|
407
|
+
hasDefault: true;
|
|
408
408
|
isPrimaryKey: false;
|
|
409
409
|
isAutoincrement: false;
|
|
410
410
|
hasRuntimeDefault: false;
|
|
@@ -413,13 +413,13 @@ export declare const storageFolder: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
413
413
|
identity: undefined;
|
|
414
414
|
generated: undefined;
|
|
415
415
|
}, {}>;
|
|
416
|
-
|
|
416
|
+
name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
417
417
|
name: string;
|
|
418
418
|
tableName: "storage_folder";
|
|
419
419
|
dataType: "string";
|
|
420
420
|
data: string;
|
|
421
421
|
driverParam: string;
|
|
422
|
-
notNull:
|
|
422
|
+
notNull: true;
|
|
423
423
|
hasDefault: false;
|
|
424
424
|
isPrimaryKey: false;
|
|
425
425
|
isAutoincrement: false;
|
|
@@ -429,7 +429,7 @@ export declare const storageFolder: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
429
429
|
identity: undefined;
|
|
430
430
|
generated: undefined;
|
|
431
431
|
}, {}>;
|
|
432
|
-
|
|
432
|
+
path: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
433
433
|
name: string;
|
|
434
434
|
tableName: "storage_folder";
|
|
435
435
|
dataType: "string";
|
|
@@ -461,6 +461,22 @@ export declare const storageFolder: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
461
461
|
identity: undefined;
|
|
462
462
|
generated: undefined;
|
|
463
463
|
}, {}>;
|
|
464
|
+
updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
465
|
+
name: string;
|
|
466
|
+
tableName: "storage_folder";
|
|
467
|
+
dataType: "object date";
|
|
468
|
+
data: Date;
|
|
469
|
+
driverParam: number;
|
|
470
|
+
notNull: true;
|
|
471
|
+
hasDefault: true;
|
|
472
|
+
isPrimaryKey: false;
|
|
473
|
+
isAutoincrement: false;
|
|
474
|
+
hasRuntimeDefault: true;
|
|
475
|
+
enumValues: undefined;
|
|
476
|
+
baseColumn: never;
|
|
477
|
+
identity: undefined;
|
|
478
|
+
generated: undefined;
|
|
479
|
+
}, {}>;
|
|
464
480
|
};
|
|
465
481
|
dialect: 'sqlite';
|
|
466
482
|
isAlias: false;
|
|
@@ -599,7 +615,7 @@ export declare const dimahS3Tables: {
|
|
|
599
615
|
identity: undefined;
|
|
600
616
|
generated: undefined;
|
|
601
617
|
}, {}>;
|
|
602
|
-
|
|
618
|
+
folderId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
603
619
|
name: string;
|
|
604
620
|
tableName: "storage_object";
|
|
605
621
|
dataType: "string";
|
|
@@ -911,14 +927,14 @@ export declare const dimahS3Tables: {
|
|
|
911
927
|
identity: undefined;
|
|
912
928
|
generated: undefined;
|
|
913
929
|
}, {}>;
|
|
914
|
-
|
|
930
|
+
parentId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
915
931
|
name: string;
|
|
916
932
|
tableName: "storage_folder";
|
|
917
933
|
dataType: "string";
|
|
918
934
|
data: string;
|
|
919
935
|
driverParam: string;
|
|
920
936
|
notNull: true;
|
|
921
|
-
hasDefault:
|
|
937
|
+
hasDefault: true;
|
|
922
938
|
isPrimaryKey: false;
|
|
923
939
|
isAutoincrement: false;
|
|
924
940
|
hasRuntimeDefault: false;
|
|
@@ -927,13 +943,13 @@ export declare const dimahS3Tables: {
|
|
|
927
943
|
identity: undefined;
|
|
928
944
|
generated: undefined;
|
|
929
945
|
}, {}>;
|
|
930
|
-
|
|
946
|
+
name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
931
947
|
name: string;
|
|
932
948
|
tableName: "storage_folder";
|
|
933
949
|
dataType: "string";
|
|
934
950
|
data: string;
|
|
935
951
|
driverParam: string;
|
|
936
|
-
notNull:
|
|
952
|
+
notNull: true;
|
|
937
953
|
hasDefault: false;
|
|
938
954
|
isPrimaryKey: false;
|
|
939
955
|
isAutoincrement: false;
|
|
@@ -943,7 +959,7 @@ export declare const dimahS3Tables: {
|
|
|
943
959
|
identity: undefined;
|
|
944
960
|
generated: undefined;
|
|
945
961
|
}, {}>;
|
|
946
|
-
|
|
962
|
+
path: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
947
963
|
name: string;
|
|
948
964
|
tableName: "storage_folder";
|
|
949
965
|
dataType: "string";
|
|
@@ -975,6 +991,22 @@ export declare const dimahS3Tables: {
|
|
|
975
991
|
identity: undefined;
|
|
976
992
|
generated: undefined;
|
|
977
993
|
}, {}>;
|
|
994
|
+
updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
995
|
+
name: string;
|
|
996
|
+
tableName: "storage_folder";
|
|
997
|
+
dataType: "object date";
|
|
998
|
+
data: Date;
|
|
999
|
+
driverParam: number;
|
|
1000
|
+
notNull: true;
|
|
1001
|
+
hasDefault: true;
|
|
1002
|
+
isPrimaryKey: false;
|
|
1003
|
+
isAutoincrement: false;
|
|
1004
|
+
hasRuntimeDefault: true;
|
|
1005
|
+
enumValues: undefined;
|
|
1006
|
+
baseColumn: never;
|
|
1007
|
+
identity: undefined;
|
|
1008
|
+
generated: undefined;
|
|
1009
|
+
}, {}>;
|
|
978
1010
|
};
|
|
979
1011
|
dialect: 'sqlite';
|
|
980
1012
|
isAlias: false;
|
|
@@ -1020,4 +1052,5 @@ export declare const dimahS3Tables: {
|
|
|
1020
1052
|
isAlias: false;
|
|
1021
1053
|
}>;
|
|
1022
1054
|
};
|
|
1055
|
+
export {};
|
|
1023
1056
|
//# sourceMappingURL=sqlite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/drizzle/sqlite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/drizzle/sqlite.ts"],"names":[],"mappings":"AAwBA,KAAK,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAyBxE,8DAA8D;AAC9D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDzB,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"}
|
package/dist/drizzle/sqlite.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
+
import { createId } from '@paralleldrive/cuid2';
|
|
1
2
|
import { sql } from 'drizzle-orm';
|
|
2
3
|
import { sqliteTable, text, uniqueIndex, index, integer } from 'drizzle-orm/sqlite-core';
|
|
3
|
-
import { createId } from '@paralleldrive/cuid2';
|
|
4
|
-
|
|
5
|
-
// src/drizzle/sqlite.ts
|
|
6
|
-
var DIMAH_S3_SCHEMA_VERSION = "2.0.0";
|
|
7
|
-
var runtimeDefaults = {
|
|
8
|
-
id: () => createId(),
|
|
9
|
-
now: () => /* @__PURE__ */ new Date()
|
|
10
|
-
};
|
|
11
4
|
|
|
12
5
|
// src/drizzle/sqlite.ts
|
|
6
|
+
var SCHEMA_VERSION = "2.1.0";
|
|
13
7
|
function id() {
|
|
14
|
-
return text("id").primaryKey().$defaultFn(
|
|
8
|
+
return text("id").primaryKey().$defaultFn(() => createId());
|
|
15
9
|
}
|
|
16
10
|
function timestamp(name) {
|
|
17
11
|
return integer(name, { mode: "timestamp_ms" });
|
|
18
12
|
}
|
|
19
13
|
function timestampNow(name) {
|
|
20
|
-
return timestamp(name).notNull().default(sql`(strftime('%s', 'now') * 1000)`).$defaultFn(
|
|
14
|
+
return timestamp(name).notNull().default(sql`(strftime('%s', 'now') * 1000)`).$defaultFn(() => /* @__PURE__ */ new Date());
|
|
21
15
|
}
|
|
22
16
|
function byteCount(name) {
|
|
23
17
|
return integer(name, { mode: "number" });
|
|
@@ -30,7 +24,7 @@ var storageObject = sqliteTable(
|
|
|
30
24
|
bucket: text("bucket").notNull(),
|
|
31
25
|
key: text("key").notNull(),
|
|
32
26
|
route: text("route").notNull(),
|
|
33
|
-
|
|
27
|
+
folderId: text("folder_id"),
|
|
34
28
|
filename: text("filename").notNull(),
|
|
35
29
|
contentType: text("content_type"),
|
|
36
30
|
size: byteCount("size"),
|
|
@@ -53,7 +47,7 @@ var storageObject = sqliteTable(
|
|
|
53
47
|
index("storage_object_scope_folder_idx").on(
|
|
54
48
|
table.scope,
|
|
55
49
|
table.status,
|
|
56
|
-
table.
|
|
50
|
+
table.folderId,
|
|
57
51
|
table.createdAt
|
|
58
52
|
),
|
|
59
53
|
index("storage_object_scope_updated_idx").on(
|
|
@@ -82,19 +76,25 @@ var storageFolder = sqliteTable(
|
|
|
82
76
|
{
|
|
83
77
|
id: id(),
|
|
84
78
|
scope: text("scope").notNull(),
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
/** `""` is the root. */
|
|
80
|
+
parentId: text("parent_id").notNull().default(""),
|
|
87
81
|
name: text("name").notNull(),
|
|
88
|
-
|
|
82
|
+
path: text("path").notNull(),
|
|
83
|
+
createdAt: timestampNow("created_at"),
|
|
84
|
+
updatedAt: timestampNow("updated_at")
|
|
89
85
|
},
|
|
90
86
|
(table) => [
|
|
91
87
|
uniqueIndex("storage_folder_scope_path_uk").on(table.scope, table.path),
|
|
92
|
-
|
|
88
|
+
uniqueIndex("storage_folder_scope_parent_name_uk").on(
|
|
89
|
+
table.scope,
|
|
90
|
+
table.parentId,
|
|
91
|
+
table.name
|
|
92
|
+
)
|
|
93
93
|
]
|
|
94
94
|
);
|
|
95
95
|
var dimahS3Settings = sqliteTable("private_dimah_s3_settings", {
|
|
96
96
|
key: text("key").primaryKey(),
|
|
97
|
-
version: text("value").notNull().default(
|
|
97
|
+
version: text("value").notNull().default(SCHEMA_VERSION)
|
|
98
98
|
});
|
|
99
99
|
var dimahS3Tables = {
|
|
100
100
|
storageObject,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/drizzle/
|
|
1
|
+
{"version":3,"sources":["../../src/drizzle/sqlite.ts"],"names":[],"mappings":";;;;;AA0BA,IAAM,cAAA,GAAiB,OAAA;AAEvB,SAAS,EAAA,GAAK;AACZ,EAAA,OAAO,IAAA,CAAK,IAAI,CAAA,CACb,UAAA,GACA,UAAA,CAAW,MAAM,UAAU,CAAA;AAChC;AAEA,SAAS,UAAU,IAAA,EAAc;AAC/B,EAAA,OAAO,OAAA,CAAQ,IAAA,EAAM,EAAE,IAAA,EAAM,gBAAgB,CAAA;AAC/C;AAEA,SAAS,aAAa,IAAA,EAAc;AAClC,EAAA,OAAO,SAAA,CAAU,IAAI,CAAA,CAClB,OAAA,EAAQ,CACR,OAAA,CAAQ,GAAA,CAAA,8BAAA,CAAmC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Q,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,YAAY,8BAA8B,CAAA,CAAE,GAAG,KAAA,CAAM,KAAA,EAAO,MAAM,IAAI,CAAA;AAAA,IACtE,WAAA,CAAY,qCAAqC,CAAA,CAAE,EAAA;AAAA,MACjD,KAAA,CAAM,KAAA;AAAA,MACN,KAAA,CAAM,QAAA;AAAA,MACN,KAAA,CAAM;AAAA;AACR;AAEJ;AAMO,IAAM,eAAA,GAAkB,YAAY,2BAAA,EAA6B;AAAA,EACtE,GAAA,EAAK,IAAA,CAAK,KAAK,CAAA,CAAE,UAAA,EAAW;AAAA,EAC5B,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":"sqlite.js","sourcesContent":["/**\n * Drizzle schema for @dimah-s3/db on SQLite. Copy this file into your app\n * (`db/schema.ts`) to own the tables and add columns. Keep the table names,\n * the column names, and the `dimahS3Tables` keys: the adapter finds the\n * tables by those keys. A column you add must be nullable or have a default.\n * The plugin does not read or write it.\n *\n * Import `dimahS3Tables` from `@dimah-s3/db/drizzle/sqlite` when the tables\n * stay 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 * Timestamps are epoch milliseconds and sizes are integers, matching\n * `sql/sqlite.sql`. Requires `drizzle-orm` and `@paralleldrive/cuid2`.\n */\nimport { createId } from \"@paralleldrive/cuid2\";\nimport { sql } from \"drizzle-orm\";\nimport {\n index,\n integer,\n sqliteTable,\n text,\n uniqueIndex,\n} from \"drizzle-orm/sqlite-core\";\n\ntype StorageObjectStatus = \"pending\" | \"active\" | \"deleted\" | \"purging\";\n\nconst SCHEMA_VERSION = \"2.1.0\";\n\nfunction id() {\n return text(\"id\")\n .primaryKey()\n .$defaultFn(() => createId());\n}\n\nfunction timestamp(name: string) {\n return integer(name, { mode: \"timestamp_ms\" });\n}\n\nfunction timestampNow(name: string) {\n return timestamp(name)\n .notNull()\n .default(sql`(strftime('%s', 'now') * 1000)`)\n .$defaultFn(() => new Date());\n}\n\nfunction byteCount(name: string) {\n return integer(name, { mode: \"number\" });\n}\n\n/** The `storage_object` table: one row per tracked object. */\nexport const storageObject = sqliteTable(\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: text(\"s3_metadata\", { mode: \"json\" }).$type<\n Record<string, string>\n >(),\n attributes: text(\"attributes\", { mode: \"json\" }),\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 uniqueIndex(\"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 = sqliteTable(\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 uniqueIndex(\"storage_folder_scope_path_uk\").on(table.scope, table.path),\n uniqueIndex(\"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 = sqliteTable(\"private_dimah_s3_settings\", {\n key: text(\"key\").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"]}
|
package/dist/folder-path.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Logical folder paths. A path is NFC-normalized and `/`-separated, with no
|
|
3
|
-
* leading or trailing `/`. `null` is the root
|
|
4
|
-
*
|
|
3
|
+
* leading or trailing `/`. `null` is the root. The wire addresses a folder
|
|
4
|
+
* by id; the path is the cached label of that id.
|
|
5
5
|
*/
|
|
6
6
|
/** Longest folder path, in characters. */
|
|
7
7
|
export declare const FOLDER_PATH_MAX_LENGTH = 1024;
|
|
@@ -9,6 +9,8 @@ export declare const FOLDER_PATH_MAX_LENGTH = 1024;
|
|
|
9
9
|
export declare const FOLDER_NAME_MAX_LENGTH = 255;
|
|
10
10
|
/** Most segments in a folder path. Each one is a row the server keeps. */
|
|
11
11
|
export declare const FOLDER_MAX_DEPTH = 32;
|
|
12
|
+
/** True when `name` can be one segment of a folder path. */
|
|
13
|
+
export declare function isFolderName(name: string): boolean;
|
|
12
14
|
/**
|
|
13
15
|
* Returns the NFC form of `path`, or `null` when it is not a valid folder
|
|
14
16
|
* path. The root (`""`) is not a folder path.
|
|
@@ -21,6 +23,11 @@ export declare function normalizeFolderPath(path: string): string | null;
|
|
|
21
23
|
export declare function parseFolder(value: string): string | null;
|
|
22
24
|
/** Writes a folder for the wire. The root becomes `""`. */
|
|
23
25
|
export declare function formatFolder(folder: string | null): string;
|
|
26
|
+
/**
|
|
27
|
+
* The path of `name` inside `parent`. `null` when `name` is not a folder
|
|
28
|
+
* name or the joined path is too long or too deep.
|
|
29
|
+
*/
|
|
30
|
+
export declare function childFolderPath(parent: string | null, name: string): string | null;
|
|
24
31
|
/** Appends `name` to `parent`. The result is not validated. */
|
|
25
32
|
export declare function joinFolderPath(parent: string | null, name: string): string;
|
|
26
33
|
/** The folder that contains `path`. `null` for a top-level folder. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-path.d.ts","sourceRoot":"","sources":["../src/folder-path.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,0CAA0C;AAC1C,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"folder-path.d.ts","sourceRoot":"","sources":["../src/folder-path.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,0CAA0C;AAC1C,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAUnC,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUlD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO/D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKxD;AAED,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,IAAI,CAGf;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG5D;AAED,kCAAkC;AAClC,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAGtD"}
|
package/dist/fuma-db.d.ts
CHANGED
|
@@ -1,39 +1,19 @@
|
|
|
1
1
|
import { type InferFumaDB } from "fumadb";
|
|
2
|
-
import { v2 } from "./schema/v2";
|
|
3
2
|
/**
|
|
4
3
|
* The @dimah-s3/db FumaDB library. Call `DimahS3DB.client(adapter)` with an
|
|
5
4
|
* adapter from `@dimah-s3/db/adapters/*` to get a {@link DimahS3DbClient}.
|
|
5
|
+
*
|
|
6
|
+
* `predecessor` is empty. FumaDB skips `up` on the first schema, and the
|
|
7
|
+
* indexes are created in {@link dbSchema}'s `up`.
|
|
6
8
|
*/
|
|
7
|
-
export declare const DimahS3DB: import("fumadb").FumaDBFactory<(import("fumadb/schema").Schema<"
|
|
9
|
+
export declare const DimahS3DB: import("fumadb").FumaDBFactory<(import("fumadb/schema").Schema<"0.0.1", {}> | import("fumadb/schema").Schema<"2.1.0", {
|
|
8
10
|
storageObject: import("fumadb/schema").Table<{
|
|
9
11
|
id: import("fumadb/schema").IdColumn<"varchar(255)", string | null, string>;
|
|
10
12
|
scope: import("fumadb/schema").Column<"string", string, string>;
|
|
11
13
|
bucket: import("fumadb/schema").Column<"string", string, string>;
|
|
12
14
|
key: import("fumadb/schema").Column<"string", string, string>;
|
|
13
15
|
route: import("fumadb/schema").Column<"string", string, string>;
|
|
14
|
-
|
|
15
|
-
size: import("fumadb/schema").Column<"bigint", bigint | null, bigint | null>;
|
|
16
|
-
eTag: import("fumadb/schema").Column<"string", string | null, string | null>;
|
|
17
|
-
filename: import("fumadb/schema").Column<"string", string | null, string | null>;
|
|
18
|
-
status: import("fumadb/schema").Column<"string", string, string>;
|
|
19
|
-
s3Metadata: import("fumadb/schema").Column<"json", unknown, unknown>;
|
|
20
|
-
acl: import("fumadb/schema").Column<"string", string | null, string | null>;
|
|
21
|
-
uploadId: import("fumadb/schema").Column<"string", string | null, string | null>;
|
|
22
|
-
declaredSize: import("fumadb/schema").Column<"bigint", bigint | null, bigint | null>;
|
|
23
|
-
confirmedAt: import("fumadb/schema").Column<"timestamp", Date | null, Date | null>;
|
|
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
|
-
}> | import("fumadb/schema").Schema<"2.0.0", {
|
|
30
|
-
storageObject: import("fumadb/schema").Table<{
|
|
31
|
-
id: import("fumadb/schema").IdColumn<"varchar(255)", string | null, string>;
|
|
32
|
-
scope: import("fumadb/schema").Column<"string", string, string>;
|
|
33
|
-
bucket: import("fumadb/schema").Column<"string", string, string>;
|
|
34
|
-
key: import("fumadb/schema").Column<"string", string, string>;
|
|
35
|
-
route: import("fumadb/schema").Column<"string", string, string>;
|
|
36
|
-
folder: import("fumadb/schema").Column<"string", string | null, string | null>;
|
|
16
|
+
folderId: import("fumadb/schema").Column<"string", string | null, string | null>;
|
|
37
17
|
filename: import("fumadb/schema").Column<"string", string, string>;
|
|
38
18
|
contentType: import("fumadb/schema").Column<"string", string | null, string | null>;
|
|
39
19
|
size: import("fumadb/schema").Column<"bigint", number | null, string | number | bigint | null>;
|
|
@@ -54,15 +34,15 @@ export declare const DimahS3DB: import("fumadb").FumaDBFactory<(import("fumadb/s
|
|
|
54
34
|
storageFolder: import("fumadb/schema").Table<{
|
|
55
35
|
id: import("fumadb/schema").IdColumn<"varchar(255)", string | null, string>;
|
|
56
36
|
scope: import("fumadb/schema").Column<"string", string, string>;
|
|
57
|
-
|
|
58
|
-
parent: import("fumadb/schema").Column<"string", string | null, string | null>;
|
|
37
|
+
parentId: import("fumadb/schema").Column<"string", string, string>;
|
|
59
38
|
name: import("fumadb/schema").Column<"string", string, string>;
|
|
39
|
+
path: import("fumadb/schema").Column<"string", string, string>;
|
|
60
40
|
createdAt: import("fumadb/schema").Column<"timestamp", Date | null, Date>;
|
|
41
|
+
updatedAt: import("fumadb/schema").Column<"timestamp", Date | null, Date>;
|
|
61
42
|
}, {}>;
|
|
62
43
|
}>)[]>;
|
|
63
|
-
/** FumaDB client for the @dimah-s3/db
|
|
44
|
+
/** FumaDB client for the @dimah-s3/db schema. */
|
|
64
45
|
export type DimahS3DbClient = InferFumaDB<typeof DimahS3DB>;
|
|
65
46
|
/** The schema version the stores read and write. */
|
|
66
|
-
export declare const DB_SCHEMA_VERSION: "2.
|
|
67
|
-
export { v2 };
|
|
47
|
+
export declare const DB_SCHEMA_VERSION: "2.1.0";
|
|
68
48
|
//# sourceMappingURL=fuma-db.d.ts.map
|
package/dist/fuma-db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fuma-db.d.ts","sourceRoot":"","sources":["../src/fuma-db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"fuma-db.d.ts","sourceRoot":"","sources":["../src/fuma-db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGlD;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGpB,CAAC;AAEH,iDAAiD;AACjD,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,SAAS,CAAC,CAAC;AAE5D,oDAAoD;AACpD,eAAO,MAAM,iBAAiB,SAAmB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DB_SCHEMA_VERSION, DimahS3DB,
|
|
1
|
+
export { DB_SCHEMA_VERSION, DimahS3DB, type DimahS3DbClient } from "./fuma-db";
|
|
2
2
|
export { db, type DbPluginContext } from "./plugin/db";
|
|
3
3
|
export type { PruneDeletedOptions, PurgeStaleOptions, PurgeStaleResult, } from "./plugin/purge";
|
|
4
4
|
export type { DbFolders, DbObjects } from "./plugin/public-stores";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAG/E,OAAO,EAAE,EAAE,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,aAAa,EACb,aAAa,EACb,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,cAAc,EACd,cAAc,EACd,UAAU,EACV,eAAe,EACf,OAAO,EACP,OAAO,GACR,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,SAAS,EACT,iBAAiB,GAClB,MAAM,sBAAsB,CAAC"}
|