@prisma/composer 0.2.0-dev.1 → 0.2.0-dev.10

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.
Files changed (51) hide show
  1. package/dist/{app-config-BPb3LCdH-CH7b8Khi.d.mts → app-config-CVyObaOe-PF94uVBK.d.mts} +10 -2
  2. package/dist/app-config-CVyObaOe-PF94uVBK.d.mts.map +1 -0
  3. package/dist/assertions.d.mts.map +1 -0
  4. package/dist/bin.mjs +56 -4
  5. package/dist/bin.mjs.map +1 -1
  6. package/dist/casts.d.mts.map +1 -0
  7. package/dist/config-BP2DrIX_.d.mts +1 -0
  8. package/dist/config.d.mts +2 -2
  9. package/dist/deploy-BP2DrIX_.d.mts +1 -0
  10. package/dist/deploy.d.mts +2 -2
  11. package/dist/deploy.mjs +1 -1
  12. package/dist/deploy.mjs.map +1 -1
  13. package/dist/{dist-B0axxnBf.mjs → dist-BkSJOwTm.mjs} +2 -2
  14. package/dist/{dist-B0axxnBf.mjs.map → dist-BkSJOwTm.mjs.map} +1 -1
  15. package/dist/{graph-BmrUEdo9-6Oq1hSmS.mjs → graph-CP16cJyH-D5IW87Y-.mjs} +18 -14
  16. package/dist/graph-CP16cJyH-D5IW87Y-.mjs.map +1 -0
  17. package/dist/graph-DUSgjmzA-DhtkTqoz.d.mts.map +1 -0
  18. package/dist/graph-types-BcbVhojU-C3fhxjPK.d.mts.map +1 -0
  19. package/dist/index-BFBNz7Aw.d.mts.map +1 -0
  20. package/dist/index.mjs +2 -2
  21. package/dist/nextjs-DLyeRR7M-DwnBjryZ.d.mts.map +1 -0
  22. package/dist/nextjs-control.d.mts +3 -3
  23. package/dist/nextjs-control.d.mts.map +1 -0
  24. package/dist/nextjs-control.mjs +2 -1
  25. package/dist/nextjs-control.mjs.map +1 -1
  26. package/dist/node-control.d.mts +3 -3
  27. package/dist/node-control.d.mts.map +1 -0
  28. package/dist/node-control.mjs +44 -25
  29. package/dist/node-control.mjs.map +1 -1
  30. package/dist/node.d.mts.map +1 -0
  31. package/dist/report.d.mts +2 -2
  32. package/dist/report.d.mts.map +1 -0
  33. package/dist/service-rpc.d.mts.map +1 -0
  34. package/dist/service-rpc.mjs +2 -2
  35. package/dist/testing.d.mts.map +1 -0
  36. package/package.json +12 -11
  37. package/src/exports/assertions.ts +1 -0
  38. package/src/exports/casts.ts +1 -0
  39. package/src/exports/config.ts +1 -0
  40. package/src/exports/deploy.ts +1 -0
  41. package/src/exports/index.ts +1 -0
  42. package/src/exports/nextjs-control.ts +1 -0
  43. package/src/exports/nextjs.ts +2 -0
  44. package/src/exports/node-control.ts +1 -0
  45. package/src/exports/node.ts +2 -0
  46. package/src/exports/report.ts +1 -0
  47. package/src/exports/service-rpc.ts +1 -0
  48. package/src/exports/testing.ts +1 -0
  49. package/dist/config-Cqu_-Hna.d.mts +0 -1
  50. package/dist/deploy-Cqu_-Hna.d.mts +0 -1
  51. package/dist/graph-BmrUEdo9-6Oq1hSmS.mjs.map +0 -1
@@ -5,7 +5,7 @@ import { Input, StackServices } from "alchemy";
5
5
  import * as Effect from "effect/Effect";
6
6
  import * as Layer from "effect/Layer";
7
7
  import { State } from "alchemy/State/State";
8
- //#region ../../0-framework/1-core/core/dist/app-config-BPb3LCdH.d.mts
8
+ //#region ../../0-framework/1-core/core/dist/app-config-CVyObaOe.d.mts
9
9
  //#region src/container-transport.d.ts
10
10
  /**
11
11
  * Carries resolved containers from the CLI process into the alchemy process
@@ -240,6 +240,14 @@ interface LowerOptions {
240
240
  interface Bundle {
241
241
  readonly dir: string;
242
242
  readonly entry: string;
243
+ /**
244
+ * Absolute paths to the USER-BUILT inputs this bundle was assembled from
245
+ * (ADR-0041). `prisma-composer dev`'s watch loop watches exactly these — a
246
+ * file entry as a file, a directory entry recursively — and re-runs
247
+ * assemble on a change. Optional so a build adapter that predates this
248
+ * field still compiles; a bundle without it is simply not watched.
249
+ */
250
+ readonly watch?: readonly string[];
243
251
  }
244
252
  /** Shared input shape for every extension's build descriptor. */
245
253
  interface AssembleInput {
@@ -408,4 +416,4 @@ interface PrismaAppConfig {
408
416
  declare function defineConfig(config: PrismaAppConfig): PrismaAppConfig;
409
417
  //#endregion
410
418
  export { containerEnvVarName as A, ProvisionEdge as C, TeardownInput as D, StateDescriptor as E, lowering as F, mergedProviders as I, resolveStateLayer as L, deserializeContainers as M, joinDeployment as N, buildConfig as O, lower as P, PrismaAppConfig as S, ServiceLowering as T, Lowering as _, Bundle as a, PackageInput as b, DeployedEntity as c, ExtensionDescriptor as d, LocateContainerInput as f, LoweredResult as g, LowerOptions as h, AssembleInput as i, defineConfig as j, containerEnv as k, DeployedNode as l, LowerError as m, ApplicationDescriptor as n, ContainerDescriptor as o, LowerContext as p, Artifact as r, ContainerInstance as s, AlchemyStateLayer as t, DeploymentResult as u, NodeDescriptor as v, ProvisionerDescriptor as w, PreflightInput as x, Outputs as y };
411
- //# sourceMappingURL=app-config-BPb3LCdH-CH7b8Khi.d.mts.map
419
+ //# sourceMappingURL=app-config-CVyObaOe-PF94uVBK.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-config-CVyObaOe-PF94uVBK.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-CVyObaOe.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;UAmBU;;WAEC;;WAEA;;;;;;;UAOD;WACC,OAAO;;EAEhB;;;;;;;;;;;;UAYQ,oBAAoB,UAAU,oBAAoB;;EAE1D,OAAO,OAAO,uBAAuB,QAAQ;;EAE7C,OAAO,OAAO,uBAAuB,QAAQ;;EAE7C,OAAO,UAAU,IAAI;;EAErB,YAAY,qBAAqB;;;iBAGlB,oBAAoB;;iBAEpB,aAAa,WAAW,oBAAoB,qBAAqB;;UAExE;WACC;WACA,YAAY;;;;;;iBAMN,sBAAsB,qBAAqB,+BAA+B,KAAK,SAAS,sCAAsC,oBAAoB;;;;KAI9J,oBAAoB,MAAM,MAAM,cAAc;;;;;;UAMzC;EACR,UAAU,KAAK,eAAe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;;;;;;iBAMpH,gBAAgB,QAAQ,kBAAkB,MAAM;;;;;iBAKhD,SAAS,MAAM,YAAY,QAAQ,iBAAiB,MAAM,eAAe,OAAO,kBAAkB;;;;;;iBAMlG,MAAM,MAAM,YAAY,QAAQ,iBAAiB,MAAM,eAAe,OAAO,OAAO,QAAQ,uDAAuD;;;;;;;;UAQ1J;;WAEC;;WAEA,OAAO,eAAe;;WAEtB,aAAa,oBAAoB;;WAEjC,cAAc;;WAEd,kBAAkB,MAAM;;;;;;;;WAQxB,aAAa,OAAO,mBAAmB;;;;;;;;;WASvC,YAAY,OAAO,kBAAkB;;;;;;;;WAQrC,YAAY;;;;;;UAMb;;WAEC;;EAET,OAAO,WAAW,gCAAgC;;;UAG1C;;WAEC,OAAO;;WAEP,WAAW;;WAEX;;;UAGD;;WAEC,WAAW;;WAEX;;;;;;;KAON;WACM;IACP;WACO;IACP;WACO;EACT,SAAS,OAAO,gBAAgB,QAAQ;;;;;;;UAOhC;WACC,YAAY;WACZ,OAAO;;;iBAGD,aAAa,QAAQ,kBAAkB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertions.d.mts","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/assertions.d.mts"],"mappings":";;;;;;;;;;;;;;;iBAciB,cAAc,GAAG,OAAO,sBAAsB,0BAA0B,SAAS;;;;;;;;;;;;iBAYjF,UAAU,oBAAoB,0BAA0B"}
package/dist/bin.mjs CHANGED
@@ -88,7 +88,7 @@ function blindCast(input) {
88
88
  return input;
89
89
  }
90
90
  //#endregion
91
- //#region ../../0-framework/1-core/core/dist/graph-BmrUEdo9.mjs
91
+ //#region ../../0-framework/1-core/core/dist/graph-CP16cJyH.mjs
92
92
  /** Thrown by Load when the graph is malformed. */
93
93
  var LoadError = class extends Error {
94
94
  constructor(message) {
@@ -112,6 +112,15 @@ function isParamSource(value) {
112
112
  return typeof value === "object" && value !== null && blindCast(value)[PARAM_SOURCE] === true;
113
113
  }
114
114
  /**
115
+ * Core's grammar for every name that becomes a config-key segment —
116
+ * addresses, input/param/secret names: ASCII letters and digits only.
117
+ * Conservative by design so any target medium — POSIX env-var keys
118
+ * included — can uppercase and "_"-join segments without escaping.
119
+ */
120
+ function isConfigKeySegment(name) {
121
+ return /^[A-Za-z0-9]+$/.test(name);
122
+ }
123
+ /**
115
124
  * True if `value` was constructed by this module's factories. Checks the
116
125
  * brand only, never a prototype — a graph may mix nodes from a different
117
126
  * installed copy of core (dual-package hazard).
@@ -399,7 +408,7 @@ function flatten(moduleNode, address, wiring, secretWiring, paramWiring, nodes,
399
408
  const provisionSecrets = opts?.secrets;
400
409
  const provisionParams = opts?.params;
401
410
  if (typeof id !== "string" || id.length === 0) throw new LoadError(`provision() requires a non-empty id (module "${moduleNode.name}").`);
402
- if (id.includes("_") || id.includes(".")) throw new LoadError(`provision() id "${id}" (module "${moduleNode.name}") may not contain "_" or "." "_" is the config-key separator and "." the node-id path separator; either inside an id collides with the joined form of other names.`);
411
+ if (!isConfigKeySegment(id)) throw new LoadError(`provision() id "${id}" (module "${moduleNode.name}") must contain only ASCII letters and digits ([A-Za-z0-9]) the id becomes an address segment, and addresses derive deterministic config keys (segments uppercased and joined with "_"). "${id}" would put "${id.toUpperCase()}" inside the derived key. ("_" collides with the key separator and "." with the address separator.)`);
403
412
  if (localIds.has(id)) throw new LoadError(`Duplicate provision id "${id}" in module "${moduleNode.name}".`);
404
413
  const untrusted = child;
405
414
  if (!isNode(untrusted) || untrusted.kind !== "service" && untrusted.kind !== "resource" && untrusted.kind !== "module") throw new LoadError(`provision("${id}") expects a branded service, resource, or module node (construct it with the service()/resource()/module() factories or a pack's own).`);
@@ -602,7 +611,7 @@ function containerEnv(instances) {
602
611
  return env;
603
612
  }
604
613
  //#endregion
605
- //#region ../../0-framework/3-tooling/cli/dist/cli-Bc6_i0ls.mjs
614
+ //#region ../../0-framework/3-tooling/cli/dist/cli-riJGhp7G.mjs
606
615
  /**
607
616
  * A user-facing failure with a message that already names the fix (deploy-cli.md
608
617
  * § Error surface). `bin.ts` catches this — and any other Error, including
@@ -742,6 +751,41 @@ async function loadAppConfig(configPath) {
742
751
  };
743
752
  }
744
753
  /**
754
+ * `loadEntry` imports a user's topology with the host runtime's own module
755
+ * loader — under node (the CLI's shebang runtime), that loader strips
756
+ * TypeScript types but has no JSX transform (ADR-0005: the framework
757
+ * doesn't bundle or transform the app's code; deploy loading is no
758
+ * exception). A `.tsx`/`.jsx` file anywhere in the topology's import graph
759
+ * dies with node's raw `ERR_UNKNOWN_FILE_EXTENSION`, which names the file
760
+ * but not the cause or the fix. This turns that one case into a CliError
761
+ * message that does — every other load failure (syntax errors, missing
762
+ * files, non-JSX unknown extensions) is untouched, re-thrown as-is.
763
+ */
764
+ const UNKNOWN_EXTENSION_CODE = "ERR_UNKNOWN_FILE_EXTENSION";
765
+ const JSX_EXTENSIONS = [".tsx", ".jsx"];
766
+ function errorCode(error) {
767
+ return "code" in error && typeof error.code === "string" ? error.code : void 0;
768
+ }
769
+ function unknownExtensionPath(error) {
770
+ if (!(error instanceof Error)) return void 0;
771
+ if (errorCode(error) !== UNKNOWN_EXTENSION_CODE) return void 0;
772
+ return /Unknown file extension "\.\w+" for (.+)$/.exec(error.message)?.[1];
773
+ }
774
+ /**
775
+ * Returns a CliError-ready message when `error` is node's
776
+ * `ERR_UNKNOWN_FILE_EXTENSION` for a `.tsx`/`.jsx` file — `undefined` for
777
+ * every other error (including unknown-extension failures for some other
778
+ * extension), so the caller can fall through to its normal rethrow.
779
+ */
780
+ function explainJsxLoadError(error, entryPath) {
781
+ const offendingPath = unknownExtensionPath(error);
782
+ if (offendingPath === void 0) return void 0;
783
+ if (!JSX_EXTENSIONS.some((ext) => offendingPath.endsWith(ext))) return void 0;
784
+ return `"${offendingPath}" can't be loaded: deploy loads "${entryPath}"'s topology with node's own module loader, which strips TypeScript types but has no JSX transform — so a .tsx/.jsx file can't sit anywhere in that import graph.
785
+
786
+ Precompile that file in your own build (transform the JSX away, keep the real npm packages external) and import the compiled output instead of the raw .tsx/.jsx — see examples/email/scripts/build.ts in the prisma/composer repo for a worked example.`;
787
+ }
788
+ /**
745
789
  * Pipeline step 1 (deploy-cli.md § The pipeline): import the entry module
746
790
  * (resolved against cwd) and require its default export to be a node — a
747
791
  * service or module, branded by core's factories. Whatever this module exports
@@ -749,7 +793,15 @@ async function loadAppConfig(configPath) {
749
793
  */
750
794
  async function loadEntry(entryArg, cwd) {
751
795
  const resolvedPath = path.resolve(cwd, entryArg);
752
- const root = (await import(pathToFileURL(resolvedPath).href)).default;
796
+ let mod;
797
+ try {
798
+ mod = await import(pathToFileURL(resolvedPath).href);
799
+ } catch (error) {
800
+ const explained = explainJsxLoadError(error, resolvedPath);
801
+ if (explained !== void 0) throw new CliError(explained);
802
+ throw error;
803
+ }
804
+ const root = blindCast(mod).default;
753
805
  if (!isNode(root) || root.kind === "dependency" || root.kind === "resource") throw new CliError(`Entry module "${resolvedPath}" must default-export a node (a service or a module) — construct it with service() or module() from @prisma/composer.`);
754
806
  return {
755
807
  path: resolvedPath,