@prisma/composer 0.36.0-dev.5 → 0.36.0-dev.7

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 (116) hide show
  1. package/dist/{app-config-BvxeTt2h-CcVmwsq6.d.mts → app-config-Bf_y5R7o-BEZAnKqM.d.mts} +31 -31
  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.mjs +1 -2
  6. package/dist/arktype.mjs.map +1 -1
  7. package/dist/config-CDkq5Ayl.d.mts +1 -0
  8. package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs +47 -0
  9. package/dist/config-adapters-DG-uhGfv-Bt1M9f8b.mjs.map +1 -0
  10. package/dist/config.d.mts +7 -9
  11. package/dist/config.d.mts.map +1 -1
  12. package/dist/config.mjs +1 -1
  13. package/dist/control.d.mts +6 -183
  14. package/dist/control.d.mts.map +1 -1
  15. package/dist/control.mjs +4 -4
  16. package/dist/control.mjs.map +1 -1
  17. package/dist/deploy-CmiYExQA.mjs +373 -0
  18. package/dist/deploy-CmiYExQA.mjs.map +1 -0
  19. package/dist/deploy-DQyaIoNe.d.mts +2 -0
  20. package/dist/deploy.d.mts +4 -3
  21. package/dist/deploy.mjs +3 -365
  22. package/dist/{deployment-summary-QkZexVIS-DqL4znd4.mjs → deployment-summary-BiBkPWlB-CyC2pudN.mjs} +9 -46
  23. package/dist/deployment-summary-BiBkPWlB-CyC2pudN.mjs.map +1 -0
  24. package/dist/{deployment-summary-Cm4lN6w9-Dc69sCgo.d.mts → deployment-summary-p88NV5m5-BJOosgmI.d.mts} +4 -5
  25. package/dist/deployment-summary-p88NV5m5-BJOosgmI.d.mts.map +1 -0
  26. package/dist/{secret-DoWGmN7m-CI5Yrldp.mjs → describe-kind-Cpm_euxo-CkhlGJUL.mjs} +13 -2
  27. package/dist/describe-kind-Cpm_euxo-CkhlGJUL.mjs.map +1 -0
  28. package/dist/{dev-current-BurA9uhA-C7E-BpRH.mjs → dev-current-D0Kn6Mf4-DDWYu-3j.mjs} +5 -5
  29. package/dist/{dev-current-BurA9uhA-C7E-BpRH.mjs.map → dev-current-D0Kn6Mf4-DDWYu-3j.mjs.map} +1 -1
  30. package/dist/{dev-environment-name-6eEr5PW8-BbNUVxlS.mjs → dev-environment-name-6eEr5PW8-BwusWVKi.mjs} +3 -3
  31. package/dist/{dev-environment-name-6eEr5PW8-BbNUVxlS.mjs.map → dev-environment-name-6eEr5PW8-BwusWVKi.mjs.map} +1 -1
  32. package/dist/{dist-DiYPSVUE.mjs → dist-BtzrklYG.mjs} +2 -2
  33. package/dist/{dist-DiYPSVUE.mjs.map → dist-BtzrklYG.mjs.map} +1 -1
  34. package/dist/{dist-0Iux8Khv.mjs → dist-C7SnNTD3.mjs} +2 -2
  35. package/dist/{dist-0Iux8Khv.mjs.map → dist-C7SnNTD3.mjs.map} +1 -1
  36. package/dist/{execute-deploy-destroy-Cww6zOSC-CIPx-m4I.mjs → execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs} +59 -35
  37. package/dist/execute-deploy-destroy-Dh1CQ9X6-DY4c9egd.mjs.map +1 -0
  38. package/dist/{execute-dev-4KYkqSMh-BP9S193k.mjs → execute-dev-Bl-5Q-Av-DILne6iY.mjs} +79 -48
  39. package/dist/execute-dev-Bl-5Q-Av-DILne6iY.mjs.map +1 -0
  40. package/dist/{execute-dev-current-Cd4YEUZk-C6bs4ONa.mjs → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs} +6 -6
  41. package/dist/{execute-dev-current-Cd4YEUZk-C6bs4ONa.mjs.map → execute-dev-current-D3USgHJ4-CNQe5ADb.mjs.map} +1 -1
  42. package/dist/{execute-log-BC5o35wQ-C8QWELlP.mjs → execute-log-Dm3DkQQP-BSjoy6Wd.mjs} +6 -6
  43. package/dist/{execute-log-BC5o35wQ-C8QWELlP.mjs.map → execute-log-Dm3DkQQP-BSjoy6Wd.mjs.map} +1 -1
  44. package/dist/{graph-gE31_ToO-BouKBfIS.mjs → graph-Bqr7PSGl-BM-M-TlO.mjs} +183 -44
  45. package/dist/graph-Bqr7PSGl-BM-M-TlO.mjs.map +1 -0
  46. package/dist/{graph-CN8VuVZN-Ck2y98XZ.d.mts → graph-DI1v3WKX-3g1lTRbh.d.mts} +8 -4
  47. package/dist/graph-DI1v3WKX-3g1lTRbh.d.mts.map +1 -0
  48. package/dist/{graph-types-R38xjBnN-cDTIX_rZ.d.mts → graph-types-DRe9UUOp-C85Yr-sJ.d.mts} +138 -67
  49. package/dist/graph-types-DRe9UUOp-C85Yr-sJ.d.mts.map +1 -0
  50. package/dist/http.d.mts +2 -2
  51. package/dist/http.mjs +2 -2
  52. package/dist/{index-BHdm4Q39.d.mts → index-DWQ6BSgm.d.mts} +3 -3
  53. package/dist/{index-BHdm4Q39.d.mts.map → index-DWQ6BSgm.d.mts.map} +1 -1
  54. package/dist/index.d.mts +4 -4
  55. package/dist/index.mjs +3 -3
  56. package/dist/internal-app-configuration-file.d.mts +19 -0
  57. package/dist/internal-app-configuration-file.d.mts.map +1 -0
  58. package/dist/internal-app-configuration-file.mjs +2 -0
  59. package/dist/{local-target-zSdLvLyy.mjs → local-target-Dd8FJEb5.mjs} +4 -3
  60. package/dist/{local-target-zSdLvLyy.mjs.map → local-target-Dd8FJEb5.mjs.map} +1 -1
  61. package/dist/local-target.d.mts +2 -2
  62. package/dist/local-target.d.mts.map +1 -1
  63. package/dist/local-target.mjs +1 -1
  64. package/dist/{nextjs-DLyeRR7M-CuGngjU4.d.mts → nextjs-DLyeRR7M-RtoHcY1c.d.mts} +3 -3
  65. package/dist/{nextjs-DLyeRR7M-CuGngjU4.d.mts.map → nextjs-DLyeRR7M-RtoHcY1c.d.mts.map} +1 -1
  66. package/dist/nextjs-control.d.mts +4 -4
  67. package/dist/nextjs-control.mjs +2 -2
  68. package/dist/nextjs.d.mts +1 -1
  69. package/dist/node-control.d.mts +3 -3
  70. package/dist/node-control.mjs +2 -2
  71. package/dist/node.d.mts +2 -2
  72. package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts +183 -0
  73. package/dist/redaction-Bf8FvTFH-BTsKD9B5.d.mts.map +1 -0
  74. package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs +295 -0
  75. package/dist/redaction-HnbkSFrK-BXRZ3B33.mjs.map +1 -0
  76. package/dist/report.d.mts +3 -3
  77. package/dist/report.mjs +1 -1
  78. package/dist/report.mjs.map +1 -1
  79. package/dist/{run-alchemy-B-Z6i3cD-C30mHT0u.mjs → run-alchemy-OS_ix5g0-DCvUYZ7T.mjs} +30 -13
  80. package/dist/run-alchemy-OS_ix5g0-DCvUYZ7T.mjs.map +1 -0
  81. package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs → run-report-CmBz2-xc-Cc8rV1CX.mjs} +2 -2
  82. package/dist/{run-report-CmBz2-xc-S50d4g5V.mjs.map → run-report-CmBz2-xc-Cc8rV1CX.mjs.map} +1 -1
  83. package/dist/service-rpc.d.mts +2 -2
  84. package/dist/service-rpc.mjs +2 -2
  85. package/dist/testing.d.mts +1 -1
  86. package/dist/{validate-environment-BNZC6W46-B0ESzFBn.mjs → validate-environment-D_dECxgO-B-gqpVEf.mjs} +76 -13
  87. package/dist/validate-environment-D_dECxgO-B-gqpVEf.mjs.map +1 -0
  88. package/dist/zod.mjs +1 -2
  89. package/dist/zod.mjs.map +1 -1
  90. package/package.json +13 -13
  91. package/skills/prisma-composer-core-concepts/SKILL.md +7 -24
  92. package/src/exports/internal-app-configuration-file.ts +1 -0
  93. package/dist/app-config-BvxeTt2h-CcVmwsq6.d.mts.map +0 -1
  94. package/dist/config-Cn9vjklJ.d.mts +0 -1
  95. package/dist/config-adapters-BA_IeiX0-BiE51GeB.mjs +0 -84
  96. package/dist/config-adapters-BA_IeiX0-BiE51GeB.mjs.map +0 -1
  97. package/dist/config-pools-DiYw7wMu-DzeWrJdm.mjs +0 -63
  98. package/dist/config-pools-DiYw7wMu-DzeWrJdm.mjs.map +0 -1
  99. package/dist/deploy-Cn9vjklJ.d.mts +0 -1
  100. package/dist/deploy.mjs.map +0 -1
  101. package/dist/deployment-summary-Cm4lN6w9-Dc69sCgo.d.mts.map +0 -1
  102. package/dist/deployment-summary-QkZexVIS-DqL4znd4.mjs.map +0 -1
  103. package/dist/describe-kind-Cpm_euxo-JFh8ejof.mjs +0 -14
  104. package/dist/describe-kind-Cpm_euxo-JFh8ejof.mjs.map +0 -1
  105. package/dist/execute-deploy-destroy-Cww6zOSC-CIPx-m4I.mjs.map +0 -1
  106. package/dist/execute-dev-4KYkqSMh-BP9S193k.mjs.map +0 -1
  107. package/dist/graph-CN8VuVZN-Ck2y98XZ.d.mts.map +0 -1
  108. package/dist/graph-gE31_ToO-BouKBfIS.mjs.map +0 -1
  109. package/dist/graph-types-R38xjBnN-cDTIX_rZ.d.mts.map +0 -1
  110. package/dist/internal-pools.d.mts +0 -18
  111. package/dist/internal-pools.d.mts.map +0 -1
  112. package/dist/internal-pools.mjs +0 -2
  113. package/dist/run-alchemy-B-Z6i3cD-C30mHT0u.mjs.map +0 -1
  114. package/dist/secret-DoWGmN7m-CI5Yrldp.mjs.map +0 -1
  115. package/dist/validate-environment-BNZC6W46-B0ESzFBn.mjs.map +0 -1
  116. package/src/exports/internal-pools.ts +0 -1
@@ -1,11 +1,11 @@
1
- import { H as ProvisionNeed, P as NodeId, g as Graph, i as Config, j as ModuleNode, nt as ServiceNode, q as ResourceNode, r as BuildAdapter } from "./graph-types-R38xjBnN-cDTIX_rZ.mjs";
2
- import "./graph-CN8VuVZN-Ck2y98XZ.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-BvxeTt2h.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,8 +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
- /** The config pool Load reads a source's pool key and the root's input from, and the Prisma Cloud serializer reads a service's envParam() leaves from. The generated stack files pass what readConfigPool() returns. */
273
- readonly configPool?: Readonly<Record<string, unknown>>;
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[];
274
276
  readonly bundles: Record<string, Bundle>;
275
277
  /** Alchemy state store for the stack. Defaults to the config's own state layer. */
276
278
  readonly state?: AlchemyStateLayer;
@@ -496,8 +498,10 @@ interface PreflightInput<C = unknown> {
496
498
  readonly container: ContainerInstance | undefined;
497
499
  /** The environment name. */
498
500
  readonly environment: string;
499
- /** The pools the command read for this environment. Preflight fills a missing `envSecret()` platform variable from `pools.secrets` and an `envParam()` param's from `pools.config`. */
500
- readonly pools: ConfigPools;
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;
501
505
  /** What the caller has already authenticated, for the platform calls preflight makes. Absent means the extension falls back to its own credential protocol. */
502
506
  readonly credentials?: ContainerCredentials<C> | undefined;
503
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. */
@@ -675,8 +679,10 @@ interface LocalTargetProvidersInput {
675
679
  readonly container: ContainerInstance | undefined;
676
680
  /** Absolute path of the environment's dev state directory (`devEnvironmentDir`, under the cwd). */
677
681
  readonly devDir: string;
678
- /** The pools the command read for this environment. A local deployment takes the values its rows point at from them. */
679
- readonly pools: ConfigPools;
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;
680
686
  }
681
687
  interface LocalTargetEmulatorsInput {
682
688
  /** The loaded application graph — inspected for which node kinds need an emulator. */
@@ -716,8 +722,10 @@ interface LocalTargetAttachment {
716
722
  readonly address: string;
717
723
  readonly node: ServiceNode;
718
724
  readonly server: DevServer;
719
- /** The pools the command read for this environment. The command takes the values the service's rows point at from them. */
720
- readonly pools: ConfigPools;
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;
721
729
  }): Promise<{
722
730
  readonly restarted: boolean;
723
731
  }>;
@@ -774,40 +782,32 @@ interface ConfigAdapterInput {
774
782
  }
775
783
  /** The values one adapter returns, by name. */
776
784
  type ConfigValues = Readonly<Record<string, unknown>>;
777
- /**
778
- * A function in the `config` or `secrets` list of the `composer` section (ADR-0062):
779
- * it receives the environment and returns that environment's values. Composer calls it
780
- * in the CLI and again in the deploy engine's process, so it must return the same
781
- * values for the same environment both times.
782
- */
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. */
783
786
  type ConfigAdapter = (input: ConfigAdapterInput) => ConfigValues | Promise<ConfigValues>;
784
- /** What the `config` adapters return, merged by top-level key, a later adapter winning: the root's input, and what `envParam()` reads. */
785
- type ConfigPool = Readonly<Record<string, unknown>>;
786
- /** What the `secrets` adapters return, merged the same way. Every value is text. Only preflight and local dev read it; it is never logged, reported or written anywhere but the platform variable it fills. */
787
- type SecretsPool = Readonly<Record<string, string>>;
788
- /** The two pools one command read for one environment. */
789
- interface ConfigPools {
790
- readonly config: ConfigPool;
791
- readonly secrets: SecretsPool;
792
- }
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>>;
793
793
  /**
794
794
  * The config file's default export. `extensions` lists every extension the
795
795
  * app deploys through; `state` is the ONE state store per deploy — explicit,
796
796
  * platform-agnostic, never defaulted by an extension. `config` and `secrets`
797
- * list the adapters the two pools come from.
797
+ * list the adapters the app configuration and the app secrets come from.
798
798
  */
799
799
  interface PrismaAppConfig {
800
800
  /** The module whose default export is the app root, relative to `prisma.config.ts`. `--entry` overrides it. */
801
801
  readonly entry?: string;
802
802
  readonly extensions: ExtensionDescriptor[];
803
803
  readonly state: StateDescriptor;
804
- /** Where the config pool comes from. Defaults to `[environmentVariables()]`; a list given here replaces the default. */
804
+ /** Where the app configuration comes from. Defaults to `[environmentVariables()]`; a list given here replaces the default. */
805
805
  readonly config?: readonly ConfigAdapter[];
806
- /** Where the secrets pool comes from. Defaults to `[environmentVariables()]`; a list given here replaces the default. */
806
+ /** Where the app secrets come from. Defaults to `[environmentVariables()]`; a list given here replaces the default. */
807
807
  readonly secrets?: readonly ConfigAdapter[];
808
808
  }
809
809
  /** Typed identity — exists so the `composer` section of `prisma.config.ts` gets checked against PrismaAppConfig where it is written. */
810
810
  declare function defineConfig(config: PrismaAppConfig): PrismaAppConfig;
811
811
  //#endregion
812
- export { StateDescriptor as $, LocalTargetProvidersInput as A, PreflightInput as B, LocalNodeStopped as C, LocalTargetCurrentInput as D, LocalTargetCurrentApp as E, LoweredResult as F, ReportAttachInput as G, PrismaAppConfig as H, Lowering as I, RunOutcome as J, ReportBeginInput as K, NodeDescriptor as L, LowerContext as M, LowerError as N, LocalTargetDescriptor as O, LowerOptions as P, ServiceLowering as Q, Outputs as R, LocalNodeLocation as S, LocalTargetAttachment as T, ProvisionEdge as U, PreflightPayload as V, ProvisionerDescriptor as W, SecretsPool as X, RunReporter as Y, ServeInput as Z, DeployedNode as _, Bundle as a, defineConfig as at, ExtensionDescriptor as b, ConfigPool 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, AssembleInput as i, containerEnvVarName as it, LocateContainerInput as j, LocalTargetEmulatorsInput as k, ConfigPools as l, joinDeployment as lt, DEV_DIR as m, preflightEnvVarName as mt, ApplicationDescriptor as n, connectionInputs as nt, ConfigAdapter as o, deserializeContainers as ot, ContainerInstance as p, preflightEnv as pt, ReporterDescriptor as q, Artifact as r, containerEnv as rt, ConfigAdapterInput 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, PackageInput as z };
813
- //# sourceMappingURL=app-config-BvxeTt2h-CcVmwsq6.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":";;;;;;;;;;;;;;;;;;;;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EC,WAAW;;WAEX;;WAEA,sBAAsB,SAAS;;WAE/B,cAAc;;UAEf;;WAEC,OAAO;WACP,WAAW;;WAEX;;UAED;WACC,WAAW;;WAEX;;UAED;;EAER,iBAAiB;;EAEjB,aAAa;aACF;aACA;;;EAGX,KAAK,QAAQ,aAAa;aACf;aACA;MACP;aACO;aACA;;;;;;;;EAQX,OAAO;aACI;aACA,MAAM;aACN,QAAQ;;aAER,eAAe;;aAEf,SAAS;MAChB;aACO;;;EAGX,WAAW;;;cAGC;;;;;;iBAMG,kBAAkB;;;;;;cAMrB;;;;;;;;;iBASG,qBAAqB,WAAW;;;;;;KAM5C;WACM;IACP;WACO;IACP;WACO;EACT,SAAS,OAAO,gBAAgB,QAAQ;;;;;EAKxC,OAAO,OAAO,aAAa,QAAQ;;;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,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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"}
package/dist/arktype.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
- import { a as isSecretPointer, i as isPlainPointer, n as isSecretString } from "./secret-DoWGmN7m-CI5Yrldp.mjs";
3
- import { t as describeKind } from "./describe-kind-Cpm_euxo-JFh8ejof.mjs";
2
+ import { a as isPlainPointer, o as isSecretPointer, r as isSecretString, t as describeKind } from "./describe-kind-Cpm_euxo-CkhlGJUL.mjs";
4
3
  import { type } from "arktype";
5
4
  //#region ../../0-framework/0-foundation/foundation/dist/arktype.mjs
6
5
  /**
@@ -1 +1 @@
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"}
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,18 +1,16 @@
1
- import { $ as StateDescriptor, A as LocalTargetProvidersInput, B as PreflightInput, C as LocalNodeStopped, D as LocalTargetCurrentInput, E as LocalTargetCurrentApp, G as ReportAttachInput, H as PrismaAppConfig, J as RunOutcome, K as ReportBeginInput, L as NodeDescriptor, O as LocalTargetDescriptor, S as LocalNodeLocation, T as LocalTargetAttachment, V as PreflightPayload, X as SecretsPool, Y as RunReporter, at as defineConfig, b as ExtensionDescriptor, c as ConfigPool, 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 ConfigPools, m as DEV_DIR, mt as preflightEnvVarName, o as ConfigAdapter, ot as deserializeContainers, p as ContainerInstance, pt as preflightEnv, q as ReporterDescriptor, rt as containerEnv, s as ConfigAdapterInput, st as devEnvironmentDir, u as ConfigValues, w as LocalTargetAttachInput, x as LocalNodeCondition } from "./app-config-BvxeTt2h-CcVmwsq6.mjs";
2
- import "./config-Cn9vjklJ.mjs";
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
3
  //#region ../../0-framework/3-tooling/cli/dist/config.d.mts
4
4
  //#region src/config-adapters.d.ts
5
- /**
6
- * Reads the process environment when called: every variable whose value is a string,
7
- * except Composer's own `PRISMA_COMPOSER_` variables. The default for both `config` and `secrets`.
8
- */
5
+ /** Reads the process environment when called: every variable whose value is a string. The default for both `config` and `secrets`. */
9
6
  declare function environmentVariables(): ConfigAdapter;
10
7
  /**
11
8
  * Reads `.env`, `.env.local`, `.env.<environment>` and `.env.<environment>.local` from the
12
- * directory of prisma.config.ts, a later file winning. A missing file is skipped. It does
13
- * not read the process environment.
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.
14
12
  */
15
13
  declare function dotenv(): ConfigAdapter;
16
14
  //#endregion
17
- export { ConfigAdapter, ConfigAdapterInput, ConfigPool, ConfigPools, 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, NodeDescriptor, PreflightInput, type PreflightPayload, PrismaAppConfig, ReportAttachInput, ReportBeginInput, ReporterDescriptor, RunOutcome, RunReporter, SecretsPool, StateDescriptor, TeardownInput, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, devEnvironmentDir, dotenv, environmentVariables, isBuildOnlyExtension, preflightEnv, preflightEnvVarName, readPreflightPayload };
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 };
18
16
  //# sourceMappingURL=config.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.mts","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/config.d.mts"],"mappings":";;;;;;;;iBAMiB,wBAAwB;;;;;;iBAMxB,UAAU"}
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,4 @@
1
- import { n as dotenv, r as environmentVariables } from "./config-adapters-BA_IeiX0-BiE51GeB.mjs";
1
+ import { n as environmentVariables, t as dotenv } from "./config-adapters-DG-uhGfv-Bt1M9f8b.mjs";
2
2
  import { n as containerEnvVarName, r as deserializeContainers, t as containerEnv } from "./container-transport-HcvNOGZL-twPi2TIv.mjs";
3
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";
4
4
  import { n as preflightEnvVarName, r as readPreflightPayload, t as preflightEnv } from "./config-BFuriECI.mjs";