@prisma/composer 0.36.0 → 0.37.0-dev.1

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 (119) hide show
  1. package/dist/{app-config-DNnd7Zu--BQ1vHaMK.d.mts → app-config-Bf_y5R7o-BEZAnKqM.d.mts} +46 -6
  2. package/dist/app-config-Bf_y5R7o-BEZAnKqM.d.mts.map +1 -0
  3. package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs +221 -0
  4. package/dist/app-configuration-file-CeJvBAti-D3uDlheX.mjs.map +1 -0
  5. package/dist/arktype.d.mts +20 -6
  6. package/dist/arktype.d.mts.map +1 -1
  7. package/dist/arktype.mjs +45 -6
  8. package/dist/arktype.mjs.map +1 -1
  9. package/dist/config-CDkq5Ayl.d.mts +1 -0
  10. package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs +47 -0
  11. package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs.map +1 -0
  12. package/dist/config.d.mts +16 -3
  13. package/dist/config.d.mts.map +1 -0
  14. package/dist/config.mjs +2 -1
  15. package/dist/control.d.mts +6 -174
  16. package/dist/control.d.mts.map +1 -1
  17. package/dist/control.mjs +4 -4
  18. package/dist/control.mjs.map +1 -1
  19. package/dist/deploy-CmiYExQA.mjs +373 -0
  20. package/dist/deploy-CmiYExQA.mjs.map +1 -0
  21. package/dist/deploy-DQyaIoNe.d.mts +2 -0
  22. package/dist/deploy.d.mts +4 -3
  23. package/dist/deploy.mjs +3 -364
  24. package/dist/{deployment-summary-CDHdLtnO-DrE7GsHq.mjs → deployment-summary-BiBkPWlB-CyC2pudN.mjs} +10 -23
  25. package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +1 -0
  26. package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts → deployment-summary-p88NV5m5-BJOosgmI.d.mts} +3 -3
  27. package/dist/{deployment-summary-p88NV5m5-SaPCCX2C.d.mts.map → deployment-summary-p88NV5m5-BJOosgmI.d.mts.map} +1 -1
  28. package/dist/{secret-DoWGmN7m-DO5Brq1Y.mjs → describe-kind-Cpm_euxo-CkhlGJUL.mjs} +29 -2
  29. package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +1 -0
  30. package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs → dev-current-D0Kn6Mf4-DDWYu-3j.mjs} +5 -5
  31. package/dist/{dev-current-Brb4qugP-CG0_96FZ.mjs.map → dev-current-D0Kn6Mf4-DDWYu-3j.mjs.map} +1 -1
  32. package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs → dev-environment-name-6eEr5PW8-BwusWVKi.mjs} +3 -3
  33. package/dist/{dev-environment-name-6eEr5PW8-CGk1ijP7.mjs.map → dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map} +1 -1
  34. package/dist/{dist-DiYPSVUE.mjs → dist-BtzrklYG.mjs} +2 -2
  35. package/dist/{dist-DiYPSVUE.mjs.map → dist-BtzrklYG.mjs.map} +1 -1
  36. package/dist/{dist-CZ_yEZ7F.mjs → dist-C7SnNTD3.mjs} +11 -4
  37. package/dist/dist-C7SnNTD3.mjs.map +1 -0
  38. package/dist/errors-0e8IVwzi.mjs.map +1 -1
  39. package/dist/{execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs → execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs} +60 -29
  40. package/dist/execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs.map +1 -0
  41. package/dist/{execute-dev-BUk-XWBJ-ZHX5A8cR.mjs → execute-dev-Bl-5Q-Av-DILne6iY.mjs} +99 -44
  42. package/dist/execute-dev-Bl-5Q-Av-DILne6iY.mjs.map +1 -0
  43. package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs} +6 -6
  44. package/dist/{execute-dev-current-BdEqeKAB-BLUs2eQv.mjs.map → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs.map} +1 -1
  45. package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs → execute-log-Dm3DkQQP-BSjoy6Wd.mjs} +6 -6
  46. package/dist/{execute-log-aiHhujIh-C_aXmb6j.mjs.map → execute-log-Dm3DkQQP-BSjoy6Wd.mjs.map} +1 -1
  47. package/dist/{graph-MGOZJdDt-CyI8-9r7.mjs → graph-Bqr7PSGl-BM-M-TlO.mjs} +637 -199
  48. package/dist/graph-Bqr7PSGl-BM-M-TlO.mjs.map +1 -0
  49. package/dist/{graph-BzTSXnoQ-BvGVq0bm.d.mts → graph-DI1v3WKX-3g1lTRbh.d.mts} +8 -4
  50. package/dist/graph-DI1v3WKX-3g1lTRbh.d.mts.map +1 -0
  51. package/dist/{graph-types-DfsG9Rkg-D_ARjMo7.d.mts → graph-types-DRe9UUOp-C85Yr-sJ.d.mts} +253 -120
  52. package/dist/graph-types-DRe9UUOp-C85Yr-sJ.d.mts.map +1 -0
  53. package/dist/http.d.mts +2 -2
  54. package/dist/http.mjs +2 -2
  55. package/dist/{index-D89ftK2z.d.mts → index-DWQ6BSgm.d.mts} +3 -3
  56. package/dist/index-DWQ6BSgm.d.mts.map +1 -0
  57. package/dist/index.d.mts +5 -5
  58. package/dist/index.mjs +4 -4
  59. package/dist/internal-app-configuration-file.d.mts +19 -0
  60. package/dist/internal-app-configuration-file.d.mts.map +1 -0
  61. package/dist/internal-app-configuration-file.mjs +2 -0
  62. package/dist/{local-target-DySKw61w.mjs → local-target-Dd8FJEb5.mjs} +5 -3
  63. package/dist/{local-target-DySKw61w.mjs.map → local-target-Dd8FJEb5.mjs.map} +1 -1
  64. package/dist/local-target.d.mts +2 -2
  65. package/dist/local-target.d.mts.map +1 -1
  66. package/dist/local-target.mjs +1 -1
  67. package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts → nextjs-DLyeRR7M-RtoHcY1c.d.mts} +3 -3
  68. package/dist/{nextjs-DLyeRR7M-BeiYsLuZ.d.mts.map → nextjs-DLyeRR7M-RtoHcY1c.d.mts.map} +1 -1
  69. package/dist/nextjs-control.d.mts +4 -4
  70. package/dist/nextjs-control.mjs +2 -2
  71. package/dist/nextjs.d.mts +1 -1
  72. package/dist/node-control.d.mts +3 -3
  73. package/dist/node-control.mjs +2 -2
  74. package/dist/node.d.mts +2 -2
  75. package/dist/pointer-CyQZZugO-D7k3vibs.d.mts +42 -0
  76. package/dist/pointer-CyQZZugO-D7k3vibs.d.mts.map +1 -0
  77. package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts +183 -0
  78. package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts.map +1 -0
  79. package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs +295 -0
  80. package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs.map +1 -0
  81. package/dist/report.d.mts +3 -3
  82. package/dist/report.mjs +1 -1
  83. package/dist/report.mjs.map +1 -1
  84. package/dist/{run-alchemy-Dl_MWw4g-BZaLckHp.mjs → run-alchemy-OS_ix5g0-DCvUYZ7T.mjs} +30 -12
  85. package/dist/run-alchemy-OS_ix5g0-DCvUYZ7T.mjs.map +1 -0
  86. package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs → run-report-CmBz2-xc-Cc8rV1CX.mjs} +2 -2
  87. package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs.map → run-report-CmBz2-xc-Cc8rV1CX.mjs.map} +1 -1
  88. package/dist/service-rpc.d.mts +2 -2
  89. package/dist/service-rpc.mjs +2 -2
  90. package/dist/testing.d.mts +2 -2
  91. package/dist/testing.d.mts.map +1 -1
  92. package/dist/{validate-environment-CEhUSEg2-DmAtiQhe.mjs → validate-environment-D_dECxgO-B-gqpVEf.mjs} +113 -13
  93. package/dist/validate-environment-D_dECxgO-B-gqpVEf.mjs.map +1 -0
  94. package/dist/zod.d.mts +30 -0
  95. package/dist/zod.d.mts.map +1 -0
  96. package/dist/zod.mjs +39 -0
  97. package/dist/zod.mjs.map +1 -0
  98. package/package.json +31 -18
  99. package/skills/prisma-composer-core-concepts/SKILL.md +49 -23
  100. package/src/exports/config.ts +1 -0
  101. package/src/exports/internal-app-configuration-file.ts +1 -0
  102. package/src/exports/zod.ts +1 -0
  103. package/dist/app-config-DNnd7Zu--BQ1vHaMK.d.mts.map +0 -1
  104. package/dist/config-RKyUvtGC.d.mts +0 -1
  105. package/dist/deploy-RKyUvtGC.d.mts +0 -1
  106. package/dist/deploy.mjs.map +0 -1
  107. package/dist/deployment-summary-CDHdLtnO-DrE7GsHq.mjs.map +0 -1
  108. package/dist/dist-CZ_yEZ7F.mjs.map +0 -1
  109. package/dist/execute-deploy-destroy-CNt-xpE7-CYaa3sYk.mjs.map +0 -1
  110. package/dist/execute-dev-BUk-XWBJ-ZHX5A8cR.mjs.map +0 -1
  111. package/dist/graph-BzTSXnoQ-BvGVq0bm.d.mts.map +0 -1
  112. package/dist/graph-MGOZJdDt-CyI8-9r7.mjs.map +0 -1
  113. package/dist/graph-types-DfsG9Rkg-D_ARjMo7.d.mts.map +0 -1
  114. package/dist/index-D89ftK2z.d.mts.map +0 -1
  115. package/dist/run-alchemy-Dl_MWw4g-BZaLckHp.mjs.map +0 -1
  116. package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts +0 -25
  117. package/dist/secret-CHOw4LBU-C8yXoC9N.d.mts.map +0 -1
  118. package/dist/secret-DoWGmN7m-DO5Brq1Y.mjs.map +0 -1
  119. package/dist/validate-environment-CEhUSEg2-DmAtiQhe.mjs.map +0 -1
@@ -1,11 +1,11 @@
1
- import { A as NodeId, B as ProvisionNeed, D as ModuleNode, G as ResourceNode, g as Graph, i as Config, r as BuildAdapter, tt as ServiceNode } from "./graph-types-DfsG9Rkg-D_ARjMo7.mjs";
2
- import "./graph-BzTSXnoQ-BvGVq0bm.mjs";
1
+ import { F as NodeId, J as ResourceNode, M as ModuleNode, U as ProvisionNeed, _ as Graph, a as Config, i as BuildAdapter, it as ServiceNode, t as AppConfigurationRead } from "./graph-types-DRe9UUOp-C85Yr-sJ.mjs";
2
+ import "./graph-DI1v3WKX-3g1lTRbh.mjs";
3
3
  import * as Alchemy from "alchemy";
4
4
  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-DNnd7Zu-.d.mts
8
+ //#region ../../0-framework/1-core/core/dist/app-config-Bf_y5R7o.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
@@ -269,6 +269,10 @@ interface LowerOptions {
269
269
  readonly name: string;
270
270
  /** The environment being deployed, as `--environment` gave it. Required by any value over `environment.name`; the generated stack files always pass it. */
271
271
  readonly environment?: string;
272
+ /** What the first process's Load read from the app configuration (ADR-0062), from the app configuration file. Load takes the root's input and every configuration key's text from it, and the Prisma Cloud serializer reads a service's `envParam()` leaves from its `configurationKeyText`. The generated stack files pass it. */
273
+ readonly appConfigurationRead?: AppConfigurationRead;
274
+ /** The node addresses of the graph the first process built. When given, lowering refuses a graph whose addresses differ. The generated stack files pass them. */
275
+ readonly firstProcessNodeAddresses?: readonly string[];
272
276
  readonly bundles: Record<string, Bundle>;
273
277
  /** Alchemy state store for the stack. Defaults to the config's own state layer. */
274
278
  readonly state?: AlchemyStateLayer;
@@ -494,10 +498,16 @@ interface PreflightInput<C = unknown> {
494
498
  readonly container: ContainerInstance | undefined;
495
499
  /** The environment name. */
496
500
  readonly environment: string;
501
+ /** The app configuration the command read for this environment. Preflight fills a missing `envParam()` param's platform variable from it. */
502
+ readonly configuration: AppConfiguration;
503
+ /** The app secrets the command read for this environment. Preflight fills a missing `envSecret()` platform variable from it. */
504
+ readonly secrets: AppSecrets;
497
505
  /** What the caller has already authenticated, for the platform calls preflight makes. Absent means the extension falls back to its own credential protocol. */
498
506
  readonly credentials?: ContainerCredentials<C> | undefined;
499
507
  /** Hands the deploy's progress output what the check covered, as counts (e.g. `{ checked: 53, filled: 0, missing: 0 }`). Counts only: never a name or a value. */
500
508
  readonly report?: ((counts: Readonly<Record<string, number>>) => void) | undefined;
509
+ /** Shows the user a warning that does not stop the run. Only `prisma dev` passes it and shows the warnings; deploy passes none. */
510
+ readonly warn?: ((message: string) => void) | undefined;
501
511
  }
502
512
  /** The resolved destroy context handed to an extension's `teardown` hook. */
503
513
  interface TeardownInput {
@@ -669,6 +679,10 @@ interface LocalTargetProvidersInput {
669
679
  readonly container: ContainerInstance | undefined;
670
680
  /** Absolute path of the environment's dev state directory (`devEnvironmentDir`, under the cwd). */
671
681
  readonly devDir: string;
682
+ /** The text of each configuration key the graph reads, from the app configuration file. A local deployment takes the text its param rows point at from it. */
683
+ readonly configurationKeyText: Readonly<Record<string, string>>;
684
+ /** The app secrets the graph's `envSecret()`s name, which the first process handed the second. A local deployment takes the text its `$secret` pointers name from it. */
685
+ readonly namedSecrets: NamedSecrets;
672
686
  }
673
687
  interface LocalTargetEmulatorsInput {
674
688
  /** The loaded application graph — inspected for which node kinds need an emulator. */
@@ -708,6 +722,10 @@ interface LocalTargetAttachment {
708
722
  readonly address: string;
709
723
  readonly node: ServiceNode;
710
724
  readonly server: DevServer;
725
+ /** The app configuration the command read for this environment. */
726
+ readonly configuration: AppConfiguration;
727
+ /** The app secrets the command read for this environment. */
728
+ readonly secrets: AppSecrets;
711
729
  }): Promise<{
712
730
  readonly restarted: boolean;
713
731
  }>;
@@ -755,19 +773,41 @@ type NodeDescriptor = ({
755
773
  */
756
774
  serve?(input: ServeInput): Promise<DevServer | undefined>;
757
775
  };
776
+ /** What a config adapter receives (ADR-0062). */
777
+ interface ConfigAdapterInput {
778
+ /** The environment's name, as `--environment` gave it. */
779
+ readonly environment: string;
780
+ /** The absolute directory of the prisma.config.ts that declares the `composer` section. A file adapter reads its files relative to it (ADR-0004). */
781
+ readonly configDirectory: string;
782
+ }
783
+ /** The values one adapter returns, by name. */
784
+ type ConfigValues = Readonly<Record<string, unknown>>;
785
+ /** A function in the `config` or `secrets` list of the `composer` section (ADR-0062): it receives the environment and returns that environment's values. Only the command's first process calls it; the second process reads what the first read from the app configuration file. */
786
+ type ConfigAdapter = (input: ConfigAdapterInput) => ConfigValues | Promise<ConfigValues>;
787
+ /** The app configuration (ADR-0062): what the `config` adapters return, merged by top-level key, a later adapter winning. It is the root's input, and what `envParam()` reads. */
788
+ type AppConfiguration = Readonly<Record<string, unknown>>;
789
+ /** The app secrets (ADR-0062): what the `secrets` adapters return, merged the same way. Every value is text. Preflight fills a missing `envSecret()` platform variable from it, and `prisma dev` hands its second process the values the graph's `envSecret()`s name. Composer redacts the values the graph's `envSecret()`s name wherever it prints. */
790
+ type AppSecrets = Readonly<Record<string, string>>;
791
+ /** The app secrets an `envSecret()` in the graph names, each with text. `prisma dev`'s first process hands them to its second process in `PRISMA_COMPOSER_NAMED_SECRETS`. */
792
+ type NamedSecrets = Readonly<Record<string, string>>;
758
793
  /**
759
794
  * The config file's default export. `extensions` lists every extension the
760
795
  * app deploys through; `state` is the ONE state store per deploy — explicit,
761
- * platform-agnostic, never defaulted by an extension.
796
+ * platform-agnostic, never defaulted by an extension. `config` and `secrets`
797
+ * list the adapters the app configuration and the app secrets come from.
762
798
  */
763
799
  interface PrismaAppConfig {
764
800
  /** The module whose default export is the app root, relative to `prisma.config.ts`. `--entry` overrides it. */
765
801
  readonly entry?: string;
766
802
  readonly extensions: ExtensionDescriptor[];
767
803
  readonly state: StateDescriptor;
804
+ /** Where the app configuration comes from. Defaults to `[environmentVariables()]`; a list given here replaces the default. */
805
+ readonly config?: readonly ConfigAdapter[];
806
+ /** Where the app secrets come from. Defaults to `[environmentVariables()]`; a list given here replaces the default. */
807
+ readonly secrets?: readonly ConfigAdapter[];
768
808
  }
769
809
  /** Typed identity — exists so the `composer` section of `prisma.config.ts` gets checked against PrismaAppConfig where it is written. */
770
810
  declare function defineConfig(config: PrismaAppConfig): PrismaAppConfig;
771
811
  //#endregion
772
- export { defineConfig as $, LoweredResult as A, ReportAttachInput as B, LocalTargetDescriptor as C, LowerContext as D, LocateContainerInput as E, PreflightInput as F, ServeInput as G, ReporterDescriptor as H, PreflightPayload as I, TeardownInput as J, ServiceLowering as K, PrismaAppConfig as L, NodeDescriptor as M, Outputs as N, LowerError as O, PackageInput as P, containerEnvVarName as Q, ProvisionEdge as R, LocalTargetCurrentInput as S, LocalTargetProvidersInput as T, RunOutcome as U, ReportBeginInput as V, RunReporter as W, connectionInputs as X, buildConfig as Y, containerEnv as Z, LocalNodeLocation as _, Bundle as a, lowering as at, LocalTargetAttachment as b, ContainerInstance as c, preflightEnvVarName as ct, DeployedEntity as d, deserializeContainers as et, DeployedNode as f, LocalNodeCondition as g, ExtensionDescriptor as h, AssembleInput as i, lower as it, Lowering as j, LowerOptions as k, DEV_DIR as l, readPreflightPayload as lt, DevServer as m, ApplicationDescriptor as n, isBuildOnlyExtension as nt, ContainerCredentials as o, mergedProviders as ot, DeploymentResult as p, StateDescriptor as q, Artifact as r, joinDeployment as rt, ContainerDescriptor as s, preflightEnv as st, AlchemyStateLayer as t, devEnvironmentDir as tt, DEV_ENVIRONMENT_NAME_FILE as u, resolveStateLayer as ut, LocalNodeStopped as v, LocalTargetEmulatorsInput as w, LocalTargetCurrentApp as x, LocalTargetAttachInput as y, ProvisionerDescriptor as z };
773
- //# sourceMappingURL=app-config-DNnd7Zu--BQ1vHaMK.d.mts.map
812
+ export { StateDescriptor as $, LocalTargetProvidersInput as A, PackageInput as B, LocalNodeStopped as C, LocalTargetCurrentInput as D, LocalTargetCurrentApp as E, LoweredResult as F, ProvisionerDescriptor as G, PreflightPayload as H, Lowering as I, ReporterDescriptor as J, ReportAttachInput as K, NamedSecrets as L, LowerContext as M, LowerError as N, LocalTargetDescriptor as O, LowerOptions as P, ServiceLowering as Q, NodeDescriptor as R, LocalNodeLocation as S, LocalTargetAttachment as T, PrismaAppConfig as U, PreflightInput as V, ProvisionEdge as W, RunReporter as X, RunOutcome as Y, ServeInput as Z, DeployedNode as _, Artifact as a, defineConfig as at, ExtensionDescriptor as b, ConfigAdapter as c, isBuildOnlyExtension as ct, ContainerCredentials as d, lowering as dt, TeardownInput as et, ContainerDescriptor as f, mergedProviders as ft, DeployedEntity as g, resolveStateLayer as gt, DEV_ENVIRONMENT_NAME_FILE as h, readPreflightPayload as ht, ApplicationDescriptor as i, containerEnvVarName as it, LocateContainerInput as j, LocalTargetEmulatorsInput as k, ConfigAdapterInput as l, joinDeployment as lt, DEV_DIR as m, preflightEnvVarName as mt, AppConfiguration as n, connectionInputs as nt, AssembleInput as o, deserializeContainers as ot, ContainerInstance as p, preflightEnv as pt, ReportBeginInput as q, AppSecrets as r, containerEnv as rt, Bundle as s, devEnvironmentDir as st, AlchemyStateLayer as t, buildConfig as tt, ConfigValues as u, lower as ut, DeploymentResult as v, LocalTargetAttachInput as w, LocalNodeCondition as x, DevServer as y, Outputs as z };
813
+ //# sourceMappingURL=app-config-Bf_y5R7o-BEZAnKqM.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-config-Bf_y5R7o-BEZAnKqM.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/app-config-Bf_y5R7o.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;UAmBU;;WAEC;;WAEA;;;;;;;UAOD;WACC,OAAO;;WAEP;;EAET;;;;;;;;;;;;;;;UAeQ,qBAAqB;;WAEpB;;WAEA,SAAS;;;;;;;;;;;;UAYV,oBAAoB,UAAU,oBAAoB,mBAAmB;;EAE7E,OAAO,OAAO,sBAAsB,cAAc,qBAAqB,KAAK,QAAQ;;EAEpF,OAAO,OAAO,sBAAsB,cAAc,qBAAqB,KAAK,QAAQ;;EAEpF,OAAO,UAAU,GAAG,cAAc,qBAAqB,KAAK;;EAE5D,YAAY,qBAAqB;;;iBAGlB,oBAAoB;;iBAEpB,aAAa,WAAW,oBAAoB,qBAAqB;;UAExE;WACC;WACA,YAAY;;;;;;iBAMN,sBAAsB,qBAAqB,+BAA+B,KAAK,SAAS,sCAAsC,oB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;;;UAG3B;;WAEC;;WAEA;;;KAGN,eAAe,SAAS;;KAExB,iBAAiB,OAAO,uBAAuB,eAAe,QAAQ;;KAEtE,mBAAmB,SAAS;;KAE5B,aAAa,SAAS;;KAEtB,eAAe,SAAS;;;;;;;UAOnB;;WAEC;WACA,YAAY;WACZ,OAAO;;WAEP,kBAAkB;;WAElB,mBAAmB;;;iBAGb,aAAa,QAAQ,kBAAkB"}
@@ -0,0 +1,221 @@
1
+ import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
2
+ import { t as DEV_DIR } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
3
+ import * as path$1 from "node:path";
4
+ import * as fs$1 from "node:fs";
5
+ //#region ../../0-framework/3-tooling/cli/dist/app-configuration-file-CeJvBAti.mjs
6
+ /** Names the app configuration file the first process wrote for this run (ADR-0062). */
7
+ const APP_CONFIGURATION_FILE_ENV = "PRISMA_COMPOSER_APP_CONFIGURATION_FILE";
8
+ /** `prisma dev` only: the named secrets, as a JSON object. */
9
+ const NAMED_SECRETS_ENV = "PRISMA_COMPOSER_NAMED_SECRETS";
10
+ const FILE_NAME = /^app-configuration-(\d+)(-[^/]*)?\.json$/;
11
+ /** The app configuration file a deploy or destroy run writes: unique per run, so concurrent runs from one checkout never share one. */
12
+ function deployAppConfigurationFile(cwd, runId) {
13
+ return path$1.join(cwd, ".prisma-composer", `app-configuration-${String(process.pid)}-${runId}.json`);
14
+ }
15
+ /** The app configuration file `prisma dev` writes in an environment's folder. */
16
+ function devAppConfigurationFile(devDir) {
17
+ return path$1.join(devDir, `app-configuration-${String(process.pid)}.json`);
18
+ }
19
+ function isRunning(pid) {
20
+ try {
21
+ process.kill(pid, 0);
22
+ return true;
23
+ } catch (error) {
24
+ return error instanceof Error && "code" in error && error.code === "EPERM";
25
+ }
26
+ }
27
+ /**
28
+ * Deletes the app configuration files that earlier runs left in `.prisma-composer/` and in
29
+ * each dev environment's folder: a run killed before its exit handler ran leaves its file. A
30
+ * file is deleted only when its process is not running and it is older than
31
+ * `LEFTOVER_APP_CONFIGURATION_FILE_AGE_MS`. Never throws.
32
+ */
33
+ function removeLeftoverAppConfigurationFiles(cwd) {
34
+ const devRoot = path$1.join(cwd, DEV_DIR);
35
+ const dirs = [path$1.join(cwd, ".prisma-composer")];
36
+ try {
37
+ for (const entry of fs$1.readdirSync(devRoot, { withFileTypes: true })) if (entry.isDirectory()) dirs.push(path$1.join(devRoot, entry.name));
38
+ } catch {}
39
+ for (const dir of dirs) {
40
+ let names;
41
+ try {
42
+ names = fs$1.readdirSync(dir);
43
+ } catch {
44
+ continue;
45
+ }
46
+ for (const name of names) {
47
+ const pid = Number(FILE_NAME.exec(name)?.[1]);
48
+ if (Number.isNaN(pid) || pid === process.pid || isRunning(pid)) continue;
49
+ const file = path$1.join(dir, name);
50
+ try {
51
+ if (Date.now() - fs$1.statSync(file).mtimeMs < 6e5) continue;
52
+ fs$1.rmSync(file, { force: true });
53
+ } catch {}
54
+ }
55
+ }
56
+ }
57
+ function textIn(value, at) {
58
+ if (typeof value === "string") return [{
59
+ at,
60
+ text: value
61
+ }];
62
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return [{
63
+ at,
64
+ text: String(value)
65
+ }];
66
+ if (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));
67
+ if (typeof value === "object" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));
68
+ return [];
69
+ }
70
+ /**
71
+ * Refuses when the file would hold a known secret in a plain value, a number or a boolean
72
+ * compared as its text (`KnownSecrets.nameIn`). The message names where and the secrets key,
73
+ * never the value.
74
+ */
75
+ function refuseSecretsIn(read, knownSecrets) {
76
+ const places = [...read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({
77
+ where: `Root input field input.${at.join(".")}`,
78
+ text
79
+ }))), ...Object.entries(read.configurationKeyText).map(([key, text]) => ({
80
+ where: `Configuration key "${key}"`,
81
+ text
82
+ }))];
83
+ for (const { where, text } of places) {
84
+ const name = knownSecrets.nameIn(text);
85
+ if (name === void 0) continue;
86
+ throw new CliStructuredError("CONFIG.SECRET_AS_PLAIN_VALUE", `${where} holds the value of the secret "${name}", which an envSecret() in the graph reads. Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.`, { fix: `Read the secret with envSecret('${name}') where it is used, or give this plain value text that does not contain the value of "${name}".` });
87
+ }
88
+ }
89
+ /**
90
+ * First process: the handover to the second process (ADR-0062). The app configuration file at
91
+ * `file` holds what Load read and the graph's node addresses. With `appSecrets`, which only
92
+ * `prisma dev` passes, the environment also carries the named secrets: the app secrets under
93
+ * the graph's secrets keys, each with text. Refuses when the file would hold any of
94
+ * `knownSecrets`. Every other input is plain data from the graph, such as
95
+ * `graph.appConfigurationRead`, `nodeAddresses(graph)` and `secretsKeys(graph)`, so a caller with
96
+ * its own copy of Composer's core can pass them. The exception is `knownSecrets`, a
97
+ * `KnownSecrets`, which such a caller builds from the testing entry.
98
+ */
99
+ function prepareSecondProcess(input) {
100
+ const { file, appSecrets } = input;
101
+ refuseSecretsIn(input.appConfigurationRead, input.knownSecrets);
102
+ const contents = {
103
+ appConfigurationRead: input.appConfigurationRead,
104
+ nodeAddresses: input.nodeAddresses
105
+ };
106
+ const env = { [APP_CONFIGURATION_FILE_ENV]: file };
107
+ if (appSecrets !== void 0) {
108
+ const named = {};
109
+ for (const key of input.secretsKeys) {
110
+ const text = appSecrets[key];
111
+ if (text !== void 0 && text !== "") named[key] = text;
112
+ }
113
+ env[NAMED_SECRETS_ENV] = JSON.stringify(named);
114
+ }
115
+ const remove = () => {
116
+ try {
117
+ fs$1.rmSync(file, { force: true });
118
+ } catch {}
119
+ };
120
+ return {
121
+ env,
122
+ writeFile() {
123
+ fs$1.rmSync(file, { force: true });
124
+ fs$1.writeFileSync(file, JSON.stringify(contents), {
125
+ mode: 384,
126
+ flag: "wx"
127
+ });
128
+ process.off("exit", remove);
129
+ process.on("exit", remove);
130
+ },
131
+ removeFile() {
132
+ process.off("exit", remove);
133
+ remove();
134
+ }
135
+ };
136
+ }
137
+ function missingVariable(name, what) {
138
+ return `${name} is not set. This stack file runs as the second process of a Composer deploy, destroy or prisma dev, which ${what}.`;
139
+ }
140
+ function isRecord(value) {
141
+ return typeof value === "object" && value !== null && !Array.isArray(value);
142
+ }
143
+ function isTextList(value) {
144
+ return Array.isArray(value) && value.every((member) => typeof member === "string");
145
+ }
146
+ function rootFieldsOf(value) {
147
+ if (!Array.isArray(value)) return void 0;
148
+ const fields = [];
149
+ for (const member of value) {
150
+ if (!isRecord(member) || !isTextList(member["path"])) return void 0;
151
+ fields.push("value" in member ? {
152
+ path: member["path"],
153
+ value: member["value"]
154
+ } : { path: member["path"] });
155
+ }
156
+ return fields;
157
+ }
158
+ function textByKeyOf(value) {
159
+ if (!isRecord(value)) return void 0;
160
+ const byKey = {};
161
+ for (const [key, member] of Object.entries(value)) {
162
+ if (typeof member !== "string") return void 0;
163
+ byKey[key] = member;
164
+ }
165
+ return byKey;
166
+ }
167
+ /** Second process: the app configuration file the first process named in its environment. */
168
+ function readAppConfigurationFile(env) {
169
+ const file = env[APP_CONFIGURATION_FILE_ENV];
170
+ if (file === void 0 || file === "") throw new Error(missingVariable(APP_CONFIGURATION_FILE_ENV, "names the app configuration file it wrote there"));
171
+ let text;
172
+ try {
173
+ text = fs$1.readFileSync(file, "utf8");
174
+ } catch (cause) {
175
+ const message = cause instanceof Error ? cause.message : String(cause);
176
+ throw new Error(`Could not read the app configuration file ${file}: ${message}. Composer deletes it when the run ends, so a stack file run by hand after that cannot read it; run the command again.`, { cause });
177
+ }
178
+ const notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not one Composer wrote: ${what}.`);
179
+ let parsed;
180
+ try {
181
+ parsed = JSON.parse(text);
182
+ } catch {
183
+ throw notComposers("it is not JSON");
184
+ }
185
+ if (!isRecord(parsed)) throw notComposers("it is not JSON");
186
+ const read = parsed["appConfigurationRead"];
187
+ if (!isRecord(read)) throw notComposers("appConfigurationRead is not an object");
188
+ const rootInput = rootFieldsOf(read["rootInput"]);
189
+ if (rootInput === void 0) throw notComposers("rootInput is not a list of fields");
190
+ const configurationKeyText = textByKeyOf(read["configurationKeyText"]);
191
+ if (configurationKeyText === void 0) throw notComposers("configurationKeyText is not an object of text");
192
+ const addresses = parsed["nodeAddresses"];
193
+ if (!isTextList(addresses)) throw notComposers("nodeAddresses is not a list of node addresses");
194
+ return {
195
+ appConfigurationRead: {
196
+ rootInput,
197
+ configurationKeyText
198
+ },
199
+ nodeAddresses: addresses
200
+ };
201
+ }
202
+ /** Second process, under `prisma dev`: the named secrets the first process handed it. */
203
+ function namedSecretsFromEnvironment(env) {
204
+ const text = env[NAMED_SECRETS_ENV];
205
+ if (text === void 0 || text === "") throw new Error(missingVariable(NAMED_SECRETS_ENV, "hands the secrets the local services need there"));
206
+ let parsed;
207
+ try {
208
+ parsed = JSON.parse(text);
209
+ } catch {
210
+ parsed = void 0;
211
+ }
212
+ const byKey = textByKeyOf(parsed);
213
+ if (byKey === void 0) throw new Error(`${NAMED_SECRETS_ENV} is not a JSON object of text.`);
214
+ const secrets = Object.create(null);
215
+ Object.assign(secrets, byKey);
216
+ return Object.freeze(secrets);
217
+ }
218
+ //#endregion
219
+ export { readAppConfigurationFile as a, prepareSecondProcess as i, devAppConfigurationFile as n, removeLeftoverAppConfigurationFiles as o, namedSecretsFromEnvironment as r, deployAppConfigurationFile as t };
220
+
221
+ //# sourceMappingURL=app-configuration-file-CeJvBAti-D3uDlheX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-configuration-file-CeJvBAti-D3uDlheX.mjs","names":["path","fs"],"sources":["../../../0-framework/3-tooling/cli/dist/app-configuration-file-CeJvBAti.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { DEV_DIR } from \"@internal/core/config\";\n//#region src/app-configuration-file.ts\n/** Names the app configuration file the first process wrote for this run (ADR-0062). */\nconst APP_CONFIGURATION_FILE_ENV = \"PRISMA_COMPOSER_APP_CONFIGURATION_FILE\";\n/** `prisma dev` only: the named secrets, as a JSON object. */\nconst NAMED_SECRETS_ENV = \"PRISMA_COMPOSER_NAMED_SECRETS\";\nconst FILE_NAME = /^app-configuration-(\\d+)(-[^/]*)?\\.json$/;\n/** The app configuration file a deploy or destroy run writes: unique per run, so concurrent runs from one checkout never share one. */\nfunction deployAppConfigurationFile(cwd, runId) {\n\treturn path.join(cwd, \".prisma-composer\", `app-configuration-${String(process.pid)}-${runId}.json`);\n}\n/** The app configuration file `prisma dev` writes in an environment's folder. */\nfunction devAppConfigurationFile(devDir) {\n\treturn path.join(devDir, `app-configuration-${String(process.pid)}.json`);\n}\nfunction isRunning(pid) {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn error instanceof Error && \"code\" in error && error.code === \"EPERM\";\n\t}\n}\n/**\n* Deletes the app configuration files that earlier runs left in `.prisma-composer/` and in\n* each dev environment's folder: a run killed before its exit handler ran leaves its file. A\n* file is deleted only when its process is not running and it is older than\n* `LEFTOVER_APP_CONFIGURATION_FILE_AGE_MS`. Never throws.\n*/\nfunction removeLeftoverAppConfigurationFiles(cwd) {\n\tconst devRoot = path.join(cwd, DEV_DIR);\n\tconst dirs = [path.join(cwd, \".prisma-composer\")];\n\ttry {\n\t\tfor (const entry of fs.readdirSync(devRoot, { withFileTypes: true })) if (entry.isDirectory()) dirs.push(path.join(devRoot, entry.name));\n\t} catch {}\n\tfor (const dir of dirs) {\n\t\tlet names;\n\t\ttry {\n\t\t\tnames = fs.readdirSync(dir);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const name of names) {\n\t\t\tconst pid = Number(FILE_NAME.exec(name)?.[1]);\n\t\t\tif (Number.isNaN(pid) || pid === process.pid || isRunning(pid)) continue;\n\t\t\tconst file = path.join(dir, name);\n\t\t\ttry {\n\t\t\t\tif (Date.now() - fs.statSync(file).mtimeMs < 6e5) continue;\n\t\t\t\tfs.rmSync(file, { force: true });\n\t\t\t} catch {}\n\t\t}\n\t}\n}\nfunction textIn(value, at) {\n\tif (typeof value === \"string\") return [{\n\t\tat,\n\t\ttext: value\n\t}];\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") return [{\n\t\tat,\n\t\ttext: String(value)\n\t}];\n\tif (Array.isArray(value)) return value.flatMap((member, index) => textIn(member, [...at, String(index)]));\n\tif (typeof value === \"object\" && value !== null) return Object.entries(value).flatMap(([key, member]) => textIn(member, [...at, key]));\n\treturn [];\n}\n/**\n* Refuses when the file would hold a known secret in a plain value, a number or a boolean\n* compared as its text (`KnownSecrets.nameIn`). The message names where and the secrets key,\n* never the value.\n*/\nfunction refuseSecretsIn(read, knownSecrets) {\n\tconst places = [...read.rootInput.flatMap((field) => textIn(field.value, field.path).map(({ at, text }) => ({\n\t\twhere: `Root input field input.${at.join(\".\")}`,\n\t\ttext\n\t}))), ...Object.entries(read.configurationKeyText).map(([key, text]) => ({\n\t\twhere: `Configuration key \"${key}\"`,\n\t\ttext\n\t}))];\n\tfor (const { where, text } of places) {\n\t\tconst name = knownSecrets.nameIn(text);\n\t\tif (name === void 0) continue;\n\t\tthrow new CliStructuredError(\"CONFIG.SECRET_AS_PLAIN_VALUE\", `${where} holds the value of the secret \"${name}\", which an envSecret() in the graph reads. Composer hands the second process every plain value Load read, in a file, and never writes a secret to a file.`, { fix: `Read the secret with envSecret('${name}') where it is used, or give this plain value text that does not contain the value of \"${name}\".` });\n\t}\n}\n/**\n* First process: the handover to the second process (ADR-0062). The app configuration file at\n* `file` holds what Load read and the graph's node addresses. With `appSecrets`, which only\n* `prisma dev` passes, the environment also carries the named secrets: the app secrets under\n* the graph's secrets keys, each with text. Refuses when the file would hold any of\n* `knownSecrets`. Every other input is plain data from the graph, such as\n* `graph.appConfigurationRead`, `nodeAddresses(graph)` and `secretsKeys(graph)`, so a caller with\n* its own copy of Composer's core can pass them. The exception is `knownSecrets`, a\n* `KnownSecrets`, which such a caller builds from the testing entry.\n*/\nfunction prepareSecondProcess(input) {\n\tconst { file, appSecrets } = input;\n\trefuseSecretsIn(input.appConfigurationRead, input.knownSecrets);\n\tconst contents = {\n\t\tappConfigurationRead: input.appConfigurationRead,\n\t\tnodeAddresses: input.nodeAddresses\n\t};\n\tconst env = { [APP_CONFIGURATION_FILE_ENV]: file };\n\tif (appSecrets !== void 0) {\n\t\tconst named = {};\n\t\tfor (const key of input.secretsKeys) {\n\t\t\tconst text = appSecrets[key];\n\t\t\tif (text !== void 0 && text !== \"\") named[key] = text;\n\t\t}\n\t\tenv[NAMED_SECRETS_ENV] = JSON.stringify(named);\n\t}\n\tconst remove = () => {\n\t\ttry {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t} catch {}\n\t};\n\treturn {\n\t\tenv,\n\t\twriteFile() {\n\t\t\tfs.rmSync(file, { force: true });\n\t\t\tfs.writeFileSync(file, JSON.stringify(contents), {\n\t\t\t\tmode: 384,\n\t\t\t\tflag: \"wx\"\n\t\t\t});\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tprocess.on(\"exit\", remove);\n\t\t},\n\t\tremoveFile() {\n\t\t\tprocess.off(\"exit\", remove);\n\t\t\tremove();\n\t\t}\n\t};\n}\nfunction missingVariable(name, what) {\n\treturn `${name} is not set. This stack file runs as the second process of a Composer deploy, destroy or prisma dev, which ${what}.`;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction isTextList(value) {\n\treturn Array.isArray(value) && value.every((member) => typeof member === \"string\");\n}\nfunction rootFieldsOf(value) {\n\tif (!Array.isArray(value)) return void 0;\n\tconst fields = [];\n\tfor (const member of value) {\n\t\tif (!isRecord(member) || !isTextList(member[\"path\"])) return void 0;\n\t\tfields.push(\"value\" in member ? {\n\t\t\tpath: member[\"path\"],\n\t\t\tvalue: member[\"value\"]\n\t\t} : { path: member[\"path\"] });\n\t}\n\treturn fields;\n}\nfunction textByKeyOf(value) {\n\tif (!isRecord(value)) return void 0;\n\tconst byKey = {};\n\tfor (const [key, member] of Object.entries(value)) {\n\t\tif (typeof member !== \"string\") return void 0;\n\t\tbyKey[key] = member;\n\t}\n\treturn byKey;\n}\n/** Second process: the app configuration file the first process named in its environment. */\nfunction readAppConfigurationFile(env) {\n\tconst file = env[APP_CONFIGURATION_FILE_ENV];\n\tif (file === void 0 || file === \"\") throw new Error(missingVariable(APP_CONFIGURATION_FILE_ENV, \"names the app configuration file it wrote there\"));\n\tlet text;\n\ttry {\n\t\ttext = fs.readFileSync(file, \"utf8\");\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`Could not read the app configuration file ${file}: ${message}. Composer deletes it when the run ends, so a stack file run by hand after that cannot read it; run the command again.`, { cause });\n\t}\n\tconst notComposers = (what) => /* @__PURE__ */ new Error(`The app configuration file ${file} is not one Composer wrote: ${what}.`);\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tthrow notComposers(\"it is not JSON\");\n\t}\n\tif (!isRecord(parsed)) throw notComposers(\"it is not JSON\");\n\tconst read = parsed[\"appConfigurationRead\"];\n\tif (!isRecord(read)) throw notComposers(\"appConfigurationRead is not an object\");\n\tconst rootInput = rootFieldsOf(read[\"rootInput\"]);\n\tif (rootInput === void 0) throw notComposers(\"rootInput is not a list of fields\");\n\tconst configurationKeyText = textByKeyOf(read[\"configurationKeyText\"]);\n\tif (configurationKeyText === void 0) throw notComposers(\"configurationKeyText is not an object of text\");\n\tconst addresses = parsed[\"nodeAddresses\"];\n\tif (!isTextList(addresses)) throw notComposers(\"nodeAddresses is not a list of node addresses\");\n\treturn {\n\t\tappConfigurationRead: {\n\t\t\trootInput,\n\t\t\tconfigurationKeyText\n\t\t},\n\t\tnodeAddresses: addresses\n\t};\n}\n/** Second process, under `prisma dev`: the named secrets the first process handed it. */\nfunction namedSecretsFromEnvironment(env) {\n\tconst text = env[NAMED_SECRETS_ENV];\n\tif (text === void 0 || text === \"\") throw new Error(missingVariable(NAMED_SECRETS_ENV, \"hands the secrets the local services need there\"));\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(text);\n\t} catch {\n\t\tparsed = void 0;\n\t}\n\tconst byKey = textByKeyOf(parsed);\n\tif (byKey === void 0) throw new Error(`${NAMED_SECRETS_ENV} is not a JSON object of text.`);\n\tconst secrets = Object.create(null);\n\tObject.assign(secrets, byKey);\n\treturn Object.freeze(secrets);\n}\n//#endregion\nexport { readAppConfigurationFile as a, prepareSecondProcess as i, devAppConfigurationFile as n, removeLeftoverAppConfigurationFiles as o, namedSecretsFromEnvironment as r, deployAppConfigurationFile as t };\n\n//# sourceMappingURL=app-configuration-file-CeJvBAti.mjs.map"],"mappings":";;;;;;AAMA,MAAM,6BAA6B;;AAEnC,MAAM,oBAAoB;AAC1B,MAAM,YAAY;;AAElB,SAAS,2BAA2B,KAAK,OAAO;CAC/C,OAAOA,OAAK,KAAK,KAAK,oBAAoB,qBAAqB,OAAO,QAAQ,GAAG,EAAE,GAAG,MAAM,MAAM;AACnG;;AAEA,SAAS,wBAAwB,QAAQ;CACxC,OAAOA,OAAK,KAAK,QAAQ,qBAAqB,OAAO,QAAQ,GAAG,EAAE,MAAM;AACzE;AACA,SAAS,UAAU,KAAK;CACvB,IAAI;EACH,QAAQ,KAAK,KAAK,CAAC;EACnB,OAAO;CACR,SAAS,OAAO;EACf,OAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;CACpE;AACD;;;;;;;AAOA,SAAS,oCAAoC,KAAK;CACjD,MAAM,UAAUA,OAAK,KAAK,KAAK,OAAO;CACtC,MAAM,OAAO,CAACA,OAAK,KAAK,KAAK,kBAAkB,CAAC;CAChD,IAAI;EACH,KAAK,MAAM,SAASC,KAAG,YAAY,SAAS,EAAE,eAAe,KAAK,CAAC,GAAG,IAAI,MAAM,YAAY,GAAG,KAAK,KAAKD,OAAK,KA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C;CACjN;CACA,MAAM,gBAAgB,yBAAyB,IAAI,MAAM,8BAA8B,KAAK,8BAA8B,KAAK,EAAE;CACjI,IAAI;CACJ,IAAI;EACH,SAAS,KAAK,MAAM,IAAI;CACzB,QAAQ;EACP,MAAM,aAAa,gBAAgB;CACpC;CACA,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,aAAa,gBAAgB;CAC1D,MAAM,OAAO,OAAO;CACpB,IAAI,CAAC,SAAS,IAAI,GAAG,MAAM,aAAa,uCAAuC;CAC/E,MAAM,YAAY,aAAa,KAAK,YAAY;CAChD,IAAI,cAAc,KAAK,GAAG,MAAM,aAAa,mCAAmC;CAChF,MAAM,uBAAuB,YAAY,KAAK,uBAAuB;CACrE,IAAI,yBAAyB,KAAK,GAAG,MAAM,aAAa,+CAA+C;CACvG,MAAM,YAAY,OAAO;CACzB,IAAI,CAAC,WAAW,SAAS,GAAG,MAAM,aAAa,+CAA+C;CAC9F,OAAO;EACN,sBAAsB;GACrB;GACA;EACD;EACA,eAAe;CAChB;AACD;;AAEA,SAAS,4BAA4B,KAAK;CACzC,MAAM,OAAO,IAAI;CACjB,IAAI,SAAS,KAAK,KAAK,SAAS,IAAI,MAAM,IAAI,MAAM,gBAAgB,mBAAmB,iDAAiD,CAAC;CACzI,IAAI;CACJ,IAAI;EACH,SAAS,KAAK,MAAM,IAAI;CACzB,QAAQ;EACP,SAAS,KAAK;CACf;CACA,MAAM,QAAQ,YAAY,MAAM;CAChC,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,kBAAkB,+BAA+B;CAC1F,MAAM,UAAU,OAAO,OAAO,IAAI;CAClC,OAAO,OAAO,SAAS,KAAK;CAC5B,OAAO,OAAO,OAAO,OAAO;AAC7B"}
@@ -1,16 +1,30 @@
1
- import { n as SecretString } from "./secret-CHOw4LBU-C8yXoC9N.mjs";
1
+ import { a as SecretString, t as Pointer } from "./pointer-CyQZZugO-D7k3vibs.mjs";
2
+ import { Type } from "arktype";
2
3
  //#region ../../0-framework/0-foundation/foundation/dist/arktype.d.mts
3
4
  //#region src/arktype.d.ts
4
5
  /**
5
- * A schema leaf that accepts only a redacting `SecretString` box, so
6
- * `input().<field>.expose()` type-checks and binding a plain literal there
7
- * fails the deploy (ADR-0042).
6
+ * A schema leaf that accepts only a redacting `SecretString` box or a secret
7
+ * pointer, so `input().<field>.expose()` type-checks and binding a plain
8
+ * literal there fails the deploy (ADR-0042). Its error names the refused
9
+ * value's kind, never the value.
8
10
  *
9
11
  * ```ts
10
12
  * input: type({ signingKey: secretString() })
11
13
  * ```
12
14
  */
13
- declare const secretString: () => import("arktype/internal/variants/object.ts").ObjectType<SecretString, {}>;
15
+ declare const secretString: () => import("arktype/internal/variants/object.ts").ObjectType<SecretString | Pointer<SecretString>, {}>;
16
+ /**
17
+ * Wraps the schema of one leaf field so the field also accepts a plain
18
+ * pointer, which stands for a value known only at boot. The field's input type
19
+ * is `In | Pointer<In>` and its output type `Out | Pointer<In>`, where `In` and
20
+ * `Out` are `inner`'s. A value that is not a pointer gets `inner`'s error.
21
+ * Wrap a leaf, never an object schema; put a default outside the wrapper.
22
+ *
23
+ * ```ts
24
+ * input: type({ from: field(type('string')), port: field(type('string.integer.parse')) })
25
+ * ```
26
+ */
27
+ declare function field<t, $>(inner: Type<t, $>): Type<t | Pointer<Type<t, $>['inferIn']>, $>;
14
28
  //#endregion
15
- export { secretString };
29
+ export { field, secretString };
16
30
  //# sourceMappingURL=arktype.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"arktype.d.mts","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/arktype.d.mts"],"mappings":";;;;;;;;;;;;cAWc,kEAAkE,WAAW"}
1
+ {"version":3,"file":"arktype.d.mts","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/arktype.d.mts"],"mappings":";;;;;;;;;;;;;;cAcc,kEAAkE,WAAW,eAAe,QAAQ;;;;;;;;;;;;iBAYjG,MAAM,GAAG,GAAG,OAAO,KAAK,GAAG,KAAK,KAAK,IAAI,QAAQ,KAAK,GAAG,gBAAgB"}
package/dist/arktype.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { n as isSecretString } from "./secret-DoWGmN7m-DO5Brq1Y.mjs";
1
+ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
+ import { a as isPlainPointer, o as isSecretPointer, r as isSecretString, t as describeKind } from "./describe-kind-Cpm_euxo-CkhlGJUL.mjs";
2
3
  import { type } from "arktype";
3
4
  //#region ../../0-framework/0-foundation/foundation/dist/arktype.mjs
4
5
  /**
@@ -7,16 +8,54 @@ import { type } from "arktype";
7
8
  * module imports arktype, so an app that uses Zod never loads it.
8
9
  */
9
10
  /**
10
- * A schema leaf that accepts only a redacting `SecretString` box, so
11
- * `input().<field>.expose()` type-checks and binding a plain literal there
12
- * fails the deploy (ADR-0042).
11
+ * A schema leaf that accepts only a redacting `SecretString` box or a secret
12
+ * pointer, so `input().<field>.expose()` type-checks and binding a plain
13
+ * literal there fails the deploy (ADR-0042). Its error names the refused
14
+ * value's kind, never the value.
13
15
  *
14
16
  * ```ts
15
17
  * input: type({ signingKey: secretString() })
16
18
  * ```
17
19
  */
18
- const secretString = () => type("unknown").narrow((value, ctx) => isSecretString(value) || ctx.mustBe("a SecretString box — bind this field to a secret"));
20
+ const secretString = () => type("unknown").narrow((value, ctx) => isSecretString(value) || isSecretPointer(value) || ctx.reject({
21
+ expected: "a SecretString box — bind this field to a secret",
22
+ actual: isPlainPointer(value) ? "a value known only at boot that is not a secret" : describeKind(value)
23
+ }));
24
+ /** `error`'s message as if it were reported at `parent` joined with its own path. */
25
+ function messageAt(parent, error) {
26
+ return error.transform(({ relativePath, prefixPath, ...input }) => ({
27
+ ...input,
28
+ path: [...parent, ...error.path]
29
+ })).message;
30
+ }
31
+ /**
32
+ * The error `inner` reports for the wrapped field's value: what a wrapped field
33
+ * reports for a value that is not a pointer. When both branches are objects,
34
+ * ArkType reports a union error, whose message is its problem alone, so each
35
+ * inner error carries its full path from the field's parent.
36
+ */
37
+ function innerProblem(inner, field) {
38
+ const errors = inner(field.data);
39
+ if (!(errors instanceof type.errors)) return `must be ${inner.description} (was ${describeKind(field.data)})`;
40
+ return errors.map((error) => field.hasCode("union") ? messageAt(field.path, error) : error.problem).join("; ");
41
+ }
42
+ /**
43
+ * Wraps the schema of one leaf field so the field also accepts a plain
44
+ * pointer, which stands for a value known only at boot. The field's input type
45
+ * is `In | Pointer<In>` and its output type `Out | Pointer<In>`, where `In` and
46
+ * `Out` are `inner`'s. A value that is not a pointer gets `inner`'s error.
47
+ * Wrap a leaf, never an object schema; put a default outside the wrapper.
48
+ *
49
+ * ```ts
50
+ * input: type({ from: field(type('string')), port: field(type('string.integer.parse')) })
51
+ * ```
52
+ */
53
+ function field(inner) {
54
+ const checked = blindCast(inner);
55
+ const pointer = type("object").narrow((value) => isPlainPointer(value));
56
+ return blindCast(checked.or(pointer).configure({ problem: (error) => innerProblem(checked, error) }));
57
+ }
19
58
  //#endregion
20
- export { secretString };
59
+ export { field, secretString };
21
60
 
22
61
  //# sourceMappingURL=arktype.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"arktype.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/arktype.mjs"],"sourcesContent":["import { n as isSecretString } from \"./secret-DoWGmN7m.mjs\";\nimport { type } from \"arktype\";\n//#region src/arktype.ts\n/**\n* ArkType spellings of the framework's schema leaves. Opt-in: the framework\n* accepts any Standard Schema library (ADR-0042) and nothing outside this\n* module imports arktype, so an app that uses Zod never loads it.\n*/\n/**\n* A schema leaf that accepts only a redacting `SecretString` box, so\n* `input().<field>.expose()` type-checks and binding a plain literal there\n* fails the deploy (ADR-0042).\n*\n* ```ts\n* input: type({ signingKey: secretString() })\n* ```\n*/\nconst secretString = () => type(\"unknown\").narrow((value, ctx) => isSecretString(value) || ctx.mustBe(\"a SecretString box — bind this field to a secret\"));\n//#endregion\nexport { secretString };\n\n//# sourceMappingURL=arktype.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,qBAAqB,KAAK,SAAS,CAAC,CAAC,QAAQ,OAAO,QAAQ,eAAe,KAAK,KAAK,IAAI,OAAO,kDAAkD,CAAC"}
1
+ {"version":3,"file":"arktype.mjs","names":[],"sources":["../../../0-framework/0-foundation/foundation/dist/arktype.mjs"],"sourcesContent":["import { t as blindCast } from \"./casts-DpaahrlC.mjs\";\nimport { t as describeKind } from \"./describe-kind-Cpm_euxo.mjs\";\nimport { n as isSecretString } from \"./secret-DoWGmN7m.mjs\";\nimport { n as isPlainPointer, r as isSecretPointer } from \"./pointer-Cw3E-nrh.mjs\";\nimport { type } from \"arktype\";\n//#region src/arktype.ts\n/**\n* ArkType spellings of the framework's schema leaves. Opt-in: the framework\n* accepts any Standard Schema library (ADR-0042) and nothing outside this\n* module imports arktype, so an app that uses Zod never loads it.\n*/\n/**\n* A schema leaf that accepts only a redacting `SecretString` box or a secret\n* pointer, so `input().<field>.expose()` type-checks and binding a plain\n* literal there fails the deploy (ADR-0042). Its error names the refused\n* value's kind, never the value.\n*\n* ```ts\n* input: type({ signingKey: secretString() })\n* ```\n*/\nconst secretString = () => type(\"unknown\").narrow((value, ctx) => isSecretString(value) || isSecretPointer(value) || ctx.reject({\n\texpected: \"a SecretString box — bind this field to a secret\",\n\tactual: isPlainPointer(value) ? \"a value known only at boot that is not a secret\" : describeKind(value)\n}));\n/** `error`'s message as if it were reported at `parent` joined with its own path. */\nfunction messageAt(parent, error) {\n\treturn error.transform(({ relativePath, prefixPath, ...input }) => ({\n\t\t...input,\n\t\tpath: [...parent, ...error.path]\n\t})).message;\n}\n/**\n* The error `inner` reports for the wrapped field's value: what a wrapped field\n* reports for a value that is not a pointer. When both branches are objects,\n* ArkType reports a union error, whose message is its problem alone, so each\n* inner error carries its full path from the field's parent.\n*/\nfunction innerProblem(inner, field) {\n\tconst errors = inner(field.data);\n\tif (!(errors instanceof type.errors)) return `must be ${inner.description} (was ${describeKind(field.data)})`;\n\treturn errors.map((error) => field.hasCode(\"union\") ? messageAt(field.path, error) : error.problem).join(\"; \");\n}\n/**\n* Wraps the schema of one leaf field so the field also accepts a plain\n* pointer, which stands for a value known only at boot. The field's input type\n* is `In | Pointer<In>` and its output type `Out | Pointer<In>`, where `In` and\n* `Out` are `inner`'s. A value that is not a pointer gets `inner`'s error.\n* Wrap a leaf, never an object schema; put a default outside the wrapper.\n*\n* ```ts\n* input: type({ from: field(type('string')), port: field(type('string.integer.parse')) })\n* ```\n*/\nfunction field(inner) {\n\tconst checked = blindCast(inner);\n\tconst pointer = type(\"object\").narrow((value) => isPlainPointer(value));\n\treturn blindCast(checked.or(pointer).configure({ problem: (error) => innerProblem(checked, error) }));\n}\n//#endregion\nexport { field, secretString };\n\n//# sourceMappingURL=arktype.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAM,qBAAqB,KAAK,SAAS,CAAC,CAAC,QAAQ,OAAO,QAAQ,eAAe,KAAK,KAAK,gBAAgB,KAAK,KAAK,IAAI,OAAO;CAC/H,UAAU;CACV,QAAQ,eAAe,KAAK,IAAI,oDAAoD,aAAa,KAAK;AACvG,CAAC,CAAC;;AAEF,SAAS,UAAU,QAAQ,OAAO;CACjC,OAAO,MAAM,WAAW,EAAE,cAAc,YAAY,GAAG,aAAa;EACnE,GAAG;EACH,MAAM,CAAC,GAAG,QAAQ,GAAG,MAAM,IAAI;CAChC,EAAE,CAAC,CAAC;AACL;;;;;;;AAOA,SAAS,aAAa,OAAO,OAAO;CACnC,MAAM,SAAS,MAAM,MAAM,IAAI;CAC/B,IAAI,EAAE,kBAAkB,KAAK,SAAS,OAAO,WAAW,MAAM,YAAY,QAAQ,aAAa,MAAM,IAAI,EAAE;CAC3G,OAAO,OAAO,KAAK,UAAU,MAAM,QAAQ,OAAO,IAAI,UAAU,MAAM,MAAM,KAAK,IAAI,MAAM,OAAO,CAAC,CAAC,KAAK,IAAI;AAC9G;;;;;;;;;;;;AAYA,SAAS,MAAM,OAAO;CACrB,MAAM,UAAU,UAAU,KAAK;CAC/B,MAAM,UAAU,KAAK,QAAQ,CAAC,CAAC,QAAQ,UAAU,eAAe,KAAK,CAAC;CACtE,OAAO,UAAU,QAAQ,GAAG,OAAO,CAAC,CAAC,UAAU,EAAE,UAAU,UAAU,aAAa,SAAS,KAAK,EAAE,CAAC,CAAC;AACrG"}
@@ -0,0 +1 @@
1
+ import "./app-config-Bf_y5R7o-BEZAnKqM.mjs";
@@ -0,0 +1,47 @@
1
+ import * as path$1 from "node:path";
2
+ import { listFiles, parse } from "dotenv-flow";
3
+ //#region ../../0-framework/3-tooling/cli/dist/config-adapters-DG-uhGfv.mjs
4
+ /** Reads the process environment when called: every variable whose value is a string. The default for both `config` and `secrets`. */
5
+ function environmentVariables() {
6
+ return () => {
7
+ const values = {};
8
+ for (const [name, value] of Object.entries(process.env)) if (typeof value === "string") values[name] = value;
9
+ return values;
10
+ };
11
+ }
12
+ /** `dotenv-flow`'s own default pattern. Given it, `listFiles` also lists `.env.defaults`, first. */
13
+ const DOTENV_FLOW_PATTERN = ".env[.node_env][.local]";
14
+ const ENV_DEFAULTS_FILE = ".env.defaults";
15
+ function envFiles(configDirectory, environment) {
16
+ const files = listFiles({
17
+ node_env: encodeURIComponent(environment),
18
+ path: configDirectory,
19
+ pattern: DOTENV_FLOW_PATTERN
20
+ });
21
+ return files[0] === path$1.resolve(configDirectory, ENV_DEFAULTS_FILE) ? files.slice(1) : files;
22
+ }
23
+ function readEnvFile(file) {
24
+ try {
25
+ return parse(file);
26
+ } catch (error) {
27
+ const message = error instanceof Error ? error.message : String(error);
28
+ throw new Error(`dotenv() could not read ${file}: ${message}`, { cause: error });
29
+ }
30
+ }
31
+ /**
32
+ * Reads `.env`, `.env.local`, `.env.<environment>` and `.env.<environment>.local` from the
33
+ * directory of prisma.config.ts, in `dotenv-flow`'s order, a later file winning. It skips
34
+ * `.env.local` for the environment `test`, as `dotenv-flow` does, and never reads
35
+ * `.env.defaults`. It does not read or change the process environment.
36
+ */
37
+ function dotenv() {
38
+ return ({ environment, configDirectory }) => {
39
+ const values = {};
40
+ for (const file of envFiles(configDirectory, environment)) Object.assign(values, readEnvFile(file));
41
+ return values;
42
+ };
43
+ }
44
+ //#endregion
45
+ export { environmentVariables as n, dotenv as t };
46
+
47
+ //# sourceMappingURL=config-adapters-DG-uhGfv-Bt1M9f8b.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-adapters-DG-uhGfv-Bt1M9f8b.mjs","names":["path"],"sources":["../../../0-framework/3-tooling/cli/dist/config-adapters-DG-uhGfv.mjs"],"sourcesContent":["import * as path from \"node:path\";\nimport { listFiles, parse } from \"dotenv-flow\";\n//#region src/config-adapters.ts\n/** Reads the process environment when called: every variable whose value is a string. The default for both `config` and `secrets`. */\nfunction environmentVariables() {\n\treturn () => {\n\t\tconst values = {};\n\t\tfor (const [name, value] of Object.entries(process.env)) if (typeof value === \"string\") values[name] = value;\n\t\treturn values;\n\t};\n}\n/** `dotenv-flow`'s own default pattern. Given it, `listFiles` also lists `.env.defaults`, first. */\nconst DOTENV_FLOW_PATTERN = \".env[.node_env][.local]\";\nconst ENV_DEFAULTS_FILE = \".env.defaults\";\nfunction envFiles(configDirectory, environment) {\n\tconst files = listFiles({\n\t\tnode_env: encodeURIComponent(environment),\n\t\tpath: configDirectory,\n\t\tpattern: DOTENV_FLOW_PATTERN\n\t});\n\treturn files[0] === path.resolve(configDirectory, ENV_DEFAULTS_FILE) ? files.slice(1) : files;\n}\nfunction readEnvFile(file) {\n\ttry {\n\t\treturn parse(file);\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tthrow new Error(`dotenv() could not read ${file}: ${message}`, { cause: error });\n\t}\n}\n/**\n* Reads `.env`, `.env.local`, `.env.<environment>` and `.env.<environment>.local` from the\n* directory of prisma.config.ts, in `dotenv-flow`'s order, a later file winning. It skips\n* `.env.local` for the environment `test`, as `dotenv-flow` does, and never reads\n* `.env.defaults`. It does not read or change the process environment.\n*/\nfunction dotenv() {\n\treturn ({ environment, configDirectory }) => {\n\t\tconst values = {};\n\t\tfor (const file of envFiles(configDirectory, environment)) Object.assign(values, readEnvFile(file));\n\t\treturn values;\n\t};\n}\n//#endregion\nexport { environmentVariables as n, dotenv as t };\n\n//# sourceMappingURL=config-adapters-DG-uhGfv.mjs.map"],"mappings":";;;;AAIA,SAAS,uBAAuB;CAC/B,aAAa;EACZ,MAAM,SAAS,CAAC;EAChB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,GAAG,GAAG,IAAI,OAAO,UAAU,UAAU,OAAO,QAAQ;EACvG,OAAO;CACR;AACD;;AAEA,MAAM,sBAAsB;AAC5B,MAAM,oBAAoB;AAC1B,SAAS,SAAS,iBAAiB,aAAa;CAC/C,MAAM,QAAQ,UAAU;EACvB,UAAU,mBAAmB,WAAW;EACxC,MAAM;EACN,SAAS;CACV,CAAC;CACD,OAAO,MAAM,OAAOA,OAAK,QAAQ,iBAAiB,iBAAiB,IAAI,MAAM,MAAM,CAAC,IAAI;AACzF;AACA,SAAS,YAAY,MAAM;CAC1B,IAAI;EACH,OAAO,MAAM,IAAI;CAClB,SAAS,OAAO;EACf,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACrE,MAAM,IAAI,MAAM,2BAA2B,KAAK,IAAI,WAAW,EAAE,OAAO,MAAM,CAAC;CAChF;AACD;;;;;;;AAOA,SAAS,SAAS;CACjB,QAAQ,EAAE,aAAa,sBAAsB;EAC5C,MAAM,SAAS,CAAC;EAChB,KAAK,MAAM,QAAQ,SAAS,iBAAiB,WAAW,GAAG,OAAO,OAAO,QAAQ,YAAY,IAAI,CAAC;EAClG,OAAO;CACR;AACD"}
package/dist/config.d.mts CHANGED
@@ -1,3 +1,16 @@
1
- import { $ as defineConfig, B as ReportAttachInput, C as LocalTargetDescriptor, E as LocateContainerInput, F as PreflightInput, H as ReporterDescriptor, I as PreflightPayload, J as TeardownInput, L as PrismaAppConfig, M as NodeDescriptor, Q as containerEnvVarName, S as LocalTargetCurrentInput, T as LocalTargetProvidersInput, U as RunOutcome, V as ReportBeginInput, W as RunReporter, Z as containerEnv, _ as LocalNodeLocation, b as LocalTargetAttachment, c as ContainerInstance, ct as preflightEnvVarName, d as DeployedEntity, et as deserializeContainers, g as LocalNodeCondition, h as ExtensionDescriptor, l as DEV_DIR, lt as readPreflightPayload, nt as isBuildOnlyExtension, o as ContainerCredentials, q as StateDescriptor, s as ContainerDescriptor, st as preflightEnv, tt as devEnvironmentDir, u as DEV_ENVIRONMENT_NAME_FILE, v as LocalNodeStopped, w as LocalTargetEmulatorsInput, x as LocalTargetCurrentApp, y as LocalTargetAttachInput } from "./app-config-DNnd7Zu--BQ1vHaMK.mjs";
2
- import "./config-RKyUvtGC.mjs";
3
- export { type ContainerCredentials, type ContainerDescriptor, type ContainerInstance, DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, type DeployedEntity, ExtensionDescriptor, LocalNodeCondition, LocalNodeLocation, LocalNodeStopped, LocalTargetAttachInput, LocalTargetAttachment, LocalTargetCurrentApp, LocalTargetCurrentInput, LocalTargetDescriptor, LocalTargetEmulatorsInput, LocalTargetProvidersInput, type LocateContainerInput, NodeDescriptor, PreflightInput, type PreflightPayload, PrismaAppConfig, ReportAttachInput, ReportBeginInput, ReporterDescriptor, RunOutcome, RunReporter, StateDescriptor, TeardownInput, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, devEnvironmentDir, isBuildOnlyExtension, preflightEnv, preflightEnvVarName, readPreflightPayload };
1
+ import { $ as StateDescriptor, A as LocalTargetProvidersInput, C as LocalNodeStopped, D as LocalTargetCurrentInput, E as LocalTargetCurrentApp, H as PreflightPayload, J as ReporterDescriptor, K as ReportAttachInput, L as NamedSecrets, O as LocalTargetDescriptor, R as NodeDescriptor, S as LocalNodeLocation, T as LocalTargetAttachment, U as PrismaAppConfig, V as PreflightInput, X as RunReporter, Y as RunOutcome, at as defineConfig, b as ExtensionDescriptor, c as ConfigAdapter, ct as isBuildOnlyExtension, d as ContainerCredentials, et as TeardownInput, f as ContainerDescriptor, g as DeployedEntity, h as DEV_ENVIRONMENT_NAME_FILE, ht as readPreflightPayload, it as containerEnvVarName, j as LocateContainerInput, k as LocalTargetEmulatorsInput, l as ConfigAdapterInput, m as DEV_DIR, mt as preflightEnvVarName, n as AppConfiguration, ot as deserializeContainers, p as ContainerInstance, pt as preflightEnv, q as ReportBeginInput, r as AppSecrets, rt as containerEnv, st as devEnvironmentDir, u as ConfigValues, w as LocalTargetAttachInput, x as LocalNodeCondition } from "./app-config-Bf_y5R7o-BEZAnKqM.mjs";
2
+ import "./config-CDkq5Ayl.mjs";
3
+ //#region ../../0-framework/3-tooling/cli/dist/config.d.mts
4
+ //#region src/config-adapters.d.ts
5
+ /** Reads the process environment when called: every variable whose value is a string. The default for both `config` and `secrets`. */
6
+ declare function environmentVariables(): ConfigAdapter;
7
+ /**
8
+ * Reads `.env`, `.env.local`, `.env.<environment>` and `.env.<environment>.local` from the
9
+ * directory of prisma.config.ts, in `dotenv-flow`'s order, a later file winning. It skips
10
+ * `.env.local` for the environment `test`, as `dotenv-flow` does, and never reads
11
+ * `.env.defaults`. It does not read or change the process environment.
12
+ */
13
+ declare function dotenv(): ConfigAdapter;
14
+ //#endregion
15
+ export { AppConfiguration, AppSecrets, ConfigAdapter, ConfigAdapterInput, ConfigValues, type ContainerCredentials, type ContainerDescriptor, type ContainerInstance, DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, type DeployedEntity, ExtensionDescriptor, LocalNodeCondition, LocalNodeLocation, LocalNodeStopped, LocalTargetAttachInput, LocalTargetAttachment, LocalTargetCurrentApp, LocalTargetCurrentInput, LocalTargetDescriptor, LocalTargetEmulatorsInput, LocalTargetProvidersInput, type LocateContainerInput, NamedSecrets, NodeDescriptor, PreflightInput, type PreflightPayload, PrismaAppConfig, ReportAttachInput, ReportBeginInput, ReporterDescriptor, RunOutcome, RunReporter, StateDescriptor, TeardownInput, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, devEnvironmentDir, dotenv, environmentVariables, isBuildOnlyExtension, preflightEnv, preflightEnvVarName, readPreflightPayload };
16
+ //# sourceMappingURL=config.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/config.d.mts"],"mappings":";;;;;iBAGiB,wBAAwB;;;;;;;iBAOxB,UAAU"}
package/dist/config.mjs CHANGED
@@ -1,4 +1,5 @@
1
+ import { n as environmentVariables, t as dotenv } from "./config-adapters-DG-uhGfv-Bt1M9f8b.mjs";
1
2
  import { n as containerEnvVarName, r as deserializeContainers, t as containerEnv } from "./container-transport-HcvNOGZL-twPi2TIv.mjs";
2
3
  import { a as isBuildOnlyExtension, i as devEnvironmentDir, n as DEV_ENVIRONMENT_NAME_FILE, r as defineConfig, t as DEV_DIR } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
3
4
  import { n as preflightEnvVarName, r as readPreflightPayload, t as preflightEnv } from "./config-BFuriECI.mjs";
4
- export { DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, devEnvironmentDir, isBuildOnlyExtension, preflightEnv, preflightEnvVarName, readPreflightPayload };
5
+ export { DEV_DIR, DEV_ENVIRONMENT_NAME_FILE, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, devEnvironmentDir, dotenv, environmentVariables, isBuildOnlyExtension, preflightEnv, preflightEnvVarName, readPreflightPayload };