@prisma-next/mongo 0.4.0-dev.2 → 0.4.0-dev.4
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/dist/config.mjs +2 -2
- package/dist/config.mjs.map +1 -1
- package/package.json +14 -14
- package/src/config/define-config.ts +3 -5
package/dist/config.mjs
CHANGED
|
@@ -22,10 +22,10 @@ function defineConfig(options) {
|
|
|
22
22
|
adapter: mongoAdapter,
|
|
23
23
|
driver: mongoDriver,
|
|
24
24
|
contract: ext === ".ts" ? {
|
|
25
|
-
source: async () => {
|
|
25
|
+
source: async (context) => {
|
|
26
26
|
const { typescriptContract } = await import("@prisma-next/mongo-contract-ts/config-types");
|
|
27
27
|
const mod = await import(pathToFileURL(absoluteContractPath).href);
|
|
28
|
-
return typescriptContract(mod.default ?? mod.contract, output).source(
|
|
28
|
+
return typescriptContract(mod.default ?? mod.contract, output).source(context);
|
|
29
29
|
},
|
|
30
30
|
output
|
|
31
31
|
} : mongoContract(options.contract, { output }),
|
package/dist/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":["coreDefineConfig"],"sources":["../src/config/define-config.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport mongoAdapter from '@prisma-next/adapter-mongo/control';\nimport type { PrismaNextConfig } from '@prisma-next/config/config-types';\nimport { defineConfig as coreDefineConfig } from '@prisma-next/config/config-types';\nimport mongoDriver from '@prisma-next/driver-mongo/control';\nimport { mongoFamilyDescriptor, mongoTargetDescriptor } from '@prisma-next/family-mongo/control';\nimport { mongoContract } from '@prisma-next/mongo-contract-psl/provider';\nimport { extname, isAbsolute, resolve } from 'pathe';\n\nexport interface MongoConfigOptions {\n readonly contract: string;\n readonly db?: {\n readonly connection?: string;\n };\n}\n\nfunction deriveOutputPath(contractPath: string): string {\n const ext = extname(contractPath);\n if (ext.length === 0) {\n return `${contractPath}.json`;\n }\n return `${contractPath.slice(0, -ext.length)}.json`;\n}\n\nexport function defineConfig(options: MongoConfigOptions): PrismaNextConfig<'mongo', 'mongo'> {\n const output = deriveOutputPath(options.contract);\n const ext = extname(options.contract);\n\n const absoluteContractPath = isAbsolute(options.contract)\n ? options.contract\n : resolve(process.cwd(), options.contract);\n\n const contractConfig =\n ext === '.ts'\n ? {\n source: async () => {\n const { typescriptContract } = await import(\n '@prisma-next/mongo-contract-ts/config-types'\n );\n const mod = await import(pathToFileURL(absoluteContractPath).href);\n const contract = mod.default ?? mod.contract;\n return typescriptContract(contract, output).source(
|
|
1
|
+
{"version":3,"file":"config.mjs","names":["coreDefineConfig"],"sources":["../src/config/define-config.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url';\nimport mongoAdapter from '@prisma-next/adapter-mongo/control';\nimport type { ContractSourceContext, PrismaNextConfig } from '@prisma-next/config/config-types';\nimport { defineConfig as coreDefineConfig } from '@prisma-next/config/config-types';\nimport mongoDriver from '@prisma-next/driver-mongo/control';\nimport { mongoFamilyDescriptor, mongoTargetDescriptor } from '@prisma-next/family-mongo/control';\nimport { mongoContract } from '@prisma-next/mongo-contract-psl/provider';\nimport { extname, isAbsolute, resolve } from 'pathe';\n\nexport interface MongoConfigOptions {\n readonly contract: string;\n readonly db?: {\n readonly connection?: string;\n };\n}\n\nfunction deriveOutputPath(contractPath: string): string {\n const ext = extname(contractPath);\n if (ext.length === 0) {\n return `${contractPath}.json`;\n }\n return `${contractPath.slice(0, -ext.length)}.json`;\n}\n\nexport function defineConfig(options: MongoConfigOptions): PrismaNextConfig<'mongo', 'mongo'> {\n const output = deriveOutputPath(options.contract);\n const ext = extname(options.contract);\n\n const absoluteContractPath = isAbsolute(options.contract)\n ? options.contract\n : resolve(process.cwd(), options.contract);\n\n const contractConfig =\n ext === '.ts'\n ? {\n source: async (context: ContractSourceContext) => {\n const { typescriptContract } = await import(\n '@prisma-next/mongo-contract-ts/config-types'\n );\n const mod = await import(pathToFileURL(absoluteContractPath).href);\n const contract = mod.default ?? mod.contract;\n return typescriptContract(contract, output).source(context);\n },\n output,\n }\n : mongoContract(options.contract, { output });\n\n return coreDefineConfig({\n family: mongoFamilyDescriptor,\n target: mongoTargetDescriptor,\n adapter: mongoAdapter,\n driver: mongoDriver,\n contract: contractConfig,\n ...(options.db !== undefined ? { db: options.db } : {}),\n });\n}\n"],"mappings":";;;;;;;;;AAgBA,SAAS,iBAAiB,cAA8B;CACtD,MAAM,MAAM,QAAQ,aAAa;AACjC,KAAI,IAAI,WAAW,EACjB,QAAO,GAAG,aAAa;AAEzB,QAAO,GAAG,aAAa,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC;;AAG/C,SAAgB,aAAa,SAAiE;CAC5F,MAAM,SAAS,iBAAiB,QAAQ,SAAS;CACjD,MAAM,MAAM,QAAQ,QAAQ,SAAS;CAErC,MAAM,uBAAuB,WAAW,QAAQ,SAAS,GACrD,QAAQ,WACR,QAAQ,QAAQ,KAAK,EAAE,QAAQ,SAAS;AAiB5C,QAAOA,eAAiB;EACtB,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,UAnBA,QAAQ,QACJ;GACE,QAAQ,OAAO,YAAmC;IAChD,MAAM,EAAE,uBAAuB,MAAM,OACnC;IAEF,MAAM,MAAM,MAAM,OAAO,cAAc,qBAAqB,CAAC;AAE7D,WAAO,mBADU,IAAI,WAAW,IAAI,UACA,OAAO,CAAC,OAAO,QAAQ;;GAE7D;GACD,GACD,cAAc,QAAQ,UAAU,EAAE,QAAQ,CAAC;EAQ/C,GAAI,QAAQ,OAAO,SAAY,EAAE,IAAI,QAAQ,IAAI,GAAG,EAAE;EACvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/mongo",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "One-package Mongo setup for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"pathe": "^2.0.3",
|
|
9
|
-
"@prisma-next/adapter-mongo": "0.4.0-dev.
|
|
10
|
-
"@prisma-next/
|
|
11
|
-
"@prisma-next/contract": "0.4.0-dev.
|
|
12
|
-
"@prisma-next/
|
|
13
|
-
"@prisma-next/framework-components": "0.4.0-dev.
|
|
14
|
-
"@prisma-next/mongo-contract": "0.4.0-dev.
|
|
15
|
-
"@prisma-next/
|
|
16
|
-
"@prisma-next/mongo
|
|
17
|
-
"@prisma-next/mongo-contract-
|
|
18
|
-
"@prisma-next/mongo-
|
|
19
|
-
"@prisma-next/mongo-
|
|
20
|
-
"@prisma-next/mongo-
|
|
21
|
-
"@prisma-next/target-mongo": "0.4.0-dev.
|
|
9
|
+
"@prisma-next/adapter-mongo": "0.4.0-dev.4",
|
|
10
|
+
"@prisma-next/driver-mongo": "0.4.0-dev.4",
|
|
11
|
+
"@prisma-next/contract": "0.4.0-dev.4",
|
|
12
|
+
"@prisma-next/config": "0.4.0-dev.4",
|
|
13
|
+
"@prisma-next/framework-components": "0.4.0-dev.4",
|
|
14
|
+
"@prisma-next/mongo-contract": "0.4.0-dev.4",
|
|
15
|
+
"@prisma-next/mongo-orm": "0.4.0-dev.4",
|
|
16
|
+
"@prisma-next/family-mongo": "0.4.0-dev.4",
|
|
17
|
+
"@prisma-next/mongo-contract-ts": "0.4.0-dev.4",
|
|
18
|
+
"@prisma-next/mongo-contract-psl": "0.4.0-dev.4",
|
|
19
|
+
"@prisma-next/mongo-runtime": "0.4.0-dev.4",
|
|
20
|
+
"@prisma-next/mongo-pipeline-builder": "0.4.0-dev.4",
|
|
21
|
+
"@prisma-next/target-mongo": "0.4.0-dev.4"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"tsdown": "0.18.4",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pathToFileURL } from 'node:url';
|
|
2
2
|
import mongoAdapter from '@prisma-next/adapter-mongo/control';
|
|
3
|
-
import type { PrismaNextConfig } from '@prisma-next/config/config-types';
|
|
3
|
+
import type { ContractSourceContext, PrismaNextConfig } from '@prisma-next/config/config-types';
|
|
4
4
|
import { defineConfig as coreDefineConfig } from '@prisma-next/config/config-types';
|
|
5
5
|
import mongoDriver from '@prisma-next/driver-mongo/control';
|
|
6
6
|
import { mongoFamilyDescriptor, mongoTargetDescriptor } from '@prisma-next/family-mongo/control';
|
|
@@ -33,15 +33,13 @@ export function defineConfig(options: MongoConfigOptions): PrismaNextConfig<'mon
|
|
|
33
33
|
const contractConfig =
|
|
34
34
|
ext === '.ts'
|
|
35
35
|
? {
|
|
36
|
-
source: async () => {
|
|
36
|
+
source: async (context: ContractSourceContext) => {
|
|
37
37
|
const { typescriptContract } = await import(
|
|
38
38
|
'@prisma-next/mongo-contract-ts/config-types'
|
|
39
39
|
);
|
|
40
40
|
const mod = await import(pathToFileURL(absoluteContractPath).href);
|
|
41
41
|
const contract = mod.default ?? mod.contract;
|
|
42
|
-
return typescriptContract(contract, output).source(
|
|
43
|
-
composedExtensionPacks: [],
|
|
44
|
-
});
|
|
42
|
+
return typescriptContract(contract, output).source(context);
|
|
45
43
|
},
|
|
46
44
|
output,
|
|
47
45
|
}
|