@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
@@ -1,310 +1,6 @@
1
- import { __ΩEnvPluginContext, __ΩEnvPluginResolvedConfig, __ΩEnvType } from "../types/plugin.mjs";
2
- import { createEnvReflection } from "./reflect.mjs";
3
- import { ReflectionClass, ReflectionKind, deserializeType, resolveClassType } from "@powerlines/deepkit/vendor/type";
4
- import { __ΩContext, __ΩUnresolvedContext } from "powerlines/types/context";
5
- import { convertFromCapnp, convertToCapnp } from "@powerlines/deepkit/capnp";
6
- import { getReflectionsPath } from "@powerlines/deepkit/resolve-reflections";
7
- import { SerializedTypes } from "@powerlines/deepkit/schemas/reflection";
8
- import * as capnp from "@stryke/capnp";
9
- import { readFileBuffer, writeFileBuffer, writeFileBufferSync } from "@stryke/fs/buffer";
10
- import { joinPaths } from "@stryke/path/join-paths";
11
- import { isEmptyObject } from "@stryke/type-checks/is-empty-object";
12
- import { existsSync } from "node:fs";
1
+ import "../runtime-C5ukCv3P.mjs";
2
+ import "../plugin-eBjQJP6x.mjs";
3
+ import "../join-paths-BMg51Ddi.mjs";
4
+ import { a as readEnvReflection, c as resolveRuntimeTypeFile, d as writeEnvTypeReflection, i as getSecretsDefaultTypeDefinition, l as writeEnvReflection, n as getEnvReflectionsPath, o as readEnvTypeReflection, r as getEnvTypeReflectionsPath, s as readSecretsReflection, t as getEnvDefaultTypeDefinition, u as writeEnvReflectionSync } from "../persistence-BsBxs9wt.mjs";
13
5
 
14
- //#region src/helpers/persistence.ts
15
- /**
16
- * Resolves the runtime type definition file for the environment variables.
17
- *
18
- * @param context - The plugin context.
19
- * @returns The runtime type definition file for the environment variables.
20
- */
21
- async function resolveRuntimeTypeFile(context) {
22
- const resolved = await context.fs.resolve("@powerlines/plugin-env/types/runtime");
23
- 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.`);
24
- return resolved;
25
- }
26
- resolveRuntimeTypeFile.__type = [
27
- () => __ΩUnresolvedContext,
28
- () => __ΩEnvPluginResolvedConfig,
29
- "context",
30
- "resolveRuntimeTypeFile",
31
- "Resolves the runtime type definition file for the environment variables.",
32
- "Pn\"o!\"2#&`/$?%"
33
- ];
34
- /**
35
- * Gets the default type definition for the environment variables.
36
- *
37
- * @param context - The plugin context.
38
- * @returns The default type definition for the environment variables.
39
- */
40
- async function getEnvDefaultTypeDefinition(context) {
41
- return {
42
- file: await resolveRuntimeTypeFile(context),
43
- name: "EnvInterface"
44
- };
45
- }
46
- getEnvDefaultTypeDefinition.__type = [
47
- () => __ΩUnresolvedContext,
48
- () => __ΩEnvPluginResolvedConfig,
49
- "context",
50
- "getEnvDefaultTypeDefinition",
51
- "Gets the default type definition for the environment variables.",
52
- "Pn\"o!\"2#!`/$?%"
53
- ];
54
- /** Gets the default type definition for the environment secrets.
55
- *
56
- * @param context - The plugin context.
57
- * @returns The default type definition for the environment secrets.
58
- */
59
- async function getSecretsDefaultTypeDefinition(context) {
60
- return {
61
- file: await resolveRuntimeTypeFile(context),
62
- name: "SecretsInterface"
63
- };
64
- }
65
- getSecretsDefaultTypeDefinition.__type = [
66
- () => __ΩUnresolvedContext,
67
- () => __ΩEnvPluginResolvedConfig,
68
- "context",
69
- "getSecretsDefaultTypeDefinition",
70
- "Pn\"o!\"2#!`/$"
71
- ];
72
- /**
73
- * Gets the path to the environment type reflections.
74
- *
75
- * @param context - The plugin context.
76
- * @param name - The name of the type reflections.
77
- * @returns The path to the environment type reflections.
78
- */
79
- function getEnvTypeReflectionsPath(context, name = "env") {
80
- return joinPaths(getReflectionsPath(context), "env", `${name}-types.bin`);
81
- }
82
- getEnvTypeReflectionsPath.__type = [
83
- () => __ΩContext,
84
- () => __ΩEnvPluginResolvedConfig,
85
- "context",
86
- () => __ΩEnvType,
87
- "name",
88
- () => "env",
89
- "getEnvTypeReflectionsPath",
90
- "Gets the path to the environment type reflections.",
91
- "Pn\"o!\"2#n$2%>&&/'?("
92
- ];
93
- /**
94
- * Reads the environment type reflection from the file system.
95
- *
96
- * @param context - The plugin context.
97
- * @param name - The name of the type reflections.
98
- * @returns The environment type reflection.
99
- */
100
- async function readEnvTypeReflection(context, name = "env") {
101
- const filePath = getEnvTypeReflectionsPath(context, name);
102
- if (!existsSync(filePath)) {
103
- if (!context.env.types.env || isEmptyObject(context.env.types.env)) {
104
- const reflection$1 = createEnvReflection(context);
105
- const message = new capnp.Message();
106
- reflection$1.messageRoot = message.initRoot(SerializedTypes);
107
- reflection$1.dataBuffer = message.toArrayBuffer();
108
- context.env.types.env = reflection$1;
109
- await writeEnvTypeReflection(context, context.env.types.env, name);
110
- }
111
- return context.env.types.env;
112
- }
113
- const buffer = await readFileBuffer(filePath);
114
- const messageRoot = new capnp.Message(buffer, false).getRoot(SerializedTypes);
115
- const reflection = resolveClassType(deserializeType(convertFromCapnp(messageRoot.types)));
116
- context.env.types[name] = reflection;
117
- context.env.types[name].messageRoot = messageRoot;
118
- context.env.types[name].dataBuffer = buffer;
119
- return reflection;
120
- }
121
- readEnvTypeReflection.__type = [
122
- () => __ΩEnvPluginContext,
123
- "context",
124
- () => __ΩEnvType,
125
- "name",
126
- () => "env",
127
- () => ReflectionClass,
128
- "readEnvTypeReflection",
129
- "Reads the environment type reflection from the file system.",
130
- "Pn!2\"n#2$>%P\"7&`/'?("
131
- ];
132
- /**
133
- * Writes the environment type reflection to the file system.
134
- *
135
- * @param context - The plugin context.
136
- * @param reflection - The environment type reflection to write.
137
- * @param name - The name of the type reflections.
138
- */
139
- async function writeEnvTypeReflection(context, reflection, name = "env") {
140
- const serialized = reflection.serializeType();
141
- const message = new capnp.Message();
142
- convertToCapnp(serialized, message.initRoot(SerializedTypes)._initTypes(serialized.length));
143
- await writeFileBuffer(getEnvTypeReflectionsPath(context, name), message.toArrayBuffer());
144
- }
145
- writeEnvTypeReflection.__type = [
146
- () => __ΩEnvPluginContext,
147
- "context",
148
- () => ReflectionClass,
149
- "reflection",
150
- () => __ΩEnvType,
151
- "name",
152
- () => "env",
153
- "writeEnvTypeReflection",
154
- "Writes the environment type reflection to the file system.",
155
- "Pn!2\"P\"7#2$n%2&>'\"/(?)"
156
- ];
157
- function getEnvReflectionsPath(context, name) {
158
- return joinPaths(getReflectionsPath(context), "env", `${name}.bin`);
159
- }
160
- getEnvReflectionsPath.__type = [
161
- () => __ΩEnvPluginContext,
162
- "context",
163
- () => __ΩEnvType,
164
- "name",
165
- "getEnvReflectionsPath",
166
- "Pn!2\"n#2$&/%"
167
- ];
168
- /**
169
- * Reads the environment reflection data from the file system.
170
- *
171
- * @param context - The plugin context.
172
- * @returns The environment reflection data.
173
- */
174
- async function readEnvReflection(context) {
175
- const filePath = getEnvReflectionsPath(context, "env");
176
- if (!existsSync(filePath)) {
177
- if (!context.env.types.env) context.env.types.env = await readEnvTypeReflection(context, "env");
178
- if (!context.env.used.env || isEmptyObject(context.env.used.env)) {
179
- const reflection$1 = createEnvReflection(context, {
180
- type: {
181
- kind: ReflectionKind.objectLiteral,
182
- typeName: "Env",
183
- description: `An object containing the environment configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
184
- types: []
185
- },
186
- superReflection: context.env.types.env
187
- });
188
- reflection$1.name = "Env";
189
- const message = new capnp.Message();
190
- reflection$1.messageRoot = message.initRoot(SerializedTypes);
191
- reflection$1.dataBuffer = message.toArrayBuffer();
192
- context.env.used.env = reflection$1;
193
- await writeEnvReflection(context, context.env.used.env, "env");
194
- }
195
- return context.env.used.env;
196
- }
197
- const buffer = await readFileBuffer(filePath);
198
- const messageRoot = new capnp.Message(buffer, false).getRoot(SerializedTypes);
199
- const reflection = resolveClassType(deserializeType(convertFromCapnp(messageRoot.types)));
200
- context.env.used.env = reflection;
201
- context.env.used.env.messageRoot = messageRoot;
202
- context.env.used.env.dataBuffer = buffer;
203
- return reflection;
204
- }
205
- readEnvReflection.__type = [
206
- () => __ΩEnvPluginContext,
207
- "context",
208
- () => ReflectionClass,
209
- "readEnvReflection",
210
- "Reads the environment reflection data from the file system.",
211
- "Pn!2\"P\"7#`/$?%"
212
- ];
213
- /**
214
- * Reads the secret environment reflection data from the file system.
215
- *
216
- * @param context - The plugin context.
217
- * @returns The environment reflection data.
218
- */
219
- async function readSecretsReflection(context) {
220
- const filePath = getEnvReflectionsPath(context, "secrets");
221
- if (!existsSync(filePath)) {
222
- if (!context.env.types.secrets) context.env.types.secrets = await readEnvTypeReflection(context, "secrets");
223
- if (!context.env.used.secrets || isEmptyObject(context.env.used.secrets)) {
224
- const reflection$1 = createEnvReflection(context, {
225
- type: {
226
- kind: ReflectionKind.objectLiteral,
227
- typeName: "Secrets",
228
- description: `An object containing the secret configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
229
- types: []
230
- },
231
- superReflection: context.env.types.secrets
232
- });
233
- reflection$1.name = "Secrets";
234
- const message = new capnp.Message();
235
- reflection$1.messageRoot = message.initRoot(SerializedTypes);
236
- reflection$1.dataBuffer = message.toArrayBuffer();
237
- context.env.used.secrets = reflection$1;
238
- await writeEnvReflection(context, context.env.used.secrets, "secrets");
239
- }
240
- return context.env.used.secrets;
241
- }
242
- const buffer = await readFileBuffer(filePath);
243
- const messageRoot = new capnp.Message(buffer, false).getRoot(SerializedTypes);
244
- const reflection = resolveClassType(deserializeType(convertFromCapnp(messageRoot.types)));
245
- context.env.used.secrets = reflection;
246
- context.env.used.secrets.messageRoot = messageRoot;
247
- context.env.used.secrets.dataBuffer = buffer;
248
- return reflection;
249
- }
250
- readSecretsReflection.__type = [
251
- () => __ΩEnvPluginContext,
252
- "context",
253
- () => ReflectionClass,
254
- "readSecretsReflection",
255
- "Reads the secret environment reflection data from the file system.",
256
- "Pn!2\"P\"7#`/$?%"
257
- ];
258
- /**
259
- * Writes the environment reflection data to the file system.
260
- *
261
- * @param context - The plugin context.
262
- * @param reflection - The reflection data to write.
263
- * @param name - The name of the reflection (either "env" or "secrets").
264
- */
265
- async function writeEnvReflection(context, reflection, name = "env") {
266
- const serialized = reflection.serializeType();
267
- const message = new capnp.Message();
268
- convertToCapnp(serialized, message.initRoot(SerializedTypes)._initTypes(serialized.length));
269
- await writeFileBuffer(getEnvReflectionsPath(context, name), message.toArrayBuffer());
270
- }
271
- writeEnvReflection.__type = [
272
- () => __ΩEnvPluginContext,
273
- "context",
274
- () => ReflectionClass,
275
- "reflection",
276
- () => __ΩEnvType,
277
- "name",
278
- () => "env",
279
- "writeEnvReflection",
280
- "Writes the environment reflection data to the file system.",
281
- "Pn!2\"P\"7#2$n%2&>'\"/(?)"
282
- ];
283
- /**
284
- * Writes the environment reflection data to the file system.
285
- *
286
- * @param context - The plugin context.
287
- * @param reflection - The reflection data to write.
288
- * @param name - The name of the reflection (either "env" or "secrets").
289
- */
290
- function writeEnvReflectionSync(context, reflection, name = "env") {
291
- const serialized = reflection.serializeType();
292
- const message = new capnp.Message();
293
- convertToCapnp(serialized, message.initRoot(SerializedTypes)._initTypes(serialized.length));
294
- writeFileBufferSync(getEnvReflectionsPath(context, name), message.toArrayBuffer());
295
- }
296
- writeEnvReflectionSync.__type = [
297
- () => __ΩEnvPluginContext,
298
- "context",
299
- () => ReflectionClass,
300
- "reflection",
301
- () => __ΩEnvType,
302
- "name",
303
- () => "env",
304
- "writeEnvReflectionSync",
305
- "Writes the environment reflection data to the file system.",
306
- "Pn!2\"P\"7#2$n%2&>'\"/(?)"
307
- ];
308
-
309
- //#endregion
310
6
  export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
@@ -1,263 +1,14 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_types_runtime = require('../types/runtime.cjs');
3
- const require_types_plugin = require('../types/plugin.cjs');
4
- const require_helpers_persistence = require('./persistence.cjs');
5
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
6
- let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
7
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
8
- let __powerlines_deepkit_reflect_type = require("@powerlines/deepkit/reflect-type");
9
- let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
1
+ require('../runtime-g0TEIoZK.cjs');
2
+ require('../plugin-CM1TSv1B.cjs');
3
+ require('../join-paths-Bc4rM2TX.cjs');
4
+ const require_persistence = require('../persistence-D_clXRxP.cjs');
10
5
 
11
- //#region src/helpers/reflect.ts
12
- function __assignType(fn, args) {
13
- fn.__type = args;
14
- return fn;
15
- }
16
- function mergeEnvReflections(context, reflections) {
17
- return createEnvReflection(context, { type: (0, __powerlines_deepkit_vendor_type.merge)(reflections.map(__assignType((reflection) => reflection.type, [
18
- "reflection",
19
- "",
20
- "P\"2!\"/\""
21
- ]))) });
22
- }
23
- mergeEnvReflections.__type = [
24
- () => require_types_plugin.__ΩEnvPluginContext,
25
- "context",
26
- () => __powerlines_deepkit_vendor_type.ReflectionClass,
27
- "reflections",
28
- () => __powerlines_deepkit_vendor_type.ReflectionClass,
29
- "mergeEnvReflections",
30
- "Pn!2\"P\"7#F2$P\"7%/&"
31
- ];
32
- function mergeSecretsReflections(context, reflections) {
33
- return createSecretsReflection(context, { type: (0, __powerlines_deepkit_vendor_type.merge)(reflections.map(__assignType((reflection) => reflection.type, [
34
- "reflection",
35
- "",
36
- "P\"2!\"/\""
37
- ]))) });
38
- }
39
- mergeSecretsReflections.__type = [
40
- () => require_types_plugin.__ΩEnvPluginContext,
41
- "context",
42
- () => __powerlines_deepkit_vendor_type.ReflectionClass,
43
- "reflections",
44
- () => __powerlines_deepkit_vendor_type.ReflectionClass,
45
- "mergeSecretsReflections",
46
- "Pn!2\"P\"7#F2$P\"7%/&"
47
- ];
48
- const __ΩCreateEnvReflectionOptions = [
49
- () => __powerlines_deepkit_vendor_type.__ΩTypeObjectLiteral,
50
- () => __powerlines_deepkit_vendor_type.__ΩTypeClass,
51
- "type",
52
- () => __powerlines_deepkit_vendor_type.ReflectionClass,
53
- "superReflection",
54
- "CreateEnvReflectionOptions",
55
- "PPn!n\"J4#8P\"7$4%8Mw&y"
56
- ];
57
- var BaseEnv = class {
58
- PLATFORM = "neutral";
59
- MODE = "production";
60
- DEBUG = false;
61
- TEST = false;
62
- MINIMAL = false;
63
- NO_COLOR = false;
64
- FORCE_COLOR = false;
65
- FORCE_HYPERLINK = false;
66
- STACKTRACE = false;
67
- INCLUDE_ERROR_DATA = false;
68
- CI = false;
69
- static __type = [
70
- "APP_NAME",
71
- "APP_VERSION",
72
- "BUILD_ID",
73
- "BUILD_TIMESTAMP",
74
- "BUILD_CHECKSUM",
75
- "RELEASE_ID",
76
- "RELEASE_TAG",
77
- "ORGANIZATION",
78
- "node",
79
- "browser",
80
- "neutral",
81
- "PLATFORM",
82
- function() {
83
- return "neutral";
84
- },
85
- "development",
86
- "test",
87
- "production",
88
- "MODE",
89
- function() {
90
- return "production";
91
- },
92
- "ENVIRONMENT",
93
- "DEBUG",
94
- function() {
95
- return false;
96
- },
97
- "TEST",
98
- function() {
99
- return false;
100
- },
101
- "MINIMAL",
102
- function() {
103
- return false;
104
- },
105
- "NO_COLOR",
106
- function() {
107
- return false;
108
- },
109
- "FORCE_COLOR",
110
- function() {
111
- return false;
112
- },
113
- "FORCE_HYPERLINK",
114
- function() {
115
- return false;
116
- },
117
- "STACKTRACE",
118
- function() {
119
- return false;
120
- },
121
- "INCLUDE_ERROR_DATA",
122
- function() {
123
- return false;
124
- },
125
- "ERROR_URL",
126
- "DEFAULT_TIMEZONE",
127
- "DEFAULT_LOCALE",
128
- "CI",
129
- function() {
130
- return false;
131
- },
132
- () => require_types_runtime.__ΩEnvInterface,
133
- "BaseEnv",
134
- "&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"
135
- ];
136
- };
137
- var BaseSecrets = class {
138
- static __type = [
139
- "ENCRYPTION_KEY",
140
- () => require_types_runtime.__ΩSecretsInterface,
141
- "BaseSecrets",
142
- "&3!5n\"x\"w#"
143
- ];
144
- };
145
- function createEnvReflection(context, options = {}) {
146
- const parent = options.superReflection ?? new __powerlines_deepkit_vendor_type.ReflectionClass({
147
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.class,
148
- description: `The base environment configuration definition for the ${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
149
- classType: BaseEnv,
150
- types: [],
151
- implements: [{
152
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
153
- typeName: "EnvInterface",
154
- description: `The environment configuration interface definition for the ${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
155
- types: []
156
- }]
157
- });
158
- parent.name = "Env";
159
- const result = new __powerlines_deepkit_vendor_type.ReflectionClass(options.type ?? {
160
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
161
- typeName: "Env",
162
- description: `A schema describing the list of available environment variables that can be used by the ${context.config.name ? `${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} application` : "application"}.`,
163
- types: []
164
- }, parent);
165
- result.name = "Env";
166
- return result;
167
- }
168
- createEnvReflection.__type = [
169
- () => require_types_plugin.__ΩEnvPluginContext,
170
- "context",
171
- () => __ΩCreateEnvReflectionOptions,
172
- "options",
173
- () => ({}),
174
- () => __powerlines_deepkit_vendor_type.ReflectionClass,
175
- "createEnvReflection",
176
- "Pn!2\"n#2$>%P\"7&/'"
177
- ];
178
- function createSecretsReflection(context, options = {}) {
179
- const parent = options.superReflection ?? new __powerlines_deepkit_vendor_type.ReflectionClass({
180
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.class,
181
- description: `The base secrets configuration definition for the ${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
182
- classType: BaseSecrets,
183
- types: [],
184
- implements: [{
185
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
186
- typeName: "SecretsInterface",
187
- description: `The secrets configuration interface definition for the ${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
188
- types: []
189
- }]
190
- });
191
- parent.name = "Secrets";
192
- const result = new __powerlines_deepkit_vendor_type.ReflectionClass(options.type ?? {
193
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
194
- typeName: "Secrets",
195
- description: `A schema describing the list of available environment secrets that can be used by the ${context.config.name ? `${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} application` : "application"}.`,
196
- types: []
197
- }, parent);
198
- result.name = "Secrets";
199
- return result;
200
- }
201
- createSecretsReflection.__type = [
202
- () => require_types_plugin.__ΩEnvPluginContext,
203
- "context",
204
- () => __ΩCreateEnvReflectionOptions,
205
- "options",
206
- () => ({}),
207
- () => __powerlines_deepkit_vendor_type.ReflectionClass,
208
- "createSecretsReflection",
209
- "Pn!2\"n#2$>%P\"7&/'"
210
- ];
211
- async function reflectEnv(context, file, name) {
212
- let config;
213
- if (file) config = (0, __powerlines_deepkit_vendor_type.resolveClassType)(await (0, __powerlines_deepkit_reflect_type.reflectType)(context, {
214
- file: !(0, __stryke_path_is_parent_path.isParentPath)(file, context.workspaceConfig.workspaceRoot) ? (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, file) : file,
215
- name
216
- }));
217
- const defaultConfigType = await (0, __powerlines_deepkit_reflect_type.reflectType)(context, await require_helpers_persistence.getEnvDefaultTypeDefinition(context));
218
- return mergeEnvReflections(context, [
219
- await require_helpers_persistence.readEnvTypeReflection(context, "env"),
220
- config,
221
- (0, __powerlines_deepkit_vendor_type.resolveClassType)(defaultConfigType)
222
- ].filter(Boolean));
223
- }
224
- reflectEnv.__type = [
225
- () => require_types_plugin.__ΩEnvPluginContext,
226
- "context",
227
- "file",
228
- "name",
229
- "reflectEnv",
230
- "Pn!2\"&2#8&2$8\"/%"
231
- ];
232
- async function reflectSecrets(context, file, name) {
233
- let config;
234
- if (file) config = (0, __powerlines_deepkit_vendor_type.resolveClassType)(await (0, __powerlines_deepkit_reflect_type.reflectType)(context, {
235
- file: !(0, __stryke_path_is_parent_path.isParentPath)(file, context.workspaceConfig.workspaceRoot) ? (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, file) : file,
236
- name
237
- }));
238
- const defaultSecretsType = await (0, __powerlines_deepkit_reflect_type.reflectType)(context, await require_helpers_persistence.getSecretsDefaultTypeDefinition(context));
239
- return mergeSecretsReflections(context, [
240
- await require_helpers_persistence.readSecretsReflection(context),
241
- config,
242
- (0, __powerlines_deepkit_vendor_type.resolveClassType)(defaultSecretsType)
243
- ].filter(Boolean));
244
- }
245
- reflectSecrets.__type = [
246
- () => require_types_plugin.__ΩEnvPluginContext,
247
- "context",
248
- "file",
249
- "name",
250
- "reflectSecrets",
251
- "Pn!2\"&2#8&2$8\"/%"
252
- ];
253
-
254
- //#endregion
255
- exports.BaseEnv = BaseEnv;
256
- exports.BaseSecrets = BaseSecrets;
257
- exports.__ΩCreateEnvReflectionOptions = __ΩCreateEnvReflectionOptions;
258
- exports.createEnvReflection = createEnvReflection;
259
- exports.createSecretsReflection = createSecretsReflection;
260
- exports.mergeEnvReflections = mergeEnvReflections;
261
- exports.mergeSecretsReflections = mergeSecretsReflections;
262
- exports.reflectEnv = reflectEnv;
263
- exports.reflectSecrets = reflectSecrets;
6
+ exports.BaseEnv = require_persistence.BaseEnv;
7
+ exports.BaseSecrets = require_persistence.BaseSecrets;
8
+ exports.__ΩCreateEnvReflectionOptions = require_persistence.__ΩCreateEnvReflectionOptions;
9
+ exports.createEnvReflection = require_persistence.createEnvReflection;
10
+ exports.createSecretsReflection = require_persistence.createSecretsReflection;
11
+ exports.mergeEnvReflections = require_persistence.mergeEnvReflections;
12
+ exports.mergeSecretsReflections = require_persistence.mergeSecretsReflections;
13
+ exports.reflectEnv = require_persistence.reflectEnv;
14
+ exports.reflectSecrets = require_persistence.reflectSecrets;
@@ -1,46 +1,4 @@
1
- import { EnvInterface, SecretsInterface } from "../types/runtime.cjs";
2
- import { EnvPluginContext } from "../types/plugin.cjs";
3
- import { ReflectionClass, TypeClass, TypeObjectLiteral } from "@powerlines/deepkit/vendor/type";
4
-
5
- //#region src/helpers/reflect.d.ts
6
- declare function mergeEnvReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
7
- declare function mergeSecretsReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
8
- interface CreateEnvReflectionOptions {
9
- type?: TypeObjectLiteral | TypeClass;
10
- superReflection?: ReflectionClass<any>;
11
- }
12
- declare class BaseEnv implements EnvInterface {
13
- APP_NAME: string;
14
- APP_VERSION: string;
15
- BUILD_ID: string;
16
- BUILD_TIMESTAMP: string;
17
- BUILD_CHECKSUM: string;
18
- RELEASE_ID: string;
19
- RELEASE_TAG: string;
20
- ORGANIZATION: string;
21
- PLATFORM: "node" | "browser" | "neutral";
22
- MODE: "development" | "test" | "production";
23
- ENVIRONMENT: string;
24
- DEBUG: boolean;
25
- TEST: boolean;
26
- MINIMAL: boolean;
27
- NO_COLOR: boolean;
28
- FORCE_COLOR: number | boolean;
29
- FORCE_HYPERLINK: number | boolean;
30
- STACKTRACE: boolean;
31
- INCLUDE_ERROR_DATA: boolean;
32
- ERROR_URL: string;
33
- DEFAULT_TIMEZONE: string;
34
- DEFAULT_LOCALE: string;
35
- CI: boolean;
36
- }
37
- declare class BaseSecrets implements SecretsInterface {
38
- ENCRYPTION_KEY: string;
39
- }
40
- declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
41
- declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
42
- declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
43
- declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
44
- declare type __ΩCreateEnvReflectionOptions = any[];
45
- //#endregion
1
+ import "../runtime-BDzzR4wH.cjs";
2
+ import "../plugin-CSe5f2cD.cjs";
3
+ import { a as createEnvReflection, c as mergeSecretsReflections, i as __ΩCreateEnvReflectionOptions, l as reflectEnv, n as BaseSecrets, o as createSecretsReflection, r as CreateEnvReflectionOptions, s as mergeEnvReflections, t as BaseEnv, u as reflectSecrets } from "../reflect-Dm8a3c29.cjs";
46
4
  export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
@@ -1,46 +1,4 @@
1
- import { EnvInterface, SecretsInterface } from "../types/runtime.mjs";
2
- import { EnvPluginContext } from "../types/plugin.mjs";
3
- import { ReflectionClass, TypeClass, TypeObjectLiteral } from "@powerlines/deepkit/vendor/type";
4
-
5
- //#region src/helpers/reflect.d.ts
6
- declare function mergeEnvReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
7
- declare function mergeSecretsReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
8
- interface CreateEnvReflectionOptions {
9
- type?: TypeObjectLiteral | TypeClass;
10
- superReflection?: ReflectionClass<any>;
11
- }
12
- declare class BaseEnv implements EnvInterface {
13
- APP_NAME: string;
14
- APP_VERSION: string;
15
- BUILD_ID: string;
16
- BUILD_TIMESTAMP: string;
17
- BUILD_CHECKSUM: string;
18
- RELEASE_ID: string;
19
- RELEASE_TAG: string;
20
- ORGANIZATION: string;
21
- PLATFORM: "node" | "browser" | "neutral";
22
- MODE: "development" | "test" | "production";
23
- ENVIRONMENT: string;
24
- DEBUG: boolean;
25
- TEST: boolean;
26
- MINIMAL: boolean;
27
- NO_COLOR: boolean;
28
- FORCE_COLOR: number | boolean;
29
- FORCE_HYPERLINK: number | boolean;
30
- STACKTRACE: boolean;
31
- INCLUDE_ERROR_DATA: boolean;
32
- ERROR_URL: string;
33
- DEFAULT_TIMEZONE: string;
34
- DEFAULT_LOCALE: string;
35
- CI: boolean;
36
- }
37
- declare class BaseSecrets implements SecretsInterface {
38
- ENCRYPTION_KEY: string;
39
- }
40
- declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
41
- declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
42
- declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
43
- declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
44
- declare type __ΩCreateEnvReflectionOptions = any[];
45
- //#endregion
1
+ import "../runtime-lYSIZdMn.mjs";
2
+ import "../plugin-DMbVjdcQ.mjs";
3
+ import { a as createEnvReflection, c as mergeSecretsReflections, i as __ΩCreateEnvReflectionOptions, l as reflectEnv, n as BaseSecrets, o as createSecretsReflection, r as CreateEnvReflectionOptions, s as mergeEnvReflections, t as BaseEnv, u as reflectSecrets } from "../reflect-Dpz8ifa0.mjs";
46
4
  export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };