@powerlines/plugin-env 0.15.140 → 0.15.142

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 (209) hide show
  1. package/dist/automd-generator-BNg74tyV.cjs +37 -0
  2. package/dist/automd-generator-DoKLIMuw.mjs +32 -0
  3. package/dist/automd-generator-DoKLIMuw.mjs.map +1 -0
  4. package/dist/babel/index.cjs +5 -2
  5. package/dist/babel/index.d.cts +14 -1
  6. package/dist/babel/index.d.mts +14 -1
  7. package/dist/babel/index.mjs +4 -1
  8. package/dist/babel/plugin.cjs +4 -140
  9. package/dist/babel/plugin.d.cts +14 -7
  10. package/dist/babel/plugin.d.mts +14 -7
  11. package/dist/babel/plugin.mjs +3 -138
  12. package/dist/babel-BZqmdVF4.cjs +0 -0
  13. package/dist/babel-DgietUY3.mjs +1 -0
  14. package/dist/chunk-CNVrAnJR.cjs +48 -0
  15. package/dist/{_virtual/rolldown_runtime.cjs → chunk-CsF2CmBJ.mjs} +6 -2
  16. package/dist/components/docs.cjs +13 -69
  17. package/dist/components/docs.d.cts +1 -21
  18. package/dist/components/docs.d.mts +1 -21
  19. package/dist/components/docs.mjs +12 -67
  20. package/dist/components/env.cjs +13 -588
  21. package/dist/components/env.d.cts +1 -19
  22. package/dist/components/env.d.mts +1 -19
  23. package/dist/components/env.mjs +11 -584
  24. package/dist/components/index.cjs +17 -5
  25. package/dist/components/index.d.cts +3 -2
  26. package/dist/components/index.d.mts +3 -2
  27. package/dist/components/index.mjs +14 -2
  28. package/dist/components-BUo6Koax.cjs +0 -0
  29. package/dist/components-DDFmImcI.mjs +1 -0
  30. package/dist/confbox.DA7CpUDY-DShUZ_rW.mjs +23 -0
  31. package/dist/confbox.DA7CpUDY-DShUZ_rW.mjs.map +1 -0
  32. package/dist/confbox.DA7CpUDY-r6FXRsI6.cjs +28 -0
  33. package/dist/confbox.DnMsyigM-C13n3X-S.cjs +415 -0
  34. package/dist/confbox.DnMsyigM-V6Wj0LPC.mjs +405 -0
  35. package/dist/confbox.DnMsyigM-V6Wj0LPC.mjs.map +1 -0
  36. package/dist/create-reflection-resource-B3friIs9.mjs +98 -0
  37. package/dist/create-reflection-resource-B3friIs9.mjs.map +1 -0
  38. package/dist/create-reflection-resource-BJj83ii4.cjs +103 -0
  39. package/dist/create-reflection-resource-DSLbLsX2.d.cts +16 -0
  40. package/dist/create-reflection-resource-DSLbLsX2.d.cts.map +1 -0
  41. package/dist/create-reflection-resource-DwWJAo-G.d.mts +16 -0
  42. package/dist/create-reflection-resource-DwWJAo-G.d.mts.map +1 -0
  43. package/dist/defu-CrqNIh1A.cjs +227 -0
  44. package/dist/defu-DV5Grr85.mjs +180 -0
  45. package/dist/defu-DV5Grr85.mjs.map +1 -0
  46. package/dist/dist-BQc8ZRwl.cjs +13 -0
  47. package/dist/dist-C_a6goTt.cjs +15282 -0
  48. package/dist/dist-CjWvISyq.mjs +15271 -0
  49. package/dist/dist-CjWvISyq.mjs.map +1 -0
  50. package/dist/dist-mV5Swt78.mjs +13 -0
  51. package/dist/dist-mV5Swt78.mjs.map +1 -0
  52. package/dist/docs-B-SDRHeg.cjs +75 -0
  53. package/dist/docs-B0d8pdIg.d.mts +23 -0
  54. package/dist/docs-B0d8pdIg.d.mts.map +1 -0
  55. package/dist/docs-DMfzQuvP.d.cts +23 -0
  56. package/dist/docs-DMfzQuvP.d.cts.map +1 -0
  57. package/dist/docs-DbRoWmL_.mjs +70 -0
  58. package/dist/docs-DbRoWmL_.mjs.map +1 -0
  59. package/dist/docs-helper-2fe7M3Th.mjs +24 -0
  60. package/dist/docs-helper-2fe7M3Th.mjs.map +1 -0
  61. package/dist/docs-helper-4MoQ5-R3.cjs +28 -0
  62. package/dist/env-BIyd8CTA.d.cts +21 -0
  63. package/dist/env-BIyd8CTA.d.cts.map +1 -0
  64. package/dist/env-BKmI7DyR.d.mts +21 -0
  65. package/dist/env-BKmI7DyR.d.mts.map +1 -0
  66. package/dist/env-D9oCn-AS.mjs +587 -0
  67. package/dist/env-D9oCn-AS.mjs.map +1 -0
  68. package/dist/env-R63eR4RP.cjs +598 -0
  69. package/dist/helpers/automd-generator.cjs +3 -31
  70. package/dist/helpers/automd-generator.d.cts +2 -1
  71. package/dist/helpers/automd-generator.d.cts.map +1 -0
  72. package/dist/helpers/automd-generator.d.mts +2 -1
  73. package/dist/helpers/automd-generator.d.mts.map +1 -0
  74. package/dist/helpers/automd-generator.mjs +2 -29
  75. package/dist/helpers/create-reflection-resource.cjs +11 -97
  76. package/dist/helpers/create-reflection-resource.d.cts +3 -14
  77. package/dist/helpers/create-reflection-resource.d.mts +3 -14
  78. package/dist/helpers/create-reflection-resource.mjs +10 -95
  79. package/dist/helpers/docs-helper.cjs +5 -23
  80. package/dist/helpers/docs-helper.d.cts +4 -2
  81. package/dist/helpers/docs-helper.d.cts.map +1 -0
  82. package/dist/helpers/docs-helper.d.mts +4 -2
  83. package/dist/helpers/docs-helper.d.mts.map +1 -0
  84. package/dist/helpers/docs-helper.mjs +4 -21
  85. package/dist/helpers/index.cjs +38 -32
  86. package/dist/helpers/index.d.cts +9 -6
  87. package/dist/helpers/index.d.mts +9 -6
  88. package/dist/helpers/index.mjs +12 -6
  89. package/dist/helpers/load.cjs +10 -134
  90. package/dist/helpers/load.d.cts +3 -34
  91. package/dist/helpers/load.d.mts +3 -34
  92. package/dist/helpers/load.mjs +8 -130
  93. package/dist/helpers/persistence.cjs +15 -321
  94. package/dist/helpers/persistence.d.cts +3 -83
  95. package/dist/helpers/persistence.d.mts +3 -83
  96. package/dist/helpers/persistence.mjs +4 -308
  97. package/dist/helpers/reflect.cjs +13 -262
  98. package/dist/helpers/reflect.d.cts +3 -45
  99. package/dist/helpers/reflect.d.mts +3 -45
  100. package/dist/helpers/reflect.mjs +4 -252
  101. package/dist/helpers/source-file-env.cjs +3 -57
  102. package/dist/helpers/source-file-env.d.cts +1 -7
  103. package/dist/helpers/source-file-env.d.mts +1 -7
  104. package/dist/helpers/source-file-env.mjs +1 -54
  105. package/dist/helpers/template-helpers.cjs +6 -69
  106. package/dist/helpers/template-helpers.d.cts +3 -14
  107. package/dist/helpers/template-helpers.d.mts +3 -14
  108. package/dist/helpers/template-helpers.mjs +5 -67
  109. package/dist/helpers-45e1bvAO.mjs +1 -0
  110. package/dist/helpers-DgYP3uej.cjs +0 -0
  111. package/dist/index-BNRXMhlr.d.mts +1 -0
  112. package/dist/index-Bdi8CvaN.d.cts +16 -0
  113. package/dist/index-Bdi8CvaN.d.cts.map +1 -0
  114. package/dist/index-CEDY7cmG.d.cts +1 -0
  115. package/dist/index-CREkvfw9.d.mts +1 -0
  116. package/dist/index-DSiHnMH2.d.cts +1 -0
  117. package/dist/index-Drhzdkqe.d.mts +16 -0
  118. package/dist/index-Drhzdkqe.d.mts.map +1 -0
  119. package/dist/index-dhjtMp5F.d.mts +1 -0
  120. package/dist/index-uTS5iDq_.d.cts +1 -0
  121. package/dist/index.cjs +257 -98
  122. package/dist/index.d.cts +14 -23
  123. package/dist/index.d.mts +14 -23
  124. package/dist/index.mjs +184 -23
  125. package/dist/index.mjs.map +1 -0
  126. package/dist/join-paths-BMg51Ddi.mjs +148 -0
  127. package/dist/join-paths-BMg51Ddi.mjs.map +1 -0
  128. package/dist/join-paths-Bc4rM2TX.cjs +159 -0
  129. package/dist/json5-DEV_07Nb.cjs +786 -0
  130. package/dist/json5-jq90mF9X.mjs +787 -0
  131. package/dist/json5-jq90mF9X.mjs.map +1 -0
  132. package/dist/jsonc-CBh70baJ.cjs +4 -0
  133. package/dist/jsonc-CDLU6bgi.mjs +4 -0
  134. package/dist/load-DPB0maqs.cjs +6594 -0
  135. package/dist/load-Dr5ybfL7.mjs +6579 -0
  136. package/dist/load-Dr5ybfL7.mjs.map +1 -0
  137. package/dist/load-GpP6cojj.d.mts +36 -0
  138. package/dist/load-GpP6cojj.d.mts.map +1 -0
  139. package/dist/load-PHGmxX_X.d.cts +36 -0
  140. package/dist/load-PHGmxX_X.d.cts.map +1 -0
  141. package/dist/multipart-parser-D65rtMfY.mjs +176 -0
  142. package/dist/multipart-parser-D65rtMfY.mjs.map +1 -0
  143. package/dist/multipart-parser-aEF5a4Xf.cjs +178 -0
  144. package/dist/node-Co8KdzkZ.cjs +3985 -0
  145. package/dist/node-D9MigVDD.mjs +3975 -0
  146. package/dist/node-D9MigVDD.mjs.map +1 -0
  147. package/dist/persistence-BR4cUaN6.d.cts +85 -0
  148. package/dist/persistence-BR4cUaN6.d.cts.map +1 -0
  149. package/dist/persistence-BsBxs9wt.mjs +586 -0
  150. package/dist/persistence-BsBxs9wt.mjs.map +1 -0
  151. package/dist/persistence-D_clXRxP.cjs +712 -0
  152. package/dist/persistence-DrKQZNCv.d.mts +85 -0
  153. package/dist/persistence-DrKQZNCv.d.mts.map +1 -0
  154. package/dist/plugin-CM1TSv1B.cjs +159 -0
  155. package/dist/plugin-CSVnrdpE.cjs +146 -0
  156. package/dist/plugin-CSe5f2cD.d.cts +155 -0
  157. package/dist/plugin-CSe5f2cD.d.cts.map +1 -0
  158. package/dist/plugin-DMbVjdcQ.d.mts +155 -0
  159. package/dist/plugin-DMbVjdcQ.d.mts.map +1 -0
  160. package/dist/plugin-Vyvy9w9Z.mjs +141 -0
  161. package/dist/plugin-Vyvy9w9Z.mjs.map +1 -0
  162. package/dist/plugin-eBjQJP6x.mjs +130 -0
  163. package/dist/plugin-eBjQJP6x.mjs.map +1 -0
  164. package/dist/reflect-Dm8a3c29.d.cts +47 -0
  165. package/dist/reflect-Dm8a3c29.d.cts.map +1 -0
  166. package/dist/reflect-Dpz8ifa0.d.mts +47 -0
  167. package/dist/reflect-Dpz8ifa0.d.mts.map +1 -0
  168. package/dist/runtime-BDzzR4wH.d.cts +792 -0
  169. package/dist/runtime-BDzzR4wH.d.cts.map +1 -0
  170. package/dist/runtime-C5ukCv3P.mjs +242 -0
  171. package/dist/runtime-C5ukCv3P.mjs.map +1 -0
  172. package/dist/runtime-g0TEIoZK.cjs +253 -0
  173. package/dist/runtime-lYSIZdMn.d.mts +792 -0
  174. package/dist/runtime-lYSIZdMn.d.mts.map +1 -0
  175. package/dist/source-file-env-4Vdtzc5-.cjs +68 -0
  176. package/dist/source-file-env-Brfopjyr.d.cts +9 -0
  177. package/dist/source-file-env-Brfopjyr.d.cts.map +1 -0
  178. package/dist/source-file-env-DWejSP2U.d.mts +9 -0
  179. package/dist/source-file-env-DWejSP2U.d.mts.map +1 -0
  180. package/dist/source-file-env-Tj-6qobx.mjs +57 -0
  181. package/dist/source-file-env-Tj-6qobx.mjs.map +1 -0
  182. package/dist/template-helpers-1SKodHKt.d.mts +16 -0
  183. package/dist/template-helpers-1SKodHKt.d.mts.map +1 -0
  184. package/dist/template-helpers-CCEjhw1B.mjs +70 -0
  185. package/dist/template-helpers-CCEjhw1B.mjs.map +1 -0
  186. package/dist/template-helpers-YVcwxmoF.cjs +75 -0
  187. package/dist/template-helpers-zyitPfMz.d.cts +16 -0
  188. package/dist/template-helpers-zyitPfMz.d.cts.map +1 -0
  189. package/dist/toml-DvrxV201.cjs +657 -0
  190. package/dist/toml-uuOYvEAO.mjs +658 -0
  191. package/dist/toml-uuOYvEAO.mjs.map +1 -0
  192. package/dist/types/index.cjs +10 -9
  193. package/dist/types/index.d.cts +3 -2
  194. package/dist/types/index.d.mts +3 -2
  195. package/dist/types/index.mjs +3 -2
  196. package/dist/types/plugin.cjs +7 -133
  197. package/dist/types/plugin.d.cts +2 -153
  198. package/dist/types/plugin.d.mts +2 -153
  199. package/dist/types/plugin.mjs +2 -127
  200. package/dist/types/runtime.cjs +3 -242
  201. package/dist/types/runtime.d.cts +1 -790
  202. package/dist/types/runtime.d.mts +1 -790
  203. package/dist/types/runtime.mjs +1 -239
  204. package/dist/types-DyPQho_C.mjs +1 -0
  205. package/dist/types-o3zWarRp.cjs +0 -0
  206. package/dist/yaml-CIn2Gddw.mjs +1055 -0
  207. package/dist/yaml-CIn2Gddw.mjs.map +1 -0
  208. package/dist/yaml-CQSFMRMS.cjs +1054 -0
  209. package/package.json +9 -9
@@ -0,0 +1,85 @@
1
+ import { a as EnvType, r as EnvPluginResolvedConfig, t as EnvPluginContext } from "./plugin-CSe5f2cD.cjs";
2
+ import { TypeDefinition } from "@stryke/types/configuration";
3
+ import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
4
+ import { Context, UnresolvedContext } from "powerlines/types/context";
5
+
6
+ //#region src/helpers/persistence.d.ts
7
+
8
+ /**
9
+ * Resolves the runtime type definition file for the environment variables.
10
+ *
11
+ * @param context - The plugin context.
12
+ * @returns The runtime type definition file for the environment variables.
13
+ */
14
+ declare function resolveRuntimeTypeFile(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<string>;
15
+ /**
16
+ * Gets the default type definition for the environment variables.
17
+ *
18
+ * @param context - The plugin context.
19
+ * @returns The default type definition for the environment variables.
20
+ */
21
+ declare function getEnvDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
22
+ /** Gets the default type definition for the environment secrets.
23
+ *
24
+ * @param context - The plugin context.
25
+ * @returns The default type definition for the environment secrets.
26
+ */
27
+ declare function getSecretsDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
28
+ /**
29
+ * Gets the path to the environment type reflections.
30
+ *
31
+ * @param context - The plugin context.
32
+ * @param name - The name of the type reflections.
33
+ * @returns The path to the environment type reflections.
34
+ */
35
+ declare function getEnvTypeReflectionsPath(context: Context<EnvPluginResolvedConfig>, name?: EnvType): string;
36
+ /**
37
+ * Reads the environment type reflection from the file system.
38
+ *
39
+ * @param context - The plugin context.
40
+ * @param name - The name of the type reflections.
41
+ * @returns The environment type reflection.
42
+ */
43
+ declare function readEnvTypeReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
44
+ /**
45
+ * Writes the environment type reflection to the file system.
46
+ *
47
+ * @param context - The plugin context.
48
+ * @param reflection - The environment type reflection to write.
49
+ * @param name - The name of the type reflections.
50
+ */
51
+ declare function writeEnvTypeReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
52
+ declare function getEnvReflectionsPath(context: EnvPluginContext, name: EnvType): string;
53
+ /**
54
+ * Reads the environment reflection data from the file system.
55
+ *
56
+ * @param context - The plugin context.
57
+ * @returns The environment reflection data.
58
+ */
59
+ declare function readEnvReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
60
+ /**
61
+ * Reads the secret environment reflection data from the file system.
62
+ *
63
+ * @param context - The plugin context.
64
+ * @returns The environment reflection data.
65
+ */
66
+ declare function readSecretsReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
67
+ /**
68
+ * Writes the environment reflection data to the file system.
69
+ *
70
+ * @param context - The plugin context.
71
+ * @param reflection - The reflection data to write.
72
+ * @param name - The name of the reflection (either "env" or "secrets").
73
+ */
74
+ declare function writeEnvReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
75
+ /**
76
+ * Writes the environment reflection data to the file system.
77
+ *
78
+ * @param context - The plugin context.
79
+ * @param reflection - The reflection data to write.
80
+ * @param name - The name of the reflection (either "env" or "secrets").
81
+ */
82
+ declare function writeEnvReflectionSync(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): void;
83
+ //#endregion
84
+ export { readEnvReflection as a, resolveRuntimeTypeFile as c, writeEnvTypeReflection as d, getSecretsDefaultTypeDefinition as i, writeEnvReflection as l, getEnvReflectionsPath as n, readEnvTypeReflection as o, getEnvTypeReflectionsPath as r, readSecretsReflection as s, getEnvDefaultTypeDefinition as t, writeEnvReflectionSync as u };
85
+ //# sourceMappingURL=persistence-BR4cUaN6.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence-BR4cUaN6.d.cts","names":[],"sources":["../src/helpers/persistence.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAoDA;;;;AAEU,iBAFY,sBAAA,CAEZ,OAAA,EADC,iBACD,CADmB,uBACnB,CAAA,CAAA,EAAP,OAAO,CAAA,MAAA,CAAA;AAmBV;;;;;;AAcsB,iBAdA,2BAAA,CAc+B,OAAA,EAb1C,iBAa0C,CAbxB,uBAawB,CAAA,CAAA,EAZlD,OAYkD,CAZ1C,cAY0C,CAAA;;;;;;AAgBrC,iBAhBM,+BAAA,CAgBmB,OAAA,EAf9B,iBAe8B,CAfZ,uBAeY,CAAA,CAAA,EAdtC,OAcsC,CAd9B,cAc8B,CAAA;;;;;AAczC;;;AAGW,iBAjBK,yBAAA,CAiBL,OAAA,EAhBA,OAgBA,CAhBQ,uBAgBR,CAAA,EAAA,IAAA,CAAA,EAfH,OAeG,CAAA,EAAA,MAAA;;;AAuCX;;;;;AAGuB,iBA7CD,qBAAA,CA6CC,OAAA,EA5CZ,gBA4CY,EAAA,IAAA,CAAA,EA3Cf,OA2Ce,CAAA,EA1CpB,OA0CoB,CA1CZ,eA0CY,CAAA,GAAA,CAAA,CAAA;AAevB;AAaA;;;;;AAyDA;AACW,iBAzFW,sBAAA,CAyFX,OAAA,EAxFA,gBAwFA,EAAA,UAAA,EAvFG,eAuFH,CAAA,GAAA,CAAA,EAAA,IAAA,CAAA,EAtFH,OAsFG,CAAA,EAtFY,OAsFZ,CAAA,IAAA,CAAA;AACA,iBAxEK,qBAAA,CAwEL,OAAA,EAvEA,gBAuEA,EAAA,IAAA,EAtEH,OAsEG,CAAA,EAAA,MAAA;;;AA2DX;;;;AAGuB,iBAzHD,iBAAA,CAyHC,OAAA,EAxHZ,gBAwHY,CAAA,EAvHpB,OAuHoB,CAvHZ,eAuHY,CAAA,GAAA,CAAA,CAAA;;AAsBvB;;;;;iBAtFsB,qBAAA,UACX,mBACR,QAAQ;;;;;;;;iBA2DW,kBAAA,UACX,8BACG,6BACN,UAAe;;;;;;;;iBAsBP,sBAAA,UACL,8BACG,6BACN"}
@@ -0,0 +1,586 @@
1
+ import { n as __ΩSecretsInterface, t as __ΩEnvInterface } from "./runtime-C5ukCv3P.mjs";
2
+ import { a as __ΩEnvType, r as __ΩEnvPluginResolvedConfig, t as __ΩEnvPluginContext } from "./plugin-eBjQJP6x.mjs";
3
+ import { n as slash, t as joinPaths } from "./join-paths-BMg51Ddi.mjs";
4
+ import { ReflectionClass, ReflectionKind, __ΩTypeClass, __ΩTypeObjectLiteral, deserializeType, merge, resolveClassType } from "@powerlines/deepkit/vendor/type";
5
+ import { titleCase } from "@stryke/string-format/title-case";
6
+ import { __ΩContext, __ΩUnresolvedContext } from "powerlines/types/context";
7
+ import { convertFromCapnp, convertToCapnp } from "@powerlines/deepkit/capnp";
8
+ import { getReflectionsPath } from "@powerlines/deepkit/resolve-reflections";
9
+ import { SerializedTypes } from "@powerlines/deepkit/schemas/reflection";
10
+ import * as capnp from "@stryke/capnp";
11
+ import { readFileBuffer, writeFileBuffer, writeFileBufferSync } from "@stryke/fs/buffer";
12
+ import { isEmptyObject } from "@stryke/type-checks/is-empty-object";
13
+ import { existsSync } from "node:fs";
14
+ import { reflectType } from "@powerlines/deepkit/reflect-type";
15
+
16
+ //#region ../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/is-parent-path.mjs
17
+ /**
18
+ * Check if a given path is a parent of another path.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project/src");
23
+ * // returns true
24
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project");
25
+ * // returns true
26
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/other");
27
+ * // returns false
28
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/other");
29
+ * // returns false
30
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/index.ts");
31
+ * // returns false
32
+ * ```
33
+ *
34
+ * @param childPath - The path to check if it is a child of the parent path.
35
+ * @param parentPath - The path to check if it is a parent of the child path.
36
+ * @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
37
+ */
38
+ function isParentPath(childPath, parentPath) {
39
+ const normalizedChild = slash(childPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
40
+ const normalizedParent = slash(parentPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
41
+ return childPath !== parentPath && normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
42
+ }
43
+
44
+ //#endregion
45
+ //#region src/helpers/reflect.ts
46
+ function __assignType(fn, args) {
47
+ fn.__type = args;
48
+ return fn;
49
+ }
50
+ function mergeEnvReflections(context, reflections) {
51
+ return createEnvReflection(context, { type: merge(reflections.map(__assignType((reflection) => reflection.type, [
52
+ "reflection",
53
+ "",
54
+ "P\"2!\"/\""
55
+ ]))) });
56
+ }
57
+ mergeEnvReflections.__type = [
58
+ () => __ΩEnvPluginContext,
59
+ "context",
60
+ () => ReflectionClass,
61
+ "reflections",
62
+ () => ReflectionClass,
63
+ "mergeEnvReflections",
64
+ "Pn!2\"P\"7#F2$P\"7%/&"
65
+ ];
66
+ function mergeSecretsReflections(context, reflections) {
67
+ return createSecretsReflection(context, { type: merge(reflections.map(__assignType((reflection) => reflection.type, [
68
+ "reflection",
69
+ "",
70
+ "P\"2!\"/\""
71
+ ]))) });
72
+ }
73
+ mergeSecretsReflections.__type = [
74
+ () => __ΩEnvPluginContext,
75
+ "context",
76
+ () => ReflectionClass,
77
+ "reflections",
78
+ () => ReflectionClass,
79
+ "mergeSecretsReflections",
80
+ "Pn!2\"P\"7#F2$P\"7%/&"
81
+ ];
82
+ const __ΩCreateEnvReflectionOptions = [
83
+ () => __ΩTypeObjectLiteral,
84
+ () => __ΩTypeClass,
85
+ "type",
86
+ () => ReflectionClass,
87
+ "superReflection",
88
+ "CreateEnvReflectionOptions",
89
+ "PPn!n\"J4#8P\"7$4%8Mw&y"
90
+ ];
91
+ var BaseEnv = class {
92
+ PLATFORM = "neutral";
93
+ MODE = "production";
94
+ DEBUG = false;
95
+ TEST = false;
96
+ MINIMAL = false;
97
+ NO_COLOR = false;
98
+ FORCE_COLOR = false;
99
+ FORCE_HYPERLINK = false;
100
+ STACKTRACE = false;
101
+ INCLUDE_ERROR_DATA = false;
102
+ CI = false;
103
+ static __type = [
104
+ "APP_NAME",
105
+ "APP_VERSION",
106
+ "BUILD_ID",
107
+ "BUILD_TIMESTAMP",
108
+ "BUILD_CHECKSUM",
109
+ "RELEASE_ID",
110
+ "RELEASE_TAG",
111
+ "ORGANIZATION",
112
+ "node",
113
+ "browser",
114
+ "neutral",
115
+ "PLATFORM",
116
+ function() {
117
+ return "neutral";
118
+ },
119
+ "development",
120
+ "test",
121
+ "production",
122
+ "MODE",
123
+ function() {
124
+ return "production";
125
+ },
126
+ "ENVIRONMENT",
127
+ "DEBUG",
128
+ function() {
129
+ return false;
130
+ },
131
+ "TEST",
132
+ function() {
133
+ return false;
134
+ },
135
+ "MINIMAL",
136
+ function() {
137
+ return false;
138
+ },
139
+ "NO_COLOR",
140
+ function() {
141
+ return false;
142
+ },
143
+ "FORCE_COLOR",
144
+ function() {
145
+ return false;
146
+ },
147
+ "FORCE_HYPERLINK",
148
+ function() {
149
+ return false;
150
+ },
151
+ "STACKTRACE",
152
+ function() {
153
+ return false;
154
+ },
155
+ "INCLUDE_ERROR_DATA",
156
+ function() {
157
+ return false;
158
+ },
159
+ "ERROR_URL",
160
+ "DEFAULT_TIMEZONE",
161
+ "DEFAULT_LOCALE",
162
+ "CI",
163
+ function() {
164
+ return false;
165
+ },
166
+ () => __ΩEnvInterface,
167
+ "BaseEnv",
168
+ "&3!&3\"&3#&3$&3%&3&&3'&3(P.).*.+J3,>-P.../.0J31>2&33)34>5)36>7)38>9)3:>;P')J3<>=P')J3>>?)3@>A)3B>C&3D&3E&3F)3G>H5nIx\"wJ"
169
+ ];
170
+ };
171
+ var BaseSecrets = class {
172
+ static __type = [
173
+ "ENCRYPTION_KEY",
174
+ () => __ΩSecretsInterface,
175
+ "BaseSecrets",
176
+ "&3!5n\"x\"w#"
177
+ ];
178
+ };
179
+ function createEnvReflection(context, options = {}) {
180
+ const parent = options.superReflection ?? new ReflectionClass({
181
+ kind: ReflectionKind.class,
182
+ description: `The base environment configuration definition for the ${titleCase(context.config.name)} project.`,
183
+ classType: BaseEnv,
184
+ types: [],
185
+ implements: [{
186
+ kind: ReflectionKind.objectLiteral,
187
+ typeName: "EnvInterface",
188
+ description: `The environment configuration interface definition for the ${titleCase(context.config.name)} project.`,
189
+ types: []
190
+ }]
191
+ });
192
+ parent.name = "Env";
193
+ const result = new ReflectionClass(options.type ?? {
194
+ kind: ReflectionKind.objectLiteral,
195
+ typeName: "Env",
196
+ description: `A schema describing the list of available environment variables that can be used by the ${context.config.name ? `${titleCase(context.config.name)} application` : "application"}.`,
197
+ types: []
198
+ }, parent);
199
+ result.name = "Env";
200
+ return result;
201
+ }
202
+ createEnvReflection.__type = [
203
+ () => __ΩEnvPluginContext,
204
+ "context",
205
+ () => __ΩCreateEnvReflectionOptions,
206
+ "options",
207
+ () => ({}),
208
+ () => ReflectionClass,
209
+ "createEnvReflection",
210
+ "Pn!2\"n#2$>%P\"7&/'"
211
+ ];
212
+ function createSecretsReflection(context, options = {}) {
213
+ const parent = options.superReflection ?? new ReflectionClass({
214
+ kind: ReflectionKind.class,
215
+ description: `The base secrets configuration definition for the ${titleCase(context.config.name)} project.`,
216
+ classType: BaseSecrets,
217
+ types: [],
218
+ implements: [{
219
+ kind: ReflectionKind.objectLiteral,
220
+ typeName: "SecretsInterface",
221
+ description: `The secrets configuration interface definition for the ${titleCase(context.config.name)} project.`,
222
+ types: []
223
+ }]
224
+ });
225
+ parent.name = "Secrets";
226
+ const result = new ReflectionClass(options.type ?? {
227
+ kind: ReflectionKind.objectLiteral,
228
+ typeName: "Secrets",
229
+ description: `A schema describing the list of available environment secrets that can be used by the ${context.config.name ? `${titleCase(context.config.name)} application` : "application"}.`,
230
+ types: []
231
+ }, parent);
232
+ result.name = "Secrets";
233
+ return result;
234
+ }
235
+ createSecretsReflection.__type = [
236
+ () => __ΩEnvPluginContext,
237
+ "context",
238
+ () => __ΩCreateEnvReflectionOptions,
239
+ "options",
240
+ () => ({}),
241
+ () => ReflectionClass,
242
+ "createSecretsReflection",
243
+ "Pn!2\"n#2$>%P\"7&/'"
244
+ ];
245
+ async function reflectEnv(context, file, name) {
246
+ let config;
247
+ if (file) config = resolveClassType(await reflectType(context, {
248
+ file: !isParentPath(file, context.workspaceConfig.workspaceRoot) ? joinPaths(context.workspaceConfig.workspaceRoot, file) : file,
249
+ name
250
+ }));
251
+ const defaultConfigType = await reflectType(context, await getEnvDefaultTypeDefinition(context));
252
+ return mergeEnvReflections(context, [
253
+ await readEnvTypeReflection(context, "env"),
254
+ config,
255
+ resolveClassType(defaultConfigType)
256
+ ].filter(Boolean));
257
+ }
258
+ reflectEnv.__type = [
259
+ () => __ΩEnvPluginContext,
260
+ "context",
261
+ "file",
262
+ "name",
263
+ "reflectEnv",
264
+ "Pn!2\"&2#8&2$8\"/%"
265
+ ];
266
+ async function reflectSecrets(context, file, name) {
267
+ let config;
268
+ if (file) config = resolveClassType(await reflectType(context, {
269
+ file: !isParentPath(file, context.workspaceConfig.workspaceRoot) ? joinPaths(context.workspaceConfig.workspaceRoot, file) : file,
270
+ name
271
+ }));
272
+ const defaultSecretsType = await reflectType(context, await getSecretsDefaultTypeDefinition(context));
273
+ return mergeSecretsReflections(context, [
274
+ await readSecretsReflection(context),
275
+ config,
276
+ resolveClassType(defaultSecretsType)
277
+ ].filter(Boolean));
278
+ }
279
+ reflectSecrets.__type = [
280
+ () => __ΩEnvPluginContext,
281
+ "context",
282
+ "file",
283
+ "name",
284
+ "reflectSecrets",
285
+ "Pn!2\"&2#8&2$8\"/%"
286
+ ];
287
+
288
+ //#endregion
289
+ //#region src/helpers/persistence.ts
290
+ /**
291
+ * Resolves the runtime type definition file for the environment variables.
292
+ *
293
+ * @param context - The plugin context.
294
+ * @returns The runtime type definition file for the environment variables.
295
+ */
296
+ async function resolveRuntimeTypeFile(context) {
297
+ const resolved = await context.fs.resolve("@powerlines/plugin-env/types/runtime");
298
+ if (!resolved) throw new Error(`Failed to resolve the runtime type definition file for the environment variables. Please ensure that the "@powerlines/plugin-env" package is installed.`);
299
+ return resolved;
300
+ }
301
+ resolveRuntimeTypeFile.__type = [
302
+ () => __ΩUnresolvedContext,
303
+ () => __ΩEnvPluginResolvedConfig,
304
+ "context",
305
+ "resolveRuntimeTypeFile",
306
+ "Resolves the runtime type definition file for the environment variables.",
307
+ "Pn\"o!\"2#&`/$?%"
308
+ ];
309
+ /**
310
+ * Gets the default type definition for the environment variables.
311
+ *
312
+ * @param context - The plugin context.
313
+ * @returns The default type definition for the environment variables.
314
+ */
315
+ async function getEnvDefaultTypeDefinition(context) {
316
+ return {
317
+ file: await resolveRuntimeTypeFile(context),
318
+ name: "EnvInterface"
319
+ };
320
+ }
321
+ getEnvDefaultTypeDefinition.__type = [
322
+ () => __ΩUnresolvedContext,
323
+ () => __ΩEnvPluginResolvedConfig,
324
+ "context",
325
+ "getEnvDefaultTypeDefinition",
326
+ "Gets the default type definition for the environment variables.",
327
+ "Pn\"o!\"2#!`/$?%"
328
+ ];
329
+ /** Gets the default type definition for the environment secrets.
330
+ *
331
+ * @param context - The plugin context.
332
+ * @returns The default type definition for the environment secrets.
333
+ */
334
+ async function getSecretsDefaultTypeDefinition(context) {
335
+ return {
336
+ file: await resolveRuntimeTypeFile(context),
337
+ name: "SecretsInterface"
338
+ };
339
+ }
340
+ getSecretsDefaultTypeDefinition.__type = [
341
+ () => __ΩUnresolvedContext,
342
+ () => __ΩEnvPluginResolvedConfig,
343
+ "context",
344
+ "getSecretsDefaultTypeDefinition",
345
+ "Pn\"o!\"2#!`/$"
346
+ ];
347
+ /**
348
+ * Gets the path to the environment type reflections.
349
+ *
350
+ * @param context - The plugin context.
351
+ * @param name - The name of the type reflections.
352
+ * @returns The path to the environment type reflections.
353
+ */
354
+ function getEnvTypeReflectionsPath(context, name = "env") {
355
+ return joinPaths(getReflectionsPath(context), "env", `${name}-types.bin`);
356
+ }
357
+ getEnvTypeReflectionsPath.__type = [
358
+ () => __ΩContext,
359
+ () => __ΩEnvPluginResolvedConfig,
360
+ "context",
361
+ () => __ΩEnvType,
362
+ "name",
363
+ () => "env",
364
+ "getEnvTypeReflectionsPath",
365
+ "Gets the path to the environment type reflections.",
366
+ "Pn\"o!\"2#n$2%>&&/'?("
367
+ ];
368
+ /**
369
+ * Reads the environment type reflection from the file system.
370
+ *
371
+ * @param context - The plugin context.
372
+ * @param name - The name of the type reflections.
373
+ * @returns The environment type reflection.
374
+ */
375
+ async function readEnvTypeReflection(context, name = "env") {
376
+ const filePath = getEnvTypeReflectionsPath(context, name);
377
+ if (!existsSync(filePath)) {
378
+ if (!context.env.types.env || isEmptyObject(context.env.types.env)) {
379
+ const reflection$1 = createEnvReflection(context);
380
+ const message = new capnp.Message();
381
+ reflection$1.messageRoot = message.initRoot(SerializedTypes);
382
+ reflection$1.dataBuffer = message.toArrayBuffer();
383
+ context.env.types.env = reflection$1;
384
+ await writeEnvTypeReflection(context, context.env.types.env, name);
385
+ }
386
+ return context.env.types.env;
387
+ }
388
+ const buffer = await readFileBuffer(filePath);
389
+ const messageRoot = new capnp.Message(buffer, false).getRoot(SerializedTypes);
390
+ const reflection = resolveClassType(deserializeType(convertFromCapnp(messageRoot.types)));
391
+ context.env.types[name] = reflection;
392
+ context.env.types[name].messageRoot = messageRoot;
393
+ context.env.types[name].dataBuffer = buffer;
394
+ return reflection;
395
+ }
396
+ readEnvTypeReflection.__type = [
397
+ () => __ΩEnvPluginContext,
398
+ "context",
399
+ () => __ΩEnvType,
400
+ "name",
401
+ () => "env",
402
+ () => ReflectionClass,
403
+ "readEnvTypeReflection",
404
+ "Reads the environment type reflection from the file system.",
405
+ "Pn!2\"n#2$>%P\"7&`/'?("
406
+ ];
407
+ /**
408
+ * Writes the environment type reflection to the file system.
409
+ *
410
+ * @param context - The plugin context.
411
+ * @param reflection - The environment type reflection to write.
412
+ * @param name - The name of the type reflections.
413
+ */
414
+ async function writeEnvTypeReflection(context, reflection, name = "env") {
415
+ const serialized = reflection.serializeType();
416
+ const message = new capnp.Message();
417
+ convertToCapnp(serialized, message.initRoot(SerializedTypes)._initTypes(serialized.length));
418
+ await writeFileBuffer(getEnvTypeReflectionsPath(context, name), message.toArrayBuffer());
419
+ }
420
+ writeEnvTypeReflection.__type = [
421
+ () => __ΩEnvPluginContext,
422
+ "context",
423
+ () => ReflectionClass,
424
+ "reflection",
425
+ () => __ΩEnvType,
426
+ "name",
427
+ () => "env",
428
+ "writeEnvTypeReflection",
429
+ "Writes the environment type reflection to the file system.",
430
+ "Pn!2\"P\"7#2$n%2&>'\"/(?)"
431
+ ];
432
+ function getEnvReflectionsPath(context, name) {
433
+ return joinPaths(getReflectionsPath(context), "env", `${name}.bin`);
434
+ }
435
+ getEnvReflectionsPath.__type = [
436
+ () => __ΩEnvPluginContext,
437
+ "context",
438
+ () => __ΩEnvType,
439
+ "name",
440
+ "getEnvReflectionsPath",
441
+ "Pn!2\"n#2$&/%"
442
+ ];
443
+ /**
444
+ * Reads the environment reflection data from the file system.
445
+ *
446
+ * @param context - The plugin context.
447
+ * @returns The environment reflection data.
448
+ */
449
+ async function readEnvReflection(context) {
450
+ const filePath = getEnvReflectionsPath(context, "env");
451
+ if (!existsSync(filePath)) {
452
+ if (!context.env.types.env) context.env.types.env = await readEnvTypeReflection(context, "env");
453
+ if (!context.env.used.env || isEmptyObject(context.env.used.env)) {
454
+ const reflection$1 = createEnvReflection(context, {
455
+ type: {
456
+ kind: ReflectionKind.objectLiteral,
457
+ typeName: "Env",
458
+ description: `An object containing the environment configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
459
+ types: []
460
+ },
461
+ superReflection: context.env.types.env
462
+ });
463
+ reflection$1.name = "Env";
464
+ const message = new capnp.Message();
465
+ reflection$1.messageRoot = message.initRoot(SerializedTypes);
466
+ reflection$1.dataBuffer = message.toArrayBuffer();
467
+ context.env.used.env = reflection$1;
468
+ await writeEnvReflection(context, context.env.used.env, "env");
469
+ }
470
+ return context.env.used.env;
471
+ }
472
+ const buffer = await readFileBuffer(filePath);
473
+ const messageRoot = new capnp.Message(buffer, false).getRoot(SerializedTypes);
474
+ const reflection = resolveClassType(deserializeType(convertFromCapnp(messageRoot.types)));
475
+ context.env.used.env = reflection;
476
+ context.env.used.env.messageRoot = messageRoot;
477
+ context.env.used.env.dataBuffer = buffer;
478
+ return reflection;
479
+ }
480
+ readEnvReflection.__type = [
481
+ () => __ΩEnvPluginContext,
482
+ "context",
483
+ () => ReflectionClass,
484
+ "readEnvReflection",
485
+ "Reads the environment reflection data from the file system.",
486
+ "Pn!2\"P\"7#`/$?%"
487
+ ];
488
+ /**
489
+ * Reads the secret environment reflection data from the file system.
490
+ *
491
+ * @param context - The plugin context.
492
+ * @returns The environment reflection data.
493
+ */
494
+ async function readSecretsReflection(context) {
495
+ const filePath = getEnvReflectionsPath(context, "secrets");
496
+ if (!existsSync(filePath)) {
497
+ if (!context.env.types.secrets) context.env.types.secrets = await readEnvTypeReflection(context, "secrets");
498
+ if (!context.env.used.secrets || isEmptyObject(context.env.used.secrets)) {
499
+ const reflection$1 = createEnvReflection(context, {
500
+ type: {
501
+ kind: ReflectionKind.objectLiteral,
502
+ typeName: "Secrets",
503
+ description: `An object containing the secret configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
504
+ types: []
505
+ },
506
+ superReflection: context.env.types.secrets
507
+ });
508
+ reflection$1.name = "Secrets";
509
+ const message = new capnp.Message();
510
+ reflection$1.messageRoot = message.initRoot(SerializedTypes);
511
+ reflection$1.dataBuffer = message.toArrayBuffer();
512
+ context.env.used.secrets = reflection$1;
513
+ await writeEnvReflection(context, context.env.used.secrets, "secrets");
514
+ }
515
+ return context.env.used.secrets;
516
+ }
517
+ const buffer = await readFileBuffer(filePath);
518
+ const messageRoot = new capnp.Message(buffer, false).getRoot(SerializedTypes);
519
+ const reflection = resolveClassType(deserializeType(convertFromCapnp(messageRoot.types)));
520
+ context.env.used.secrets = reflection;
521
+ context.env.used.secrets.messageRoot = messageRoot;
522
+ context.env.used.secrets.dataBuffer = buffer;
523
+ return reflection;
524
+ }
525
+ readSecretsReflection.__type = [
526
+ () => __ΩEnvPluginContext,
527
+ "context",
528
+ () => ReflectionClass,
529
+ "readSecretsReflection",
530
+ "Reads the secret environment reflection data from the file system.",
531
+ "Pn!2\"P\"7#`/$?%"
532
+ ];
533
+ /**
534
+ * Writes the environment reflection data to the file system.
535
+ *
536
+ * @param context - The plugin context.
537
+ * @param reflection - The reflection data to write.
538
+ * @param name - The name of the reflection (either "env" or "secrets").
539
+ */
540
+ async function writeEnvReflection(context, reflection, name = "env") {
541
+ const serialized = reflection.serializeType();
542
+ const message = new capnp.Message();
543
+ convertToCapnp(serialized, message.initRoot(SerializedTypes)._initTypes(serialized.length));
544
+ await writeFileBuffer(getEnvReflectionsPath(context, name), message.toArrayBuffer());
545
+ }
546
+ writeEnvReflection.__type = [
547
+ () => __ΩEnvPluginContext,
548
+ "context",
549
+ () => ReflectionClass,
550
+ "reflection",
551
+ () => __ΩEnvType,
552
+ "name",
553
+ () => "env",
554
+ "writeEnvReflection",
555
+ "Writes the environment reflection data to the file system.",
556
+ "Pn!2\"P\"7#2$n%2&>'\"/(?)"
557
+ ];
558
+ /**
559
+ * Writes the environment reflection data to the file system.
560
+ *
561
+ * @param context - The plugin context.
562
+ * @param reflection - The reflection data to write.
563
+ * @param name - The name of the reflection (either "env" or "secrets").
564
+ */
565
+ function writeEnvReflectionSync(context, reflection, name = "env") {
566
+ const serialized = reflection.serializeType();
567
+ const message = new capnp.Message();
568
+ convertToCapnp(serialized, message.initRoot(SerializedTypes)._initTypes(serialized.length));
569
+ writeFileBufferSync(getEnvReflectionsPath(context, name), message.toArrayBuffer());
570
+ }
571
+ writeEnvReflectionSync.__type = [
572
+ () => __ΩEnvPluginContext,
573
+ "context",
574
+ () => ReflectionClass,
575
+ "reflection",
576
+ () => __ΩEnvType,
577
+ "name",
578
+ () => "env",
579
+ "writeEnvReflectionSync",
580
+ "Writes the environment reflection data to the file system.",
581
+ "Pn!2\"P\"7#2$n%2&>'\"/(?)"
582
+ ];
583
+
584
+ //#endregion
585
+ export { mergeEnvReflections as _, readEnvReflection as a, reflectSecrets as b, resolveRuntimeTypeFile as c, writeEnvTypeReflection as d, BaseEnv as f, createSecretsReflection as g, createEnvReflection as h, getSecretsDefaultTypeDefinition as i, writeEnvReflection as l, __ΩCreateEnvReflectionOptions as m, getEnvReflectionsPath as n, readEnvTypeReflection as o, BaseSecrets as p, getEnvTypeReflectionsPath as r, readSecretsReflection as s, getEnvDefaultTypeDefinition as t, writeEnvReflectionSync as u, mergeSecretsReflections as v, isParentPath as x, reflectEnv as y };
586
+ //# sourceMappingURL=persistence-BsBxs9wt.mjs.map