@powerlines/plugin-env 0.16.84 → 0.16.86

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 (117) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +3 -0
  3. package/dist/babel/index.cjs +4 -0
  4. package/dist/babel/index.d.cts +2 -0
  5. package/dist/babel/index.d.mts +2 -0
  6. package/dist/babel/index.mjs +3 -0
  7. package/dist/babel/plugin.cjs +144 -0
  8. package/dist/babel/plugin.d.cts +8 -0
  9. package/dist/babel/plugin.d.cts.map +1 -0
  10. package/dist/babel/plugin.d.mts +8 -0
  11. package/dist/babel/plugin.d.mts.map +1 -0
  12. package/dist/babel/plugin.mjs +143 -0
  13. package/dist/babel/plugin.mjs.map +1 -0
  14. package/dist/components/docs.cjs +70 -0
  15. package/dist/components/docs.d.cts +25 -0
  16. package/dist/components/docs.d.cts.map +1 -0
  17. package/dist/components/docs.d.mts +25 -0
  18. package/dist/components/docs.d.mts.map +1 -0
  19. package/dist/components/docs.mjs +69 -0
  20. package/dist/components/docs.mjs.map +1 -0
  21. package/dist/components/env-builtin.cjs +568 -0
  22. package/dist/components/env-builtin.d.cts +22 -0
  23. package/dist/components/env-builtin.d.cts.map +1 -0
  24. package/dist/components/env-builtin.d.mts +22 -0
  25. package/dist/components/env-builtin.d.mts.map +1 -0
  26. package/dist/components/env-builtin.mjs +565 -0
  27. package/dist/components/env-builtin.mjs.map +1 -0
  28. package/dist/components/index.cjs +7 -0
  29. package/dist/components/index.d.cts +3 -0
  30. package/dist/components/index.d.mts +3 -0
  31. package/dist/components/index.mjs +4 -0
  32. package/dist/helpers/automd-generator.cjs +33 -0
  33. package/dist/helpers/automd-generator.d.cts +14 -0
  34. package/dist/helpers/automd-generator.d.cts.map +1 -0
  35. package/dist/helpers/automd-generator.d.mts +14 -0
  36. package/dist/helpers/automd-generator.d.mts.map +1 -0
  37. package/dist/helpers/automd-generator.mjs +32 -0
  38. package/dist/helpers/automd-generator.mjs.map +1 -0
  39. package/dist/helpers/create-reflection-resource.cjs +23 -0
  40. package/dist/helpers/create-reflection-resource.d.cts +13 -0
  41. package/dist/helpers/create-reflection-resource.d.cts.map +1 -0
  42. package/dist/helpers/create-reflection-resource.d.mts +13 -0
  43. package/dist/helpers/create-reflection-resource.d.mts.map +1 -0
  44. package/dist/helpers/create-reflection-resource.mjs +23 -0
  45. package/dist/helpers/create-reflection-resource.mjs.map +1 -0
  46. package/dist/helpers/docs-helper.cjs +25 -0
  47. package/dist/helpers/docs-helper.d.cts +13 -0
  48. package/dist/helpers/docs-helper.d.cts.map +1 -0
  49. package/dist/helpers/docs-helper.d.mts +13 -0
  50. package/dist/helpers/docs-helper.d.mts.map +1 -0
  51. package/dist/helpers/docs-helper.mjs +24 -0
  52. package/dist/helpers/docs-helper.mjs.map +1 -0
  53. package/dist/helpers/index.cjs +34 -0
  54. package/dist/helpers/index.d.cts +7 -0
  55. package/dist/helpers/index.d.mts +7 -0
  56. package/dist/helpers/index.mjs +8 -0
  57. package/dist/helpers/load.cjs +136 -0
  58. package/dist/helpers/load.d.cts +35 -0
  59. package/dist/helpers/load.d.cts.map +1 -0
  60. package/dist/helpers/load.d.mts +35 -0
  61. package/dist/helpers/load.d.mts.map +1 -0
  62. package/dist/helpers/load.mjs +133 -0
  63. package/dist/helpers/load.mjs.map +1 -0
  64. package/dist/helpers/persistence.cjs +323 -0
  65. package/dist/helpers/persistence.d.cts +84 -0
  66. package/dist/helpers/persistence.d.cts.map +1 -0
  67. package/dist/helpers/persistence.d.mts +84 -0
  68. package/dist/helpers/persistence.d.mts.map +1 -0
  69. package/dist/helpers/persistence.mjs +311 -0
  70. package/dist/helpers/persistence.mjs.map +1 -0
  71. package/dist/helpers/reflect.cjs +299 -0
  72. package/dist/helpers/reflect.d.cts +69 -0
  73. package/dist/helpers/reflect.d.cts.map +1 -0
  74. package/dist/helpers/reflect.d.mts +69 -0
  75. package/dist/helpers/reflect.d.mts.map +1 -0
  76. package/dist/helpers/reflect.mjs +290 -0
  77. package/dist/helpers/reflect.mjs.map +1 -0
  78. package/dist/helpers/source-file-env.cjs +59 -0
  79. package/dist/helpers/source-file-env.d.cts +9 -0
  80. package/dist/helpers/source-file-env.d.cts.map +1 -0
  81. package/dist/helpers/source-file-env.d.mts +9 -0
  82. package/dist/helpers/source-file-env.d.mts.map +1 -0
  83. package/dist/helpers/source-file-env.mjs +57 -0
  84. package/dist/helpers/source-file-env.mjs.map +1 -0
  85. package/dist/helpers/template-helpers.cjs +71 -0
  86. package/dist/helpers/template-helpers.d.cts +15 -0
  87. package/dist/helpers/template-helpers.d.cts.map +1 -0
  88. package/dist/helpers/template-helpers.d.mts +15 -0
  89. package/dist/helpers/template-helpers.d.mts.map +1 -0
  90. package/dist/helpers/template-helpers.mjs +70 -0
  91. package/dist/helpers/template-helpers.mjs.map +1 -0
  92. package/dist/index.cjs +195 -0
  93. package/dist/index.d.cts +17 -0
  94. package/dist/index.d.cts.map +1 -0
  95. package/dist/index.d.mts +17 -0
  96. package/dist/index.d.mts.map +1 -0
  97. package/dist/index.mjs +189 -0
  98. package/dist/index.mjs.map +1 -0
  99. package/dist/types/index.cjs +11 -0
  100. package/dist/types/index.d.cts +3 -0
  101. package/dist/types/index.d.mts +3 -0
  102. package/dist/types/index.mjs +4 -0
  103. package/dist/types/plugin.cjs +137 -0
  104. package/dist/types/plugin.d.cts +168 -0
  105. package/dist/types/plugin.d.cts.map +1 -0
  106. package/dist/types/plugin.d.mts +168 -0
  107. package/dist/types/plugin.d.mts.map +1 -0
  108. package/dist/types/plugin.mjs +132 -0
  109. package/dist/types/plugin.mjs.map +1 -0
  110. package/dist/types/runtime.cjs +244 -0
  111. package/dist/types/runtime.d.cts +792 -0
  112. package/dist/types/runtime.d.cts.map +1 -0
  113. package/dist/types/runtime.d.mts +792 -0
  114. package/dist/types/runtime.d.mts.map +1 -0
  115. package/dist/types/runtime.mjs +242 -0
  116. package/dist/types/runtime.mjs.map +1 -0
  117. package/package.json +10 -10
@@ -0,0 +1,311 @@
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";
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";
13
+
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 = createEnvReflection(context);
105
+ const message = new capnp.Message();
106
+ reflection.messageRoot = message.initRoot(SerializedTypes);
107
+ reflection.dataBuffer = message.toArrayBuffer();
108
+ context.env.types.env = reflection;
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 = 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.name = "Env";
189
+ const message = new capnp.Message();
190
+ reflection.messageRoot = message.initRoot(SerializedTypes);
191
+ reflection.dataBuffer = message.toArrayBuffer();
192
+ context.env.used.env = reflection;
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 = 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.name = "Secrets";
234
+ const message = new capnp.Message();
235
+ reflection.messageRoot = message.initRoot(SerializedTypes);
236
+ reflection.dataBuffer = message.toArrayBuffer();
237
+ context.env.used.secrets = reflection;
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
+ export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
311
+ //# sourceMappingURL=persistence.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { convertFromCapnp, convertToCapnp } from \"@powerlines/deepkit/capnp\";\nimport { getReflectionsPath } from \"@powerlines/deepkit/resolve-reflections\";\nimport { SerializedTypes } from \"@powerlines/deepkit/schemas/reflection\";\nimport { Reflection } from \"@powerlines/deepkit/types\";\nimport {\n deserializeType,\n ReflectionClass,\n ReflectionKind,\n resolveClassType\n} from \"@powerlines/deepkit/vendor/type\";\nimport * as capnp from \"@stryke/capnp\";\nimport {\n readFileBuffer,\n writeFileBuffer,\n writeFileBufferSync\n} from \"@stryke/fs/buffer\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isEmptyObject } from \"@stryke/type-checks/is-empty-object\";\nimport type { TypeDefinition } from \"@stryke/types/configuration\";\nimport { existsSync } from \"node:fs\";\nimport { Context, UnresolvedContext } from \"powerlines\";\nimport {\n EnvPluginContext,\n EnvPluginResolvedConfig,\n EnvType\n} from \"../types/plugin\";\nimport { createEnvReflection } from \"./reflect\";\n\n/**\n * Resolves the runtime type definition file for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The runtime type definition file for the environment variables.\n */\nexport async function resolveRuntimeTypeFile(\n context: UnresolvedContext<EnvPluginResolvedConfig>\n): Promise<string> {\n const resolved = await context.fs.resolve(\n \"@powerlines/plugin-env/types/runtime\"\n );\n if (!resolved) {\n throw new Error(\n `Failed to resolve the runtime type definition file for the environment variables. Please ensure that the \"@powerlines/plugin-env\" package is installed.`\n );\n }\n\n return resolved;\n}\n\n/**\n * Gets the default type definition for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment variables.\n */\nexport async function getEnvDefaultTypeDefinition(\n context: UnresolvedContext<EnvPluginResolvedConfig>\n): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"EnvInterface\"\n };\n}\n\n/** Gets the default type definition for the environment secrets.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment secrets.\n */\nexport async function getSecretsDefaultTypeDefinition(\n context: UnresolvedContext<EnvPluginResolvedConfig>\n): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"SecretsInterface\"\n };\n}\n\n/**\n * Gets the path to the environment type reflections.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The path to the environment type reflections.\n */\nexport function getEnvTypeReflectionsPath(\n context: Context<EnvPluginResolvedConfig>,\n name: EnvType = \"env\"\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}-types.bin`);\n}\n\n/**\n * Reads the environment type reflection from the file system.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The environment type reflection.\n */\nexport async function readEnvTypeReflection(\n context: EnvPluginContext,\n name: EnvType = \"env\"\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvTypeReflectionsPath(context, name);\n if (!existsSync(filePath)) {\n if (!context.env.types.env || isEmptyObject(context.env.types.env)) {\n const reflection = createEnvReflection(context) as Reflection;\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.types.env = reflection;\n await writeEnvTypeReflection(context, context.env.types.env, name);\n }\n\n return context.env.types.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.types[name] = reflection;\n context.env.types[name].messageRoot = messageRoot;\n context.env.types[name].dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment type reflection to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The environment type reflection to write.\n * @param name - The name of the type reflections.\n */\nexport async function writeEnvTypeReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvTypeReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\nexport function getEnvReflectionsPath(\n context: EnvPluginContext,\n name: EnvType\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}.bin`);\n}\n\n/**\n * Reads the environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readEnvReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"env\");\n if (!existsSync(filePath)) {\n if (!context.env.types.env) {\n context.env.types.env = await readEnvTypeReflection(context, \"env\");\n }\n\n if (!context.env.used.env || isEmptyObject(context.env.used.env)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.env\n }) as Reflection;\n reflection.name = \"Env\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.env = reflection;\n await writeEnvReflection(context, context.env.used.env, \"env\");\n }\n\n return context.env.used.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.env = reflection;\n context.env.used.env.messageRoot = messageRoot;\n context.env.used.env.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Reads the secret environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readSecretsReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"secrets\");\n if (!existsSync(filePath)) {\n if (!context.env.types.secrets) {\n context.env.types.secrets = await readEnvTypeReflection(\n context,\n \"secrets\"\n );\n }\n\n if (!context.env.used.secrets || isEmptyObject(context.env.used.secrets)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.secrets\n }) as Reflection;\n reflection.name = \"Secrets\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.secrets = reflection;\n await writeEnvReflection(context, context.env.used.secrets, \"secrets\");\n }\n\n return context.env.used.secrets;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.secrets = reflection;\n context.env.used.secrets.messageRoot = messageRoot;\n context.env.used.secrets.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport async function writeEnvReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport function writeEnvReflectionSync(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n writeFileBufferSync(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,299 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_types_runtime = require('../types/runtime.cjs');
4
+ const require_types_plugin = require('../types/plugin.cjs');
5
+ const require_helpers_persistence = require('./persistence.cjs');
6
+ let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
7
+ let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
8
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
9
+ let _powerlines_deepkit_reflect_type = require("@powerlines/deepkit/reflect-type");
10
+ let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
11
+
12
+ //#region src/helpers/reflect.ts
13
+ function __assignType(fn, args) {
14
+ fn.__type = args;
15
+ return fn;
16
+ }
17
+ function mergeEnvReflections(context, reflections) {
18
+ return createEnvReflection(context, { type: (0, _powerlines_deepkit_vendor_type.merge)(reflections.map(__assignType((reflection) => reflection.type, [
19
+ "reflection",
20
+ "",
21
+ "P\"2!\"/\""
22
+ ]))) });
23
+ }
24
+ mergeEnvReflections.__type = [
25
+ () => require_types_plugin.__ΩEnvPluginContext,
26
+ "context",
27
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
28
+ "reflections",
29
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
30
+ "mergeEnvReflections",
31
+ "Pn!2\"P\"7#F2$P\"7%/&"
32
+ ];
33
+ function mergeSecretsReflections(context, reflections) {
34
+ return createSecretsReflection(context, { type: (0, _powerlines_deepkit_vendor_type.merge)(reflections.map(__assignType((reflection) => reflection.type, [
35
+ "reflection",
36
+ "",
37
+ "P\"2!\"/\""
38
+ ]))) });
39
+ }
40
+ mergeSecretsReflections.__type = [
41
+ () => require_types_plugin.__ΩEnvPluginContext,
42
+ "context",
43
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
44
+ "reflections",
45
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
46
+ "mergeSecretsReflections",
47
+ "Pn!2\"P\"7#F2$P\"7%/&"
48
+ ];
49
+ const __ΩCreateEnvReflectionOptions = [
50
+ () => _powerlines_deepkit_vendor_type.__ΩTypeObjectLiteral,
51
+ () => _powerlines_deepkit_vendor_type.__ΩTypeClass,
52
+ "type",
53
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
54
+ "superReflection",
55
+ "CreateEnvReflectionOptions",
56
+ "PPn!n\"J4#8P\"7$4%8Mw&y"
57
+ ];
58
+ var BaseEnv = class {
59
+ APP_NAME;
60
+ APP_VERSION;
61
+ BUILD_ID;
62
+ BUILD_TIMESTAMP;
63
+ BUILD_CHECKSUM;
64
+ RELEASE_ID;
65
+ RELEASE_TAG;
66
+ ORGANIZATION;
67
+ PLATFORM = "neutral";
68
+ MODE = "production";
69
+ ENVIRONMENT;
70
+ DEBUG = false;
71
+ TEST = false;
72
+ MINIMAL = false;
73
+ NO_COLOR = false;
74
+ FORCE_COLOR = false;
75
+ FORCE_HYPERLINK = false;
76
+ STACKTRACE = false;
77
+ INCLUDE_ERROR_DATA = false;
78
+ ERROR_URL;
79
+ DEFAULT_TIMEZONE;
80
+ DEFAULT_LOCALE;
81
+ CI = false;
82
+ static __type = [
83
+ "APP_NAME",
84
+ "APP_VERSION",
85
+ "BUILD_ID",
86
+ "BUILD_TIMESTAMP",
87
+ "BUILD_CHECKSUM",
88
+ "RELEASE_ID",
89
+ "RELEASE_TAG",
90
+ "ORGANIZATION",
91
+ "node",
92
+ "browser",
93
+ "neutral",
94
+ "PLATFORM",
95
+ function() {
96
+ return "neutral";
97
+ },
98
+ "development",
99
+ "test",
100
+ "production",
101
+ "MODE",
102
+ function() {
103
+ return "production";
104
+ },
105
+ "ENVIRONMENT",
106
+ "DEBUG",
107
+ function() {
108
+ return false;
109
+ },
110
+ "TEST",
111
+ function() {
112
+ return false;
113
+ },
114
+ "MINIMAL",
115
+ function() {
116
+ return false;
117
+ },
118
+ "NO_COLOR",
119
+ function() {
120
+ return false;
121
+ },
122
+ "FORCE_COLOR",
123
+ function() {
124
+ return false;
125
+ },
126
+ "FORCE_HYPERLINK",
127
+ function() {
128
+ return false;
129
+ },
130
+ "STACKTRACE",
131
+ function() {
132
+ return false;
133
+ },
134
+ "INCLUDE_ERROR_DATA",
135
+ function() {
136
+ return false;
137
+ },
138
+ "ERROR_URL",
139
+ "DEFAULT_TIMEZONE",
140
+ "DEFAULT_LOCALE",
141
+ "CI",
142
+ function() {
143
+ return false;
144
+ },
145
+ () => require_types_runtime.__ΩEnvInterface,
146
+ "BaseEnv",
147
+ "&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"
148
+ ];
149
+ };
150
+ var BaseSecrets = class {
151
+ ENCRYPTION_KEY;
152
+ static __type = [
153
+ "ENCRYPTION_KEY",
154
+ () => require_types_runtime.__ΩSecretsInterface,
155
+ "BaseSecrets",
156
+ "&3!5n\"x\"w#"
157
+ ];
158
+ };
159
+ function createEnvReflection(context, options = {}) {
160
+ const parent = options.superReflection ?? new _powerlines_deepkit_vendor_type.ReflectionClass({
161
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.class,
162
+ description: `The base environment configuration definition for the ${(0, _stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
163
+ classType: BaseEnv,
164
+ types: [],
165
+ implements: [{
166
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
167
+ typeName: "EnvInterface",
168
+ description: `The environment configuration interface definition for the ${(0, _stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
169
+ types: []
170
+ }]
171
+ });
172
+ parent.name = "Env";
173
+ const result = new _powerlines_deepkit_vendor_type.ReflectionClass(options.type ?? {
174
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
175
+ typeName: "Env",
176
+ 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"}.`,
177
+ types: []
178
+ }, parent);
179
+ result.name = "Env";
180
+ return result;
181
+ }
182
+ createEnvReflection.__type = [
183
+ () => require_types_plugin.__ΩEnvPluginContext,
184
+ "context",
185
+ () => __ΩCreateEnvReflectionOptions,
186
+ "options",
187
+ () => ({}),
188
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
189
+ "createEnvReflection",
190
+ "Pn!2\"n#2$>%P\"7&/'"
191
+ ];
192
+ function createSecretsReflection(context, options = {}) {
193
+ const parent = options.superReflection ?? new _powerlines_deepkit_vendor_type.ReflectionClass({
194
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.class,
195
+ description: `The base secrets configuration definition for the ${(0, _stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
196
+ classType: BaseSecrets,
197
+ types: [],
198
+ implements: [{
199
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
200
+ typeName: "SecretsInterface",
201
+ description: `The secrets configuration interface definition for the ${(0, _stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
202
+ types: []
203
+ }]
204
+ });
205
+ parent.name = "Secrets";
206
+ const result = new _powerlines_deepkit_vendor_type.ReflectionClass(options.type ?? {
207
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
208
+ typeName: "Secrets",
209
+ 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"}.`,
210
+ types: []
211
+ }, parent);
212
+ result.name = "Secrets";
213
+ return result;
214
+ }
215
+ createSecretsReflection.__type = [
216
+ () => require_types_plugin.__ΩEnvPluginContext,
217
+ "context",
218
+ () => __ΩCreateEnvReflectionOptions,
219
+ "options",
220
+ () => ({}),
221
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
222
+ "createSecretsReflection",
223
+ "Pn!2\"n#2$>%P\"7&/'"
224
+ ];
225
+ /**
226
+ * Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.
227
+ *
228
+ * @remarks
229
+ * The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
230
+ *
231
+ * @param context - The plugin context
232
+ * @param file - The file path to reflect the environment configuration type definition from
233
+ * @param name - The name of the type definition to reflect the environment configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
234
+ * @returns A reflection of the environment configuration type definition, merged with the default environment configuration reflection and the currently used environment configuration reflection. The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
235
+ */
236
+ async function reflectEnv(context, file, name) {
237
+ let config;
238
+ if (file) config = (0, _powerlines_deepkit_vendor_type.resolveClassType)(await (0, _powerlines_deepkit_reflect_type.reflectType)(context, {
239
+ file: !(0, _stryke_path_is_parent_path.isParentPath)(file, context.workspaceConfig.workspaceRoot) ? (0, _stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, file) : file,
240
+ name
241
+ }));
242
+ return mergeEnvReflections(context, [
243
+ await require_helpers_persistence.readEnvTypeReflection(context, "env"),
244
+ config,
245
+ (0, _powerlines_deepkit_vendor_type.resolveClassType)(await (0, _powerlines_deepkit_reflect_type.reflectType)(context, await require_helpers_persistence.getEnvDefaultTypeDefinition(context)))
246
+ ].filter(Boolean));
247
+ }
248
+ reflectEnv.__type = [
249
+ () => require_types_plugin.__ΩEnvPluginContext,
250
+ "context",
251
+ "file",
252
+ "name",
253
+ "reflectEnv",
254
+ "Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.",
255
+ "Pn!2\"&2#8&2$8\"/%?&"
256
+ ];
257
+ /**
258
+ * Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.
259
+ *
260
+ * @remarks
261
+ * The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
262
+ *
263
+ * @param context - The plugin context
264
+ * @param file - The file path to reflect the secrets configuration type definition from
265
+ * @param name - The name of the type definition to reflect the secrets configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
266
+ * @returns A reflection of the secrets configuration type definition, merged with the default secrets configuration reflection and the currently used secrets configuration reflection. The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
267
+ */
268
+ async function reflectSecrets(context, file, name) {
269
+ let config;
270
+ if (file) config = (0, _powerlines_deepkit_vendor_type.resolveClassType)(await (0, _powerlines_deepkit_reflect_type.reflectType)(context, {
271
+ file: !(0, _stryke_path_is_parent_path.isParentPath)(file, context.workspaceConfig.workspaceRoot) ? (0, _stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, file) : file,
272
+ name
273
+ }));
274
+ return mergeSecretsReflections(context, [
275
+ await require_helpers_persistence.readSecretsReflection(context),
276
+ config,
277
+ (0, _powerlines_deepkit_vendor_type.resolveClassType)(await (0, _powerlines_deepkit_reflect_type.reflectType)(context, await require_helpers_persistence.getSecretsDefaultTypeDefinition(context)))
278
+ ].filter(Boolean));
279
+ }
280
+ reflectSecrets.__type = [
281
+ () => require_types_plugin.__ΩEnvPluginContext,
282
+ "context",
283
+ "file",
284
+ "name",
285
+ "reflectSecrets",
286
+ "Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.",
287
+ "Pn!2\"&2#8&2$8\"/%?&"
288
+ ];
289
+
290
+ //#endregion
291
+ exports.BaseEnv = BaseEnv;
292
+ exports.BaseSecrets = BaseSecrets;
293
+ exports.__ΩCreateEnvReflectionOptions = __ΩCreateEnvReflectionOptions;
294
+ exports.createEnvReflection = createEnvReflection;
295
+ exports.createSecretsReflection = createSecretsReflection;
296
+ exports.mergeEnvReflections = mergeEnvReflections;
297
+ exports.mergeSecretsReflections = mergeSecretsReflections;
298
+ exports.reflectEnv = reflectEnv;
299
+ exports.reflectSecrets = reflectSecrets;