@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
|
@@ -578,15 +578,19 @@ function requireExtension(extension, factory) {
|
|
|
578
578
|
if (typeof extension !== "string" || extension.length === 0) throw new Error(`${factory}() requires a non-empty extension (the authoring extension's package name).`);
|
|
579
579
|
}
|
|
580
580
|
/**
|
|
581
|
-
*
|
|
582
|
-
*
|
|
583
|
-
*
|
|
581
|
+
* Core's grammar for every name that becomes a config-key segment —
|
|
582
|
+
* addresses, input/param/secret names: ASCII letters and digits only.
|
|
583
|
+
* Conservative by design so any target medium — POSIX env-var keys
|
|
584
|
+
* included — can uppercase and "_"-join segments without escaping.
|
|
584
585
|
*/
|
|
585
|
-
function
|
|
586
|
-
|
|
586
|
+
function isConfigKeySegment(name) {
|
|
587
|
+
return /^[A-Za-z0-9]+$/.test(name);
|
|
587
588
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
589
|
+
function requireConfigKeySegmentName(name, kind, factory) {
|
|
590
|
+
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.`);
|
|
591
|
+
}
|
|
592
|
+
function requireConfigKeySegmentNames(names, kind, factory) {
|
|
593
|
+
for (const name of names) requireConfigKeySegmentName(name, kind, factory);
|
|
590
594
|
}
|
|
591
595
|
function freezeParams(params) {
|
|
592
596
|
const frozen = {};
|
|
@@ -657,9 +661,9 @@ function service$1(def) {
|
|
|
657
661
|
requireName(def.name, "service");
|
|
658
662
|
requireExtension(def.extension, "service");
|
|
659
663
|
requireType(def.type, "service");
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
664
|
+
requireConfigKeySegmentNames(Object.keys(def.inputs), "input", "service");
|
|
665
|
+
requireConfigKeySegmentNames(Object.keys(def.params), "param", "service");
|
|
666
|
+
requireConfigKeySegmentNames(Object.keys(def.secrets ?? {}), "secret", "service");
|
|
663
667
|
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.`);
|
|
664
668
|
return Object.freeze({
|
|
665
669
|
[NODE]: true,
|
|
@@ -681,7 +685,7 @@ function service$1(def) {
|
|
|
681
685
|
*/
|
|
682
686
|
function dependency(def) {
|
|
683
687
|
requireType(def.type, "dependency");
|
|
684
|
-
|
|
688
|
+
requireConfigKeySegmentNames(Object.keys(def.connection.params), "param", "dependency");
|
|
685
689
|
const connection = Object.freeze({
|
|
686
690
|
params: freezeParams(def.connection.params),
|
|
687
691
|
hydrate: def.connection.hydrate
|