@dudousxd/nestjs-media-database-drizzle 0.6.0 → 0.7.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.
@@ -1,13 +1,7 @@
1
+ import { b as DrizzlePgDatabase } from '../drizzle-pg-upload-session-store-DO2rMDNN.cjs';
2
+ export { D as DrizzlePgMediaStore, a as DrizzlePgUploadSessionStore } from '../drizzle-pg-upload-session-store-DO2rMDNN.cjs';
1
3
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
2
- import { PgDatabase } from 'drizzle-orm/pg-core';
3
- import { MediaStore, MediaRecord, MediaCountFilter, MediaAggregateQuery, MediaAggregateResult, MediaListFilter, MediaListPage, MediaListResult, UploadSessionStore, UploadSession, MultipartPart, UploadSessionListFilter, MediaConversion } from '@dudousxd/nestjs-media-core';
4
-
5
- /**
6
- * Any drizzle Postgres database — node-postgres (`NodePgDatabase`), postgres-js, neon, pglite, …
7
- * and transactions of those. Kept deliberately loose so hosts on any drizzle Postgres driver /
8
- * schema generic can pass their `db` handle straight in.
9
- */
10
- type DrizzlePgDatabase = PgDatabase<any, any, any>;
4
+ import { MediaConversion } from '@dudousxd/nestjs-media-core';
11
5
 
12
6
  /**
13
7
  * Postgres DDL for the tables exported from `./schema` (`mediaPgTable`,
@@ -23,42 +17,6 @@ declare const MEDIA_PG_DDL: readonly string[];
23
17
  */
24
18
  declare function createMediaPgTables(db: DrizzlePgDatabase): Promise<void>;
25
19
 
26
- /**
27
- * `MediaStore` backed by Drizzle on **PostgreSQL**. POJO receiving any drizzle Postgres db
28
- * (see {@link DrizzlePgDatabase}). Migration-first: create the table with drizzle-kit from
29
- * `mediaPgTable`, or `createMediaPgTables(db)` in tests/dev.
30
- */
31
- declare class DrizzlePgMediaStore implements MediaStore {
32
- private readonly db;
33
- constructor(db: DrizzlePgDatabase);
34
- save(record: MediaRecord): Promise<MediaRecord>;
35
- find(id: string): Promise<MediaRecord | null>;
36
- listByOwner(ownerType: string, ownerId: string, collection?: string): Promise<MediaRecord[]>;
37
- delete(id: string): Promise<void>;
38
- nextOrder(ownerType: string, ownerId: string, collection: string): Promise<number>;
39
- count(filter?: MediaCountFilter): Promise<number>;
40
- aggregate(query: MediaAggregateQuery): Promise<MediaAggregateResult>;
41
- list(filter?: MediaListFilter, page?: MediaListPage): Promise<MediaListResult>;
42
- }
43
-
44
- /**
45
- * `UploadSessionStore` (resumable uploads) backed by Drizzle on **PostgreSQL**. Implements every
46
- * optional method: `addPart` is a single atomic upsert on `(session_id, part_number)` so parallel
47
- * part uploads never lose an ETag; `delete` cascades to the parts via the FK.
48
- * Tables: `mediaUploadSessionsPgTable` + `mediaUploadPartsPgTable` (or `createMediaPgTables(db)`).
49
- */
50
- declare class DrizzlePgUploadSessionStore implements UploadSessionStore {
51
- private readonly db;
52
- constructor(db: DrizzlePgDatabase);
53
- create(session: UploadSession): Promise<UploadSession>;
54
- get(id: string): Promise<UploadSession | null>;
55
- update(session: UploadSession): Promise<UploadSession>;
56
- delete(id: string): Promise<void>;
57
- addPart(id: string, part: MultipartPart): Promise<void>;
58
- listParts(id: string): Promise<MultipartPart[]>;
59
- list(filter?: UploadSessionListFilter): Promise<UploadSession[]>;
60
- }
61
-
62
20
  /**
63
21
  * Drizzle (Postgres) media table — the same logical shape as the sqlite `mediaTable`.
64
22
  * `order` maps to the `position` column; JSON columns are `jsonb`; timestamps are `timestamptz`.
@@ -587,4 +545,4 @@ declare const mediaUploadPartsPgTable: drizzle_orm_pg_core.PgTableWithColumns<{
587
545
  dialect: "pg";
588
546
  }>;
589
547
 
590
- export { type DrizzlePgDatabase, DrizzlePgMediaStore, DrizzlePgUploadSessionStore, MEDIA_PG_DDL, createMediaPgTables, mediaPgTable, mediaUploadPartsPgTable, mediaUploadSessionsPgTable };
548
+ export { DrizzlePgDatabase, MEDIA_PG_DDL, createMediaPgTables, mediaPgTable, mediaUploadPartsPgTable, mediaUploadSessionsPgTable };
@@ -1,13 +1,7 @@
1
+ import { b as DrizzlePgDatabase } from '../drizzle-pg-upload-session-store-DO2rMDNN.js';
2
+ export { D as DrizzlePgMediaStore, a as DrizzlePgUploadSessionStore } from '../drizzle-pg-upload-session-store-DO2rMDNN.js';
1
3
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
2
- import { PgDatabase } from 'drizzle-orm/pg-core';
3
- import { MediaStore, MediaRecord, MediaCountFilter, MediaAggregateQuery, MediaAggregateResult, MediaListFilter, MediaListPage, MediaListResult, UploadSessionStore, UploadSession, MultipartPart, UploadSessionListFilter, MediaConversion } from '@dudousxd/nestjs-media-core';
4
-
5
- /**
6
- * Any drizzle Postgres database — node-postgres (`NodePgDatabase`), postgres-js, neon, pglite, …
7
- * and transactions of those. Kept deliberately loose so hosts on any drizzle Postgres driver /
8
- * schema generic can pass their `db` handle straight in.
9
- */
10
- type DrizzlePgDatabase = PgDatabase<any, any, any>;
4
+ import { MediaConversion } from '@dudousxd/nestjs-media-core';
11
5
 
12
6
  /**
13
7
  * Postgres DDL for the tables exported from `./schema` (`mediaPgTable`,
@@ -23,42 +17,6 @@ declare const MEDIA_PG_DDL: readonly string[];
23
17
  */
24
18
  declare function createMediaPgTables(db: DrizzlePgDatabase): Promise<void>;
25
19
 
26
- /**
27
- * `MediaStore` backed by Drizzle on **PostgreSQL**. POJO receiving any drizzle Postgres db
28
- * (see {@link DrizzlePgDatabase}). Migration-first: create the table with drizzle-kit from
29
- * `mediaPgTable`, or `createMediaPgTables(db)` in tests/dev.
30
- */
31
- declare class DrizzlePgMediaStore implements MediaStore {
32
- private readonly db;
33
- constructor(db: DrizzlePgDatabase);
34
- save(record: MediaRecord): Promise<MediaRecord>;
35
- find(id: string): Promise<MediaRecord | null>;
36
- listByOwner(ownerType: string, ownerId: string, collection?: string): Promise<MediaRecord[]>;
37
- delete(id: string): Promise<void>;
38
- nextOrder(ownerType: string, ownerId: string, collection: string): Promise<number>;
39
- count(filter?: MediaCountFilter): Promise<number>;
40
- aggregate(query: MediaAggregateQuery): Promise<MediaAggregateResult>;
41
- list(filter?: MediaListFilter, page?: MediaListPage): Promise<MediaListResult>;
42
- }
43
-
44
- /**
45
- * `UploadSessionStore` (resumable uploads) backed by Drizzle on **PostgreSQL**. Implements every
46
- * optional method: `addPart` is a single atomic upsert on `(session_id, part_number)` so parallel
47
- * part uploads never lose an ETag; `delete` cascades to the parts via the FK.
48
- * Tables: `mediaUploadSessionsPgTable` + `mediaUploadPartsPgTable` (or `createMediaPgTables(db)`).
49
- */
50
- declare class DrizzlePgUploadSessionStore implements UploadSessionStore {
51
- private readonly db;
52
- constructor(db: DrizzlePgDatabase);
53
- create(session: UploadSession): Promise<UploadSession>;
54
- get(id: string): Promise<UploadSession | null>;
55
- update(session: UploadSession): Promise<UploadSession>;
56
- delete(id: string): Promise<void>;
57
- addPart(id: string, part: MultipartPart): Promise<void>;
58
- listParts(id: string): Promise<MultipartPart[]>;
59
- list(filter?: UploadSessionListFilter): Promise<UploadSession[]>;
60
- }
61
-
62
20
  /**
63
21
  * Drizzle (Postgres) media table — the same logical shape as the sqlite `mediaTable`.
64
22
  * `order` maps to the `position` column; JSON columns are `jsonb`; timestamps are `timestamptz`.
@@ -587,4 +545,4 @@ declare const mediaUploadPartsPgTable: drizzle_orm_pg_core.PgTableWithColumns<{
587
545
  dialect: "pg";
588
546
  }>;
589
547
 
590
- export { type DrizzlePgDatabase, DrizzlePgMediaStore, DrizzlePgUploadSessionStore, MEDIA_PG_DDL, createMediaPgTables, mediaPgTable, mediaUploadPartsPgTable, mediaUploadSessionsPgTable };
548
+ export { DrizzlePgDatabase, MEDIA_PG_DDL, createMediaPgTables, mediaPgTable, mediaUploadPartsPgTable, mediaUploadSessionsPgTable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-media-database-drizzle",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "nestjs-media Drizzle media store (sqlite, and Postgres via /pg)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -44,6 +44,16 @@
44
44
  "types": "./dist/pg/index.d.cts",
45
45
  "default": "./dist/pg/index.cjs"
46
46
  }
47
+ },
48
+ "./nest": {
49
+ "import": {
50
+ "types": "./dist/nest/index.d.ts",
51
+ "default": "./dist/nest/index.js"
52
+ },
53
+ "require": {
54
+ "types": "./dist/nest/index.d.cts",
55
+ "default": "./dist/nest/index.cjs"
56
+ }
47
57
  }
48
58
  },
49
59
  "files": [
@@ -51,19 +61,25 @@
51
61
  ],
52
62
  "peerDependencies": {
53
63
  "@dudousxd/nestjs-media-core": ">=0.8.0 <1.0.0",
54
- "drizzle-orm": ">=0.38.0 <1.0.0"
64
+ "drizzle-orm": ">=0.38.0 <1.0.0",
65
+ "@nestjs/drizzle": ">=0.0.2 <0.1.0"
55
66
  },
56
67
  "devDependencies": {
57
68
  "@types/better-sqlite3": "7.6.13",
58
- "@types/pg": "8.11.10",
69
+ "@types/pg": "8.23.1",
59
70
  "better-sqlite3": "11.10.0",
60
- "drizzle-orm": "0.45.3",
61
- "pg": "8.23.0",
71
+ "drizzle-orm": "0.45.4",
72
+ "pg": "8.23.1",
62
73
  "testcontainers": "10.18.0",
63
- "tsup": "8.3.5",
74
+ "tsup": "8.5.1",
64
75
  "typescript": "5.9.3",
65
- "@dudousxd/nestjs-media-core": "0.9.1",
66
- "@dudousxd/nestjs-media-testing": "0.6.0"
76
+ "@nestjs/drizzle": "0.0.2",
77
+ "@nestjs/common": "12.3.2",
78
+ "@nestjs/core": "12.3.2",
79
+ "reflect-metadata": "0.2.2",
80
+ "rxjs": "7.8.2",
81
+ "@dudousxd/nestjs-media-core": "0.10.0",
82
+ "@dudousxd/nestjs-media-testing": "0.7.0"
67
83
  },
68
84
  "typesVersions": {
69
85
  "*": {
@@ -72,6 +88,11 @@
72
88
  ]
73
89
  }
74
90
  },
91
+ "peerDependenciesMeta": {
92
+ "@nestjs/drizzle": {
93
+ "optional": true
94
+ }
95
+ },
75
96
  "scripts": {
76
97
  "build": "tsup",
77
98
  "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.spec.json --noEmit"