@dimah-s3/db 2.0.0-beta.1 → 2.0.0-beta.11
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 +19 -10
- package/dist/adapters/drizzle.d.ts +2 -3
- package/dist/adapters/drizzle.d.ts.map +1 -1
- package/dist/adapters/kysely.d.ts +1 -1
- package/dist/adapters/prisma.d.ts +1 -1
- package/dist/cli.d.ts +18 -13
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +57 -84
- 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 +15 -9
- package/dist/client/db-object-source.d.ts.map +1 -1
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +101 -21
- package/dist/client/index.js.map +1 -1
- package/dist/folder-path.d.ts +17 -4
- package/dist/folder-path.d.ts.map +1 -1
- package/dist/fuma-db.d.ts +23 -23
- package/dist/fuma-db.d.ts.map +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +843 -268
- package/dist/index.js.map +1 -1
- package/dist/plugin/create-database-endpoints.d.ts +46 -22
- package/dist/plugin/create-database-endpoints.d.ts.map +1 -1
- package/dist/plugin/create-database-lifecycle-hooks.d.ts +4 -4
- package/dist/plugin/create-database-lifecycle-hooks.d.ts.map +1 -1
- package/dist/plugin/db.d.ts +10 -2
- package/dist/plugin/db.d.ts.map +1 -1
- package/dist/plugin/object-access.d.ts +2 -2
- package/dist/plugin/object-access.d.ts.map +1 -1
- package/dist/plugin/public-stores.d.ts +5 -8
- package/dist/plugin/public-stores.d.ts.map +1 -1
- package/dist/plugin/quota.d.ts +1 -1
- package/dist/plugin/record.d.ts +58 -0
- package/dist/plugin/record.d.ts.map +1 -0
- package/dist/plugin/schemas.d.ts +25 -11
- package/dist/plugin/schemas.d.ts.map +1 -1
- package/dist/plugin/scope.d.ts +2 -0
- package/dist/plugin/scope.d.ts.map +1 -1
- package/dist/plugin/to-db-client-object.d.ts.map +1 -1
- package/dist/schema/schema.d.ts +48 -49
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/store/create-db-store.d.ts +2 -2
- package/dist/store/create-db-store.d.ts.map +1 -1
- package/dist/store/folder-store.d.ts +73 -15
- package/dist/store/folder-store.d.ts.map +1 -1
- package/dist/store/list-cursor.d.ts +3 -1
- package/dist/store/list-cursor.d.ts.map +1 -1
- package/dist/store/map-row.d.ts +3 -9
- package/dist/store/map-row.d.ts.map +1 -1
- package/dist/store/object-store.d.ts +42 -10
- package/dist/store/object-store.d.ts.map +1 -1
- package/dist/store/search-name.d.ts +7 -0
- package/dist/store/search-name.d.ts.map +1 -0
- package/dist/types/client.d.ts +114 -23
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +19 -7
- 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 +15 -33
- package/dist/drizzle/mysql.d.ts +0 -1025
- package/dist/drizzle/mysql.d.ts.map +0 -1
- package/dist/drizzle/mysql.js +0 -117
- package/dist/drizzle/mysql.js.map +0 -1
- package/dist/drizzle/pg.d.ts +0 -964
- package/dist/drizzle/pg.d.ts.map +0 -1
- package/dist/drizzle/pg.js +0 -98
- package/dist/drizzle/pg.js.map +0 -1
- package/dist/drizzle/shared.d.ts +0 -7
- package/dist/drizzle/shared.d.ts.map +0 -1
- package/dist/drizzle/sqlite.d.ts +0 -1024
- package/dist/drizzle/sqlite.d.ts.map +0 -1
- package/dist/drizzle/sqlite.js +0 -101
- package/dist/drizzle/sqlite.js.map +0 -1
- package/prisma/dimah-s3.prisma +0 -80
- package/sql/mysql.sql +0 -59
- package/sql/pg.sql +0 -53
- package/sql/sqlite.sql +0 -54
- package/src/drizzle/mysql.ts +0 -172
- package/src/drizzle/pg.ts +0 -140
- package/src/drizzle/sqlite.ts +0 -144
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @dimah-s3/db
|
|
2
2
|
|
|
3
|
-
**2.0 beta.** Install with `@beta`. `@latest` stays on 1.x, and betas can include breaking changes until 2.0.0.
|
|
3
|
+
**2.0 beta.** Install with `@beta`. `@latest` stays on 1.x ([v1.s3.dimah.dev](https://v1.s3.dimah.dev/docs)), and betas can include breaking changes until 2.0.0.
|
|
4
4
|
|
|
5
5
|
Optional database plugin for [dimah-s3](https://github.com/dimah-kz/dimah-s3). It tracks each upload in a `storage_object` table, binds uploads to the caller's scope, and adds logical folders, listings, and quotas.
|
|
6
6
|
|
|
7
|
-
**Docs:** [Database Setup](https://
|
|
7
|
+
**Docs:** [Database Setup](https://s3.dimah.dev/docs/db/setup) · [Lifecycle Hooks](https://s3.dimah.dev/docs/db/lifecycle-hooks) · [API](https://s3.dimah.dev/docs/db/api) · [Purge](https://s3.dimah.dev/docs/db/purge) · [llms.txt](https://s3.dimah.dev/llms.txt) · **Example:** [`examples/with-db`](../../examples/with-db)
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -12,18 +12,27 @@ Optional database plugin for [dimah-s3](https://github.com/dimah-kz/dimah-s3). I
|
|
|
12
12
|
pnpm add @dimah-s3/db@beta @dimah-s3/server@beta
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
You do not install `fumadb`: the adapters ship from `@dimah-s3/db/adapters
|
|
15
|
+
You do not install `fumadb`: the adapters ship from `@dimah-s3/db/adapters/*`, and the FumaDB CLI from `@dimah-s3/db/cli`.
|
|
16
16
|
|
|
17
17
|
## Tables
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
`runCli(client)` from `@dimah-s3/db/cli` runs the FumaDB CLI for this schema:
|
|
20
20
|
|
|
21
|
-
- Drizzle:
|
|
22
|
-
-
|
|
23
|
-
- Plain SQL: run [`sql/<dialect>.sql`](./sql).
|
|
24
|
-
- Kysely: call `migrate(client)` from `@dimah-s3/db/cli`. It creates the tables and the indexes. The FumaDB CLI from `runCli` does the same only with `migrate:up`; its `migrate` command jumps straight to the latest schema and skips the indexes.
|
|
21
|
+
- Drizzle or Prisma: `generate` writes the tables or models, with the indexes and the MySQL prefix lengths and collations. Apply them with `drizzle-kit` or Prisma Migrate. Generating does not connect to the database.
|
|
22
|
+
- Kysely: `migrate` creates the tables and the indexes, and so does `migrate(client)`.
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
```ts
|
|
25
|
+
// scripts/dimah-s3.ts — npx tsx scripts/dimah-s3.ts generate latest -o db/dimah-s3.ts
|
|
26
|
+
import { DimahS3DB } from "@dimah-s3/db";
|
|
27
|
+
import { drizzleAdapter } from "@dimah-s3/db/adapters/drizzle";
|
|
28
|
+
import { runCli } from "@dimah-s3/db/cli";
|
|
29
|
+
|
|
30
|
+
await runCli(
|
|
31
|
+
DimahS3DB.client(drizzleAdapter({ db: undefined, provider: "sqlite" })),
|
|
32
|
+
);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The package reads schema `2.1.0` and does not upgrade a 1.x or `2.0.0` database: create the tables on a new database. A database at another schema version throws on the first query. Call `s3.db.checkSchema()` at startup to fail fast.
|
|
27
36
|
|
|
28
37
|
## Server
|
|
29
38
|
|
|
@@ -74,7 +83,7 @@ const list = useObjectList({
|
|
|
74
83
|
});
|
|
75
84
|
```
|
|
76
85
|
|
|
77
|
-
`dbObjectSource` lists one folder at a time. Uploads go to the open folder, and "New folder" calls `api.db.createFolder`. Pass `folders: false` for a flat list.
|
|
86
|
+
`dbObjectSource` lists one folder at a time. Uploads go to the open folder, and "New folder" calls `api.db.createFolder`. Rename calls `updateObject` or `updateFolder` and leaves the object key as it is. Pass `folders: false` for a flat list; file rename stays available.
|
|
78
87
|
|
|
79
88
|
`api.db` also has `getObject`, `updateObject` (rename, move, or set `attributes`), and `deleteFolder`.
|
|
80
89
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The FumaDB Drizzle adapter. Pass a Drizzle instance whose
|
|
3
|
-
* the tables
|
|
4
|
-
* imported as `dimahS3Tables` from `@dimah-s3/db/drizzle/<dialect>`:
|
|
2
|
+
* The FumaDB Drizzle adapter. Pass a Drizzle instance whose relations include
|
|
3
|
+
* the tables `runCli` → `generate` writes:
|
|
5
4
|
* `DimahS3DB.client(drizzleAdapter({ db, provider: "postgresql" }))`.
|
|
6
5
|
*/
|
|
7
6
|
export { drizzleAdapter, type DrizzleConfig } from "fumadb/adapters/drizzle";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drizzle.d.ts","sourceRoot":"","sources":["../../src/adapters/drizzle.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"drizzle.d.ts","sourceRoot":"","sources":["../../src/adapters/drizzle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The FumaDB Kysely adapter.
|
|
2
|
+
* The FumaDB Kysely adapter. `migrate(client)` creates the schema through it:
|
|
3
3
|
* `DimahS3DB.client(kyselyAdapter({ db, provider: "postgresql" }))`.
|
|
4
4
|
*/
|
|
5
5
|
export { kyselyAdapter } from "fumadb/adapters/kysely";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The FumaDB Prisma adapter. Pass a Prisma client generated with the models
|
|
3
|
-
*
|
|
3
|
+
* `runCli` → `generate` writes:
|
|
4
4
|
* `DimahS3DB.client(prismaAdapter({ prisma, provider: "postgresql" }))`.
|
|
5
5
|
*/
|
|
6
6
|
export { prismaAdapter, type PrismaConfig } from "fumadb/adapters/prisma";
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import { type DimahS3DbClient } from "./fuma-db";
|
|
1
|
+
import { type DimahS3DbClient } from "./fuma-db.js";
|
|
2
2
|
/**
|
|
3
|
-
* Runs the
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* Runs the FumaDB CLI for the @dimah-s3/db schema. `generate` writes the
|
|
4
|
+
* Drizzle or Prisma schema for the client's adapter, and with Kysely, the SQL
|
|
5
|
+
* that creates the tables. `migrate` creates them with Kysely.
|
|
6
|
+
*
|
|
7
|
+
* Generating does not query the database, so the client can wrap an adapter
|
|
8
|
+
* that has no connection yet.
|
|
8
9
|
*
|
|
9
10
|
* ```ts
|
|
10
|
-
* // scripts/
|
|
11
|
+
* // scripts/dimah-s3.mts
|
|
12
|
+
* import { DimahS3DB } from "@dimah-s3/db";
|
|
13
|
+
* import { drizzleAdapter } from "@dimah-s3/db/adapters/drizzle";
|
|
11
14
|
* import { runCli } from "@dimah-s3/db/cli";
|
|
12
|
-
* import { dimahS3Db } from "../lib/s3";
|
|
13
15
|
*
|
|
14
|
-
* await runCli(
|
|
16
|
+
* await runCli(DimahS3DB.client(drizzleAdapter({ db: undefined, provider: "postgresql" })));
|
|
15
17
|
* ```
|
|
18
|
+
*
|
|
19
|
+
* `node scripts/dimah-s3.mts generate latest -o db/dimah-s3.ts`
|
|
16
20
|
*/
|
|
17
21
|
export declare function runCli(client: DimahS3DbClient): Promise<void>;
|
|
18
22
|
/**
|
|
19
|
-
* Creates the schema this package reads,
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
+
* Creates the schema this package reads, with its indexes, on an empty
|
|
24
|
+
* database. It needs the Kysely adapter; with Drizzle or Prisma, generate the
|
|
25
|
+
* schema with {@link runCli} and apply it with your ORM. It does nothing on a
|
|
26
|
+
* database already at {@link DB_SCHEMA_VERSION}, and throws on a database at
|
|
27
|
+
* another version: this package does not upgrade one.
|
|
23
28
|
*
|
|
24
29
|
* ```ts
|
|
25
30
|
* import { DimahS3DB } from "@dimah-s3/db";
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAIpE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAS7D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAcpE"}
|
package/dist/cli.js
CHANGED
|
@@ -3,124 +3,99 @@ import { fumadb } from 'fumadb';
|
|
|
3
3
|
import { table, column, idColumn, schema } from 'fumadb/schema';
|
|
4
4
|
|
|
5
5
|
// src/cli.ts
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
var BINARY = { mysql: "utf8mb4_bin" };
|
|
7
|
+
var TEXT = { mysql: "utf8mb4_unicode_ci" };
|
|
8
|
+
var SEARCH_NAME_MAX_LENGTH = 1024;
|
|
9
|
+
var LONG_PREFIX = 512;
|
|
10
|
+
var SCOPE_MAX_LENGTH = 255;
|
|
11
|
+
function string(name, length = 255) {
|
|
12
|
+
return column(name, `varchar(${length})`).collate(BINARY);
|
|
8
13
|
}
|
|
9
14
|
var storageObject = table("storage_object", {
|
|
10
|
-
id: idColumn("id", "varchar(255)").defaultTo$("auto"),
|
|
15
|
+
id: idColumn("id", "varchar(255)").collate(BINARY).defaultTo$("auto"),
|
|
11
16
|
/** Owner, for example `user:123` or `org:acme`. */
|
|
12
|
-
scope:
|
|
13
|
-
bucket:
|
|
14
|
-
key:
|
|
17
|
+
scope: string("scope", SCOPE_MAX_LENGTH),
|
|
18
|
+
bucket: string("bucket"),
|
|
19
|
+
key: string("key", 1024),
|
|
15
20
|
/** Named dimah-s3 route that created the object. */
|
|
16
|
-
route:
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
filename: column("filename", "
|
|
20
|
-
|
|
21
|
+
route: string("route"),
|
|
22
|
+
/** Folder that holds the object. `null` is the root. */
|
|
23
|
+
folderId: string("folder_id").nullable(),
|
|
24
|
+
filename: column("filename", "varchar(255)").collate(TEXT),
|
|
25
|
+
/**
|
|
26
|
+
* `filename` folded for search: lowercase, without accents, with `%`,
|
|
27
|
+
* `_`, and `\` kept literal. Search matches it on every database the
|
|
28
|
+
* same way.
|
|
29
|
+
*/
|
|
30
|
+
searchName: string("search_name", SEARCH_NAME_MAX_LENGTH),
|
|
31
|
+
contentType: string("content_type").nullable(),
|
|
21
32
|
/** Verified size from HeadObject, set on confirm. */
|
|
22
|
-
size:
|
|
33
|
+
size: column("size", "bigint").nullable(),
|
|
23
34
|
/** Size the client declared before confirm. Quota counts it while pending. */
|
|
24
|
-
declaredSize:
|
|
25
|
-
eTag:
|
|
26
|
-
status:
|
|
35
|
+
declaredSize: column("declared_size", "bigint").nullable(),
|
|
36
|
+
eTag: string("e_tag").nullable(),
|
|
37
|
+
status: string("status", 16),
|
|
27
38
|
/** S3 user metadata of the verified object. */
|
|
28
39
|
s3Metadata: column("s3_metadata", "json").nullable(),
|
|
29
40
|
/** App attributes, validated by the plugin's `attributes.schema`. */
|
|
30
41
|
attributes: column("attributes", "json").nullable(),
|
|
31
|
-
acl:
|
|
42
|
+
acl: string("acl").nullable(),
|
|
32
43
|
/** Multipart upload ID while the row is pending. */
|
|
33
|
-
uploadId: column("upload_id", "string").nullable(),
|
|
44
|
+
uploadId: column("upload_id", "string").collate(BINARY).nullable(),
|
|
34
45
|
/** Token of the upload ticket that wrote the row. Confirm and purge match it. */
|
|
35
|
-
uploadToken:
|
|
46
|
+
uploadToken: string("upload_token", 64).nullable(),
|
|
36
47
|
/** Confirm deadline of a pending row (the upload ticket's expiry). */
|
|
37
48
|
expiresAt: column("expires_at", "timestamp").nullable(),
|
|
38
49
|
confirmedAt: column("confirmed_at", "timestamp").nullable(),
|
|
39
50
|
createdAt: column("created_at", "timestamp").defaultTo$("now"),
|
|
40
51
|
updatedAt: column("updated_at", "timestamp").defaultTo$("now"),
|
|
41
52
|
deletedAt: column("deleted_at", "timestamp").nullable()
|
|
42
|
-
}).unique("storage_object_bucket_key_uk", ["bucket", "key"]
|
|
53
|
+
}).unique("storage_object_bucket_key_uk", ["bucket", "key"], {
|
|
54
|
+
length: { key: LONG_PREFIX }
|
|
55
|
+
}).index("storage_object_scope_folder_idx", [
|
|
56
|
+
"scope",
|
|
57
|
+
"status",
|
|
58
|
+
"folderId",
|
|
59
|
+
"createdAt"
|
|
60
|
+
]).index("storage_object_scope_updated_idx", ["scope", "status", "updatedAt"]).index("storage_object_scope_filename_idx", ["scope", "status", "filename"]).index("storage_object_scope_size_idx", ["scope", "status", "size"]).index("storage_object_status_expires_idx", ["status", "expiresAt"]);
|
|
43
61
|
var storageFolder = table("storage_folder", {
|
|
44
|
-
id: idColumn("id", "varchar(255)").defaultTo$("auto"),
|
|
45
|
-
scope:
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
/** Path of the containing folder. `null` is the root. */
|
|
49
|
-
parent: column("parent", "string").nullable(),
|
|
62
|
+
id: idColumn("id", "varchar(255)").collate(BINARY).defaultTo$("auto"),
|
|
63
|
+
scope: string("scope", SCOPE_MAX_LENGTH),
|
|
64
|
+
/** Id of the containing folder. `""` is the root. */
|
|
65
|
+
parentId: string("parent_id").defaultTo(""),
|
|
50
66
|
/** Last segment of `path`. */
|
|
51
|
-
name:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
name: "storage_object_scope_updated_idx",
|
|
62
|
-
table: "storage_object",
|
|
63
|
-
columns: ["scope", "status", "updated_at"]
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: "storage_object_scope_filename_idx",
|
|
67
|
-
table: "storage_object",
|
|
68
|
-
columns: ["scope", "status", "filename"]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: "storage_object_scope_size_idx",
|
|
72
|
-
table: "storage_object",
|
|
73
|
-
columns: ["scope", "status", "size"]
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: "storage_object_status_expires_idx",
|
|
77
|
-
table: "storage_object",
|
|
78
|
-
columns: ["status", "expires_at"]
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: "storage_folder_scope_parent_idx",
|
|
82
|
-
table: "storage_folder",
|
|
83
|
-
columns: ["scope", "parent"]
|
|
84
|
-
}
|
|
85
|
-
];
|
|
86
|
-
var custom = (sql) => ({ type: "custom", sql });
|
|
87
|
-
var PREDECESSOR_VERSION = "0.0.1";
|
|
88
|
-
var predecessor = schema({
|
|
89
|
-
version: PREDECESSOR_VERSION,
|
|
90
|
-
tables: {}
|
|
91
|
-
});
|
|
67
|
+
name: string("name"),
|
|
68
|
+
/** `name` folded for search, like `storage_object.search_name`. */
|
|
69
|
+
searchName: string("search_name", SEARCH_NAME_MAX_LENGTH),
|
|
70
|
+
/** Full folder path. */
|
|
71
|
+
path: string("path", 1024),
|
|
72
|
+
createdAt: column("created_at", "timestamp").defaultTo$("now"),
|
|
73
|
+
updatedAt: column("updated_at", "timestamp").defaultTo$("now")
|
|
74
|
+
}).unique("storage_folder_scope_path_uk", ["scope", "path"], {
|
|
75
|
+
length: { path: LONG_PREFIX }
|
|
76
|
+
}).unique("storage_folder_scope_parent_name_uk", ["scope", "parentId", "name"]);
|
|
92
77
|
var dbSchema = schema({
|
|
93
|
-
version: "2.
|
|
78
|
+
version: "2.2.0",
|
|
94
79
|
tables: {
|
|
95
80
|
storageObject,
|
|
96
81
|
storageFolder
|
|
97
|
-
},
|
|
98
|
-
async up({ auto }) {
|
|
99
|
-
const indexes = schemaIndexes.map((index) => {
|
|
100
|
-
const columns = index.columns.map((name) => `"${name}"`).join(", ");
|
|
101
|
-
return custom(
|
|
102
|
-
`CREATE INDEX IF NOT EXISTS "${index.name}" ON "${index.table}" (${columns})`
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
return [...await auto(), ...indexes];
|
|
106
82
|
}
|
|
107
83
|
});
|
|
108
84
|
|
|
109
85
|
// src/fuma-db.ts
|
|
110
86
|
fumadb({
|
|
111
87
|
namespace: "dimah_s3",
|
|
112
|
-
schemas: [
|
|
88
|
+
schemas: [dbSchema]
|
|
113
89
|
});
|
|
114
90
|
var DB_SCHEMA_VERSION = dbSchema.version;
|
|
115
91
|
|
|
116
92
|
// src/cli.ts
|
|
117
|
-
var RESUMABLE = /* @__PURE__ */ new Set([PREDECESSOR_VERSION, DB_SCHEMA_VERSION]);
|
|
118
93
|
function runCli(client) {
|
|
119
94
|
const { main } = createCli({
|
|
120
95
|
db: client,
|
|
121
96
|
command: "dimah-s3-db",
|
|
122
97
|
description: "FumaDB CLI for @dimah-s3/db",
|
|
123
|
-
version: "2.0.0-beta.
|
|
98
|
+
version: "2.0.0-beta.11"
|
|
124
99
|
});
|
|
125
100
|
return main();
|
|
126
101
|
}
|
|
@@ -131,15 +106,13 @@ async function migrate(client) {
|
|
|
131
106
|
} catch {
|
|
132
107
|
version = void 0;
|
|
133
108
|
}
|
|
134
|
-
if (version
|
|
109
|
+
if (version === DB_SCHEMA_VERSION) return;
|
|
110
|
+
if (version !== void 0) {
|
|
135
111
|
throw new Error(
|
|
136
112
|
`[dimah-s3/db] The database is at schema ${version}, which this package does not upgrade. Create schema ${DB_SCHEMA_VERSION} on a new database.`
|
|
137
113
|
);
|
|
138
114
|
}
|
|
139
|
-
|
|
140
|
-
for (let next = await migrator.next(); next; next = await migrator.next()) {
|
|
141
|
-
await (await migrator.up()).execute();
|
|
142
|
-
}
|
|
115
|
+
await (await client.createMigrator().migrateToLatest()).execute();
|
|
143
116
|
}
|
|
144
117
|
|
|
145
118
|
export { migrate, runCli };
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema/schema.ts","../src/fuma-db.ts","../src/cli.ts"],"names":[],"mappings":";;;;;AASA,SAAS,UAAU,IAAA,EAAc;AAC/B,EAAA,OAAO,MAAA,CAAO,IAAA,EAAM,QAAQ,CAAA,CAAE,QAAA,EAAS;AAKzC;AAOA,IAAM,aAAA,GAAgB,MAAM,gBAAA,EAAkB;AAAA,EAC5C,IAAI,QAAA,CAAS,IAAA,EAAM,cAAc,CAAA,CAAE,WAAW,MAAM,CAAA;AAAA;AAAA,EAEpD,KAAA,EAAO,MAAA,CAAO,OAAA,EAAS,QAAQ,CAAA;AAAA,EAC/B,MAAA,EAAQ,MAAA,CAAO,QAAA,EAAU,QAAQ,CAAA;AAAA,EACjC,GAAA,EAAK,MAAA,CAAO,KAAA,EAAO,QAAQ,CAAA;AAAA;AAAA,EAE3B,KAAA,EAAO,MAAA,CAAO,OAAA,EAAS,QAAQ,CAAA;AAAA;AAAA,EAE/B,MAAA,EAAQ,MAAA,CAAO,QAAA,EAAU,QAAQ,EAAE,QAAA,EAAS;AAAA,EAC5C,QAAA,EAAU,MAAA,CAAO,UAAA,EAAY,QAAQ,CAAA;AAAA,EACrC,WAAA,EAAa,MAAA,CAAO,cAAA,EAAgB,QAAQ,EAAE,QAAA,EAAS;AAAA;AAAA,EAEvD,IAAA,EAAM,UAAU,MAAM,CAAA;AAAA;AAAA,EAEtB,YAAA,EAAc,UAAU,eAAe,CAAA;AAAA,EACvC,IAAA,EAAM,MAAA,CAAO,OAAA,EAAS,QAAQ,EAAE,QAAA,EAAS;AAAA,EACzC,MAAA,EAAQ,MAAA,CAAO,QAAA,EAAU,QAAQ,CAAA;AAAA;AAAA,EAEjC,UAAA,EAAY,MAAA,CAAO,aAAA,EAAe,MAAM,EAAE,QAAA,EAAS;AAAA;A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jC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAA,GAAU,MAAA;AAAA,EACZ;AACA,EAAA,IAAI,YAAY,MAAA,IAAa,CAAC,SAAA,CAAU,GAAA,CAAI,OAAO,CAAA,EAAG;AACpD,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,wCAAA,EAA2C,OAAO,CAAA,qDAAA,EAAwD,iBAAiB,CAAA,mBAAA;AAAA,KAC7H;AAAA,EACF;AACA,EAAA,MAAM,QAAA,GAAW,OAAO,cAAA,EAAe;AACvC,EAAA,KAAA,IAAS,IAAA,GAAO,MAAM,QAAA,CAAS,IAAA,EAAK,EAAG,MAAM,IAAA,GAAO,MAAM,QAAA,CAAS,IAAA,EAAK,EAAG;AACzE,IAAA,MAAA,CAAO,MAAM,QAAA,CAAS,EAAA,EAAG,EAAG,OAAA,EAAQ;AAAA,EACtC;AACF","file":"cli.js","sourcesContent":["import { column, idColumn, schema, table, type Column } from \"fumadb/schema\";\n\n/**\n * A byte count. The column is a `bigint` (int8 on PostgreSQL and MySQL), but\n * values are bound as numbers so SQLite stores a number instead of FumaDB's\n * 8-byte blob, which would sort after every number: INTEGER in the shipped\n * SQL, or REAL in a column FumaDB created, compared by value either way.\n * Drivers read int8 back as a number, a bigint, or a string.\n */\nfunction byteCount(name: string) {\n return column(name, \"bigint\").nullable() as unknown as Column<\n \"bigint\",\n number | null,\n number | bigint | string | null\n >;\n}\n\n/**\n * One row per tracked object:\n * `pending` (presigned) → `active` (confirmed) → `deleted` (soft delete).\n * `purging` marks a stale pending row that purge has claimed.\n */\nconst storageObject = table(\"storage_object\", {\n id: idColumn(\"id\", \"varchar(255)\").defaultTo$(\"auto\"),\n /** Owner, for example `user:123` or `org:acme`. */\n scope: column(\"scope\", \"string\"),\n bucket: column(\"bucket\", \"string\"),\n key: column(\"key\", \"string\"),\n /** Named dimah-s3 route that created the object. */\n route: column(\"route\", \"string\"),\n /** Logical folder path. `null` is the root. */\n folder: column(\"folder\", \"string\").nullable(),\n filename: column(\"filename\", \"string\"),\n contentType: column(\"content_type\", \"string\").nullable(),\n /** Verified size from HeadObject, set on confirm. */\n size: byteCount(\"size\"),\n /** Size the client declared before confirm. Quota counts it while pending. */\n declaredSize: byteCount(\"declared_size\"),\n eTag: column(\"e_tag\", \"string\").nullable(),\n status: column(\"status\", \"string\"),\n /** S3 user metadata of the verified object. */\n s3Metadata: column(\"s3_metadata\", \"json\").nullable(),\n /** App attributes, validated by the plugin's `attributes.schema`. */\n attributes: column(\"attributes\", \"json\").nullable(),\n acl: column(\"acl\", \"string\").nullable(),\n /** Multipart upload ID while the row is pending. */\n uploadId: column(\"upload_id\", \"string\").nullable(),\n /** Token of the upload ticket that wrote the row. Confirm and purge match it. */\n uploadToken: column(\"upload_token\", \"string\").nullable(),\n /** Confirm deadline of a pending row (the upload ticket's expiry). */\n expiresAt: column(\"expires_at\", \"timestamp\").nullable(),\n confirmedAt: column(\"confirmed_at\", \"timestamp\").nullable(),\n createdAt: column(\"created_at\", \"timestamp\").defaultTo$(\"now\"),\n updatedAt: column(\"updated_at\", \"timestamp\").defaultTo$(\"now\"),\n deletedAt: column(\"deleted_at\", \"timestamp\").nullable(),\n}).unique(\"storage_object_bucket_key_uk\", [\"bucket\", \"key\"]);\n\n/** One row per folder, so an empty folder still lists. */\nconst storageFolder = table(\"storage_folder\", {\n id: idColumn(\"id\", \"varchar(255)\").defaultTo$(\"auto\"),\n scope: column(\"scope\", \"string\"),\n /** Full folder path. */\n path: column(\"path\", \"string\"),\n /** Path of the containing folder. `null` is the root. */\n parent: column(\"parent\", \"string\").nullable(),\n /** Last segment of `path`. */\n name: column(\"name\", \"string\"),\n createdAt: column(\"created_at\", \"timestamp\").defaultTo$(\"now\"),\n}).unique(\"storage_folder_scope_path_uk\", [\"scope\", \"path\"]);\n\n/** A secondary index, by SQL table and column names. */\nexport type SchemaIndex = {\n name: string;\n table: \"storage_object\" | \"storage_folder\";\n columns: readonly string[];\n};\n\n/**\n * Secondary indexes. FumaDB cannot declare them, so {@link dbSchema}'s\n * migration, the SQL files, the Drizzle tables, and the Prisma schema carry\n * them.\n */\nexport const schemaIndexes: readonly SchemaIndex[] = [\n {\n name: \"storage_object_scope_folder_idx\",\n table: \"storage_object\",\n columns: [\"scope\", \"status\", \"folder\", \"created_at\"],\n },\n {\n name: \"storage_object_scope_updated_idx\",\n table: \"storage_object\",\n columns: [\"scope\", \"status\", \"updated_at\"],\n },\n {\n name: \"storage_object_scope_filename_idx\",\n table: \"storage_object\",\n columns: [\"scope\", \"status\", \"filename\"],\n },\n {\n name: \"storage_object_scope_size_idx\",\n table: \"storage_object\",\n columns: [\"scope\", \"status\", \"size\"],\n },\n {\n name: \"storage_object_status_expires_idx\",\n table: \"storage_object\",\n columns: [\"status\", \"expires_at\"],\n },\n {\n name: \"storage_folder_scope_parent_idx\",\n table: \"storage_folder\",\n columns: [\"scope\", \"parent\"],\n },\n];\n\nconst custom = (sql: string) => ({ type: \"custom\" as const, sql });\n\n/**\n * FumaDB runs `up` only when migrating from the previous entry, and skips\n * `up` on the first one. This empty entry exists so {@link dbSchema} can\n * create the indexes on a new database. A finished database is at\n * {@link dbSchema}.\n */\nexport const PREDECESSOR_VERSION = \"0.0.1\";\n\nexport const predecessor = schema({\n version: PREDECESSOR_VERSION,\n tables: {},\n});\n\n/**\n * The @dimah-s3/db schema, version `2.0.0`. The migration creates the\n * secondary indexes after the tables, because FumaDB cannot declare them.\n */\nexport const dbSchema = schema({\n version: \"2.0.0\",\n tables: {\n storageObject,\n storageFolder,\n },\n async up({ auto }) {\n const indexes = schemaIndexes.map((index) => {\n const columns = index.columns.map((name) => `\"${name}\"`).join(\", \");\n return custom(\n `CREATE INDEX IF NOT EXISTS \"${index.name}\" ON \"${index.table}\" (${columns})`,\n );\n });\n return [...(await auto()), ...indexes];\n },\n});\n","import { fumadb, type InferFumaDB } from \"fumadb\";\nimport { dbSchema, predecessor } from \"./schema/schema\";\n\n/**\n * The @dimah-s3/db FumaDB library. Call `DimahS3DB.client(adapter)` with an\n * adapter from `@dimah-s3/db/adapters/*` to get a {@link DimahS3DbClient}.\n *\n * `predecessor` is empty. FumaDB skips `up` on the first schema, and the\n * indexes are created in {@link dbSchema}'s `up`.\n */\nexport const DimahS3DB = fumadb({\n namespace: \"dimah_s3\",\n schemas: [predecessor, dbSchema],\n});\n\n/** FumaDB client for the @dimah-s3/db schema. */\nexport type DimahS3DbClient = InferFumaDB<typeof DimahS3DB>;\n\n/** The schema version the stores read and write. */\nexport const DB_SCHEMA_VERSION = dbSchema.version;\n","import { createCli } from \"fumadb/cli\";\nimport { DB_SCHEMA_VERSION, type DimahS3DbClient } from \"./fuma-db\";\nimport { PREDECESSOR_VERSION } from \"./schema/schema\";\n\ndeclare const __DIMAH_S3_DB_VERSION__: string;\n\n/**\n * Versions `migrate` may continue from: an empty database, a migration that\n * stopped on the empty predecessor, or a database already at\n * {@link DB_SCHEMA_VERSION}.\n */\nconst RESUMABLE = new Set<string>([PREDECESSOR_VERSION, DB_SCHEMA_VERSION]);\n\n/**\n * Runs the interactive FumaDB CLI: generate the ORM schema, or migrate when\n * the client uses the Kysely adapter. Prefer {@link migrate}. Only\n * `migrate:up`, one version at a time, runs the steps the schema needs,\n * including the indexes. The CLI `migrate` command jumps to the latest\n * schema and skips them.\n *\n * ```ts\n * // scripts/db.ts\n * import { runCli } from \"@dimah-s3/db/cli\";\n * import { dimahS3Db } from \"../lib/s3\";\n *\n * await runCli(dimahS3Db);\n * ```\n */\nexport function runCli(client: DimahS3DbClient): Promise<void> {\n const { main } = createCli({\n db: client,\n command: \"dimah-s3-db\",\n description: \"FumaDB CLI for @dimah-s3/db\",\n version: __DIMAH_S3_DB_VERSION__,\n });\n\n return main();\n}\n\n/**\n * Creates the schema this package reads, one version at a time, so the\n * schema's own steps run (the indexes among them). It needs the Kysely\n * adapter; with Drizzle or Prisma, use your ORM's migrations or the files\n * in `sql/`. It does not upgrade a database at another version.\n *\n * ```ts\n * import { DimahS3DB } from \"@dimah-s3/db\";\n * import { kyselyAdapter } from \"@dimah-s3/db/adapters/kysely\";\n * import { migrate } from \"@dimah-s3/db/cli\";\n *\n * await migrate(DimahS3DB.client(kyselyAdapter({ db: kysely, provider: \"postgresql\" })));\n * ```\n */\nexport async function migrate(client: DimahS3DbClient): Promise<void> {\n let version: string | undefined;\n try {\n version = await client.version();\n } catch {\n version = undefined;\n }\n if (version !== undefined && !RESUMABLE.has(version)) {\n throw new Error(\n `[dimah-s3/db] The database is at schema ${version}, which this package does not upgrade. Create schema ${DB_SCHEMA_VERSION} on a new database.`,\n );\n }\n const migrator = client.createMigrator();\n for (let next = await migrator.next(); next; next = await migrator.next()) {\n await (await migrator.up()).execute();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/schema/schema.ts","../src/fuma-db.ts","../src/cli.ts"],"names":[],"mappings":";;;;;AAMA,IAAM,MAAA,GAAS,EAAE,KAAA,EAAO,aAAA,EAAc;AAGtC,IAAM,IAAA,GAAO,EAAE,KAAA,EAAO,oBAAA,EAAqB;AAMpC,IAAM,sBAAA,GAAyB,IAAA;AAOtC,IAAM,WAAA,GAAc,GAAA;AAMb,IAAM,gBAAA,GAAmB,GAAA;AAEhC,SAAS,MAAA,CAAO,IAAA,EAAc,MAAA,GAAS,GAAA,EAAK;AAC1C,EAAA,OAAO,OAAO,IAAA,EAAM,CAAA,QAAA,EAAW,MAAM,CAAA,CAAA,CAAG,CAAA,CAAE,QAAQ,MAAM,CAAA;AAC1D;AAOA,IAAM,aAAA,GAAgB,MAAM,gBAAA,EAAkB;AAAA,EAC5C,EAAA,EAAI,SAAS,IAAA,EAAM,cAAc,EAAE,OAAA,CAAQ,MAAM,CAAA,CAAE,UAAA,CAAW,MAAM,CAAA;AAAA;AAAA,EAEpE,KAAA,EAAO,MAAA,CAAO,OAAA,EAAS,gBAAgB,CAAA;AAAA,EACvC,MAAA,EAAQ,OAAO,QAAQ,CAAA;AAAA,EACvB,GAAA,EAAK,MAAA,CAAO,KAAA,EAAO,IAAI,CAA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,MACR,CAAA,wCAAA,EAA2C,OAAO,CAAA,qDAAA,EAAwD,iBAAiB,CAAA,mBAAA;AAAA,KAC7H;AAAA,EACF;AACA,EAAA,MAAA,CAAO,MAAM,MAAA,CAAO,cAAA,EAAe,CAAE,eAAA,IAAmB,OAAA,EAAQ;AAClE","file":"cli.js","sourcesContent":["import { column, idColumn, schema, table } from \"fumadb/schema\";\n\n/**\n * MySQL collation of every text column but `filename`: keys, scopes, ids, and\n * upload tokens compare byte for byte.\n */\nconst BINARY = { mysql: \"utf8mb4_bin\" };\n\n/** MySQL collation of `filename`: case-insensitive, for the name sort. */\nconst TEXT = { mysql: \"utf8mb4_unicode_ci\" };\n\n/**\n * Longest `search_name`, in characters. Folding can lengthen a name (`ß`\n * becomes `ss`), so it has more room than the 255-character name.\n */\nexport const SEARCH_NAME_MAX_LENGTH = 1024;\n\n/**\n * InnoDB indexes at most 3072 bytes, so S3 keys and folder paths are indexed\n * on their first 512 characters on MySQL. Two values that share those\n * characters share an index entry, and the unique keys treat them as equal.\n */\nconst LONG_PREFIX = 512;\n\n/**\n * Longest scope `resolveScope` may return, in characters. The `scope`\n * columns are `varchar(255)`.\n */\nexport const SCOPE_MAX_LENGTH = 255;\n\nfunction string(name: string, length = 255) {\n return column(name, `varchar(${length})`).collate(BINARY);\n}\n\n/**\n * One row per tracked object:\n * `pending` (presigned) → `active` (confirmed) → `deleted` (soft delete).\n * `purging` marks a stale pending row that purge has claimed.\n */\nconst storageObject = table(\"storage_object\", {\n id: idColumn(\"id\", \"varchar(255)\").collate(BINARY).defaultTo$(\"auto\"),\n /** Owner, for example `user:123` or `org:acme`. */\n scope: string(\"scope\", SCOPE_MAX_LENGTH),\n bucket: string(\"bucket\"),\n key: string(\"key\", 1024),\n /** Named dimah-s3 route that created the object. */\n route: string(\"route\"),\n /** Folder that holds the object. `null` is the root. */\n folderId: string(\"folder_id\").nullable(),\n filename: column(\"filename\", \"varchar(255)\").collate(TEXT),\n /**\n * `filename` folded for search: lowercase, without accents, with `%`,\n * `_`, and `\\` kept literal. Search matches it on every database the\n * same way.\n */\n searchName: string(\"search_name\", SEARCH_NAME_MAX_LENGTH),\n contentType: string(\"content_type\").nullable(),\n /** Verified size from HeadObject, set on confirm. */\n size: column(\"size\", \"bigint\").nullable(),\n /** Size the client declared before confirm. Quota counts it while pending. */\n declaredSize: column(\"declared_size\", \"bigint\").nullable(),\n eTag: string(\"e_tag\").nullable(),\n status: string(\"status\", 16),\n /** S3 user metadata of the verified object. */\n s3Metadata: column(\"s3_metadata\", \"json\").nullable(),\n /** App attributes, validated by the plugin's `attributes.schema`. */\n attributes: column(\"attributes\", \"json\").nullable(),\n acl: string(\"acl\").nullable(),\n /** Multipart upload ID while the row is pending. */\n uploadId: column(\"upload_id\", \"string\").collate(BINARY).nullable(),\n /** Token of the upload ticket that wrote the row. Confirm and purge match it. */\n uploadToken: string(\"upload_token\", 64).nullable(),\n /** Confirm deadline of a pending row (the upload ticket's expiry). */\n expiresAt: column(\"expires_at\", \"timestamp\").nullable(),\n confirmedAt: column(\"confirmed_at\", \"timestamp\").nullable(),\n createdAt: column(\"created_at\", \"timestamp\").defaultTo$(\"now\"),\n updatedAt: column(\"updated_at\", \"timestamp\").defaultTo$(\"now\"),\n deletedAt: column(\"deleted_at\", \"timestamp\").nullable(),\n})\n .unique(\"storage_object_bucket_key_uk\", [\"bucket\", \"key\"], {\n length: { key: LONG_PREFIX },\n })\n .index(\"storage_object_scope_folder_idx\", [\n \"scope\",\n \"status\",\n \"folderId\",\n \"createdAt\",\n ])\n .index(\"storage_object_scope_updated_idx\", [\"scope\", \"status\", \"updatedAt\"])\n .index(\"storage_object_scope_filename_idx\", [\"scope\", \"status\", \"filename\"])\n .index(\"storage_object_scope_size_idx\", [\"scope\", \"status\", \"size\"])\n .index(\"storage_object_status_expires_idx\", [\"status\", \"expiresAt\"]);\n\n/**\n * One row per folder, so an empty folder still lists. `parentId` is `\"\"` at\n * the root: a nullable parent cannot be unique on PostgreSQL, MySQL, and\n * SQLite, and the root is not a row. `path` is a cache of `name` joined\n * through the parents, rewritten when a folder is renamed or moved.\n */\nconst storageFolder = table(\"storage_folder\", {\n id: idColumn(\"id\", \"varchar(255)\").collate(BINARY).defaultTo$(\"auto\"),\n scope: string(\"scope\", SCOPE_MAX_LENGTH),\n /** Id of the containing folder. `\"\"` is the root. */\n parentId: string(\"parent_id\").defaultTo(\"\"),\n /** Last segment of `path`. */\n name: string(\"name\"),\n /** `name` folded for search, like `storage_object.search_name`. */\n searchName: string(\"search_name\", SEARCH_NAME_MAX_LENGTH),\n /** Full folder path. */\n path: string(\"path\", 1024),\n createdAt: column(\"created_at\", \"timestamp\").defaultTo$(\"now\"),\n updatedAt: column(\"updated_at\", \"timestamp\").defaultTo$(\"now\"),\n})\n .unique(\"storage_folder_scope_path_uk\", [\"scope\", \"path\"], {\n length: { path: LONG_PREFIX },\n })\n .unique(\"storage_folder_scope_parent_name_uk\", [\"scope\", \"parentId\", \"name\"]);\n\n/**\n * The @dimah-s3/db schema, version `2.2.0`. The tables, their indexes, and\n * the MySQL collations and prefix lengths are all declared here, so FumaDB\n * creates them (`migrate`) and generates them for Drizzle and Prisma.\n */\nexport const dbSchema = schema({\n version: \"2.2.0\",\n tables: {\n storageObject,\n storageFolder,\n },\n});\n","import { fumadb, type InferFumaDB } from \"fumadb\";\nimport { dbSchema } from \"./schema/schema\";\n\n/**\n * The @dimah-s3/db FumaDB library. Call `DimahS3DB.client(adapter)` with an\n * adapter from `@dimah-s3/db/adapters/*` to get a {@link DimahS3DbClient}.\n */\nexport const DimahS3DB = fumadb({\n namespace: \"dimah_s3\",\n schemas: [dbSchema],\n});\n\n/** FumaDB client for the @dimah-s3/db schema. */\nexport type DimahS3DbClient = InferFumaDB<typeof DimahS3DB>;\n\n/** The schema version the stores read and write. */\nexport const DB_SCHEMA_VERSION = dbSchema.version;\n","import { createCli } from \"fumadb/cli\";\nimport { DB_SCHEMA_VERSION, type DimahS3DbClient } from \"./fuma-db\";\n\ndeclare const __DIMAH_S3_DB_VERSION__: string;\n\n/**\n * Runs the FumaDB CLI for the @dimah-s3/db schema. `generate` writes the\n * Drizzle or Prisma schema for the client's adapter, and with Kysely, the SQL\n * that creates the tables. `migrate` creates them with Kysely.\n *\n * Generating does not query the database, so the client can wrap an adapter\n * that has no connection yet.\n *\n * ```ts\n * // scripts/dimah-s3.mts\n * import { DimahS3DB } from \"@dimah-s3/db\";\n * import { drizzleAdapter } from \"@dimah-s3/db/adapters/drizzle\";\n * import { runCli } from \"@dimah-s3/db/cli\";\n *\n * await runCli(DimahS3DB.client(drizzleAdapter({ db: undefined, provider: \"postgresql\" })));\n * ```\n *\n * `node scripts/dimah-s3.mts generate latest -o db/dimah-s3.ts`\n */\nexport function runCli(client: DimahS3DbClient): Promise<void> {\n const { main } = createCli({\n db: client,\n command: \"dimah-s3-db\",\n description: \"FumaDB CLI for @dimah-s3/db\",\n version: __DIMAH_S3_DB_VERSION__,\n });\n\n return main();\n}\n\n/**\n * Creates the schema this package reads, with its indexes, on an empty\n * database. It needs the Kysely adapter; with Drizzle or Prisma, generate the\n * schema with {@link runCli} and apply it with your ORM. It does nothing on a\n * database already at {@link DB_SCHEMA_VERSION}, and throws on a database at\n * another version: this package does not upgrade one.\n *\n * ```ts\n * import { DimahS3DB } from \"@dimah-s3/db\";\n * import { kyselyAdapter } from \"@dimah-s3/db/adapters/kysely\";\n * import { migrate } from \"@dimah-s3/db/cli\";\n *\n * await migrate(DimahS3DB.client(kyselyAdapter({ db: kysely, provider: \"postgresql\" })));\n * ```\n */\nexport async function migrate(client: DimahS3DbClient): Promise<void> {\n let version: string | undefined;\n try {\n version = await client.version();\n } catch {\n version = undefined;\n }\n if (version === DB_SCHEMA_VERSION) return;\n if (version !== undefined) {\n throw new Error(\n `[dimah-s3/db] The database is at schema ${version}, which this package does not upgrade. Create schema ${DB_SCHEMA_VERSION} on a new database.`,\n );\n }\n await (await client.createMigrator().migrateToLatest()).execute();\n}\n"]}
|
|
@@ -12,7 +12,7 @@ import type { DbClientActions } from "../types/client.js";
|
|
|
12
12
|
* plugins: [dbClient()],
|
|
13
13
|
* });
|
|
14
14
|
*
|
|
15
|
-
* const page = await s3Client.db.listObjects({
|
|
15
|
+
* const page = await s3Client.db.listObjects({ folderId: "" });
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
18
|
* The server resolves the scope from the request, so no action takes one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-client.d.ts","sourceRoot":"","sources":["../../src/client/db-client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,eAAe,EAKhB,MAAM,gBAAgB,CAAC;AAaxB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,iBAAiB,GAAG,KAAK,+
|
|
1
|
+
{"version":3,"file":"db-client.d.ts","sourceRoot":"","sources":["../../src/client/db-client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,eAAe,EAKhB,MAAM,gBAAgB,CAAC;AAaxB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,iBAAiB,GAAG,KAAK,+LAwCjD"}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import type { DbClientActions, DbObjectSource, DbObjectSourceOptions } from "../types/client.js";
|
|
2
2
|
/** The `api.db` actions {@link dbObjectSource} calls. */
|
|
3
|
-
export type DbObjectSourceActions<TClientAttributes = never> = Pick<DbClientActions<TClientAttributes>, "listObjects"> & Partial<Pick<DbClientActions<TClientAttributes>, "createFolder">>;
|
|
3
|
+
export type DbObjectSourceActions<TClientAttributes = never> = Pick<DbClientActions<TClientAttributes>, "listObjects"> & Partial<Pick<DbClientActions<TClientAttributes>, "createFolder" | "updateObject" | "updateFolder">>;
|
|
4
4
|
/**
|
|
5
5
|
* A `useObjectList` source over `api.db`.
|
|
6
6
|
*
|
|
7
|
-
* With `folders` on (the default), `parent` is a folder
|
|
8
|
-
*
|
|
9
|
-
* the open folder, and "New folder" calls
|
|
10
|
-
* `
|
|
7
|
+
* With `folders` on (the default), `parent` is a folder id: each page lists
|
|
8
|
+
* one folder, the first page carries its child folders and the breadcrumb
|
|
9
|
+
* trail, uploads go to the open folder, and "New folder" calls
|
|
10
|
+
* `api.db.createFolder`. Rename calls `api.db.updateObject` (`filename`) or
|
|
11
|
+
* `api.db.updateFolder` (`name`) and leaves the object key as it is. With
|
|
12
|
+
* `folders: false`, the list is flat: file rename stays, and folder actions
|
|
13
|
+
* do not.
|
|
11
14
|
*
|
|
12
|
-
* `search`
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* `search` runs on the server and ignores case and accents. With `folders`
|
|
16
|
+
* on it is recursive: `searchScope: "folder"` looks in the open folder and
|
|
17
|
+
* every folder below it, `"all"` in the whole scope, and each result's
|
|
18
|
+
* `location` says where it lives. `sort` maps `name` to `filename`; `size`
|
|
19
|
+
* and `updatedAt` keep their names, and other fields keep the server's
|
|
20
|
+
* order (newest first). `usage` is the scope total with its caps, not the
|
|
21
|
+
* open folder's.
|
|
16
22
|
*
|
|
17
23
|
* ```ts
|
|
18
24
|
* const list = useObjectList({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-object-source.d.ts","sourceRoot":"","sources":["../../src/client/db-object-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,
|
|
1
|
+
{"version":3,"file":"db-object-source.d.ts","sourceRoot":"","sources":["../../src/client/db-object-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EAMf,cAAc,EAGd,qBAAqB,EAEtB,MAAM,gBAAgB,CAAC;AAExB,yDAAyD;AACzD,MAAM,MAAM,qBAAqB,CAAC,iBAAiB,GAAG,KAAK,IAAI,IAAI,CACjE,eAAe,CAAC,iBAAiB,CAAC,EAClC,aAAa,CACd,GACC,OAAO,CACL,IAAI,CACF,eAAe,CAAC,iBAAiB,CAAC,EAClC,cAAc,GAAG,cAAc,GAAG,cAAc,CACjD,CACF,CAAC;AA4CJ;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,iBAAiB,GAAG,KAAK,EACtD,EAAE,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,EAC5C,OAAO,GAAE,qBAA0B,GAClC,cAAc,CAAC,iBAAiB,CAAC,CAqHnC"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { dbClient } from "./db-client";
|
|
2
|
-
export { dbObjectSource, type DbObjectSourceActions } from "./db-object-source";
|
|
3
|
-
export type { DbClientActions,
|
|
1
|
+
export { dbClient } from "./db-client.js";
|
|
2
|
+
export { dbObjectSource, type DbObjectSourceActions } from "./db-object-source.js";
|
|
3
|
+
export type { DbClientActions, DbClientCreateFolderInput, DbClientDeleteFolderInput, DbClientFolder, DbClientGetInput, DbClientListInput, DbClientListResponse, DbClientObject, DbClientObjectStatus, DbClientUpdateFolderInput, DbClientUpdateInput, DbListSort, DbListSortField, DbObjectSource, DbObjectSourceFile, DbObjectSourceFolder, DbObjectSourceOptions, DbObjectSourcePage, DbObjectSourceQueryInput, DbObjectSourceSearchScope, DbQuota, DbUsage, } from "../types/client.js";
|
|
4
4
|
export type { StorageObjectStatus } from "../types/storage-object.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChF,YAAY,EACV,eAAe,EACf,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChF,YAAY,EACV,eAAe,EACf,yBAAyB,EACzB,yBAAyB,EACzB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,OAAO,EACP,OAAO,GACR,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|