@powerlines/plugin-prisma 0.4.23 → 0.4.25
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/README.md +14 -16
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/api/client/client.gen.cjs +20 -20
- package/dist/api/client/client.gen.mjs +19 -20
- package/dist/api/client/index.cjs +1 -0
- package/dist/api/client/utils.gen.cjs +1 -1
- package/dist/api/client/utils.gen.mjs +0 -1
- package/dist/api/client.gen.cjs +1 -0
- package/dist/api/core/auth.gen.cjs +1 -0
- package/dist/api/core/bodySerializer.gen.cjs +1 -0
- package/dist/api/core/params.gen.cjs +1 -0
- package/dist/api/core/pathSerializer.gen.cjs +11 -10
- package/dist/api/core/pathSerializer.gen.mjs +10 -10
- package/dist/api/core/queryKeySerializer.gen.cjs +1 -0
- package/dist/api/core/serverSentEvents.gen.cjs +1 -0
- package/dist/api/core/utils.gen.cjs +1 -0
- package/dist/api/sdk.gen.cjs +1 -0
- package/dist/helpers/get-schema.cjs +10 -9
- package/dist/helpers/index.cjs +1 -0
- package/dist/helpers/prisma-postgres.cjs +1 -0
- package/dist/helpers/schema-creator.cjs +2 -1
- package/dist/index.cjs +21 -22
- package/dist/index.mjs +3 -4
- package/package.json +7 -6
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/constant-case.cjs +0 -31
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/constant-case.mjs +0 -31
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/get-words.cjs +0 -38
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/get-words.mjs +0 -37
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/kebab-case.cjs +0 -33
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/kebab-case.mjs +0 -33
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/snake-case.cjs +0 -17
- package/dist/node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/snake-case.mjs +0 -16
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the <b>🔌 Powerlines</b> monorepo. Powerlines is the "
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/powerlines) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -58,21 +58,19 @@ A Powerlines plugin to generate project code with [Prisma](https://www.prisma.io
|
|
|
58
58
|
|
|
59
59
|
## Table of Contents
|
|
60
60
|
|
|
61
|
-
- [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- [
|
|
65
|
-
- [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- [Contributing](#contributing)
|
|
75
|
-
- [Contributors](#contributors)
|
|
61
|
+
- [Installing](#installing)
|
|
62
|
+
- [Reduced Package Size](#reduced-package-size)
|
|
63
|
+
- [Development](#development)
|
|
64
|
+
- [Building](#building)
|
|
65
|
+
- [Running unit tests](#running-unit-tests)
|
|
66
|
+
- [Linting](#linting)
|
|
67
|
+
- [Storm Workspaces](#storm-workspaces)
|
|
68
|
+
- [Roadmap](#roadmap)
|
|
69
|
+
- [Support](#support)
|
|
70
|
+
- [License](#license)
|
|
71
|
+
- [Changelog](#changelog)
|
|
72
|
+
- [Contributing](#contributing)
|
|
73
|
+
- [Contributors](#contributors)
|
|
76
74
|
|
|
77
75
|
<!-- END doctoc -->
|
|
78
76
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
const require_api_core_serverSentEvents_gen = require('../core/serverSentEvents.gen.cjs');
|
|
2
3
|
const require_api_core_utils_gen = require('../core/utils.gen.cjs');
|
|
3
4
|
const require_api_client_utils_gen = require('./utils.gen.cjs');
|
|
@@ -6,8 +7,8 @@ const require_api_client_utils_gen = require('./utils.gen.cjs');
|
|
|
6
7
|
const createClient = (config = {}) => {
|
|
7
8
|
let _config = require_api_client_utils_gen.mergeConfigs(require_api_client_utils_gen.createConfig(), config);
|
|
8
9
|
const getConfig = () => ({ ..._config });
|
|
9
|
-
const setConfig = (config
|
|
10
|
-
_config = require_api_client_utils_gen.mergeConfigs(_config, config
|
|
10
|
+
const setConfig = (config) => {
|
|
11
|
+
_config = require_api_client_utils_gen.mergeConfigs(_config, config);
|
|
11
12
|
return getConfig();
|
|
12
13
|
};
|
|
13
14
|
const interceptors = require_api_client_utils_gen.createInterceptors();
|
|
@@ -38,26 +39,26 @@ const createClient = (config = {}) => {
|
|
|
38
39
|
...opts,
|
|
39
40
|
body: require_api_core_utils_gen.getValidRequestBody(opts)
|
|
40
41
|
};
|
|
41
|
-
let request
|
|
42
|
-
for (const fn of interceptors.request.fns) if (fn) request
|
|
42
|
+
let request = new Request(url, requestInit);
|
|
43
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
43
44
|
const _fetch = opts.fetch;
|
|
44
45
|
let response;
|
|
45
46
|
try {
|
|
46
|
-
response = await _fetch(request
|
|
47
|
-
} catch (error
|
|
48
|
-
let finalError
|
|
49
|
-
for (const fn of interceptors.error.fns) if (fn) finalError
|
|
50
|
-
finalError
|
|
51
|
-
if (opts.throwOnError) throw finalError
|
|
47
|
+
response = await _fetch(request);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
let finalError = error;
|
|
50
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, void 0, request, opts);
|
|
51
|
+
finalError = finalError || {};
|
|
52
|
+
if (opts.throwOnError) throw finalError;
|
|
52
53
|
return opts.responseStyle === "data" ? void 0 : {
|
|
53
|
-
error: finalError
|
|
54
|
-
request
|
|
54
|
+
error: finalError,
|
|
55
|
+
request,
|
|
55
56
|
response: void 0
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
|
-
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request
|
|
59
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request, opts);
|
|
59
60
|
const result = {
|
|
60
|
-
request
|
|
61
|
+
request,
|
|
61
62
|
response
|
|
62
63
|
};
|
|
63
64
|
if (response.ok) {
|
|
@@ -76,7 +77,6 @@ const createClient = (config = {}) => {
|
|
|
76
77
|
case "stream":
|
|
77
78
|
emptyData = response.body;
|
|
78
79
|
break;
|
|
79
|
-
case "json":
|
|
80
80
|
default:
|
|
81
81
|
emptyData = {};
|
|
82
82
|
break;
|
|
@@ -116,7 +116,7 @@ const createClient = (config = {}) => {
|
|
|
116
116
|
} catch {}
|
|
117
117
|
const error = jsonError ?? textError;
|
|
118
118
|
let finalError = error;
|
|
119
|
-
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request
|
|
119
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request, opts);
|
|
120
120
|
finalError = finalError || {};
|
|
121
121
|
if (opts.throwOnError) throw finalError;
|
|
122
122
|
return opts.responseStyle === "data" ? void 0 : {
|
|
@@ -135,10 +135,10 @@ const createClient = (config = {}) => {
|
|
|
135
135
|
body: opts.body,
|
|
136
136
|
headers: opts.headers,
|
|
137
137
|
method,
|
|
138
|
-
onRequest: async (url
|
|
139
|
-
let request
|
|
140
|
-
for (const fn of interceptors.request.fns) if (fn) request
|
|
141
|
-
return request
|
|
138
|
+
onRequest: async (url, init) => {
|
|
139
|
+
let request = new Request(url, init);
|
|
140
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
141
|
+
return request;
|
|
142
142
|
},
|
|
143
143
|
url
|
|
144
144
|
});
|
|
@@ -6,8 +6,8 @@ import { buildUrl, createConfig, createInterceptors, getParseAs, mergeConfigs, m
|
|
|
6
6
|
const createClient = (config = {}) => {
|
|
7
7
|
let _config = mergeConfigs(createConfig(), config);
|
|
8
8
|
const getConfig = () => ({ ..._config });
|
|
9
|
-
const setConfig = (config
|
|
10
|
-
_config = mergeConfigs(_config, config
|
|
9
|
+
const setConfig = (config) => {
|
|
10
|
+
_config = mergeConfigs(_config, config);
|
|
11
11
|
return getConfig();
|
|
12
12
|
};
|
|
13
13
|
const interceptors = createInterceptors();
|
|
@@ -38,26 +38,26 @@ const createClient = (config = {}) => {
|
|
|
38
38
|
...opts,
|
|
39
39
|
body: getValidRequestBody(opts)
|
|
40
40
|
};
|
|
41
|
-
let request
|
|
42
|
-
for (const fn of interceptors.request.fns) if (fn) request
|
|
41
|
+
let request = new Request(url, requestInit);
|
|
42
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
43
43
|
const _fetch = opts.fetch;
|
|
44
44
|
let response;
|
|
45
45
|
try {
|
|
46
|
-
response = await _fetch(request
|
|
47
|
-
} catch (error
|
|
48
|
-
let finalError
|
|
49
|
-
for (const fn of interceptors.error.fns) if (fn) finalError
|
|
50
|
-
finalError
|
|
51
|
-
if (opts.throwOnError) throw finalError
|
|
46
|
+
response = await _fetch(request);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
let finalError = error;
|
|
49
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, void 0, request, opts);
|
|
50
|
+
finalError = finalError || {};
|
|
51
|
+
if (opts.throwOnError) throw finalError;
|
|
52
52
|
return opts.responseStyle === "data" ? void 0 : {
|
|
53
|
-
error: finalError
|
|
54
|
-
request
|
|
53
|
+
error: finalError,
|
|
54
|
+
request,
|
|
55
55
|
response: void 0
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request
|
|
58
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request, opts);
|
|
59
59
|
const result = {
|
|
60
|
-
request
|
|
60
|
+
request,
|
|
61
61
|
response
|
|
62
62
|
};
|
|
63
63
|
if (response.ok) {
|
|
@@ -76,7 +76,6 @@ const createClient = (config = {}) => {
|
|
|
76
76
|
case "stream":
|
|
77
77
|
emptyData = response.body;
|
|
78
78
|
break;
|
|
79
|
-
case "json":
|
|
80
79
|
default:
|
|
81
80
|
emptyData = {};
|
|
82
81
|
break;
|
|
@@ -116,7 +115,7 @@ const createClient = (config = {}) => {
|
|
|
116
115
|
} catch {}
|
|
117
116
|
const error = jsonError ?? textError;
|
|
118
117
|
let finalError = error;
|
|
119
|
-
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request
|
|
118
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(error, response, request, opts);
|
|
120
119
|
finalError = finalError || {};
|
|
121
120
|
if (opts.throwOnError) throw finalError;
|
|
122
121
|
return opts.responseStyle === "data" ? void 0 : {
|
|
@@ -135,10 +134,10 @@ const createClient = (config = {}) => {
|
|
|
135
134
|
body: opts.body,
|
|
136
135
|
headers: opts.headers,
|
|
137
136
|
method,
|
|
138
|
-
onRequest: async (url
|
|
139
|
-
let request
|
|
140
|
-
for (const fn of interceptors.request.fns) if (fn) request
|
|
141
|
-
return request
|
|
137
|
+
onRequest: async (url, init) => {
|
|
138
|
+
let request = new Request(url, init);
|
|
139
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
140
|
+
return request;
|
|
142
141
|
},
|
|
143
142
|
url
|
|
144
143
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
const require_api_core_bodySerializer_gen = require('../core/bodySerializer.gen.cjs');
|
|
2
3
|
const require_api_core_params_gen = require('../core/params.gen.cjs');
|
|
3
4
|
const require_api_core_queryKeySerializer_gen = require('../core/queryKeySerializer.gen.cjs');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
const require_api_core_bodySerializer_gen = require('../core/bodySerializer.gen.cjs');
|
|
2
3
|
const require_api_core_pathSerializer_gen = require('../core/pathSerializer.gen.cjs');
|
|
3
4
|
const require_api_core_utils_gen = require('../core/utils.gen.cjs');
|
|
@@ -80,7 +81,6 @@ const setAuthParams = async ({ security, ...options }) => {
|
|
|
80
81
|
case "cookie":
|
|
81
82
|
options.headers.append("Cookie", `${name}=${token}`);
|
|
82
83
|
break;
|
|
83
|
-
case "header":
|
|
84
84
|
default:
|
|
85
85
|
options.headers.set(name, token);
|
|
86
86
|
break;
|
package/dist/api/client.gen.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
|
|
2
3
|
//#region src/api/core/pathSerializer.gen.ts
|
|
3
4
|
const separatorArrayExplode = (style) => {
|
|
@@ -26,12 +27,12 @@ const separatorObjectExplode = (style) => {
|
|
|
26
27
|
};
|
|
27
28
|
const serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
28
29
|
if (!explode) {
|
|
29
|
-
const joinedValues
|
|
30
|
+
const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
30
31
|
switch (style) {
|
|
31
|
-
case "label": return `.${joinedValues
|
|
32
|
-
case "matrix": return `;${name}=${joinedValues
|
|
33
|
-
case "simple": return joinedValues
|
|
34
|
-
default: return `${name}=${joinedValues
|
|
32
|
+
case "label": return `.${joinedValues}`;
|
|
33
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
34
|
+
case "simple": return joinedValues;
|
|
35
|
+
default: return `${name}=${joinedValues}`;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
const separator = separatorArrayExplode(style);
|
|
@@ -61,12 +62,12 @@ const serializeObjectParam = ({ allowReserved, explode, name, style, value, valu
|
|
|
61
62
|
allowReserved ? v : encodeURIComponent(v)
|
|
62
63
|
];
|
|
63
64
|
});
|
|
64
|
-
const joinedValues
|
|
65
|
+
const joinedValues = values.join(",");
|
|
65
66
|
switch (style) {
|
|
66
|
-
case "form": return `${name}=${joinedValues
|
|
67
|
-
case "label": return `.${joinedValues
|
|
68
|
-
case "matrix": return `;${name}=${joinedValues
|
|
69
|
-
default: return joinedValues
|
|
67
|
+
case "form": return `${name}=${joinedValues}`;
|
|
68
|
+
case "label": return `.${joinedValues}`;
|
|
69
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
70
|
+
default: return joinedValues;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
const separator = separatorObjectExplode(style);
|
|
@@ -25,12 +25,12 @@ const separatorObjectExplode = (style) => {
|
|
|
25
25
|
};
|
|
26
26
|
const serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
27
27
|
if (!explode) {
|
|
28
|
-
const joinedValues
|
|
28
|
+
const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
29
29
|
switch (style) {
|
|
30
|
-
case "label": return `.${joinedValues
|
|
31
|
-
case "matrix": return `;${name}=${joinedValues
|
|
32
|
-
case "simple": return joinedValues
|
|
33
|
-
default: return `${name}=${joinedValues
|
|
30
|
+
case "label": return `.${joinedValues}`;
|
|
31
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
32
|
+
case "simple": return joinedValues;
|
|
33
|
+
default: return `${name}=${joinedValues}`;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
const separator = separatorArrayExplode(style);
|
|
@@ -60,12 +60,12 @@ const serializeObjectParam = ({ allowReserved, explode, name, style, value, valu
|
|
|
60
60
|
allowReserved ? v : encodeURIComponent(v)
|
|
61
61
|
];
|
|
62
62
|
});
|
|
63
|
-
const joinedValues
|
|
63
|
+
const joinedValues = values.join(",");
|
|
64
64
|
switch (style) {
|
|
65
|
-
case "form": return `${name}=${joinedValues
|
|
66
|
-
case "label": return `.${joinedValues
|
|
67
|
-
case "matrix": return `;${name}=${joinedValues
|
|
68
|
-
default: return joinedValues
|
|
65
|
+
case "form": return `${name}=${joinedValues}`;
|
|
66
|
+
case "label": return `.${joinedValues}`;
|
|
67
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
68
|
+
default: return joinedValues;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
const separator = separatorObjectExplode(style);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
|
|
2
3
|
//#region src/api/core/serverSentEvents.gen.ts
|
|
3
4
|
const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
|
package/dist/api/sdk.gen.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
let
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _prisma_get_platform = require("@prisma/get-platform");
|
|
4
|
+
let _prisma_prisma_schema_wasm = require("@prisma/prisma-schema-wasm");
|
|
5
|
+
_prisma_prisma_schema_wasm = require_runtime.__toESM(_prisma_prisma_schema_wasm);
|
|
5
6
|
let fp_ts_Either = require("fp-ts/Either");
|
|
6
|
-
fp_ts_Either =
|
|
7
|
+
fp_ts_Either = require_runtime.__toESM(fp_ts_Either);
|
|
7
8
|
let fp_ts_lib_function = require("fp-ts/lib/function");
|
|
8
9
|
let ts_pattern = require("ts-pattern");
|
|
9
10
|
|
|
@@ -21,13 +22,13 @@ async function resolveBinaryTargets(generator) {
|
|
|
21
22
|
} else binaryTarget.value = value;
|
|
22
23
|
}
|
|
23
24
|
if (binaryTarget.value === "native") {
|
|
24
|
-
binaryTarget.value = await (0,
|
|
25
|
+
binaryTarget.value = await (0, _prisma_get_platform.getBinaryTargetForCurrentPlatform)();
|
|
25
26
|
binaryTarget.native = true;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
if (generator.binaryTargets.length === 0) generator.binaryTargets = [{
|
|
29
30
|
fromEnvVar: null,
|
|
30
|
-
value: await (0,
|
|
31
|
+
value: await (0, _prisma_get_platform.getBinaryTargetForCurrentPlatform)(),
|
|
31
32
|
native: true
|
|
32
33
|
}];
|
|
33
34
|
}
|
|
@@ -39,14 +40,14 @@ async function resolveBinaryTargets(generator) {
|
|
|
39
40
|
*/
|
|
40
41
|
async function getSchema(options) {
|
|
41
42
|
const configEither = (0, fp_ts_lib_function.pipe)(fp_ts_Either.tryCatch(() => {
|
|
42
|
-
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG)
|
|
43
|
+
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) _prisma_prisma_schema_wasm.default.debug_panic();
|
|
43
44
|
const params = JSON.stringify({
|
|
44
45
|
prismaSchema: options.datamodel,
|
|
45
46
|
datasourceOverrides: {},
|
|
46
47
|
ignoreEnvVarErrors: options.ignoreEnvVarErrors ?? false,
|
|
47
48
|
env: process.env
|
|
48
49
|
});
|
|
49
|
-
return
|
|
50
|
+
return _prisma_prisma_schema_wasm.default.get_config(params);
|
|
50
51
|
}, (e) => ({
|
|
51
52
|
type: "wasm-error",
|
|
52
53
|
reason: "(get-config wasm)",
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
const require_helpers_get_schema = require('./get-schema.cjs');
|
|
2
3
|
const require_helpers_schema_creator = require('./schema-creator.cjs');
|
|
3
4
|
const require_helpers_prisma_postgres = require('./prisma-postgres.cjs');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
let prisma_util_schema_creator = require("prisma-util/schema-creator");
|
|
3
4
|
|
|
4
5
|
//#region src/helpers/schema-creator.ts
|
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
const
|
|
3
|
-
const require_constant_case = require('./node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/constant-case.cjs');
|
|
4
|
-
const require_kebab_case = require('./node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/kebab-case.cjs');
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
5
3
|
const require_helpers_get_schema = require('./helpers/get-schema.cjs');
|
|
6
4
|
const require_helpers_schema_creator = require('./helpers/schema-creator.cjs');
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let
|
|
5
|
+
let _pulumi_prisma_postgres = require("@pulumi/prisma-postgres");
|
|
6
|
+
_pulumi_prisma_postgres = require_runtime.__toESM(_pulumi_prisma_postgres);
|
|
7
|
+
let _stryke_cli_execute = require("@stryke/cli/execute");
|
|
8
|
+
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
9
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
10
|
+
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
11
|
+
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
12
12
|
let defu = require("defu");
|
|
13
|
-
defu =
|
|
13
|
+
defu = require_runtime.__toESM(defu);
|
|
14
14
|
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
15
15
|
|
|
16
16
|
//#region src/index.ts
|
|
@@ -25,9 +25,9 @@ const plugin = (options = {}) => {
|
|
|
25
25
|
name: "prisma",
|
|
26
26
|
config() {
|
|
27
27
|
return { prisma: (0, defu.default)(options, {
|
|
28
|
-
schema: (0,
|
|
28
|
+
schema: (0, _stryke_path_join_paths.joinPaths)(this.config.root, "prisma", "schema.prisma"),
|
|
29
29
|
configFile: options.configFile || (0, powerlines_plugin_utils.getConfigPath)(this, "prisma.config"),
|
|
30
|
-
outputPath: (0,
|
|
30
|
+
outputPath: (0, _stryke_path_join_paths.joinPaths)("{builtinPath}", "prisma"),
|
|
31
31
|
prismaPostgres: options?.prismaPostgres ? {
|
|
32
32
|
projectId: this.config.name,
|
|
33
33
|
region: "us-east-1"
|
|
@@ -42,7 +42,7 @@ const plugin = (options = {}) => {
|
|
|
42
42
|
if (!this.config.prisma.outputPath) throw new Error(`Prisma generated path is not defined. Please specify a valid path in the plugin configuration.`);
|
|
43
43
|
this.config.prisma.outputPath = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.prisma.outputPath);
|
|
44
44
|
this.prisma ??= {};
|
|
45
|
-
if (!(0,
|
|
45
|
+
if (!(0, _stryke_fs_exists.existsSync)(this.config.prisma.schema)) this.prisma.schema ??= {
|
|
46
46
|
generators: [],
|
|
47
47
|
datasources: [],
|
|
48
48
|
warnings: []
|
|
@@ -79,11 +79,11 @@ const plugin = (options = {}) => {
|
|
|
79
79
|
];
|
|
80
80
|
if (!this.config.prisma.prismaPath) {
|
|
81
81
|
args.unshift(this.config.root);
|
|
82
|
-
const result = await (0,
|
|
82
|
+
const result = await (0, _stryke_cli_execute.executePackage)("prisma", args, (0, _stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.root));
|
|
83
83
|
if (result.failed) throw new Error(`Prisma process exited with code ${result.exitCode}.`);
|
|
84
84
|
} else {
|
|
85
85
|
args.unshift(this.config.prisma.prismaPath);
|
|
86
|
-
const result = await (0,
|
|
86
|
+
const result = await (0, _stryke_cli_execute.execute)(args.join(" "), this.config.root);
|
|
87
87
|
if (result.failed) throw new Error(`Prisma process exited with code ${result.exitCode}.`);
|
|
88
88
|
}
|
|
89
89
|
},
|
|
@@ -96,18 +96,18 @@ const plugin = (options = {}) => {
|
|
|
96
96
|
else throw new Error("Unable to determine the Prisma service token. Please set the `PRISMA_SERVICE_TOKEN` environment variable.");
|
|
97
97
|
}
|
|
98
98
|
await this.pulumi.workspace.installPlugin("registry.terraform.io/prisma/prisma-postgres", "v0.2.0");
|
|
99
|
-
const project = new
|
|
100
|
-
const database = new
|
|
99
|
+
const project = new _pulumi_prisma_postgres.Project("project", { name: `${this.config.prisma.prismaPostgres?.projectId || this.config.name}` });
|
|
100
|
+
const database = new _pulumi_prisma_postgres.Database("database", {
|
|
101
101
|
projectId: project.id,
|
|
102
|
-
name: `${this.config.prisma.prismaPostgres?.databaseName || `${
|
|
102
|
+
name: `${this.config.prisma.prismaPostgres?.databaseName || `${(0, _stryke_string_format_kebab_case.kebabCase)(this.config.name)}.${this.config.mode}.${this.config.prisma.prismaPostgres?.region}`}`,
|
|
103
103
|
region: `${this.config.prisma.prismaPostgres?.region}`
|
|
104
104
|
});
|
|
105
105
|
return {
|
|
106
106
|
project,
|
|
107
107
|
database,
|
|
108
|
-
connection: new
|
|
108
|
+
connection: new _pulumi_prisma_postgres.Connection("connection", {
|
|
109
109
|
databaseId: database.id,
|
|
110
|
-
name: `${
|
|
110
|
+
name: `${(0, _stryke_string_format_constant_case.constantCase)(this.config.name)}_API_KEY`
|
|
111
111
|
})
|
|
112
112
|
};
|
|
113
113
|
}
|
|
@@ -115,8 +115,7 @@ const plugin = (options = {}) => {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
};
|
|
118
|
-
var src_default = plugin;
|
|
119
118
|
|
|
120
119
|
//#endregion
|
|
121
|
-
exports.default =
|
|
120
|
+
exports.default = plugin;
|
|
122
121
|
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { constantCase } from "./node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/constant-case.mjs";
|
|
2
|
-
import { kebabCase } from "./node_modules/.pnpm/@stryke_string-format@0.17.3/node_modules/@stryke/string-format/dist/kebab-case.mjs";
|
|
3
1
|
import { getSchema } from "./helpers/get-schema.mjs";
|
|
4
2
|
import { PrismaSchemaCreator } from "./helpers/schema-creator.mjs";
|
|
5
3
|
import * as prismaPostgres from "@pulumi/prisma-postgres";
|
|
6
4
|
import { execute, executePackage } from "@stryke/cli/execute";
|
|
7
5
|
import { existsSync } from "@stryke/fs/exists";
|
|
8
6
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
7
|
+
import { constantCase } from "@stryke/string-format/constant-case";
|
|
8
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
9
9
|
import defu from "defu";
|
|
10
10
|
import { getConfigPath, replacePathTokens } from "powerlines/plugin-utils";
|
|
11
11
|
|
|
@@ -111,7 +111,6 @@ const plugin = (options = {}) => {
|
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
|
-
var src_default = plugin;
|
|
115
114
|
|
|
116
115
|
//#endregion
|
|
117
|
-
export {
|
|
116
|
+
export { plugin as default, plugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-prisma",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.25",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Powerlines plugin to generate project code and a Prisma client from a Prisma schema (PSL).",
|
|
6
6
|
"keywords": ["prisma", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"default": "./dist/index.mjs"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
"./*": "./*",
|
|
58
57
|
"./api/client": {
|
|
59
58
|
"require": {
|
|
60
59
|
"types": "./dist/api/client/index.d.cts",
|
|
@@ -321,6 +320,7 @@
|
|
|
321
320
|
"default": "./dist/helpers/schema-creator.mjs"
|
|
322
321
|
}
|
|
323
322
|
},
|
|
323
|
+
"./package.json": "./package.json",
|
|
324
324
|
"./types": {
|
|
325
325
|
"require": {
|
|
326
326
|
"types": "./dist/types/index.d.cts",
|
|
@@ -370,26 +370,27 @@
|
|
|
370
370
|
"typings": "dist/index.d.mts",
|
|
371
371
|
"files": ["dist/**/*"],
|
|
372
372
|
"dependencies": {
|
|
373
|
-
"@powerlines/plugin-pulumi": "^0.5.
|
|
373
|
+
"@powerlines/plugin-pulumi": "^0.5.24",
|
|
374
374
|
"@prisma/get-platform": "^6.19.2",
|
|
375
375
|
"@prisma/prisma-schema-wasm": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773",
|
|
376
376
|
"@stryke/cli": "^0.13.29",
|
|
377
377
|
"@stryke/fs": "^0.33.57",
|
|
378
378
|
"@stryke/path": "^0.26.19",
|
|
379
|
+
"@stryke/string-format": "^0.17.3",
|
|
379
380
|
"@stryke/type-checks": "^0.5.38",
|
|
380
381
|
"@stryke/types": "^0.10.52",
|
|
381
382
|
"defu": "^6.1.4",
|
|
382
383
|
"fp-ts": "^2.16.11",
|
|
383
384
|
"jiti": "^2.6.1",
|
|
384
|
-
"powerlines": "^0.41.
|
|
385
|
+
"powerlines": "^0.41.8",
|
|
385
386
|
"prisma-util": "^2.1.1",
|
|
386
387
|
"ts-pattern": "^5.9.0"
|
|
387
388
|
},
|
|
388
389
|
"devDependencies": {
|
|
390
|
+
"@powerlines/plugin-plugin": "^0.12.294",
|
|
389
391
|
"@pulumi/pulumi": "^3.225.1",
|
|
390
|
-
"@powerlines/plugin-plugin": "^0.12.292",
|
|
391
392
|
"@types/node": "^25.4.0"
|
|
392
393
|
},
|
|
393
394
|
"publishConfig": { "access": "public" },
|
|
394
|
-
"gitHead": "
|
|
395
|
+
"gitHead": "40d1f94407720be23c3801f9145fdad1fe27dfb2"
|
|
395
396
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const require_get_words = require('./get-words.cjs');
|
|
2
|
-
const require_snake_case = require('./snake-case.cjs');
|
|
3
|
-
|
|
4
|
-
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.3/node_modules/@stryke/string-format/dist/constant-case.mjs
|
|
5
|
-
/**
|
|
6
|
-
* Check if the input string is in constant case.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
10
|
-
*
|
|
11
|
-
* @param input - The input string to check.
|
|
12
|
-
* @returns True if the input is in constant case, false otherwise.
|
|
13
|
-
*/
|
|
14
|
-
function isConstantCase(input) {
|
|
15
|
-
return input ? /^[A-Z0-9_]+$/.test(input) : false;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Convert the input string to constant case.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
22
|
-
*
|
|
23
|
-
* @param input - The input string.
|
|
24
|
-
* @returns The constant-cased string.
|
|
25
|
-
*/
|
|
26
|
-
function constantCase(input) {
|
|
27
|
-
return isConstantCase(input) || input === void 0 ? input : require_snake_case.isSnakeCase(input) ? input.toUpperCase() : require_get_words.getWords(input).join("_").toUpperCase();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
exports.constantCase = constantCase;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { getWords } from "./get-words.mjs";
|
|
2
|
-
import { isSnakeCase } from "./snake-case.mjs";
|
|
3
|
-
|
|
4
|
-
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.3/node_modules/@stryke/string-format/dist/constant-case.mjs
|
|
5
|
-
/**
|
|
6
|
-
* Check if the input string is in constant case.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
10
|
-
*
|
|
11
|
-
* @param input - The input string to check.
|
|
12
|
-
* @returns True if the input is in constant case, false otherwise.
|
|
13
|
-
*/
|
|
14
|
-
function isConstantCase(input) {
|
|
15
|
-
return input ? /^[A-Z0-9_]+$/.test(input) : false;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Convert the input string to constant case.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
22
|
-
*
|
|
23
|
-
* @param input - The input string.
|
|
24
|
-
* @returns The constant-cased string.
|
|
25
|
-
*/
|
|
26
|
-
function constantCase(input) {
|
|
27
|
-
return isConstantCase(input) || input === void 0 ? input : isSnakeCase(input) ? input.toUpperCase() : getWords(input).join("_").toUpperCase();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
export { constantCase };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.3/node_modules/@stryke/string-format/dist/get-words.mjs
|
|
3
|
-
/**
|
|
4
|
-
* Regular expression pattern to split strings into words for various case conversions
|
|
5
|
-
*
|
|
6
|
-
* This pattern matches sequences of characters in a string, considering the following case:
|
|
7
|
-
* - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)
|
|
8
|
-
* - Sequences of one uppercase letter optionally followed by lowercase letters and digits
|
|
9
|
-
* - Single uppercase letters
|
|
10
|
-
* - Sequences of digits
|
|
11
|
-
*
|
|
12
|
-
* The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into
|
|
13
|
-
* a consistent format like snake case.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);
|
|
17
|
-
* // matches: ['camel', 'Case', 'HTTP', 'Request']
|
|
18
|
-
*/
|
|
19
|
-
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|\d+|[A-Z]+(?![a-z])/g;
|
|
20
|
-
const RELAXED_SPLIT_PATTERN = /[A-Z/.-]?[a-z/.-]+|\d+|[A-Z/.-]+(?![a-z/.-])/g;
|
|
21
|
-
/**
|
|
22
|
-
* Splits a string into words using a regular expression pattern
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* const words = getWords('camelCaseHTTPRequest');
|
|
26
|
-
* // words: ['camel', 'Case', 'HTTP', 'Request']
|
|
27
|
-
*
|
|
28
|
-
* @param str - The string to split into words
|
|
29
|
-
* @param options - Options for splitting the string
|
|
30
|
-
* @returns An array of words
|
|
31
|
-
*/
|
|
32
|
-
function getWords(str, options = {}) {
|
|
33
|
-
if (str.length > 5e3) throw new Error("The regular expression parameter of `get-words` can't handle strings longer than 2000 characters");
|
|
34
|
-
return [...str.match(options.split ?? (options.relaxed ? RELAXED_SPLIT_PATTERN : CASE_SPLIT_PATTERN)) ?? []];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
exports.getWords = getWords;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.3/node_modules/@stryke/string-format/dist/get-words.mjs
|
|
2
|
-
/**
|
|
3
|
-
* Regular expression pattern to split strings into words for various case conversions
|
|
4
|
-
*
|
|
5
|
-
* This pattern matches sequences of characters in a string, considering the following case:
|
|
6
|
-
* - Sequences of two or more uppercase letters followed by an uppercase letter and lowercase letters or digits (for acronyms)
|
|
7
|
-
* - Sequences of one uppercase letter optionally followed by lowercase letters and digits
|
|
8
|
-
* - Single uppercase letters
|
|
9
|
-
* - Sequences of digits
|
|
10
|
-
*
|
|
11
|
-
* The resulting match can be used to convert camelCase, snake_case, kebab-case, and other mixed formats into
|
|
12
|
-
* a consistent format like snake case.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* const matches = 'camelCaseHTTPRequest'.match(CASE_SPLIT_PATTERN);
|
|
16
|
-
* // matches: ['camel', 'Case', 'HTTP', 'Request']
|
|
17
|
-
*/
|
|
18
|
-
const CASE_SPLIT_PATTERN = /[A-Z]?[a-z]+|\d+|[A-Z]+(?![a-z])/g;
|
|
19
|
-
const RELAXED_SPLIT_PATTERN = /[A-Z/.-]?[a-z/.-]+|\d+|[A-Z/.-]+(?![a-z/.-])/g;
|
|
20
|
-
/**
|
|
21
|
-
* Splits a string into words using a regular expression pattern
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* const words = getWords('camelCaseHTTPRequest');
|
|
25
|
-
* // words: ['camel', 'Case', 'HTTP', 'Request']
|
|
26
|
-
*
|
|
27
|
-
* @param str - The string to split into words
|
|
28
|
-
* @param options - Options for splitting the string
|
|
29
|
-
* @returns An array of words
|
|
30
|
-
*/
|
|
31
|
-
function getWords(str, options = {}) {
|
|
32
|
-
if (str.length > 5e3) throw new Error("The regular expression parameter of `get-words` can't handle strings longer than 2000 characters");
|
|
33
|
-
return [...str.match(options.split ?? (options.relaxed ? RELAXED_SPLIT_PATTERN : CASE_SPLIT_PATTERN)) ?? []];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
export { getWords };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const require_get_words = require('./get-words.cjs');
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.3/node_modules/@stryke/string-format/dist/kebab-case.mjs
|
|
4
|
-
/**
|
|
5
|
-
* Check if the input string is in kebab case.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* Kebab case is defined as all lowercase letters with hyphens separating words - "this-is-an-example".
|
|
9
|
-
*
|
|
10
|
-
* @param input - The input string to check.
|
|
11
|
-
* @returns True if the input is in kebab case, false otherwise.
|
|
12
|
-
*/
|
|
13
|
-
function isKebabCase(input) {
|
|
14
|
-
return input ? /^[a-z]+(?:-[a-z0-9]+)*$/.test(input) : false;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Convert the input string to kebab case.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* Kebab case is defined as all lowercase letters with hyphens separating words - "this-is-an-example".
|
|
21
|
-
*
|
|
22
|
-
* @param input - The input string.
|
|
23
|
-
* @returns The kebab-cased string.
|
|
24
|
-
*/
|
|
25
|
-
function kebabCase(input) {
|
|
26
|
-
if (isKebabCase(input) || input === void 0) return input;
|
|
27
|
-
const parts = input ? require_get_words.getWords(input) : [];
|
|
28
|
-
if (parts.length === 0) return "";
|
|
29
|
-
return parts.join("-").toLowerCase();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
exports.kebabCase = kebabCase;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { getWords } from "./get-words.mjs";
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.3/node_modules/@stryke/string-format/dist/kebab-case.mjs
|
|
4
|
-
/**
|
|
5
|
-
* Check if the input string is in kebab case.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* Kebab case is defined as all lowercase letters with hyphens separating words - "this-is-an-example".
|
|
9
|
-
*
|
|
10
|
-
* @param input - The input string to check.
|
|
11
|
-
* @returns True if the input is in kebab case, false otherwise.
|
|
12
|
-
*/
|
|
13
|
-
function isKebabCase(input) {
|
|
14
|
-
return input ? /^[a-z]+(?:-[a-z0-9]+)*$/.test(input) : false;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Convert the input string to kebab case.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* Kebab case is defined as all lowercase letters with hyphens separating words - "this-is-an-example".
|
|
21
|
-
*
|
|
22
|
-
* @param input - The input string.
|
|
23
|
-
* @returns The kebab-cased string.
|
|
24
|
-
*/
|
|
25
|
-
function kebabCase(input) {
|
|
26
|
-
if (isKebabCase(input) || input === void 0) return input;
|
|
27
|
-
const parts = input ? getWords(input) : [];
|
|
28
|
-
if (parts.length === 0) return "";
|
|
29
|
-
return parts.join("-").toLowerCase();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { kebabCase };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.3/node_modules/@stryke/string-format/dist/snake-case.mjs
|
|
3
|
-
/**
|
|
4
|
-
* Check if the input string is in snake case.
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
8
|
-
*
|
|
9
|
-
* @param input - The input string to check.
|
|
10
|
-
* @returns True if the input is in snake case, false otherwise.
|
|
11
|
-
*/
|
|
12
|
-
function isSnakeCase(input) {
|
|
13
|
-
return input ? /^[a-z]+(?:_[a-z0-9]+)*$/.test(input) : false;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//#endregion
|
|
17
|
-
exports.isSnakeCase = isSnakeCase;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@stryke+string-format@0.17.3/node_modules/@stryke/string-format/dist/snake-case.mjs
|
|
2
|
-
/**
|
|
3
|
-
* Check if the input string is in snake case.
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
7
|
-
*
|
|
8
|
-
* @param input - The input string to check.
|
|
9
|
-
* @returns True if the input is in snake case, false otherwise.
|
|
10
|
-
*/
|
|
11
|
-
function isSnakeCase(input) {
|
|
12
|
-
return input ? /^[a-z]+(?:_[a-z0-9]+)*$/.test(input) : false;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { isSnakeCase };
|