prisma-sql 1.7.0 → 1.8.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/dist/generator.cjs +4661 -0
- package/dist/generator.cjs.map +1 -0
- package/dist/generator.d.mts +1 -0
- package/dist/generator.d.ts +1 -0
- package/dist/generator.js +44 -82
- package/dist/generator.js.map +1 -0
- package/dist/{index.mjs → index.cjs} +39 -70
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +26 -96
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +331 -12
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/generator.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { generatorHandler } from '@prisma/generator-helper';
|
|
3
|
+
import { convertDMMFToModels, processAllDirectives, isDynamicParameter, extractDynamicName } from '@dee-wan/schema-parser';
|
|
4
|
+
import { mkdir, writeFile } from 'fs/promises';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
import { logger } from '@prisma/internals';
|
|
7
|
+
|
|
4
8
|
var __defProp = Object.defineProperty;
|
|
5
9
|
var __defProps = Object.defineProperties;
|
|
6
10
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -47,10 +51,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
47
51
|
|
|
48
52
|
// package.json
|
|
49
53
|
var require_package = __commonJS({
|
|
50
|
-
"package.json"(
|
|
51
|
-
|
|
54
|
+
"package.json"(exports$1, module) {
|
|
55
|
+
module.exports = {
|
|
52
56
|
name: "prisma-sql",
|
|
53
|
-
version: "1.
|
|
57
|
+
version: "1.8.0",
|
|
54
58
|
description: "Convert Prisma queries to optimized SQL with type safety. 2-7x faster than Prisma Client.",
|
|
55
59
|
main: "dist/index.cjs",
|
|
56
60
|
module: "dist/index.js",
|
|
@@ -148,14 +152,6 @@ var require_package = __commonJS({
|
|
|
148
152
|
}
|
|
149
153
|
});
|
|
150
154
|
|
|
151
|
-
// src/generator.ts
|
|
152
|
-
var import_generator_helper = require("@prisma/generator-helper");
|
|
153
|
-
|
|
154
|
-
// src/code-emitter.ts
|
|
155
|
-
var import_schema_parser11 = require("@dee-wan/schema-parser");
|
|
156
|
-
var import_promises = require("fs/promises");
|
|
157
|
-
var import_path = require("path");
|
|
158
|
-
|
|
159
155
|
// src/sql-builder-dialect.ts
|
|
160
156
|
var globalDialect = "postgres";
|
|
161
157
|
function setGlobalDialect(dialect) {
|
|
@@ -471,7 +467,6 @@ var Wildcards = Object.freeze({
|
|
|
471
467
|
[Ops.ENDS_WITH]: (v) => `%${v}`
|
|
472
468
|
});
|
|
473
469
|
var REGEX_CACHE = {
|
|
474
|
-
PARAM_PLACEHOLDER: /\$(\d+)/g,
|
|
475
470
|
VALID_IDENTIFIER: /^[a-z_][a-z0-9_]*$/
|
|
476
471
|
};
|
|
477
472
|
var LIMITS = Object.freeze({
|
|
@@ -776,7 +771,7 @@ function validateMappingsAgainstPlaceholders(mappings, placeholders, max, dialec
|
|
|
776
771
|
const mappingIndices = /* @__PURE__ */ new Set();
|
|
777
772
|
for (const mapping of mappings) {
|
|
778
773
|
validateMappingIndex(mapping, max);
|
|
779
|
-
ensureUniqueMappingIndex(mappingIndices, mapping.index
|
|
774
|
+
ensureUniqueMappingIndex(mappingIndices, mapping.index);
|
|
780
775
|
ensureMappingIndexExistsInSql(placeholders, mapping.index);
|
|
781
776
|
validateMappingValueShape(mapping);
|
|
782
777
|
}
|
|
@@ -966,9 +961,6 @@ function joinCondition(field, parentAlias, childAlias) {
|
|
|
966
961
|
function getModelByName(schemas, name) {
|
|
967
962
|
return schemas.find((m) => m.name === name);
|
|
968
963
|
}
|
|
969
|
-
|
|
970
|
-
// src/builder/where/operators-scalar.ts
|
|
971
|
-
var import_schema_parser = require("@dee-wan/schema-parser");
|
|
972
964
|
function buildNotComposite(expr, val, params, dialect, buildOp, separator) {
|
|
973
965
|
const entries = Object.entries(val).filter(
|
|
974
966
|
([k, v]) => k !== "mode" && v !== void 0
|
|
@@ -997,7 +989,7 @@ function buildScalarOperator(expr, op, val, params, mode, fieldType, dialect) {
|
|
|
997
989
|
}
|
|
998
990
|
if (op === Ops.EQUALS && mode === Modes.INSENSITIVE && isNotNullish(dialect)) {
|
|
999
991
|
const placeholder = params.addAuto(val);
|
|
1000
|
-
return caseInsensitiveEquals(expr, placeholder
|
|
992
|
+
return caseInsensitiveEquals(expr, placeholder);
|
|
1001
993
|
}
|
|
1002
994
|
const STRING_LIKE_OPS = /* @__PURE__ */ new Set([
|
|
1003
995
|
Ops.CONTAINS,
|
|
@@ -1068,7 +1060,7 @@ function buildDynamicLikePattern(op, placeholder, dialect) {
|
|
|
1068
1060
|
}
|
|
1069
1061
|
function handleLikeOperator(expr, op, val, params, mode, dialect) {
|
|
1070
1062
|
if (val === void 0) return "";
|
|
1071
|
-
if (
|
|
1063
|
+
if (isDynamicParameter(val)) {
|
|
1072
1064
|
const placeholder2 = params.addAuto(val);
|
|
1073
1065
|
const patternExpr = buildDynamicLikePattern(op, placeholder2, dialect);
|
|
1074
1066
|
if (mode === Modes.INSENSITIVE) {
|
|
@@ -1084,7 +1076,7 @@ function handleLikeOperator(expr, op, val, params, mode, dialect) {
|
|
|
1084
1076
|
}
|
|
1085
1077
|
function handleInOperator(expr, op, val, params, dialect) {
|
|
1086
1078
|
if (val === void 0) return "";
|
|
1087
|
-
if (
|
|
1079
|
+
if (isDynamicParameter(val)) {
|
|
1088
1080
|
const placeholder2 = params.addAuto(val);
|
|
1089
1081
|
return op === Ops.IN ? inArray(expr, placeholder2, dialect) : notInArray(expr, placeholder2, dialect);
|
|
1090
1082
|
}
|
|
@@ -1117,11 +1109,8 @@ function handleComparisonOperator(expr, op, val, params) {
|
|
|
1117
1109
|
const placeholder = params.addAuto(val);
|
|
1118
1110
|
return `${expr} ${sqlOp} ${placeholder}`;
|
|
1119
1111
|
}
|
|
1120
|
-
|
|
1121
|
-
// src/builder/where/operators-array.ts
|
|
1122
|
-
var import_schema_parser2 = require("@dee-wan/schema-parser");
|
|
1123
1112
|
function buildArrayParam(val, params, dialect) {
|
|
1124
|
-
if (
|
|
1113
|
+
if (isDynamicParameter(val)) {
|
|
1125
1114
|
return params.addAuto(val);
|
|
1126
1115
|
}
|
|
1127
1116
|
if (!Array.isArray(val)) {
|
|
@@ -1195,7 +1184,7 @@ function handleArrayHas(expr, val, params, cast, dialect) {
|
|
|
1195
1184
|
value: val
|
|
1196
1185
|
});
|
|
1197
1186
|
}
|
|
1198
|
-
if (!
|
|
1187
|
+
if (!isDynamicParameter(val) && Array.isArray(val)) {
|
|
1199
1188
|
throw createError(`has requires scalar value (single element), not array`, {
|
|
1200
1189
|
operator: Ops.HAS,
|
|
1201
1190
|
value: val
|
|
@@ -1212,7 +1201,7 @@ function handleArrayHas(expr, val, params, cast, dialect) {
|
|
|
1212
1201
|
}
|
|
1213
1202
|
function handleArrayHasSome(expr, val, params, cast, dialect) {
|
|
1214
1203
|
if (val === void 0) return "";
|
|
1215
|
-
if (
|
|
1204
|
+
if (isDynamicParameter(val)) {
|
|
1216
1205
|
const placeholder2 = params.addAuto(val);
|
|
1217
1206
|
return arrayOverlaps(expr, placeholder2, cast, dialect);
|
|
1218
1207
|
}
|
|
@@ -1884,9 +1873,6 @@ function createAliasGenerator(maxAliases = 1e4) {
|
|
|
1884
1873
|
}
|
|
1885
1874
|
};
|
|
1886
1875
|
}
|
|
1887
|
-
|
|
1888
|
-
// src/builder/shared/param-store.ts
|
|
1889
|
-
var import_schema_parser3 = require("@dee-wan/schema-parser");
|
|
1890
1876
|
var MAX_PARAM_INDEX = Number.MAX_SAFE_INTEGER - 1e3;
|
|
1891
1877
|
function assertSameLength(params, mappings) {
|
|
1892
1878
|
if (params.length !== mappings.length) {
|
|
@@ -2017,8 +2003,8 @@ function createStoreInternal(startIndex, initialParams = [], initialMappings = [
|
|
|
2017
2003
|
return dynamicName === void 0 ? addStatic(value) : addDynamic(dynamicName);
|
|
2018
2004
|
}
|
|
2019
2005
|
function addAuto(value) {
|
|
2020
|
-
if (
|
|
2021
|
-
const dynamicName =
|
|
2006
|
+
if (isDynamicParameter(value)) {
|
|
2007
|
+
const dynamicName = extractDynamicName(value);
|
|
2022
2008
|
return add(void 0, dynamicName);
|
|
2023
2009
|
}
|
|
2024
2010
|
return add(value);
|
|
@@ -2107,13 +2093,10 @@ function buildWhereClause(where, options) {
|
|
|
2107
2093
|
}
|
|
2108
2094
|
return publicResult;
|
|
2109
2095
|
}
|
|
2110
|
-
|
|
2111
|
-
// src/builder/shared/int-like.ts
|
|
2112
|
-
var import_schema_parser4 = require("@dee-wan/schema-parser");
|
|
2113
2096
|
function normalizeIntLike(name, v, opts = {}) {
|
|
2114
2097
|
var _a, _b;
|
|
2115
2098
|
if (!isNotNullish(v)) return void 0;
|
|
2116
|
-
if (
|
|
2099
|
+
if (isDynamicParameter(v)) return v;
|
|
2117
2100
|
if (typeof v !== "number" || !Number.isFinite(v) || !Number.isInteger(v)) {
|
|
2118
2101
|
throw new Error(`${name} must be an integer`);
|
|
2119
2102
|
}
|
|
@@ -2130,9 +2113,6 @@ function normalizeIntLike(name, v, opts = {}) {
|
|
|
2130
2113
|
}
|
|
2131
2114
|
return v;
|
|
2132
2115
|
}
|
|
2133
|
-
|
|
2134
|
-
// src/builder/shared/dynamic-params.ts
|
|
2135
|
-
var import_schema_parser5 = require("@dee-wan/schema-parser");
|
|
2136
2116
|
function scopeName(scope, dynamicName) {
|
|
2137
2117
|
const s = String(scope).trim();
|
|
2138
2118
|
const dn = String(dynamicName).trim();
|
|
@@ -2140,16 +2120,13 @@ function scopeName(scope, dynamicName) {
|
|
|
2140
2120
|
return `${s}:${dn}`;
|
|
2141
2121
|
}
|
|
2142
2122
|
function addAutoScoped(params, value, scope) {
|
|
2143
|
-
if (
|
|
2144
|
-
const dn =
|
|
2123
|
+
if (isDynamicParameter(value)) {
|
|
2124
|
+
const dn = extractDynamicName(value);
|
|
2145
2125
|
return params.add(void 0, scopeName(scope, dn));
|
|
2146
2126
|
}
|
|
2147
2127
|
return params.add(value);
|
|
2148
2128
|
}
|
|
2149
2129
|
|
|
2150
|
-
// src/builder/pagination.ts
|
|
2151
|
-
var import_schema_parser6 = require("@dee-wan/schema-parser");
|
|
2152
|
-
|
|
2153
2130
|
// src/builder/shared/order-by-utils.ts
|
|
2154
2131
|
var flipNulls = (v) => {
|
|
2155
2132
|
const s = String(v).toLowerCase();
|
|
@@ -2285,7 +2262,7 @@ function normalizeFiniteInteger(name, v) {
|
|
|
2285
2262
|
return v;
|
|
2286
2263
|
}
|
|
2287
2264
|
function normalizeNonNegativeInt(name, v) {
|
|
2288
|
-
if (
|
|
2265
|
+
if (isDynamicParameter(v)) return v;
|
|
2289
2266
|
const n = normalizeFiniteInteger(name, v);
|
|
2290
2267
|
if (n < 0) {
|
|
2291
2268
|
throw new Error(`${name} must be >= 0`);
|
|
@@ -2299,7 +2276,7 @@ function hasNonNullishProp(v, key) {
|
|
|
2299
2276
|
return isPlainObject(v) && key in v && isNotNullish(v[key]);
|
|
2300
2277
|
}
|
|
2301
2278
|
function normalizeIntegerOrDynamic(name, v) {
|
|
2302
|
-
if (
|
|
2279
|
+
if (isDynamicParameter(v)) return v;
|
|
2303
2280
|
return normalizeFiniteInteger(name, v);
|
|
2304
2281
|
}
|
|
2305
2282
|
function readSkipTake(relArgs) {
|
|
@@ -2532,9 +2509,6 @@ function getPaginationParams(method, args) {
|
|
|
2532
2509
|
return {};
|
|
2533
2510
|
}
|
|
2534
2511
|
|
|
2535
|
-
// src/builder/select/assembly.ts
|
|
2536
|
-
var import_schema_parser7 = require("@dee-wan/schema-parser");
|
|
2537
|
-
|
|
2538
2512
|
// src/builder/select/fields.ts
|
|
2539
2513
|
function toSelectEntries(select) {
|
|
2540
2514
|
const out = [];
|
|
@@ -3370,7 +3344,7 @@ function appendPagination(sql, spec) {
|
|
|
3370
3344
|
const isFindUniqueOrFirst = method === "findUnique" || method === "findFirst";
|
|
3371
3345
|
if (isFindUniqueOrFirst) {
|
|
3372
3346
|
const parts2 = [sql, SQL_TEMPLATES.LIMIT, "1"];
|
|
3373
|
-
const hasSkip = isNotNullish(pagination.skip) && (
|
|
3347
|
+
const hasSkip = isNotNullish(pagination.skip) && (isDynamicParameter(pagination.skip) || typeof pagination.skip === "number" && pagination.skip > 0) && method === "findFirst";
|
|
3374
3348
|
if (hasSkip) {
|
|
3375
3349
|
const placeholder = addAutoScoped(
|
|
3376
3350
|
params,
|
|
@@ -3603,7 +3577,7 @@ function normalizeArgsForNegativeTake(method, args) {
|
|
|
3603
3577
|
}
|
|
3604
3578
|
function normalizeArgsForDialect(dialect, args, model) {
|
|
3605
3579
|
if (dialect !== "postgres") return args;
|
|
3606
|
-
return applyPostgresDistinctOrderBy(args
|
|
3580
|
+
return applyPostgresDistinctOrderBy(args);
|
|
3607
3581
|
}
|
|
3608
3582
|
function buildCursorClauseIfAny(input) {
|
|
3609
3583
|
const { cursor, orderBy, tableName, alias, params, dialect } = input;
|
|
@@ -3682,9 +3656,7 @@ function buildSelectSql(input) {
|
|
|
3682
3656
|
const argsForSql = normalizeArgsForNegativeTake(method, args);
|
|
3683
3657
|
const normalizedArgs = normalizeArgsForDialect(
|
|
3684
3658
|
dialectToUse,
|
|
3685
|
-
argsForSql
|
|
3686
|
-
model
|
|
3687
|
-
);
|
|
3659
|
+
argsForSql);
|
|
3688
3660
|
validateDistinct(model, normalizedArgs.distinct);
|
|
3689
3661
|
validateOrderBy(model, normalizedArgs.orderBy);
|
|
3690
3662
|
validateCursor(model, normalizedArgs.cursor);
|
|
@@ -3700,9 +3672,6 @@ function buildSelectSql(input) {
|
|
|
3700
3672
|
});
|
|
3701
3673
|
return constructFinalSql(spec);
|
|
3702
3674
|
}
|
|
3703
|
-
|
|
3704
|
-
// src/builder/aggregates.ts
|
|
3705
|
-
var import_schema_parser8 = require("@dee-wan/schema-parser");
|
|
3706
3675
|
var MODEL_FIELD_CACHE = /* @__PURE__ */ new WeakMap();
|
|
3707
3676
|
var NUMERIC_TYPES = /* @__PURE__ */ new Set(["Int", "Float", "Decimal", "BigInt"]);
|
|
3708
3677
|
var AGGREGATES = [
|
|
@@ -3797,7 +3766,7 @@ function buildNullComparison(expr, op) {
|
|
|
3797
3766
|
throw new Error(`Operator '${op}' doesn't support null in HAVING`);
|
|
3798
3767
|
}
|
|
3799
3768
|
function buildInComparison(expr, op, val, params, dialect) {
|
|
3800
|
-
if (
|
|
3769
|
+
if (isDynamicParameter(val)) {
|
|
3801
3770
|
const placeholder2 = addHavingParam(params, op, val);
|
|
3802
3771
|
return op === Ops.IN ? inArray(expr, placeholder2, dialect) : notInArray(expr, placeholder2, dialect);
|
|
3803
3772
|
}
|
|
@@ -4122,7 +4091,7 @@ function buildGroupBySql(args, whereResult, tableName, alias, model, dialect) {
|
|
|
4122
4091
|
assertSafeAlias(alias);
|
|
4123
4092
|
assertSafeTableRef(tableName);
|
|
4124
4093
|
const byFields = assertGroupByBy(args, model);
|
|
4125
|
-
const d =
|
|
4094
|
+
const d = getGlobalDialect();
|
|
4126
4095
|
const params = createParamStore(whereResult.nextParamIndex);
|
|
4127
4096
|
const { groupFields, selectFields } = buildGroupBySelectParts(
|
|
4128
4097
|
args,
|
|
@@ -4158,7 +4127,7 @@ function buildGroupBySql(args, whereResult, tableName, alias, model, dialect) {
|
|
|
4158
4127
|
function buildCountSql(whereResult, tableName, alias, skip, dialect) {
|
|
4159
4128
|
assertSafeAlias(alias);
|
|
4160
4129
|
assertSafeTableRef(tableName);
|
|
4161
|
-
const d =
|
|
4130
|
+
const d = getGlobalDialect();
|
|
4162
4131
|
const whereClause = isValidWhereClause(whereResult.clause) ? `${SQL_TEMPLATES.WHERE} ${whereResult.clause}` : "";
|
|
4163
4132
|
const params = createParamStore(whereResult.nextParamIndex);
|
|
4164
4133
|
const baseSubSelect = [
|
|
@@ -4195,7 +4164,7 @@ function buildCountSql(whereResult, tableName, alias, skip, dialect) {
|
|
|
4195
4164
|
});
|
|
4196
4165
|
}
|
|
4197
4166
|
function applyCountSkip(subSelect, normalizedSkip, params, dialect) {
|
|
4198
|
-
const shouldApply =
|
|
4167
|
+
const shouldApply = isDynamicParameter(normalizedSkip) || typeof normalizedSkip === "number" && normalizedSkip > 0;
|
|
4199
4168
|
if (!shouldApply) return subSelect;
|
|
4200
4169
|
const placeholder = addAutoScoped(params, normalizedSkip, "count.skip");
|
|
4201
4170
|
if (dialect === "sqlite") {
|
|
@@ -4203,9 +4172,6 @@ function applyCountSkip(subSelect, normalizedSkip, params, dialect) {
|
|
|
4203
4172
|
}
|
|
4204
4173
|
return `${subSelect} ${SQL_TEMPLATES.OFFSET} ${placeholder}`;
|
|
4205
4174
|
}
|
|
4206
|
-
|
|
4207
|
-
// src/sql-generator.ts
|
|
4208
|
-
var import_schema_parser9 = require("@dee-wan/schema-parser");
|
|
4209
4175
|
function safeAlias(input) {
|
|
4210
4176
|
const raw = String(input).toLowerCase();
|
|
4211
4177
|
const cleaned = raw.replace(/[^a-z0-9_]/g, "_");
|
|
@@ -4307,7 +4273,7 @@ function buildParamsFromMappings(mappings) {
|
|
|
4307
4273
|
}
|
|
4308
4274
|
function resolveModelContext(directive) {
|
|
4309
4275
|
const { model, datamodel } = directive.context;
|
|
4310
|
-
const schemaModels =
|
|
4276
|
+
const schemaModels = convertDMMFToModels(datamodel);
|
|
4311
4277
|
const modelDef = getModelByName(schemaModels, model.name);
|
|
4312
4278
|
if (!modelDef) throw new Error(`Model ${model.name} not found in schema`);
|
|
4313
4279
|
return { schemaModels, modelDef };
|
|
@@ -4402,9 +4368,6 @@ function generateSQL(directive) {
|
|
|
4402
4368
|
normalizedMappings: normalized.paramMappings
|
|
4403
4369
|
});
|
|
4404
4370
|
}
|
|
4405
|
-
|
|
4406
|
-
// src/index.ts
|
|
4407
|
-
var import_schema_parser10 = require("@dee-wan/schema-parser");
|
|
4408
4371
|
function generateSQL2(directive) {
|
|
4409
4372
|
return generateSQL(directive);
|
|
4410
4373
|
}
|
|
@@ -4414,8 +4377,8 @@ function generateClient(options) {
|
|
|
4414
4377
|
return __async(this, null, function* () {
|
|
4415
4378
|
const { datamodel, outputDir, config } = options;
|
|
4416
4379
|
setGlobalDialect(config.dialect);
|
|
4417
|
-
const models =
|
|
4418
|
-
const directiveResults =
|
|
4380
|
+
const models = convertDMMFToModels(datamodel);
|
|
4381
|
+
const directiveResults = processAllDirectives(
|
|
4419
4382
|
datamodel.models,
|
|
4420
4383
|
datamodel,
|
|
4421
4384
|
{
|
|
@@ -4447,9 +4410,9 @@ function generateClient(options) {
|
|
|
4447
4410
|
queries.set(modelName, modelQueries);
|
|
4448
4411
|
}
|
|
4449
4412
|
}
|
|
4450
|
-
yield
|
|
4413
|
+
yield mkdir(outputDir, { recursive: true });
|
|
4451
4414
|
const code = generateCode(models, queries, config.dialect);
|
|
4452
|
-
yield
|
|
4415
|
+
yield writeFile(join(outputDir, "index.ts"), code);
|
|
4453
4416
|
const totalQueries = Array.from(queries.values()).reduce(
|
|
4454
4417
|
(sum, m) => sum + m.size,
|
|
4455
4418
|
0
|
|
@@ -4640,9 +4603,6 @@ ${queryEntries.join(",\n")}
|
|
|
4640
4603
|
${entries.join(",\n")}
|
|
4641
4604
|
}`;
|
|
4642
4605
|
}
|
|
4643
|
-
|
|
4644
|
-
// src/generator.ts
|
|
4645
|
-
var import_internals = require("@prisma/internals");
|
|
4646
4606
|
var { version } = require_package();
|
|
4647
4607
|
function getDialectFromProvider(provider) {
|
|
4648
4608
|
const normalized = provider.toLowerCase();
|
|
@@ -4653,7 +4613,7 @@ function getDialectFromProvider(provider) {
|
|
|
4653
4613
|
`Unsupported database provider: ${provider}. Supported: postgresql, postgres, sqlite`
|
|
4654
4614
|
);
|
|
4655
4615
|
}
|
|
4656
|
-
|
|
4616
|
+
generatorHandler({
|
|
4657
4617
|
onManifest() {
|
|
4658
4618
|
return {
|
|
4659
4619
|
version,
|
|
@@ -4673,7 +4633,7 @@ function getDialectFromProvider(provider) {
|
|
|
4673
4633
|
const configDialect = generator.config.dialect;
|
|
4674
4634
|
const dialect = configDialect || autoDialect;
|
|
4675
4635
|
if (configDialect && configDialect !== autoDialect) {
|
|
4676
|
-
|
|
4636
|
+
logger.warn(
|
|
4677
4637
|
`Generator dialect (${configDialect}) differs from datasource provider (${datasources[0].provider}). Using generator config: ${configDialect}`
|
|
4678
4638
|
);
|
|
4679
4639
|
}
|
|
@@ -4682,16 +4642,18 @@ function getDialectFromProvider(provider) {
|
|
|
4682
4642
|
skipInvalid: generator.config.skipInvalid === "true"
|
|
4683
4643
|
};
|
|
4684
4644
|
const outputDir = ((_a = generator.output) == null ? void 0 : _a.value) || "../node_modules/.prisma/client/sql";
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4645
|
+
logger.info(`Generating SQL client to ${outputDir}`);
|
|
4646
|
+
logger.info(`Datasource: ${datasources[0].provider}`);
|
|
4647
|
+
logger.info(`Dialect: ${config.dialect}`);
|
|
4648
|
+
logger.info(`Skip invalid: ${config.skipInvalid}`);
|
|
4689
4649
|
yield generateClient({
|
|
4690
4650
|
datamodel: dmmf.datamodel,
|
|
4691
4651
|
outputDir,
|
|
4692
4652
|
config
|
|
4693
4653
|
});
|
|
4694
|
-
|
|
4654
|
+
logger.info("\u2713 Generated SQL client successfully");
|
|
4695
4655
|
});
|
|
4696
4656
|
}
|
|
4697
4657
|
});
|
|
4658
|
+
//# sourceMappingURL=generator.js.map
|
|
4659
|
+
//# sourceMappingURL=generator.js.map
|