@prisma/composer-prisma-cloud 0.2.0-dev.2 → 0.2.0-dev.3
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/cron/scheduler-entrypoint.mjs +15 -11
- package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
- package/dist/storage/storage-entrypoint.mjs +15 -11
- package/dist/storage/storage-entrypoint.mjs.map +1 -1
- package/dist/streams/streams-entrypoint.mjs +15 -11
- package/dist/streams/streams-entrypoint.mjs.map +1 -1
- package/package.json +13 -13
|
@@ -61,15 +61,19 @@ function requireExtension(extension, factory) {
|
|
|
61
61
|
if (typeof extension !== "string" || extension.length === 0) throw new Error(`${factory}() requires a non-empty extension (the authoring extension's package name).`);
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
64
|
+
* Core's grammar for every name that becomes a config-key segment —
|
|
65
|
+
* addresses, input/param/secret names: ASCII letters and digits only.
|
|
66
|
+
* Conservative by design so any target medium — POSIX env-var keys
|
|
67
|
+
* included — can uppercase and "_"-join segments without escaping.
|
|
67
68
|
*/
|
|
68
|
-
function
|
|
69
|
-
|
|
69
|
+
function isConfigKeySegment(name) {
|
|
70
|
+
return /^[A-Za-z0-9]+$/.test(name);
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
72
|
+
function requireConfigKeySegmentName(name, kind, factory) {
|
|
73
|
+
if (!isConfigKeySegment(name)) throw new Error(`${factory}() ${kind} name "${name}" must contain only ASCII letters and digits ([A-Za-z0-9]) — declared names derive deterministic config keys, uppercased and joined with "_" (an input "db"'s param "url" becomes config key "DB_URL"), so an underscore inside a name collides with that separator and any other character has no place in a config key. "${name}" would put "${name.toUpperCase()}" inside the derived key.`);
|
|
74
|
+
}
|
|
75
|
+
function requireConfigKeySegmentNames(names, kind, factory) {
|
|
76
|
+
for (const name of names) requireConfigKeySegmentName(name, kind, factory);
|
|
73
77
|
}
|
|
74
78
|
function freezeParams(params) {
|
|
75
79
|
const frozen = {};
|
|
@@ -93,9 +97,9 @@ function service$1(def) {
|
|
|
93
97
|
requireName(def.name, "service");
|
|
94
98
|
requireExtension(def.extension, "service");
|
|
95
99
|
requireType(def.type, "service");
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
requireConfigKeySegmentNames(Object.keys(def.inputs), "input", "service");
|
|
101
|
+
requireConfigKeySegmentNames(Object.keys(def.params), "param", "service");
|
|
102
|
+
requireConfigKeySegmentNames(Object.keys(def.secrets ?? {}), "secret", "service");
|
|
99
103
|
for (const slot of Object.keys(def.secrets ?? {})) if (Object.hasOwn(def.params, slot)) throw new Error(`service() secret slot "${slot}" collides with a param of the same name — a secret slot and a service param derive the same config key (COMPOSER_<addr>_${slot.toUpperCase()}); rename one.`);
|
|
100
104
|
return Object.freeze({
|
|
101
105
|
[NODE]: true,
|
|
@@ -117,7 +121,7 @@ function service$1(def) {
|
|
|
117
121
|
*/
|
|
118
122
|
function dependency(def) {
|
|
119
123
|
requireType(def.type, "dependency");
|
|
120
|
-
|
|
124
|
+
requireConfigKeySegmentNames(Object.keys(def.connection.params), "param", "dependency");
|
|
121
125
|
const connection = Object.freeze({
|
|
122
126
|
params: freezeParams(def.connection.params),
|
|
123
127
|
hydrate: def.connection.hydrate
|