@veloxts/orm 0.6.75 → 0.6.76

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @veloxts/orm
2
2
 
3
+ ## 0.6.76
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(create): resolve all template type errors for zero-error scaffolding
8
+ - Updated dependencies
9
+ - @veloxts/core@0.6.76
10
+
3
11
  ## 0.6.75
4
12
 
5
13
  ### Patch Changes
package/dist/plugin.d.ts CHANGED
@@ -7,56 +7,6 @@
7
7
  * @module plugin
8
8
  */
9
9
  import type { DatabaseClient, OrmPluginConfig } from './types.js';
10
- /**
11
- * Extend BaseContext to include the database client
12
- *
13
- * After registering the database plugin, `ctx.db` will be available
14
- * in all procedure handlers with full type information.
15
- *
16
- * @example
17
- * ```typescript
18
- * // In your app setup
19
- * import { PrismaClient } from '@prisma/client';
20
- * import { databasePlugin } from '@veloxts/orm';
21
- *
22
- * const prisma = new PrismaClient();
23
- * await app.use(databasePlugin({ client: prisma }));
24
- *
25
- * // In your procedure handlers
26
- * getUser: procedure()
27
- * .input(z.object({ id: z.string() }))
28
- * .query(async ({ input, ctx }) => {
29
- * // ctx.db is typed as your PrismaClient
30
- * return ctx.db.user.findUnique({ where: { id: input.id } });
31
- * })
32
- * ```
33
- *
34
- * To get full type inference for your specific Prisma schema,
35
- * add this to your app's declaration file:
36
- *
37
- * @example
38
- * ```typescript
39
- * // In your app's types.d.ts or similar
40
- * import type { PrismaClient } from '@prisma/client';
41
- *
42
- * declare module '@veloxts/core' {
43
- * interface BaseContext {
44
- * db: PrismaClient;
45
- * }
46
- * }
47
- * ```
48
- */
49
- declare module '@veloxts/core' {
50
- interface BaseContext {
51
- /**
52
- * Database client for executing queries
53
- *
54
- * This property is added by the @veloxts/orm plugin.
55
- * The actual type depends on your Prisma schema.
56
- */
57
- db: DatabaseClient;
58
- }
59
- }
60
10
  /**
61
11
  * Creates a database plugin for VeloxApp integration
62
12
  *
package/dist/plugin.js CHANGED
@@ -12,6 +12,44 @@ import { registerOrmProviders } from './providers.js';
12
12
  import { DATABASE } from './tokens.js';
13
13
  import { isDatabaseClient } from './types.js';
14
14
  // ============================================================================
15
+ // Context Extension
16
+ // ============================================================================
17
+ /**
18
+ * BaseContext Extension for Database
19
+ *
20
+ * After registering the database plugin, `ctx.db` will be available
21
+ * in all procedure handlers. To get full type inference for your
22
+ * specific Prisma schema, add this to your app's declaration file:
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * // In your app's types.d.ts
27
+ * import type { PrismaClient } from '@prisma/client';
28
+ *
29
+ * declare module '@veloxts/core' {
30
+ * interface BaseContext {
31
+ * db: PrismaClient;
32
+ * }
33
+ * }
34
+ * ```
35
+ *
36
+ * This enables full autocomplete for ctx.db in procedure handlers:
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * getUser: procedure()
41
+ * .input(z.object({ id: z.string() }))
42
+ * .query(async ({ input, ctx }) => {
43
+ * // ctx.db is typed as your PrismaClient with all models
44
+ * return ctx.db.user.findUnique({ where: { id: input.id } });
45
+ * })
46
+ * ```
47
+ *
48
+ * NOTE: We intentionally do NOT declare `db: DatabaseClient` on BaseContext
49
+ * here, as that would conflict with user type declarations. The user's
50
+ * declaration merging should be the authoritative source for the `db` type.
51
+ */
52
+ // ============================================================================
15
53
  // Plugin Implementation
16
54
  // ============================================================================
17
55
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/orm",
3
- "version": "0.6.75",
3
+ "version": "0.6.76",
4
4
  "description": "Prisma wrapper with enhanced DX for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "fastify": "5.6.2",
20
20
  "pg": "8.16.0",
21
21
  "pg-format": "1.0.4",
22
- "@veloxts/core": "0.6.75"
22
+ "@veloxts/core": "0.6.76"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/pg": "8.15.4",