@vankyle/storage-kysely 0.1.0
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 +129 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/mappers/blob-reference-row.mapper.d.ts +7 -0
- package/dist/mappers/blob-reference-row.mapper.d.ts.map +1 -0
- package/dist/mappers/blob-reference-row.mapper.js +13 -0
- package/dist/mappers/blob-reference-row.mapper.js.map +1 -0
- package/dist/mappers/blob-row.mapper.d.ts +7 -0
- package/dist/mappers/blob-row.mapper.d.ts.map +1 -0
- package/dist/mappers/blob-row.mapper.js +27 -0
- package/dist/mappers/blob-row.mapper.js.map +1 -0
- package/dist/mappers/file-row.mapper.d.ts +7 -0
- package/dist/mappers/file-row.mapper.d.ts.map +1 -0
- package/dist/mappers/file-row.mapper.js +25 -0
- package/dist/mappers/file-row.mapper.js.map +1 -0
- package/dist/mappers/file-version-row.mapper.d.ts +7 -0
- package/dist/mappers/file-version-row.mapper.d.ts.map +1 -0
- package/dist/mappers/file-version-row.mapper.js +23 -0
- package/dist/mappers/file-version-row.mapper.js.map +1 -0
- package/dist/mappers/index.d.ts +7 -0
- package/dist/mappers/index.d.ts.map +1 -0
- package/dist/mappers/index.js +7 -0
- package/dist/mappers/index.js.map +1 -0
- package/dist/mappers/upload-session-row.mapper.d.ts +7 -0
- package/dist/mappers/upload-session-row.mapper.d.ts.map +1 -0
- package/dist/mappers/upload-session-row.mapper.js +33 -0
- package/dist/mappers/upload-session-row.mapper.js.map +1 -0
- package/dist/mappers/uploaded-part-row.mapper.d.ts +7 -0
- package/dist/mappers/uploaded-part-row.mapper.d.ts.map +1 -0
- package/dist/mappers/uploaded-part-row.mapper.js +22 -0
- package/dist/mappers/uploaded-part-row.mapper.js.map +1 -0
- package/dist/metadata/index.d.ts +5 -0
- package/dist/metadata/index.d.ts.map +1 -0
- package/dist/metadata/index.js +5 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/metadata/kysely-metadata-store.d.ts +13 -0
- package/dist/metadata/kysely-metadata-store.d.ts.map +1 -0
- package/dist/metadata/kysely-metadata-store.js +14 -0
- package/dist/metadata/kysely-metadata-store.js.map +1 -0
- package/dist/metadata/stores/index.d.ts +4 -0
- package/dist/metadata/stores/index.d.ts.map +1 -0
- package/dist/metadata/stores/index.js +4 -0
- package/dist/metadata/stores/index.js.map +1 -0
- package/dist/metadata/stores/kysely-blob-store.d.ts +17 -0
- package/dist/metadata/stores/kysely-blob-store.d.ts.map +1 -0
- package/dist/metadata/stores/kysely-blob-store.js +105 -0
- package/dist/metadata/stores/kysely-blob-store.js.map +1 -0
- package/dist/metadata/stores/kysely-file-store.d.ts +16 -0
- package/dist/metadata/stores/kysely-file-store.d.ts.map +1 -0
- package/dist/metadata/stores/kysely-file-store.js +112 -0
- package/dist/metadata/stores/kysely-file-store.js.map +1 -0
- package/dist/metadata/stores/kysely-upload-session-store.d.ts +15 -0
- package/dist/metadata/stores/kysely-upload-session-store.d.ts.map +1 -0
- package/dist/metadata/stores/kysely-upload-session-store.js +110 -0
- package/dist/metadata/stores/kysely-upload-session-store.js.map +1 -0
- package/dist/migrations/0001_init.d.ts +4 -0
- package/dist/migrations/0001_init.d.ts.map +1 -0
- package/dist/migrations/0001_init.js +143 -0
- package/dist/migrations/0001_init.js.map +1 -0
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +2 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/schema/database.d.ts +92 -0
- package/dist/schema/database.d.ts.map +1 -0
- package/dist/schema/database.js +2 -0
- package/dist/schema/database.js.map +1 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/index.js.map +1 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# @vankyle-hub/storage-kysely
|
|
2
|
+
|
|
3
|
+
`IMetadataStore` implementation backed by [Kysely](https://kysely.dev/), supporting any Kysely-compatible SQL database.
|
|
4
|
+
|
|
5
|
+
## Supported databases
|
|
6
|
+
|
|
7
|
+
- PostgreSQL
|
|
8
|
+
- MySQL
|
|
9
|
+
- SQL Server (MSSQL)
|
|
10
|
+
- SQLite
|
|
11
|
+
- Cloudflare D1 (via `D1Dialect` from `@vankyle-hub/storage-cloudflare`)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @vankyle-hub/storage-kysely kysely @vankyle-hub/storage-core @vankyle-hub/storage-shared
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Add your database driver (e.g. `pg`, `mysql2`, `better-sqlite3`) as needed.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { KyselyMetadataStore } from "@vankyle-hub/storage-kysely";
|
|
25
|
+
import { Kysely, PostgresDialect } from "kysely";
|
|
26
|
+
import { Pool } from "pg";
|
|
27
|
+
import type { StorageDatabase } from "@vankyle-hub/storage-kysely";
|
|
28
|
+
|
|
29
|
+
const db = new Kysely<StorageDatabase>({
|
|
30
|
+
dialect: new PostgresDialect({
|
|
31
|
+
pool: new Pool({ connectionString: process.env.DATABASE_URL }),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const metadata = new KyselyMetadataStore(db);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Pass `metadata` to `DefaultStorageService`:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { DefaultStorageService } from "@vankyle-hub/storage-core";
|
|
42
|
+
|
|
43
|
+
const service = new DefaultStorageService({ storage, metadata, bucket: "..." });
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Database schema
|
|
47
|
+
|
|
48
|
+
Six tables are created by the included migration:
|
|
49
|
+
|
|
50
|
+
| Table | Description |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `upload_sessions` | Upload session state |
|
|
53
|
+
| `uploaded_parts` | Completed multipart upload parts |
|
|
54
|
+
| `blobs` | Physical objects in object storage |
|
|
55
|
+
| `blob_references` | Tracks which entities reference a blob |
|
|
56
|
+
| `files` | User-facing logical files |
|
|
57
|
+
| `file_versions` | Immutable snapshots linking a file to a blob |
|
|
58
|
+
|
|
59
|
+
### Indexes
|
|
60
|
+
|
|
61
|
+
| Index | Columns | Type |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `idx_upload_sessions_status` | `status` | Non-unique |
|
|
64
|
+
| `idx_uploaded_parts_session` | `(session_id, part_number)` | Unique |
|
|
65
|
+
| `idx_blobs_sha256` | `sha256` | Non-unique |
|
|
66
|
+
| `idx_blobs_locator` | `(provider, bucket, object_key)` | Unique |
|
|
67
|
+
|
|
68
|
+
## Running migrations
|
|
69
|
+
|
|
70
|
+
`@vankyle-hub/storage-kysely` exports a `migrations` object compatible with the [Kysely `Migrator`](https://kysely.dev/docs/migrations):
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { Migrator } from "kysely";
|
|
74
|
+
import { migrations } from "@vankyle-hub/storage-kysely";
|
|
75
|
+
|
|
76
|
+
const migrator = new Migrator({
|
|
77
|
+
db,
|
|
78
|
+
provider: {
|
|
79
|
+
getMigrations: async () => migrations,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const { error, results } = await migrator.migrateToLatest();
|
|
84
|
+
|
|
85
|
+
for (const result of results ?? []) {
|
|
86
|
+
console.log(`Migration "${result.migrationName}": ${result.status}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (error) {
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## TypeScript schema type
|
|
95
|
+
|
|
96
|
+
`StorageDatabase` is the typed Kysely database interface. Import it for type inference:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import type { StorageDatabase } from "@vankyle-hub/storage-kysely";
|
|
100
|
+
|
|
101
|
+
const db = new Kysely<StorageDatabase>({ ... });
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Cloudflare D1
|
|
105
|
+
|
|
106
|
+
Use the `D1Dialect` from `@vankyle-hub/storage-cloudflare` to run `KyselyMetadataStore` on D1:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { D1Dialect } from "@vankyle-hub/storage-cloudflare";
|
|
110
|
+
import { KyselyMetadataStore } from "@vankyle-hub/storage-kysely";
|
|
111
|
+
import { Kysely } from "kysely";
|
|
112
|
+
import type { StorageDatabase } from "@vankyle-hub/storage-kysely";
|
|
113
|
+
|
|
114
|
+
const db = new Kysely<StorageDatabase>({
|
|
115
|
+
dialect: new D1Dialect({ database: env.DB }),
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const metadata = new KyselyMetadataStore(db);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The SQL emitted by Kysely is SQLite-compatible, which D1 is based on. All six stores and the migration work without modification.
|
|
122
|
+
|
|
123
|
+
## JSON fields
|
|
124
|
+
|
|
125
|
+
Some columns store JSON as text (`metadata`, `providerSessionData`, `providerPartData`). Row mappers in this package handle serialization (`JSON.stringify`) and deserialization (`JSON.parse`) automatically. Application code always receives typed `JsonObject | undefined` values.
|
|
126
|
+
|
|
127
|
+
## SQLite date handling
|
|
128
|
+
|
|
129
|
+
SQLite returns `DATE` / `DATETIME` columns as strings. Row mappers convert them to `Date` objects via an `ensureDate()` helper. This is handled transparently — application code always receives `Date` values.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { KyselyMetadataStore } from "./metadata/index.js";
|
|
2
|
+
export { KyselyUploadSessionStore, KyselyBlobStore, KyselyFileStore, } from "./metadata/stores/index.js";
|
|
3
|
+
export type { StorageDatabase, UploadSessionsTable, UploadedPartsTable, BlobsTable, BlobReferencesTable, FilesTable, FileVersionsTable, } from "./schema/index.js";
|
|
4
|
+
export * as migrations from "./migrations/index.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAUpC,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BlobReference } from "@vankyle-hub/storage-core";
|
|
2
|
+
import type { Selectable } from "kysely";
|
|
3
|
+
import type { BlobReferencesTable } from "../schema/database.js";
|
|
4
|
+
type BlobReferenceRow = Selectable<BlobReferencesTable>;
|
|
5
|
+
export declare function blobReferenceRowToModel(row: BlobReferenceRow): BlobReference;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=blob-reference-row.mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob-reference-row.mapper.d.ts","sourceRoot":"","sources":["../../src/mappers/blob-reference-row.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,KAAK,gBAAgB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAExD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAQ5E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function blobReferenceRowToModel(row) {
|
|
2
|
+
return {
|
|
3
|
+
id: row.id,
|
|
4
|
+
blobId: row.blob_id,
|
|
5
|
+
refType: row.ref_type,
|
|
6
|
+
refId: row.ref_id,
|
|
7
|
+
createdAt: ensureDate(row.created_at),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function ensureDate(value) {
|
|
11
|
+
return typeof value === "string" ? new Date(value) : value;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=blob-reference-row.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob-reference-row.mapper.js","sourceRoot":"","sources":["../../src/mappers/blob-reference-row.mapper.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,uBAAuB,CAAC,GAAqB;IAC3D,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,KAAK,EAAE,GAAG,CAAC,MAAM;QACjB,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;KACtC,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAoB;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Blob } from "@vankyle-hub/storage-core";
|
|
2
|
+
import type { Selectable } from "kysely";
|
|
3
|
+
import type { BlobsTable } from "../schema/database.js";
|
|
4
|
+
type BlobRow = Selectable<BlobsTable>;
|
|
5
|
+
export declare function blobRowToModel(row: BlobRow): Blob;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=blob-row.mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob-row.mapper.d.ts","sourceRoot":"","sources":["../../src/mappers/blob-row.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA+B,MAAM,2BAA2B,CAAC;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,KAAK,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAEtC,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAiBjD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function blobRowToModel(row) {
|
|
2
|
+
return {
|
|
3
|
+
id: row.id,
|
|
4
|
+
provider: row.provider,
|
|
5
|
+
bucket: row.bucket,
|
|
6
|
+
objectKey: row.object_key,
|
|
7
|
+
size: row.size,
|
|
8
|
+
mimeType: row.mime_type ?? undefined,
|
|
9
|
+
sha256: row.sha256 ?? undefined,
|
|
10
|
+
etag: row.etag ?? undefined,
|
|
11
|
+
storageClass: row.storage_class ?? undefined,
|
|
12
|
+
status: row.status,
|
|
13
|
+
createdAt: ensureDate(row.created_at),
|
|
14
|
+
updatedAt: ensureDate(row.updated_at),
|
|
15
|
+
deletedAt: row.deleted_at ? ensureDate(row.deleted_at) : undefined,
|
|
16
|
+
metadata: parseJson(row.metadata),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function parseJson(value) {
|
|
20
|
+
if (value === null)
|
|
21
|
+
return undefined;
|
|
22
|
+
return JSON.parse(value);
|
|
23
|
+
}
|
|
24
|
+
function ensureDate(value) {
|
|
25
|
+
return typeof value === "string" ? new Date(value) : value;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=blob-row.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob-row.mapper.js","sourceRoot":"","sources":["../../src/mappers/blob-row.mapper.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,QAAQ,EAAE,GAAG,CAAC,QAA2B;QACzC,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,SAAS;QACpC,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,SAAS;QAC/B,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,SAAS;QAC3B,YAAY,EAAE,GAAG,CAAC,aAAa,IAAI,SAAS;QAC5C,MAAM,EAAE,GAAG,CAAC,MAAoB;QAChC,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;QACrC,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;QACrC,SAAS,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;QAClE,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAAoB;IACrC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAe,CAAC;AACzC,CAAC;AAED,SAAS,UAAU,CAAC,KAAoB;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { File } from "@vankyle-hub/storage-core";
|
|
2
|
+
import type { Selectable } from "kysely";
|
|
3
|
+
import type { FilesTable } from "../schema/database.js";
|
|
4
|
+
type FileRow = Selectable<FilesTable>;
|
|
5
|
+
export declare function fileRowToModel(row: FileRow): File;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=file-row.mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-row.mapper.d.ts","sourceRoot":"","sources":["../../src/mappers/file-row.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,2BAA2B,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,KAAK,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAEtC,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAejD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function fileRowToModel(row) {
|
|
2
|
+
return {
|
|
3
|
+
id: row.id,
|
|
4
|
+
ownerId: row.owner_id ?? undefined,
|
|
5
|
+
displayName: row.display_name,
|
|
6
|
+
mimeType: row.mime_type ?? undefined,
|
|
7
|
+
currentVersionId: row.current_version_id ?? undefined,
|
|
8
|
+
size: row.size ?? undefined,
|
|
9
|
+
parentId: row.parent_id ?? undefined,
|
|
10
|
+
status: row.status,
|
|
11
|
+
createdAt: ensureDate(row.created_at),
|
|
12
|
+
updatedAt: ensureDate(row.updated_at),
|
|
13
|
+
deletedAt: row.deleted_at ? ensureDate(row.deleted_at) : undefined,
|
|
14
|
+
metadata: parseJson(row.metadata),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function parseJson(value) {
|
|
18
|
+
if (value === null)
|
|
19
|
+
return undefined;
|
|
20
|
+
return JSON.parse(value);
|
|
21
|
+
}
|
|
22
|
+
function ensureDate(value) {
|
|
23
|
+
return typeof value === "string" ? new Date(value) : value;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=file-row.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-row.mapper.js","sourceRoot":"","sources":["../../src/mappers/file-row.mapper.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,OAAO,EAAE,GAAG,CAAC,QAAQ,IAAI,SAAS;QAClC,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,SAAS;QACpC,gBAAgB,EAAE,GAAG,CAAC,kBAAkB,IAAI,SAAS;QACrD,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,SAAS;QAC3B,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,SAAS;QACpC,MAAM,EAAE,GAAG,CAAC,MAAoB;QAChC,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;QACrC,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;QACrC,SAAS,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;QAClE,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAAoB;IACrC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAe,CAAC;AACzC,CAAC;AAED,SAAS,UAAU,CAAC,KAAoB;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FileVersion } from "@vankyle-hub/storage-core";
|
|
2
|
+
import type { Selectable } from "kysely";
|
|
3
|
+
import type { FileVersionsTable } from "../schema/database.js";
|
|
4
|
+
type FileVersionRow = Selectable<FileVersionsTable>;
|
|
5
|
+
export declare function fileVersionRowToModel(row: FileVersionRow): FileVersion;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=file-version-row.mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-version-row.mapper.d.ts","sourceRoot":"","sources":["../../src/mappers/file-version-row.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,KAAK,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAEpD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,WAAW,CAatE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function fileVersionRowToModel(row) {
|
|
2
|
+
return {
|
|
3
|
+
id: row.id,
|
|
4
|
+
fileId: row.file_id,
|
|
5
|
+
blobId: row.blob_id,
|
|
6
|
+
version: row.version,
|
|
7
|
+
size: row.size,
|
|
8
|
+
mimeType: row.mime_type ?? undefined,
|
|
9
|
+
sha256: row.sha256 ?? undefined,
|
|
10
|
+
createdAt: ensureDate(row.created_at),
|
|
11
|
+
createdBy: row.created_by ?? undefined,
|
|
12
|
+
metadata: parseJson(row.metadata),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function parseJson(value) {
|
|
16
|
+
if (value === null)
|
|
17
|
+
return undefined;
|
|
18
|
+
return JSON.parse(value);
|
|
19
|
+
}
|
|
20
|
+
function ensureDate(value) {
|
|
21
|
+
return typeof value === "string" ? new Date(value) : value;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=file-version-row.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-version-row.mapper.js","sourceRoot":"","sources":["../../src/mappers/file-version-row.mapper.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,qBAAqB,CAAC,GAAmB;IACvD,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,SAAS;QACpC,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,SAAS;QAC/B,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;QACrC,SAAS,EAAE,GAAG,CAAC,UAAU,IAAI,SAAS;QACtC,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAAoB;IACrC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAe,CAAC;AACzC,CAAC;AAED,SAAS,UAAU,CAAC,KAAoB;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { uploadSessionRowToModel } from "./upload-session-row.mapper.js";
|
|
2
|
+
export { uploadedPartRowToModel } from "./uploaded-part-row.mapper.js";
|
|
3
|
+
export { blobRowToModel } from "./blob-row.mapper.js";
|
|
4
|
+
export { fileRowToModel } from "./file-row.mapper.js";
|
|
5
|
+
export { fileVersionRowToModel } from "./file-version-row.mapper.js";
|
|
6
|
+
export { blobReferenceRowToModel } from "./blob-reference-row.mapper.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mappers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { uploadSessionRowToModel } from "./upload-session-row.mapper.js";
|
|
2
|
+
export { uploadedPartRowToModel } from "./uploaded-part-row.mapper.js";
|
|
3
|
+
export { blobRowToModel } from "./blob-row.mapper.js";
|
|
4
|
+
export { fileRowToModel } from "./file-row.mapper.js";
|
|
5
|
+
export { fileVersionRowToModel } from "./file-version-row.mapper.js";
|
|
6
|
+
export { blobReferenceRowToModel } from "./blob-reference-row.mapper.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mappers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UploadSession } from "@vankyle-hub/storage-core";
|
|
2
|
+
import type { Selectable } from "kysely";
|
|
3
|
+
import type { UploadSessionsTable } from "../schema/database.js";
|
|
4
|
+
type UploadSessionRow = Selectable<UploadSessionsTable>;
|
|
5
|
+
export declare function uploadSessionRowToModel(row: UploadSessionRow): UploadSession;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=upload-session-row.mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-session-row.mapper.d.ts","sourceRoot":"","sources":["../../src/mappers/upload-session-row.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAI/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,KAAK,gBAAgB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAExD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAuB5E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function uploadSessionRowToModel(row) {
|
|
2
|
+
return {
|
|
3
|
+
id: row.id,
|
|
4
|
+
provider: row.provider,
|
|
5
|
+
bucket: row.bucket,
|
|
6
|
+
objectKey: row.object_key,
|
|
7
|
+
mode: row.mode,
|
|
8
|
+
status: row.status,
|
|
9
|
+
fileName: row.file_name ?? undefined,
|
|
10
|
+
mimeType: row.mime_type ?? undefined,
|
|
11
|
+
expectedSize: row.expected_size ?? undefined,
|
|
12
|
+
expectedSha256: row.expected_sha256 ?? undefined,
|
|
13
|
+
providerUploadId: row.provider_upload_id ?? undefined,
|
|
14
|
+
providerSessionData: parseJson(row.provider_session_data),
|
|
15
|
+
createdBy: row.created_by ?? undefined,
|
|
16
|
+
ownerId: row.owner_id ?? undefined,
|
|
17
|
+
metadata: parseJson(row.metadata),
|
|
18
|
+
createdAt: ensureDate(row.created_at),
|
|
19
|
+
updatedAt: ensureDate(row.updated_at),
|
|
20
|
+
expiresAt: row.expires_at ? ensureDate(row.expires_at) : undefined,
|
|
21
|
+
completedAt: row.completed_at ? ensureDate(row.completed_at) : undefined,
|
|
22
|
+
abortedAt: row.aborted_at ? ensureDate(row.aborted_at) : undefined,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function parseJson(value) {
|
|
26
|
+
if (value === null)
|
|
27
|
+
return undefined;
|
|
28
|
+
return JSON.parse(value);
|
|
29
|
+
}
|
|
30
|
+
function ensureDate(value) {
|
|
31
|
+
return typeof value === "string" ? new Date(value) : value;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=upload-session-row.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-session-row.mapper.js","sourceRoot":"","sources":["../../src/mappers/upload-session-row.mapper.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,uBAAuB,CAAC,GAAqB;IAC3D,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,QAAQ,EAAE,GAAG,CAAC,QAA2B;QACzC,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,IAAI,EAAE,GAAG,CAAC,IAAkB;QAC5B,MAAM,EAAE,GAAG,CAAC,MAA6B;QACzC,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,SAAS;QACpC,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,SAAS;QACpC,YAAY,EAAE,GAAG,CAAC,aAAa,IAAI,SAAS;QAC5C,cAAc,EAAE,GAAG,CAAC,eAAe,IAAI,SAAS;QAChD,gBAAgB,EAAE,GAAG,CAAC,kBAAkB,IAAI,SAAS;QACrD,mBAAmB,EAAE,SAAS,CAAC,GAAG,CAAC,qBAAqB,CAAC;QACzD,SAAS,EAAE,GAAG,CAAC,UAAU,IAAI,SAAS;QACtC,OAAO,EAAE,GAAG,CAAC,QAAQ,IAAI,SAAS;QAClC,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;QACjC,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;QACrC,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;QACrC,SAAS,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;QAClE,WAAW,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;QACxE,SAAS,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAAoB;IACrC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAe,CAAC;AACzC,CAAC;AAED,SAAS,UAAU,CAAC,KAAoB;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UploadedPart } from "@vankyle-hub/storage-core";
|
|
2
|
+
import type { Selectable } from "kysely";
|
|
3
|
+
import type { UploadedPartsTable } from "../schema/database.js";
|
|
4
|
+
type UploadedPartRow = Selectable<UploadedPartsTable>;
|
|
5
|
+
export declare function uploadedPartRowToModel(row: UploadedPartRow): UploadedPart;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=uploaded-part-row.mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploaded-part-row.mapper.d.ts","sourceRoot":"","sources":["../../src/mappers/uploaded-part-row.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,KAAK,eAAe,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAEtD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,eAAe,GAAG,YAAY,CAYzE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function uploadedPartRowToModel(row) {
|
|
2
|
+
return {
|
|
3
|
+
id: row.id,
|
|
4
|
+
sessionId: row.session_id,
|
|
5
|
+
partNumber: row.part_number,
|
|
6
|
+
size: row.size,
|
|
7
|
+
etag: row.etag ?? undefined,
|
|
8
|
+
checksumSha256: row.checksum_sha256 ?? undefined,
|
|
9
|
+
providerPartId: row.provider_part_id ?? undefined,
|
|
10
|
+
providerPartData: parseJson(row.provider_part_data),
|
|
11
|
+
uploadedAt: ensureDate(row.uploaded_at),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function parseJson(value) {
|
|
15
|
+
if (value === null)
|
|
16
|
+
return undefined;
|
|
17
|
+
return JSON.parse(value);
|
|
18
|
+
}
|
|
19
|
+
function ensureDate(value) {
|
|
20
|
+
return typeof value === "string" ? new Date(value) : value;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=uploaded-part-row.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploaded-part-row.mapper.js","sourceRoot":"","sources":["../../src/mappers/uploaded-part-row.mapper.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,sBAAsB,CAAC,GAAoB;IACzD,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,UAAU,EAAE,GAAG,CAAC,WAAW;QAC3B,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,SAAS;QAC3B,cAAc,EAAE,GAAG,CAAC,eAAe,IAAI,SAAS;QAChD,cAAc,EAAE,GAAG,CAAC,gBAAgB,IAAI,SAAS;QACjD,gBAAgB,EAAE,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC;QACnD,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC;KACxC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAAoB;IACrC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAe,CAAC;AACzC,CAAC;AAED,SAAS,UAAU,CAAC,KAAoB;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { KyselyMetadataStore } from "./kysely-metadata-store.js";
|
|
2
|
+
export { KyselyUploadSessionStore } from "./stores/kysely-upload-session-store.js";
|
|
3
|
+
export { KyselyBlobStore } from "./stores/kysely-blob-store.js";
|
|
4
|
+
export { KyselyFileStore } from "./stores/kysely-file-store.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { KyselyMetadataStore } from "./kysely-metadata-store.js";
|
|
2
|
+
export { KyselyUploadSessionStore } from "./stores/kysely-upload-session-store.js";
|
|
3
|
+
export { KyselyBlobStore } from "./stores/kysely-blob-store.js";
|
|
4
|
+
export { KyselyFileStore } from "./stores/kysely-file-store.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Kysely } from "kysely";
|
|
2
|
+
import type { IMetadataStore } from "@vankyle-hub/storage-core";
|
|
3
|
+
import type { StorageDatabase } from "../schema/database.js";
|
|
4
|
+
import { KyselyUploadSessionStore } from "./stores/kysely-upload-session-store.js";
|
|
5
|
+
import { KyselyBlobStore } from "./stores/kysely-blob-store.js";
|
|
6
|
+
import { KyselyFileStore } from "./stores/kysely-file-store.js";
|
|
7
|
+
export declare class KyselyMetadataStore implements IMetadataStore {
|
|
8
|
+
readonly uploads: KyselyUploadSessionStore;
|
|
9
|
+
readonly blobs: KyselyBlobStore;
|
|
10
|
+
readonly files: KyselyFileStore;
|
|
11
|
+
constructor(db: Kysely<StorageDatabase>);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=kysely-metadata-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kysely-metadata-store.d.ts","sourceRoot":"","sources":["../../src/metadata/kysely-metadata-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,qBAAa,mBAAoB,YAAW,cAAc;IACxD,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;gBAEpB,EAAE,EAAE,MAAM,CAAC,eAAe,CAAC;CAKxC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { KyselyUploadSessionStore } from "./stores/kysely-upload-session-store.js";
|
|
2
|
+
import { KyselyBlobStore } from "./stores/kysely-blob-store.js";
|
|
3
|
+
import { KyselyFileStore } from "./stores/kysely-file-store.js";
|
|
4
|
+
export class KyselyMetadataStore {
|
|
5
|
+
uploads;
|
|
6
|
+
blobs;
|
|
7
|
+
files;
|
|
8
|
+
constructor(db) {
|
|
9
|
+
this.uploads = new KyselyUploadSessionStore(db);
|
|
10
|
+
this.blobs = new KyselyBlobStore(db);
|
|
11
|
+
this.files = new KyselyFileStore(db);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=kysely-metadata-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kysely-metadata-store.js","sourceRoot":"","sources":["../../src/metadata/kysely-metadata-store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM,OAAO,mBAAmB;IACrB,OAAO,CAA2B;IAClC,KAAK,CAAkB;IACvB,KAAK,CAAkB;IAEhC,YAAY,EAA2B;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAwB,CAAC,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,GAAG,IAAI,eAAe,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,IAAI,eAAe,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/metadata/stores/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metadata/stores/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Kysely } from "kysely";
|
|
2
|
+
import type { IBlobStore, CreateBlobInput, UpdateBlobInput, CreateBlobReferenceInput } from "@vankyle-hub/storage-core";
|
|
3
|
+
import type { Blob, BlobReference, StorageProvider } from "@vankyle-hub/storage-core";
|
|
4
|
+
import type { StorageDatabase } from "../../schema/database.js";
|
|
5
|
+
export declare class KyselyBlobStore implements IBlobStore {
|
|
6
|
+
private readonly db;
|
|
7
|
+
constructor(db: Kysely<StorageDatabase>);
|
|
8
|
+
createBlob(input: CreateBlobInput): Promise<Blob>;
|
|
9
|
+
getBlob(id: string): Promise<Blob | undefined>;
|
|
10
|
+
updateBlob(id: string, input: UpdateBlobInput): Promise<Blob>;
|
|
11
|
+
findBlobBySha256(sha256: string): Promise<Blob | undefined>;
|
|
12
|
+
findBlobByLocator(provider: StorageProvider, bucket: string, objectKey: string): Promise<Blob | undefined>;
|
|
13
|
+
createReference(input: CreateBlobReferenceInput): Promise<BlobReference>;
|
|
14
|
+
listReferences(blobId: string): Promise<BlobReference[]>;
|
|
15
|
+
deleteReference(id: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=kysely-blob-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kysely-blob-store.d.ts","sourceRoot":"","sources":["../../../src/metadata/stores/kysely-blob-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,eAAe,EACf,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIhE,qBAAa,eAAgB,YAAW,UAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,MAAM,CAAC,eAAe,CAAC;IAElD,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BjD,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;IAU9C,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB7D,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;IAW3D,iBAAiB,CACrB,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;IAYtB,eAAe,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC;IAgBxE,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAUxD,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMjD"}
|