@powerlines/plugin-prisma 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/LICENSE +201 -0
- package/README.md +294 -0
- package/dist/chunk-FBBMZ4NC.cjs +7 -0
- package/dist/chunk-UCUR73HG.js +7 -0
- package/dist/helpers/get-schema.cjs +7 -0
- package/dist/helpers/get-schema.d.cts +11 -0
- package/dist/helpers/get-schema.d.ts +11 -0
- package/dist/helpers/get-schema.js +7 -0
- package/dist/helpers/index.cjs +1 -0
- package/dist/helpers/index.d.cts +24 -0
- package/dist/helpers/index.d.ts +24 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/schema-creator.cjs +20 -0
- package/dist/helpers/schema-creator.d.cts +23 -0
- package/dist/helpers/schema-creator.d.ts +23 -0
- package/dist/helpers/schema-creator.js +20 -0
- package/dist/index-CxPJK_7-.d.ts +1366 -0
- package/dist/index-PmSelLdL.d.cts +1366 -0
- package/dist/src/index.cjs +7 -0
- package/dist/src/index.d.cts +34 -0
- package/dist/src/index.d.ts +34 -0
- package/dist/src/index.js +7 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +23 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/index.js +1 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +23 -0
- package/dist/types/plugin.d.ts +23 -0
- package/dist/types/plugin.js +0 -0
- package/dist/types/prisma.cjs +1 -0
- package/dist/types/prisma.d.cts +71 -0
- package/dist/types/prisma.d.ts +71 -0
- package/dist/types/prisma.js +0 -0
- package/package.json +151 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFBBMZ4NC_cjs=require('../chunk-FBBMZ4NC.cjs'),execute=require('@stryke/cli/execute'),exists=require('@stryke/fs/exists'),packageFns=require('@stryke/fs/package-fns'),joinPaths=require('@stryke/path/join-paths'),replace=require('@stryke/path/replace'),h=require('defu'),getConfigPath=require('powerlines/plugin-utils/get-config-path'),getSchema=require('./helpers/get-schema'),schemaCreator=require('./helpers/schema-creator'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var h__default=/*#__PURE__*/_interopDefault(h);/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
const u=chunkFBBMZ4NC_cjs.a((r={})=>({name:"prisma",config(){return {prisma:h__default.default(r,{schema:joinPaths.joinPaths(this.config.projectRoot,"prisma","schema.prisma"),configFile:r.configFile||getConfigPath.getConfigPath(this,"prisma.config"),generatedPath:joinPaths.joinPaths("{builtinPath}","prisma")})}},async configResolved(){if(this.dependencies["@prisma/client"]="latest",this.config.prisma.configFile=this.config.prisma.configFile?.replace("{projectRoot}",this.config.projectRoot),!this.config.prisma.schema)throw new Error("Prisma schema path is not defined. Please specify a valid path in the plugin configuration.");if(this.config.prisma.schema=this.config.prisma.schema.replace("{projectRoot}",this.config.projectRoot),!this.config.prisma.generatedPath)throw new Error("Prisma generated path is not defined. Please specify a valid path in the plugin configuration.");this.config.prisma.generatedPath=this.config.prisma.generatedPath.replace("{projectRoot}",joinPaths.joinPaths(this.workspaceConfig.workspaceRoot,this.config.projectRoot)).replace("{builtinPath}",this.builtinsPath),this.prisma??={},exists.existsSync(this.config.prisma.schema)?this.prisma.schema=await getSchema.getSchema({datamodel:this.config.prisma.schema}):this.prisma.schema??={generators:[],datasources:[],warnings:[]};const i=this.prisma.schema.generators.find(t=>t.provider.value==="prisma-client-js");i?i.output??={value:this.config.prisma.generatedPath,fromEnvVar:null}:this.prisma.schema.generators.push({name:"prisma-client-js",provider:{value:"prisma-client-js",fromEnvVar:null},output:{value:this.config.prisma.generatedPath,fromEnvVar:null},config:{},binaryTargets:[],previewFeatures:[],sourceFilePath:this.config.prisma.schema}),this.prisma.builder=new schemaCreator.PrismaSchemaCreator(this);},async prepare(){await this.prisma.builder.write();const i=["generate","--schema",this.config.prisma.schema];if(this.config.prisma.prismaPath){i.unshift(this.config.prisma.prismaPath);const t=await execute.execute(i.join(" "),this.config.projectRoot);if(t.failed)throw new Error(`Prisma process exited with code ${t.exitCode}.`)}else {const t=await packageFns.isPackageListed("prisma",this.config.projectRoot);i.unshift(t?replace.replacePath(this.config.sourceRoot,this.config.projectRoot):this.config.sourceRoot);const s=await execute.executePackage("prisma",i,joinPaths.joinPaths(this.workspaceConfig.workspaceRoot,this.config.projectRoot));if(s.failed)throw new Error(`Prisma process exited with code ${s.exitCode}.`)}}}),"plugin");var L=u;exports.default=L;exports.plugin=u;Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { a as PrismaPluginContext, b as PrismaPluginOptions, c as Plugin } from '../index-PmSelLdL.cjs';
|
|
2
|
+
export { e as PrismaPluginResolvedConfig, d as PrismaPluginUserConfig } from '../index-PmSelLdL.cjs';
|
|
3
|
+
export { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, MultipleSchemas, PrismaSchema, SchemaFileInput } from '../types/prisma.cjs';
|
|
4
|
+
import '@storm-software/build-tools/types';
|
|
5
|
+
import '@storm-software/config-tools/types';
|
|
6
|
+
import '@storm-software/config/types';
|
|
7
|
+
import '@stryke/types/base';
|
|
8
|
+
import '@stryke/types/configuration';
|
|
9
|
+
import '@stryke/types/file';
|
|
10
|
+
import 'vite';
|
|
11
|
+
import '@stryke/env/get-env-paths';
|
|
12
|
+
import '@stryke/types/package-json';
|
|
13
|
+
import 'jiti';
|
|
14
|
+
import 'oxc-parser';
|
|
15
|
+
import 'semver';
|
|
16
|
+
import 'unplugin';
|
|
17
|
+
import '@stryke/types/tsconfig';
|
|
18
|
+
import 'typescript';
|
|
19
|
+
import '@stryke/json/types';
|
|
20
|
+
import 'memfs';
|
|
21
|
+
import 'node:fs';
|
|
22
|
+
import 'unionfs';
|
|
23
|
+
import '@stryke/types/array';
|
|
24
|
+
import 'prisma-util/schema-creator';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A Powerlines plugin to integrate Prisma for code generation.
|
|
28
|
+
*
|
|
29
|
+
* @param options - The plugin options.
|
|
30
|
+
* @returns A Powerlines plugin instance.
|
|
31
|
+
*/
|
|
32
|
+
declare const plugin: <TContext extends PrismaPluginContext = PrismaPluginContext>(options?: PrismaPluginOptions) => Plugin<TContext>;
|
|
33
|
+
|
|
34
|
+
export { PrismaPluginContext, PrismaPluginOptions, plugin as default, plugin };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { a as PrismaPluginContext, b as PrismaPluginOptions, c as Plugin } from '../index-CxPJK_7-.js';
|
|
2
|
+
export { e as PrismaPluginResolvedConfig, d as PrismaPluginUserConfig } from '../index-CxPJK_7-.js';
|
|
3
|
+
export { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, MultipleSchemas, PrismaSchema, SchemaFileInput } from '../types/prisma.js';
|
|
4
|
+
import '@storm-software/build-tools/types';
|
|
5
|
+
import '@storm-software/config-tools/types';
|
|
6
|
+
import '@storm-software/config/types';
|
|
7
|
+
import '@stryke/types/base';
|
|
8
|
+
import '@stryke/types/configuration';
|
|
9
|
+
import '@stryke/types/file';
|
|
10
|
+
import 'vite';
|
|
11
|
+
import '@stryke/env/get-env-paths';
|
|
12
|
+
import '@stryke/types/package-json';
|
|
13
|
+
import 'jiti';
|
|
14
|
+
import 'oxc-parser';
|
|
15
|
+
import 'semver';
|
|
16
|
+
import 'unplugin';
|
|
17
|
+
import '@stryke/types/tsconfig';
|
|
18
|
+
import 'typescript';
|
|
19
|
+
import '@stryke/json/types';
|
|
20
|
+
import 'memfs';
|
|
21
|
+
import 'node:fs';
|
|
22
|
+
import 'unionfs';
|
|
23
|
+
import '@stryke/types/array';
|
|
24
|
+
import 'prisma-util/schema-creator';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A Powerlines plugin to integrate Prisma for code generation.
|
|
28
|
+
*
|
|
29
|
+
* @param options - The plugin options.
|
|
30
|
+
* @returns A Powerlines plugin instance.
|
|
31
|
+
*/
|
|
32
|
+
declare const plugin: <TContext extends PrismaPluginContext = PrismaPluginContext>(options?: PrismaPluginOptions) => Plugin<TContext>;
|
|
33
|
+
|
|
34
|
+
export { PrismaPluginContext, PrismaPluginOptions, plugin as default, plugin };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {a}from'../chunk-UCUR73HG.js';import {execute,executePackage}from'@stryke/cli/execute';import {existsSync}from'@stryke/fs/exists';import {isPackageListed}from'@stryke/fs/package-fns';import {joinPaths}from'@stryke/path/join-paths';import {replacePath}from'@stryke/path/replace';import h from'defu';import {getConfigPath}from'powerlines/plugin-utils/get-config-path';import {getSchema}from'./helpers/get-schema';import {PrismaSchemaCreator}from'./helpers/schema-creator';export*from'./types';/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
const u=a((r={})=>({name:"prisma",config(){return {prisma:h(r,{schema:joinPaths(this.config.projectRoot,"prisma","schema.prisma"),configFile:r.configFile||getConfigPath(this,"prisma.config"),generatedPath:joinPaths("{builtinPath}","prisma")})}},async configResolved(){if(this.dependencies["@prisma/client"]="latest",this.config.prisma.configFile=this.config.prisma.configFile?.replace("{projectRoot}",this.config.projectRoot),!this.config.prisma.schema)throw new Error("Prisma schema path is not defined. Please specify a valid path in the plugin configuration.");if(this.config.prisma.schema=this.config.prisma.schema.replace("{projectRoot}",this.config.projectRoot),!this.config.prisma.generatedPath)throw new Error("Prisma generated path is not defined. Please specify a valid path in the plugin configuration.");this.config.prisma.generatedPath=this.config.prisma.generatedPath.replace("{projectRoot}",joinPaths(this.workspaceConfig.workspaceRoot,this.config.projectRoot)).replace("{builtinPath}",this.builtinsPath),this.prisma??={},existsSync(this.config.prisma.schema)?this.prisma.schema=await getSchema({datamodel:this.config.prisma.schema}):this.prisma.schema??={generators:[],datasources:[],warnings:[]};const i=this.prisma.schema.generators.find(t=>t.provider.value==="prisma-client-js");i?i.output??={value:this.config.prisma.generatedPath,fromEnvVar:null}:this.prisma.schema.generators.push({name:"prisma-client-js",provider:{value:"prisma-client-js",fromEnvVar:null},output:{value:this.config.prisma.generatedPath,fromEnvVar:null},config:{},binaryTargets:[],previewFeatures:[],sourceFilePath:this.config.prisma.schema}),this.prisma.builder=new PrismaSchemaCreator(this);},async prepare(){await this.prisma.builder.write();const i=["generate","--schema",this.config.prisma.schema];if(this.config.prisma.prismaPath){i.unshift(this.config.prisma.prismaPath);const t=await execute(i.join(" "),this.config.projectRoot);if(t.failed)throw new Error(`Prisma process exited with code ${t.exitCode}.`)}else {const t=await isPackageListed("prisma",this.config.projectRoot);i.unshift(t?replacePath(this.config.sourceRoot,this.config.projectRoot):this.config.sourceRoot);const s=await executePackage("prisma",i,joinPaths(this.workspaceConfig.workspaceRoot,this.config.projectRoot));if(s.failed)throw new Error(`Prisma process exited with code ${s.exitCode}.`)}}}),"plugin");var O=u;export{O as default,u as plugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var plugin=require('./plugin'),prisma=require('./prisma');Object.keys(plugin).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return plugin[k]}})});Object.keys(prisma).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return prisma[k]}})});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { a as PrismaPluginContext, b as PrismaPluginOptions, e as PrismaPluginResolvedConfig, d as PrismaPluginUserConfig } from '../index-PmSelLdL.cjs';
|
|
2
|
+
export { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, MultipleSchemas, PrismaSchema, SchemaFileInput } from './prisma.cjs';
|
|
3
|
+
import '@storm-software/build-tools/types';
|
|
4
|
+
import '@storm-software/config-tools/types';
|
|
5
|
+
import '@storm-software/config/types';
|
|
6
|
+
import '@stryke/types/base';
|
|
7
|
+
import '@stryke/types/configuration';
|
|
8
|
+
import '@stryke/types/file';
|
|
9
|
+
import 'vite';
|
|
10
|
+
import '@stryke/env/get-env-paths';
|
|
11
|
+
import '@stryke/types/package-json';
|
|
12
|
+
import 'jiti';
|
|
13
|
+
import 'oxc-parser';
|
|
14
|
+
import 'semver';
|
|
15
|
+
import 'unplugin';
|
|
16
|
+
import '@stryke/types/tsconfig';
|
|
17
|
+
import 'typescript';
|
|
18
|
+
import '@stryke/json/types';
|
|
19
|
+
import 'memfs';
|
|
20
|
+
import 'node:fs';
|
|
21
|
+
import 'unionfs';
|
|
22
|
+
import '@stryke/types/array';
|
|
23
|
+
import 'prisma-util/schema-creator';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { a as PrismaPluginContext, b as PrismaPluginOptions, e as PrismaPluginResolvedConfig, d as PrismaPluginUserConfig } from '../index-CxPJK_7-.js';
|
|
2
|
+
export { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, MultipleSchemas, PrismaSchema, SchemaFileInput } from './prisma.js';
|
|
3
|
+
import '@storm-software/build-tools/types';
|
|
4
|
+
import '@storm-software/config-tools/types';
|
|
5
|
+
import '@storm-software/config/types';
|
|
6
|
+
import '@stryke/types/base';
|
|
7
|
+
import '@stryke/types/configuration';
|
|
8
|
+
import '@stryke/types/file';
|
|
9
|
+
import 'vite';
|
|
10
|
+
import '@stryke/env/get-env-paths';
|
|
11
|
+
import '@stryke/types/package-json';
|
|
12
|
+
import 'jiti';
|
|
13
|
+
import 'oxc-parser';
|
|
14
|
+
import 'semver';
|
|
15
|
+
import 'unplugin';
|
|
16
|
+
import '@stryke/types/tsconfig';
|
|
17
|
+
import 'typescript';
|
|
18
|
+
import '@stryke/json/types';
|
|
19
|
+
import 'memfs';
|
|
20
|
+
import 'node:fs';
|
|
21
|
+
import 'unionfs';
|
|
22
|
+
import '@stryke/types/array';
|
|
23
|
+
import 'prisma-util/schema-creator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from'./plugin';export*from'./prisma';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { a as PrismaPluginContext, b as PrismaPluginOptions, e as PrismaPluginResolvedConfig, d as PrismaPluginUserConfig } from '../index-PmSelLdL.cjs';
|
|
2
|
+
import './prisma.cjs';
|
|
3
|
+
import '@storm-software/build-tools/types';
|
|
4
|
+
import '@storm-software/config-tools/types';
|
|
5
|
+
import '@storm-software/config/types';
|
|
6
|
+
import '@stryke/types/base';
|
|
7
|
+
import '@stryke/types/configuration';
|
|
8
|
+
import '@stryke/types/file';
|
|
9
|
+
import 'vite';
|
|
10
|
+
import '@stryke/env/get-env-paths';
|
|
11
|
+
import '@stryke/types/package-json';
|
|
12
|
+
import 'jiti';
|
|
13
|
+
import 'oxc-parser';
|
|
14
|
+
import 'semver';
|
|
15
|
+
import 'unplugin';
|
|
16
|
+
import '@stryke/types/tsconfig';
|
|
17
|
+
import 'typescript';
|
|
18
|
+
import '@stryke/json/types';
|
|
19
|
+
import 'memfs';
|
|
20
|
+
import 'node:fs';
|
|
21
|
+
import 'unionfs';
|
|
22
|
+
import '@stryke/types/array';
|
|
23
|
+
import 'prisma-util/schema-creator';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { a as PrismaPluginContext, b as PrismaPluginOptions, e as PrismaPluginResolvedConfig, d as PrismaPluginUserConfig } from '../index-CxPJK_7-.js';
|
|
2
|
+
import './prisma.js';
|
|
3
|
+
import '@storm-software/build-tools/types';
|
|
4
|
+
import '@storm-software/config-tools/types';
|
|
5
|
+
import '@storm-software/config/types';
|
|
6
|
+
import '@stryke/types/base';
|
|
7
|
+
import '@stryke/types/configuration';
|
|
8
|
+
import '@stryke/types/file';
|
|
9
|
+
import 'vite';
|
|
10
|
+
import '@stryke/env/get-env-paths';
|
|
11
|
+
import '@stryke/types/package-json';
|
|
12
|
+
import 'jiti';
|
|
13
|
+
import 'oxc-parser';
|
|
14
|
+
import 'semver';
|
|
15
|
+
import 'unplugin';
|
|
16
|
+
import '@stryke/types/tsconfig';
|
|
17
|
+
import 'typescript';
|
|
18
|
+
import '@stryke/json/types';
|
|
19
|
+
import 'memfs';
|
|
20
|
+
import 'node:fs';
|
|
21
|
+
import 'unionfs';
|
|
22
|
+
import '@stryke/types/array';
|
|
23
|
+
import 'prisma-util/schema-creator';
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
type MultipleSchemas = Array<[filename: string, content: string]>;
|
|
2
|
+
type SchemaFileInput = string | [filename: string, content: string];
|
|
3
|
+
type ConnectorType = "mysql" | "mongodb" | "sqlite" | "postgresql" | "postgres" | "prisma+postgres" | "sqlserver" | "cockroachdb";
|
|
4
|
+
type ActiveConnectorType = Exclude<ConnectorType, "postgres" | "prisma+postgres">;
|
|
5
|
+
interface DataSource {
|
|
6
|
+
name: string;
|
|
7
|
+
provider: ConnectorType;
|
|
8
|
+
activeProvider: ActiveConnectorType;
|
|
9
|
+
url: EnvValue;
|
|
10
|
+
directUrl?: EnvValue;
|
|
11
|
+
schemas: string[] | [];
|
|
12
|
+
sourceFilePath: string;
|
|
13
|
+
}
|
|
14
|
+
interface GetSchemaResponse {
|
|
15
|
+
config: PrismaSchema;
|
|
16
|
+
errors: GetSchemaValidationError[];
|
|
17
|
+
}
|
|
18
|
+
interface EnvValue {
|
|
19
|
+
fromEnvVar: null | string;
|
|
20
|
+
value: null | string;
|
|
21
|
+
}
|
|
22
|
+
interface EnvValue {
|
|
23
|
+
fromEnvVar: null | string;
|
|
24
|
+
value: null | string;
|
|
25
|
+
}
|
|
26
|
+
interface EnvPaths {
|
|
27
|
+
rootEnvPath: string | null;
|
|
28
|
+
schemaEnvPath: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
interface BinaryTargetsEnvValue {
|
|
31
|
+
fromEnvVar: string | null;
|
|
32
|
+
value: string;
|
|
33
|
+
native?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface GeneratorConfig {
|
|
36
|
+
name: string;
|
|
37
|
+
output: EnvValue | null;
|
|
38
|
+
isCustomOutput?: boolean;
|
|
39
|
+
provider: EnvValue;
|
|
40
|
+
config: {
|
|
41
|
+
/** `output` is a reserved name and will only be available directly at `generator.output` */
|
|
42
|
+
output?: never;
|
|
43
|
+
/** `provider` is a reserved name and will only be available directly at `generator.provider` */
|
|
44
|
+
provider?: never;
|
|
45
|
+
/** `binaryTargets` is a reserved name and will only be available directly at `generator.binaryTargets` */
|
|
46
|
+
binaryTargets?: never;
|
|
47
|
+
/** `previewFeatures` is a reserved name and will only be available directly at `generator.previewFeatures` */
|
|
48
|
+
previewFeatures?: never;
|
|
49
|
+
} & {
|
|
50
|
+
[key: string]: string | string[] | undefined;
|
|
51
|
+
};
|
|
52
|
+
binaryTargets: BinaryTargetsEnvValue[];
|
|
53
|
+
previewFeatures: string[];
|
|
54
|
+
envPaths?: EnvPaths;
|
|
55
|
+
sourceFilePath: string;
|
|
56
|
+
}
|
|
57
|
+
interface PrismaSchema {
|
|
58
|
+
datasources: DataSource[];
|
|
59
|
+
generators: GeneratorConfig[];
|
|
60
|
+
warnings: string[];
|
|
61
|
+
}
|
|
62
|
+
interface GetSchemaValidationError {
|
|
63
|
+
fileName: string | null;
|
|
64
|
+
message: string;
|
|
65
|
+
}
|
|
66
|
+
interface GetSchemaOptions {
|
|
67
|
+
datamodel: SchemaFileInput;
|
|
68
|
+
ignoreEnvVarErrors?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, MultipleSchemas, PrismaSchema, SchemaFileInput };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
type MultipleSchemas = Array<[filename: string, content: string]>;
|
|
2
|
+
type SchemaFileInput = string | [filename: string, content: string];
|
|
3
|
+
type ConnectorType = "mysql" | "mongodb" | "sqlite" | "postgresql" | "postgres" | "prisma+postgres" | "sqlserver" | "cockroachdb";
|
|
4
|
+
type ActiveConnectorType = Exclude<ConnectorType, "postgres" | "prisma+postgres">;
|
|
5
|
+
interface DataSource {
|
|
6
|
+
name: string;
|
|
7
|
+
provider: ConnectorType;
|
|
8
|
+
activeProvider: ActiveConnectorType;
|
|
9
|
+
url: EnvValue;
|
|
10
|
+
directUrl?: EnvValue;
|
|
11
|
+
schemas: string[] | [];
|
|
12
|
+
sourceFilePath: string;
|
|
13
|
+
}
|
|
14
|
+
interface GetSchemaResponse {
|
|
15
|
+
config: PrismaSchema;
|
|
16
|
+
errors: GetSchemaValidationError[];
|
|
17
|
+
}
|
|
18
|
+
interface EnvValue {
|
|
19
|
+
fromEnvVar: null | string;
|
|
20
|
+
value: null | string;
|
|
21
|
+
}
|
|
22
|
+
interface EnvValue {
|
|
23
|
+
fromEnvVar: null | string;
|
|
24
|
+
value: null | string;
|
|
25
|
+
}
|
|
26
|
+
interface EnvPaths {
|
|
27
|
+
rootEnvPath: string | null;
|
|
28
|
+
schemaEnvPath: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
interface BinaryTargetsEnvValue {
|
|
31
|
+
fromEnvVar: string | null;
|
|
32
|
+
value: string;
|
|
33
|
+
native?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface GeneratorConfig {
|
|
36
|
+
name: string;
|
|
37
|
+
output: EnvValue | null;
|
|
38
|
+
isCustomOutput?: boolean;
|
|
39
|
+
provider: EnvValue;
|
|
40
|
+
config: {
|
|
41
|
+
/** `output` is a reserved name and will only be available directly at `generator.output` */
|
|
42
|
+
output?: never;
|
|
43
|
+
/** `provider` is a reserved name and will only be available directly at `generator.provider` */
|
|
44
|
+
provider?: never;
|
|
45
|
+
/** `binaryTargets` is a reserved name and will only be available directly at `generator.binaryTargets` */
|
|
46
|
+
binaryTargets?: never;
|
|
47
|
+
/** `previewFeatures` is a reserved name and will only be available directly at `generator.previewFeatures` */
|
|
48
|
+
previewFeatures?: never;
|
|
49
|
+
} & {
|
|
50
|
+
[key: string]: string | string[] | undefined;
|
|
51
|
+
};
|
|
52
|
+
binaryTargets: BinaryTargetsEnvValue[];
|
|
53
|
+
previewFeatures: string[];
|
|
54
|
+
envPaths?: EnvPaths;
|
|
55
|
+
sourceFilePath: string;
|
|
56
|
+
}
|
|
57
|
+
interface PrismaSchema {
|
|
58
|
+
datasources: DataSource[];
|
|
59
|
+
generators: GeneratorConfig[];
|
|
60
|
+
warnings: string[];
|
|
61
|
+
}
|
|
62
|
+
interface GetSchemaValidationError {
|
|
63
|
+
fileName: string | null;
|
|
64
|
+
message: string;
|
|
65
|
+
}
|
|
66
|
+
interface GetSchemaOptions {
|
|
67
|
+
datamodel: SchemaFileInput;
|
|
68
|
+
ignoreEnvVarErrors?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, MultipleSchemas, PrismaSchema, SchemaFileInput };
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@powerlines/plugin-prisma",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A Powerlines plugin to generate project code and a Prisma client from a Prisma schema (PSL).",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "github",
|
|
8
|
+
"url": "https://github.com/storm-software/powerlines.git",
|
|
9
|
+
"directory": "packages/plugin-prisma"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://stormsoftware.com",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://stormsoftware.com/support",
|
|
14
|
+
"email": "support@stormsoftware.com"
|
|
15
|
+
},
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Storm Software",
|
|
18
|
+
"email": "contact@stormsoftware.com",
|
|
19
|
+
"url": "https://stormsoftware.com"
|
|
20
|
+
},
|
|
21
|
+
"maintainers": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Storm Software",
|
|
24
|
+
"email": "contact@stormsoftware.com",
|
|
25
|
+
"url": "https://stormsoftware.com"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"contributors": [
|
|
29
|
+
{
|
|
30
|
+
"name": "Storm Software",
|
|
31
|
+
"email": "contact@stormsoftware.com",
|
|
32
|
+
"url": "https://stormsoftware.com"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"funding": {
|
|
36
|
+
"type": "github",
|
|
37
|
+
"url": "https://github.com/sponsors/storm-software"
|
|
38
|
+
},
|
|
39
|
+
"license": "Apache-2.0",
|
|
40
|
+
"private": false,
|
|
41
|
+
"main": "dist/index.cjs",
|
|
42
|
+
"module": "dist/index.js",
|
|
43
|
+
"exports": {
|
|
44
|
+
"./package.json": "./package.json",
|
|
45
|
+
".": {
|
|
46
|
+
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/index.d.cts",
|
|
49
|
+
"default": "./dist/index.cjs"
|
|
50
|
+
},
|
|
51
|
+
"default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
|
|
52
|
+
},
|
|
53
|
+
"./index": {
|
|
54
|
+
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./dist/index.d.cts",
|
|
57
|
+
"default": "./dist/index.cjs"
|
|
58
|
+
},
|
|
59
|
+
"default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
|
|
60
|
+
},
|
|
61
|
+
"./plugin": {
|
|
62
|
+
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
|
|
63
|
+
"require": {
|
|
64
|
+
"types": "./dist/index.d.cts",
|
|
65
|
+
"default": "./dist/index.cjs"
|
|
66
|
+
},
|
|
67
|
+
"default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
|
|
68
|
+
},
|
|
69
|
+
"./types": {
|
|
70
|
+
"import": {
|
|
71
|
+
"types": "./dist/types/index.d.ts",
|
|
72
|
+
"default": "./dist/types/index.js"
|
|
73
|
+
},
|
|
74
|
+
"require": {
|
|
75
|
+
"types": "./dist/types/index.d.cts",
|
|
76
|
+
"default": "./dist/types/index.cjs"
|
|
77
|
+
},
|
|
78
|
+
"default": {
|
|
79
|
+
"types": "./dist/types/index.d.ts",
|
|
80
|
+
"default": "./dist/types/index.js"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"./types/*": {
|
|
84
|
+
"import": {
|
|
85
|
+
"types": "./dist/types/*.d.ts",
|
|
86
|
+
"default": "./dist/types/*.js"
|
|
87
|
+
},
|
|
88
|
+
"require": {
|
|
89
|
+
"types": "./dist/types/*.d.cts",
|
|
90
|
+
"default": "./dist/types/*.cjs"
|
|
91
|
+
},
|
|
92
|
+
"default": {
|
|
93
|
+
"types": "./dist/types/*.d.ts",
|
|
94
|
+
"default": "./dist/types/*.js"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"./helpers": {
|
|
98
|
+
"import": {
|
|
99
|
+
"types": "./dist/helpers/index.d.ts",
|
|
100
|
+
"default": "./dist/helpers/index.js"
|
|
101
|
+
},
|
|
102
|
+
"require": {
|
|
103
|
+
"types": "./dist/helpers/index.d.cts",
|
|
104
|
+
"default": "./dist/helpers/index.cjs"
|
|
105
|
+
},
|
|
106
|
+
"default": {
|
|
107
|
+
"types": "./dist/helpers/index.d.ts",
|
|
108
|
+
"default": "./dist/helpers/index.js"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"./helpers/*": {
|
|
112
|
+
"import": {
|
|
113
|
+
"types": "./dist/helpers/*.d.ts",
|
|
114
|
+
"default": "./dist/helpers/*.js"
|
|
115
|
+
},
|
|
116
|
+
"require": {
|
|
117
|
+
"types": "./dist/helpers/*.d.cts",
|
|
118
|
+
"default": "./dist/helpers/*.cjs"
|
|
119
|
+
},
|
|
120
|
+
"default": {
|
|
121
|
+
"types": "./dist/helpers/*.d.ts",
|
|
122
|
+
"default": "./dist/helpers/*.js"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"typings": "dist/index.d.ts",
|
|
127
|
+
"files": ["dist/**/*"],
|
|
128
|
+
"keywords": ["prisma", "powerlines", "storm-software", "powerlines-plugin"],
|
|
129
|
+
"dependencies": {
|
|
130
|
+
"@stryke/path": "^0.18.5",
|
|
131
|
+
"@stryke/fs": "^0.32.10",
|
|
132
|
+
"@stryke/type-checks": "^0.3.10",
|
|
133
|
+
"@stryke/types": "^0.10.0",
|
|
134
|
+
"@stryke/cli": "^0.12.4",
|
|
135
|
+
"defu": "^6.1.4",
|
|
136
|
+
"jiti": "^2.6.1",
|
|
137
|
+
"powerlines": "^0.15.0",
|
|
138
|
+
"ts-pattern": "^5.9.0",
|
|
139
|
+
"prisma-util": "^2.1.1",
|
|
140
|
+
"@prisma/get-platform": "^6.18.0",
|
|
141
|
+
"@prisma/prisma-schema-wasm": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773",
|
|
142
|
+
"fp-ts": "^2.16.11"
|
|
143
|
+
},
|
|
144
|
+
"devDependencies": {
|
|
145
|
+
"@powerlines/nx": "^0.10.0",
|
|
146
|
+
"@powerlines/plugin-plugin": "^0.11.8",
|
|
147
|
+
"@types/node": "^22.19.0"
|
|
148
|
+
},
|
|
149
|
+
"publishConfig": { "access": "public" },
|
|
150
|
+
"gitHead": "b64f9a9d53b6eb8054c361da347f6623a7ba9e45"
|
|
151
|
+
}
|