@veloxts/orm 0.6.90 → 0.6.91
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 +8 -0
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -32
- package/dist/plugin.d.ts +0 -13
- package/dist/plugin.js +2 -25
- package/dist/types.d.ts +0 -26
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -111,22 +111,3 @@ export {
|
|
|
111
111
|
* ```
|
|
112
112
|
*/
|
|
113
113
|
databasePlugin, } from './plugin.js';
|
|
114
|
-
/**
|
|
115
|
-
* DI tokens and providers for @veloxts/orm
|
|
116
|
-
*
|
|
117
|
-
* Use these to integrate ORM services with the @veloxts/core DI container.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```typescript
|
|
121
|
-
* import { Container } from '@veloxts/core';
|
|
122
|
-
* import { registerOrmProviders, DATABASE, DATABASE_CLIENT } from '@veloxts/orm';
|
|
123
|
-
*
|
|
124
|
-
* const container = new Container();
|
|
125
|
-
* registerOrmProviders(container, { client: prisma });
|
|
126
|
-
*
|
|
127
|
-
* const db = container.resolve(DATABASE);
|
|
128
|
-
* const client = container.resolve(DATABASE_CLIENT);
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
export { databaseProvider, registerOrmProviders, registerTenantProviders, tenantClientPoolProvider, tenantProvisionerProvider, tenantSchemaManagerProvider, } from './providers.js';
|
|
132
|
-
export { DATABASE, DATABASE_CLIENT, DATABASE_CONFIG, PUBLIC_DATABASE_CLIENT, TENANT_CLIENT_POOL, TENANT_CLIENT_POOL_CONFIG, TENANT_MIDDLEWARE_CONFIG, TENANT_PROVISIONER, TENANT_PROVISIONER_CONFIG, TENANT_SCHEMA_MANAGER, TENANT_SCHEMA_MANAGER_CONFIG, } from './tokens.js';
|
package/dist/index.js
CHANGED
|
@@ -87,35 +87,3 @@ export {
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
databasePlugin, } from './plugin.js';
|
|
90
|
-
// ============================================================================
|
|
91
|
-
// Dependency Injection
|
|
92
|
-
// ============================================================================
|
|
93
|
-
/**
|
|
94
|
-
* DI tokens and providers for @veloxts/orm
|
|
95
|
-
*
|
|
96
|
-
* Use these to integrate ORM services with the @veloxts/core DI container.
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```typescript
|
|
100
|
-
* import { Container } from '@veloxts/core';
|
|
101
|
-
* import { registerOrmProviders, DATABASE, DATABASE_CLIENT } from '@veloxts/orm';
|
|
102
|
-
*
|
|
103
|
-
* const container = new Container();
|
|
104
|
-
* registerOrmProviders(container, { client: prisma });
|
|
105
|
-
*
|
|
106
|
-
* const db = container.resolve(DATABASE);
|
|
107
|
-
* const client = container.resolve(DATABASE_CLIENT);
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
// Provider exports - factory functions for registering services
|
|
111
|
-
export { databaseProvider, registerOrmProviders, registerTenantProviders, tenantClientPoolProvider, tenantProvisionerProvider, tenantSchemaManagerProvider, } from './providers.js';
|
|
112
|
-
// Token exports - unique identifiers for DI resolution
|
|
113
|
-
export {
|
|
114
|
-
// Core database tokens
|
|
115
|
-
DATABASE, DATABASE_CLIENT, DATABASE_CONFIG,
|
|
116
|
-
// Public database token (multi-tenant)
|
|
117
|
-
PUBLIC_DATABASE_CLIENT,
|
|
118
|
-
// Tenant service tokens
|
|
119
|
-
TENANT_CLIENT_POOL,
|
|
120
|
-
// Tenant config tokens
|
|
121
|
-
TENANT_CLIENT_POOL_CONFIG, TENANT_MIDDLEWARE_CONFIG, TENANT_PROVISIONER, TENANT_PROVISIONER_CONFIG, TENANT_SCHEMA_MANAGER, TENANT_SCHEMA_MANAGER_CONFIG, } from './tokens.js';
|
package/dist/plugin.d.ts
CHANGED
|
@@ -40,19 +40,6 @@ import type { DatabaseClient, OrmPluginConfig } from './types.js';
|
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* ```typescript
|
|
43
|
-
* // With DI container
|
|
44
|
-
* import { Container } from '@veloxts/core';
|
|
45
|
-
* import { databasePlugin, DATABASE } from '@veloxts/orm';
|
|
46
|
-
*
|
|
47
|
-
* const container = new Container();
|
|
48
|
-
* await app.use(databasePlugin({ client: prisma, container }));
|
|
49
|
-
*
|
|
50
|
-
* // Resolve from container
|
|
51
|
-
* const db = container.resolve(DATABASE);
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
43
|
* // Using ctx.db in procedures
|
|
57
44
|
* import { defineProcedures, procedure } from '@veloxts/router';
|
|
58
45
|
* import { z } from '@veloxts/validation';
|
package/dist/plugin.js
CHANGED
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
import { createRequire } from 'node:module';
|
|
10
10
|
import { ConfigurationError, definePlugin } from '@veloxts/core';
|
|
11
11
|
import { createDatabase } from './client.js';
|
|
12
|
-
import { registerOrmProviders } from './providers.js';
|
|
13
|
-
import { DATABASE } from './tokens.js';
|
|
14
12
|
import { isDatabaseClient } from './types.js';
|
|
15
13
|
// Read version from package.json dynamically
|
|
16
14
|
const require = createRequire(import.meta.url);
|
|
@@ -97,19 +95,6 @@ const DEFAULT_PLUGIN_NAME = '@veloxts/orm';
|
|
|
97
95
|
*
|
|
98
96
|
* @example
|
|
99
97
|
* ```typescript
|
|
100
|
-
* // With DI container
|
|
101
|
-
* import { Container } from '@veloxts/core';
|
|
102
|
-
* import { databasePlugin, DATABASE } from '@veloxts/orm';
|
|
103
|
-
*
|
|
104
|
-
* const container = new Container();
|
|
105
|
-
* await app.use(databasePlugin({ client: prisma, container }));
|
|
106
|
-
*
|
|
107
|
-
* // Resolve from container
|
|
108
|
-
* const db = container.resolve(DATABASE);
|
|
109
|
-
* ```
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```typescript
|
|
113
98
|
* // Using ctx.db in procedures
|
|
114
99
|
* import { defineProcedures, procedure } from '@veloxts/router';
|
|
115
100
|
* import { z } from '@veloxts/validation';
|
|
@@ -146,7 +131,6 @@ export function databasePlugin(config) {
|
|
|
146
131
|
'Ensure you are passing a valid Prisma client instance.');
|
|
147
132
|
}
|
|
148
133
|
const pluginName = config.name ?? DEFAULT_PLUGIN_NAME;
|
|
149
|
-
const { container } = config;
|
|
150
134
|
// Plugin state - holds the database wrapper
|
|
151
135
|
const state = {
|
|
152
136
|
database: null,
|
|
@@ -155,15 +139,8 @@ export function databasePlugin(config) {
|
|
|
155
139
|
name: pluginName,
|
|
156
140
|
version: ORM_PLUGIN_VERSION,
|
|
157
141
|
async register(server) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
registerOrmProviders(container, config);
|
|
161
|
-
state.database = container.resolve(DATABASE);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
// Legacy path: Direct instantiation (backward compatible)
|
|
165
|
-
state.database = createDatabase({ client: config.client });
|
|
166
|
-
}
|
|
142
|
+
// Create database wrapper
|
|
143
|
+
state.database = createDatabase({ client: config.client });
|
|
167
144
|
// Connect to the database
|
|
168
145
|
await state.database.connect();
|
|
169
146
|
// Add database client to request context via onRequest hook
|
package/dist/types.d.ts
CHANGED
|
@@ -91,32 +91,6 @@ export interface OrmPluginConfig<TClient extends DatabaseClient> {
|
|
|
91
91
|
* @default '@veloxts/orm'
|
|
92
92
|
*/
|
|
93
93
|
name?: string;
|
|
94
|
-
/**
|
|
95
|
-
* DI container for service registration and resolution (optional)
|
|
96
|
-
*
|
|
97
|
-
* When provided, ORM services are registered with the container and can be:
|
|
98
|
-
* - Resolved from the container directly
|
|
99
|
-
* - Mocked in tests by overriding registrations
|
|
100
|
-
* - Managed alongside other application services
|
|
101
|
-
*
|
|
102
|
-
* When not provided, services are created directly (legacy behavior).
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```typescript
|
|
106
|
-
* import { Container } from '@veloxts/core';
|
|
107
|
-
* import { databasePlugin, DATABASE } from '@veloxts/orm';
|
|
108
|
-
*
|
|
109
|
-
* const container = new Container();
|
|
110
|
-
* app.register(databasePlugin({
|
|
111
|
-
* client: prisma,
|
|
112
|
-
* container,
|
|
113
|
-
* }));
|
|
114
|
-
*
|
|
115
|
-
* // Services now available from container
|
|
116
|
-
* const db = container.resolve(DATABASE);
|
|
117
|
-
* ```
|
|
118
|
-
*/
|
|
119
|
-
container?: import('@veloxts/core').Container;
|
|
120
94
|
}
|
|
121
95
|
/**
|
|
122
96
|
* Configuration options for the database wrapper
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veloxts/orm",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.91",
|
|
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.7.2",
|
|
20
20
|
"pg": "8.18.0",
|
|
21
21
|
"pg-format": "1.0.4",
|
|
22
|
-
"@veloxts/core": "0.6.
|
|
22
|
+
"@veloxts/core": "0.6.91"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/pg": "8.16.0",
|