@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,133 @@
1
+ import { __ΩEnvPluginContext, __ΩEnvPluginOptions } from "../types/plugin.mjs";
2
+ import { removeEnvPrefix } from "./source-file-env.mjs";
3
+ import { __ΩWorkspaceConfig } from "powerlines";
4
+ import { joinPaths } from "@stryke/path/join-paths";
5
+ import { loadEnv as loadEnv$1, loadEnvFile } from "@stryke/env/load-env";
6
+ import { kebabCase } from "@stryke/string-format/kebab-case";
7
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
8
+ import { loadConfig } from "c12";
9
+ import defu from "defu";
10
+ import { DEFAULT_ENVIRONMENT } from "powerlines/constants";
11
+
12
+ //#region src/helpers/load.ts
13
+ function __assignType(fn, args) {
14
+ fn.__type = args;
15
+ return fn;
16
+ }
17
+ async function loadEnvFiles(options, mode, cwd) {
18
+ let env = await loadEnv$1(cwd, mode);
19
+ if (options.additionalFiles && options.additionalFiles?.length > 0) {
20
+ const additionalEnvFiles = await Promise.all(options.additionalFiles.map(__assignType(async (additionalEnvFile) => loadEnvFile(additionalEnvFile, cwd), [
21
+ "additionalEnvFile",
22
+ "",
23
+ "P\"2!\"/\""
24
+ ])));
25
+ for (const additionalEnvFile of additionalEnvFiles) env = defu(additionalEnvFile, env);
26
+ }
27
+ return removeEnvPrefix(env);
28
+ }
29
+ loadEnvFiles.__type = [
30
+ () => __ΩEnvPluginOptions,
31
+ "options",
32
+ "mode",
33
+ "cwd",
34
+ "loadEnvFiles",
35
+ "Pn!2\"&2#&2$\"`/%"
36
+ ];
37
+ async function loadEnvDirectory(options, directory, mode, cacheDir, packageJson, workspaceConfig) {
38
+ const [envResult, c12Result] = await Promise.all([(loadEnvFiles.Ω = [["!"]], loadEnvFiles(options, mode, directory)), loadConfig({
39
+ cwd: directory,
40
+ name: "storm",
41
+ envName: mode,
42
+ defaults: {
43
+ NAME: packageJson.name?.replace(`@${workspaceConfig.namespace}/`, ""),
44
+ MODE: mode,
45
+ ORG: workspaceConfig.organization
46
+ },
47
+ globalRc: true,
48
+ packageJson: true,
49
+ dotenv: true,
50
+ jitiOptions: {
51
+ fsCache: joinPaths(cacheDir, "jiti"),
52
+ moduleCache: true
53
+ }
54
+ })]);
55
+ return defu(envResult, c12Result.config, workspaceConfig);
56
+ }
57
+ loadEnvDirectory.__type = [
58
+ () => __ΩEnvPluginOptions,
59
+ "options",
60
+ "directory",
61
+ "mode",
62
+ "cacheDir",
63
+ "packageJson",
64
+ () => __ΩWorkspaceConfig,
65
+ "workspaceConfig",
66
+ "loadEnvDirectory",
67
+ "Pn!2\"&2#&2$&2%!2&n'2(\"`/)"
68
+ ];
69
+ /**
70
+ * Retrieves various dotenv configuration parameters from the context.
71
+ *
72
+ * @param context - The context to retrieve the dotenv configuration from.
73
+ * @param parsed - The parsed dotenv configuration.
74
+ * @returns An object containing the dotenv configuration.
75
+ */
76
+ function loadEnvFromContext(context, parsed) {
77
+ return defu({
78
+ APP_NAME: kebabCase(context.config.name || context.packageJson.name?.replace(`/${context.workspaceConfig.namespace}`, "")),
79
+ APP_VERSION: context.packageJson.version,
80
+ BUILD_ID: context.meta.buildId,
81
+ BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),
82
+ BUILD_CHECKSUM: context.meta.checksum,
83
+ RELEASE_ID: context.meta.releaseId,
84
+ RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,
85
+ DEFAULT_LOCALE: context.workspaceConfig.locale,
86
+ DEFAULT_TIMEZONE: context.workspaceConfig.timezone,
87
+ LOG_LEVEL: context.config.logLevel === "trace" ? "debug" : context.config.logLevel,
88
+ ERROR_URL: context.workspaceConfig.error?.url,
89
+ ORGANIZATION: context.config.organization || (isSetObject(context.workspaceConfig.organization) ? context.workspaceConfig.organization.name : context.workspaceConfig.organization),
90
+ PLATFORM: context.config.platform,
91
+ MODE: context.config.mode,
92
+ TEST: context.config.mode === "test",
93
+ DEBUG: context.config.mode === "development",
94
+ STACKTRACE: context.config.mode !== "production",
95
+ ENVIRONMENT: !context.environment.name || context.environment.name === DEFAULT_ENVIRONMENT ? context.config.mode : context.environment.name
96
+ }, isSetObject(context?.env?.types?.env) ? context.env.types.env?.getProperties().reduce(__assignType((ret, prop) => {
97
+ ret[prop.name] = parsed[prop.name] ?? prop.getDefaultValue();
98
+ return ret;
99
+ }, [
100
+ "ret",
101
+ "prop",
102
+ "",
103
+ "P\"2!\"2\"\"/#"
104
+ ]), {}) : {});
105
+ }
106
+ loadEnvFromContext.__type = [
107
+ () => __ΩEnvPluginContext,
108
+ "context",
109
+ "parsed",
110
+ "loadEnvFromContext",
111
+ "Retrieves various dotenv configuration parameters from the context.",
112
+ "Pn!2\"!2#\"/$?%"
113
+ ];
114
+ async function loadEnv(context, options) {
115
+ const [project, workspace, config] = await Promise.all([
116
+ (loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(options, context.config.root, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig)),
117
+ (loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(options, context.workspaceConfig.workspaceRoot, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig)),
118
+ (loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(options, context.envPaths.config, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig))
119
+ ]);
120
+ return defu(loadEnvFromContext(context, process.env), project, workspace, config);
121
+ }
122
+ loadEnv.__type = [
123
+ () => __ΩEnvPluginContext,
124
+ "context",
125
+ () => __ΩEnvPluginOptions,
126
+ "options",
127
+ "loadEnv",
128
+ "Pn!2\"n#2$\"`/%"
129
+ ];
130
+
131
+ //#endregion
132
+ export { loadEnv, loadEnvFromContext };
133
+ //# sourceMappingURL=load.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.mjs","names":[],"sources":["../../src/helpers/load.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 {\n loadEnv as loadEnvBase,\n loadEnvFile as loadEnvFileBase\n} from \"@stryke/env/load-env\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig } from \"c12\";\nimport defu from \"defu\";\nimport { WorkspaceConfig } from \"powerlines\";\nimport { DEFAULT_ENVIRONMENT } from \"powerlines/constants\";\nimport { EnvPluginContext, EnvPluginOptions } from \"../types/plugin\";\nimport { removeEnvPrefix } from \"./source-file-env\";\n\nasync function loadEnvFiles<TEnv extends DotenvParseOutput = DotenvParseOutput>(\n options: EnvPluginOptions,\n mode: string,\n cwd: string\n): Promise<TEnv> {\n let env = await loadEnvBase(cwd, mode);\n if (options.additionalFiles && options.additionalFiles?.length > 0) {\n const additionalEnvFiles = await Promise.all(\n options.additionalFiles.map(async additionalEnvFile =>\n loadEnvFileBase(additionalEnvFile, cwd)\n )\n );\n\n for (const additionalEnvFile of additionalEnvFiles) {\n env = defu(additionalEnvFile, env);\n }\n }\n\n return removeEnvPrefix(env) as TEnv;\n}\n\nasync function loadEnvDirectory<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(\n options: EnvPluginOptions,\n directory: string,\n mode: string,\n cacheDir: string,\n packageJson: PackageJson,\n workspaceConfig: WorkspaceConfig\n): Promise<TEnv> {\n const [envResult, c12Result] = await Promise.all([\n loadEnvFiles<TEnv>(options, mode, directory),\n loadConfig({\n cwd: directory,\n name: \"storm\",\n envName: mode,\n defaults: {\n NAME: packageJson.name?.replace(`@${workspaceConfig.namespace}/`, \"\"),\n MODE: mode,\n ORG: workspaceConfig.organization\n },\n globalRc: true,\n packageJson: true,\n dotenv: true,\n jitiOptions: {\n fsCache: joinPaths(cacheDir, \"jiti\"),\n moduleCache: true\n }\n })\n ]);\n\n return defu(envResult as any, c12Result.config, workspaceConfig) as TEnv;\n}\n\n/**\n * Retrieves various dotenv configuration parameters from the context.\n *\n * @param context - The context to retrieve the dotenv configuration from.\n * @param parsed - The parsed dotenv configuration.\n * @returns An object containing the dotenv configuration.\n */\nexport function loadEnvFromContext(\n context: EnvPluginContext,\n parsed: DotenvParseOutput\n) {\n return defu(\n {\n APP_NAME: kebabCase(\n context.config.name ||\n context.packageJson.name?.replace(\n `/${context.workspaceConfig.namespace}`,\n \"\"\n )\n ),\n APP_VERSION: context.packageJson.version,\n BUILD_ID: context.meta.buildId,\n BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),\n BUILD_CHECKSUM: context.meta.checksum,\n RELEASE_ID: context.meta.releaseId,\n RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,\n DEFAULT_LOCALE: context.workspaceConfig.locale,\n DEFAULT_TIMEZONE: context.workspaceConfig.timezone,\n LOG_LEVEL:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n ERROR_URL: context.workspaceConfig.error?.url,\n ORGANIZATION:\n context.config.organization ||\n (isSetObject(context.workspaceConfig.organization)\n ? context.workspaceConfig.organization.name\n : context.workspaceConfig.organization),\n PLATFORM: context.config.platform,\n MODE: context.config.mode,\n TEST: context.config.mode === \"test\",\n DEBUG: context.config.mode === \"development\",\n STACKTRACE: context.config.mode !== \"production\",\n ENVIRONMENT:\n !context.environment.name ||\n context.environment.name === DEFAULT_ENVIRONMENT\n ? context.config.mode\n : context.environment.name\n },\n isSetObject(context?.env?.types?.env)\n ? context.env.types.env?.getProperties().reduce(\n (ret, prop) => {\n ret[prop.name] = parsed[prop.name] ?? prop.getDefaultValue();\n return ret;\n },\n {} as Record<string, any>\n )\n : {}\n );\n}\n\nexport async function loadEnv<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv> {\n const [project, workspace, config] = await Promise.all([\n loadEnvDirectory<TEnv>(\n options,\n context.config.root,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n context.workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n options,\n context.workspaceConfig.workspaceRoot,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n context.workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n options,\n context.envPaths.config,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n context.workspaceConfig\n )\n ]);\n\n return defu(\n loadEnvFromContext(context, process.env),\n project,\n workspace,\n config\n ) as TEnv;\n}\n"],"mappings":"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"}
@@ -0,0 +1,323 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_types_plugin = require('../types/plugin.cjs');
4
+ const require_helpers_reflect = require('./reflect.cjs');
5
+ let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
6
+ let powerlines = require("powerlines");
7
+ let _powerlines_deepkit_capnp = require("@powerlines/deepkit/capnp");
8
+ let _powerlines_deepkit_resolve_reflections = require("@powerlines/deepkit/resolve-reflections");
9
+ let _powerlines_deepkit_schemas_reflection = require("@powerlines/deepkit/schemas/reflection");
10
+ let _stryke_capnp = require("@stryke/capnp");
11
+ _stryke_capnp = require_runtime.__toESM(_stryke_capnp);
12
+ let _stryke_fs_buffer = require("@stryke/fs/buffer");
13
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
14
+ let _stryke_type_checks_is_empty_object = require("@stryke/type-checks/is-empty-object");
15
+ let node_fs = require("node:fs");
16
+
17
+ //#region src/helpers/persistence.ts
18
+ /**
19
+ * Resolves the runtime type definition file for the environment variables.
20
+ *
21
+ * @param context - The plugin context.
22
+ * @returns The runtime type definition file for the environment variables.
23
+ */
24
+ async function resolveRuntimeTypeFile(context) {
25
+ const resolved = await context.fs.resolve("@powerlines/plugin-env/types/runtime");
26
+ 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.`);
27
+ return resolved;
28
+ }
29
+ resolveRuntimeTypeFile.__type = [
30
+ () => powerlines.__ΩUnresolvedContext,
31
+ () => require_types_plugin.__ΩEnvPluginResolvedConfig,
32
+ "context",
33
+ "resolveRuntimeTypeFile",
34
+ "Resolves the runtime type definition file for the environment variables.",
35
+ "Pn\"o!\"2#&`/$?%"
36
+ ];
37
+ /**
38
+ * Gets the default type definition for the environment variables.
39
+ *
40
+ * @param context - The plugin context.
41
+ * @returns The default type definition for the environment variables.
42
+ */
43
+ async function getEnvDefaultTypeDefinition(context) {
44
+ return {
45
+ file: await resolveRuntimeTypeFile(context),
46
+ name: "EnvInterface"
47
+ };
48
+ }
49
+ getEnvDefaultTypeDefinition.__type = [
50
+ () => powerlines.__ΩUnresolvedContext,
51
+ () => require_types_plugin.__ΩEnvPluginResolvedConfig,
52
+ "context",
53
+ "getEnvDefaultTypeDefinition",
54
+ "Gets the default type definition for the environment variables.",
55
+ "Pn\"o!\"2#!`/$?%"
56
+ ];
57
+ /** Gets the default type definition for the environment secrets.
58
+ *
59
+ * @param context - The plugin context.
60
+ * @returns The default type definition for the environment secrets.
61
+ */
62
+ async function getSecretsDefaultTypeDefinition(context) {
63
+ return {
64
+ file: await resolveRuntimeTypeFile(context),
65
+ name: "SecretsInterface"
66
+ };
67
+ }
68
+ getSecretsDefaultTypeDefinition.__type = [
69
+ () => powerlines.__ΩUnresolvedContext,
70
+ () => require_types_plugin.__ΩEnvPluginResolvedConfig,
71
+ "context",
72
+ "getSecretsDefaultTypeDefinition",
73
+ "Pn\"o!\"2#!`/$"
74
+ ];
75
+ /**
76
+ * Gets the path to the environment type reflections.
77
+ *
78
+ * @param context - The plugin context.
79
+ * @param name - The name of the type reflections.
80
+ * @returns The path to the environment type reflections.
81
+ */
82
+ function getEnvTypeReflectionsPath(context, name = "env") {
83
+ return (0, _stryke_path_join_paths.joinPaths)((0, _powerlines_deepkit_resolve_reflections.getReflectionsPath)(context), "env", `${name}-types.bin`);
84
+ }
85
+ getEnvTypeReflectionsPath.__type = [
86
+ () => powerlines.__ΩContext,
87
+ () => require_types_plugin.__ΩEnvPluginResolvedConfig,
88
+ "context",
89
+ () => require_types_plugin.__ΩEnvType,
90
+ "name",
91
+ () => "env",
92
+ "getEnvTypeReflectionsPath",
93
+ "Gets the path to the environment type reflections.",
94
+ "Pn\"o!\"2#n$2%>&&/'?("
95
+ ];
96
+ /**
97
+ * Reads the environment type reflection from the file system.
98
+ *
99
+ * @param context - The plugin context.
100
+ * @param name - The name of the type reflections.
101
+ * @returns The environment type reflection.
102
+ */
103
+ async function readEnvTypeReflection(context, name = "env") {
104
+ const filePath = getEnvTypeReflectionsPath(context, name);
105
+ if (!(0, node_fs.existsSync)(filePath)) {
106
+ if (!context.env.types.env || (0, _stryke_type_checks_is_empty_object.isEmptyObject)(context.env.types.env)) {
107
+ const reflection = require_helpers_reflect.createEnvReflection(context);
108
+ const message = new _stryke_capnp.Message();
109
+ reflection.messageRoot = message.initRoot(_powerlines_deepkit_schemas_reflection.SerializedTypes);
110
+ reflection.dataBuffer = message.toArrayBuffer();
111
+ context.env.types.env = reflection;
112
+ await writeEnvTypeReflection(context, context.env.types.env, name);
113
+ }
114
+ return context.env.types.env;
115
+ }
116
+ const buffer = await (0, _stryke_fs_buffer.readFileBuffer)(filePath);
117
+ const messageRoot = new _stryke_capnp.Message(buffer, false).getRoot(_powerlines_deepkit_schemas_reflection.SerializedTypes);
118
+ const reflection = (0, _powerlines_deepkit_vendor_type.resolveClassType)((0, _powerlines_deepkit_vendor_type.deserializeType)((0, _powerlines_deepkit_capnp.convertFromCapnp)(messageRoot.types)));
119
+ context.env.types[name] = reflection;
120
+ context.env.types[name].messageRoot = messageRoot;
121
+ context.env.types[name].dataBuffer = buffer;
122
+ return reflection;
123
+ }
124
+ readEnvTypeReflection.__type = [
125
+ () => require_types_plugin.__ΩEnvPluginContext,
126
+ "context",
127
+ () => require_types_plugin.__ΩEnvType,
128
+ "name",
129
+ () => "env",
130
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
131
+ "readEnvTypeReflection",
132
+ "Reads the environment type reflection from the file system.",
133
+ "Pn!2\"n#2$>%P\"7&`/'?("
134
+ ];
135
+ /**
136
+ * Writes the environment type reflection to the file system.
137
+ *
138
+ * @param context - The plugin context.
139
+ * @param reflection - The environment type reflection to write.
140
+ * @param name - The name of the type reflections.
141
+ */
142
+ async function writeEnvTypeReflection(context, reflection, name = "env") {
143
+ const serialized = reflection.serializeType();
144
+ const message = new _stryke_capnp.Message();
145
+ (0, _powerlines_deepkit_capnp.convertToCapnp)(serialized, message.initRoot(_powerlines_deepkit_schemas_reflection.SerializedTypes)._initTypes(serialized.length));
146
+ await (0, _stryke_fs_buffer.writeFileBuffer)(getEnvTypeReflectionsPath(context, name), message.toArrayBuffer());
147
+ }
148
+ writeEnvTypeReflection.__type = [
149
+ () => require_types_plugin.__ΩEnvPluginContext,
150
+ "context",
151
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
152
+ "reflection",
153
+ () => require_types_plugin.__ΩEnvType,
154
+ "name",
155
+ () => "env",
156
+ "writeEnvTypeReflection",
157
+ "Writes the environment type reflection to the file system.",
158
+ "Pn!2\"P\"7#2$n%2&>'\"/(?)"
159
+ ];
160
+ function getEnvReflectionsPath(context, name) {
161
+ return (0, _stryke_path_join_paths.joinPaths)((0, _powerlines_deepkit_resolve_reflections.getReflectionsPath)(context), "env", `${name}.bin`);
162
+ }
163
+ getEnvReflectionsPath.__type = [
164
+ () => require_types_plugin.__ΩEnvPluginContext,
165
+ "context",
166
+ () => require_types_plugin.__ΩEnvType,
167
+ "name",
168
+ "getEnvReflectionsPath",
169
+ "Pn!2\"n#2$&/%"
170
+ ];
171
+ /**
172
+ * Reads the environment reflection data from the file system.
173
+ *
174
+ * @param context - The plugin context.
175
+ * @returns The environment reflection data.
176
+ */
177
+ async function readEnvReflection(context) {
178
+ const filePath = getEnvReflectionsPath(context, "env");
179
+ if (!(0, node_fs.existsSync)(filePath)) {
180
+ if (!context.env.types.env) context.env.types.env = await readEnvTypeReflection(context, "env");
181
+ if (!context.env.used.env || (0, _stryke_type_checks_is_empty_object.isEmptyObject)(context.env.used.env)) {
182
+ const reflection = require_helpers_reflect.createEnvReflection(context, {
183
+ type: {
184
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
185
+ typeName: "Env",
186
+ description: `An object containing the environment configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
187
+ types: []
188
+ },
189
+ superReflection: context.env.types.env
190
+ });
191
+ reflection.name = "Env";
192
+ const message = new _stryke_capnp.Message();
193
+ reflection.messageRoot = message.initRoot(_powerlines_deepkit_schemas_reflection.SerializedTypes);
194
+ reflection.dataBuffer = message.toArrayBuffer();
195
+ context.env.used.env = reflection;
196
+ await writeEnvReflection(context, context.env.used.env, "env");
197
+ }
198
+ return context.env.used.env;
199
+ }
200
+ const buffer = await (0, _stryke_fs_buffer.readFileBuffer)(filePath);
201
+ const messageRoot = new _stryke_capnp.Message(buffer, false).getRoot(_powerlines_deepkit_schemas_reflection.SerializedTypes);
202
+ const reflection = (0, _powerlines_deepkit_vendor_type.resolveClassType)((0, _powerlines_deepkit_vendor_type.deserializeType)((0, _powerlines_deepkit_capnp.convertFromCapnp)(messageRoot.types)));
203
+ context.env.used.env = reflection;
204
+ context.env.used.env.messageRoot = messageRoot;
205
+ context.env.used.env.dataBuffer = buffer;
206
+ return reflection;
207
+ }
208
+ readEnvReflection.__type = [
209
+ () => require_types_plugin.__ΩEnvPluginContext,
210
+ "context",
211
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
212
+ "readEnvReflection",
213
+ "Reads the environment reflection data from the file system.",
214
+ "Pn!2\"P\"7#`/$?%"
215
+ ];
216
+ /**
217
+ * Reads the secret environment reflection data from the file system.
218
+ *
219
+ * @param context - The plugin context.
220
+ * @returns The environment reflection data.
221
+ */
222
+ async function readSecretsReflection(context) {
223
+ const filePath = getEnvReflectionsPath(context, "secrets");
224
+ if (!(0, node_fs.existsSync)(filePath)) {
225
+ if (!context.env.types.secrets) context.env.types.secrets = await readEnvTypeReflection(context, "secrets");
226
+ if (!context.env.used.secrets || (0, _stryke_type_checks_is_empty_object.isEmptyObject)(context.env.used.secrets)) {
227
+ const reflection = require_helpers_reflect.createEnvReflection(context, {
228
+ type: {
229
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
230
+ typeName: "Secrets",
231
+ description: `An object containing the secret configuration parameters that are used (at least once) by the ${context.config.name ? `${context.config.name} application` : "application"}.`,
232
+ types: []
233
+ },
234
+ superReflection: context.env.types.secrets
235
+ });
236
+ reflection.name = "Secrets";
237
+ const message = new _stryke_capnp.Message();
238
+ reflection.messageRoot = message.initRoot(_powerlines_deepkit_schemas_reflection.SerializedTypes);
239
+ reflection.dataBuffer = message.toArrayBuffer();
240
+ context.env.used.secrets = reflection;
241
+ await writeEnvReflection(context, context.env.used.secrets, "secrets");
242
+ }
243
+ return context.env.used.secrets;
244
+ }
245
+ const buffer = await (0, _stryke_fs_buffer.readFileBuffer)(filePath);
246
+ const messageRoot = new _stryke_capnp.Message(buffer, false).getRoot(_powerlines_deepkit_schemas_reflection.SerializedTypes);
247
+ const reflection = (0, _powerlines_deepkit_vendor_type.resolveClassType)((0, _powerlines_deepkit_vendor_type.deserializeType)((0, _powerlines_deepkit_capnp.convertFromCapnp)(messageRoot.types)));
248
+ context.env.used.secrets = reflection;
249
+ context.env.used.secrets.messageRoot = messageRoot;
250
+ context.env.used.secrets.dataBuffer = buffer;
251
+ return reflection;
252
+ }
253
+ readSecretsReflection.__type = [
254
+ () => require_types_plugin.__ΩEnvPluginContext,
255
+ "context",
256
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
257
+ "readSecretsReflection",
258
+ "Reads the secret environment reflection data from the file system.",
259
+ "Pn!2\"P\"7#`/$?%"
260
+ ];
261
+ /**
262
+ * Writes the environment reflection data to the file system.
263
+ *
264
+ * @param context - The plugin context.
265
+ * @param reflection - The reflection data to write.
266
+ * @param name - The name of the reflection (either "env" or "secrets").
267
+ */
268
+ async function writeEnvReflection(context, reflection, name = "env") {
269
+ const serialized = reflection.serializeType();
270
+ const message = new _stryke_capnp.Message();
271
+ (0, _powerlines_deepkit_capnp.convertToCapnp)(serialized, message.initRoot(_powerlines_deepkit_schemas_reflection.SerializedTypes)._initTypes(serialized.length));
272
+ await (0, _stryke_fs_buffer.writeFileBuffer)(getEnvReflectionsPath(context, name), message.toArrayBuffer());
273
+ }
274
+ writeEnvReflection.__type = [
275
+ () => require_types_plugin.__ΩEnvPluginContext,
276
+ "context",
277
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
278
+ "reflection",
279
+ () => require_types_plugin.__ΩEnvType,
280
+ "name",
281
+ () => "env",
282
+ "writeEnvReflection",
283
+ "Writes the environment reflection data to the file system.",
284
+ "Pn!2\"P\"7#2$n%2&>'\"/(?)"
285
+ ];
286
+ /**
287
+ * Writes the environment reflection data to the file system.
288
+ *
289
+ * @param context - The plugin context.
290
+ * @param reflection - The reflection data to write.
291
+ * @param name - The name of the reflection (either "env" or "secrets").
292
+ */
293
+ function writeEnvReflectionSync(context, reflection, name = "env") {
294
+ const serialized = reflection.serializeType();
295
+ const message = new _stryke_capnp.Message();
296
+ (0, _powerlines_deepkit_capnp.convertToCapnp)(serialized, message.initRoot(_powerlines_deepkit_schemas_reflection.SerializedTypes)._initTypes(serialized.length));
297
+ (0, _stryke_fs_buffer.writeFileBufferSync)(getEnvReflectionsPath(context, name), message.toArrayBuffer());
298
+ }
299
+ writeEnvReflectionSync.__type = [
300
+ () => require_types_plugin.__ΩEnvPluginContext,
301
+ "context",
302
+ () => _powerlines_deepkit_vendor_type.ReflectionClass,
303
+ "reflection",
304
+ () => require_types_plugin.__ΩEnvType,
305
+ "name",
306
+ () => "env",
307
+ "writeEnvReflectionSync",
308
+ "Writes the environment reflection data to the file system.",
309
+ "Pn!2\"P\"7#2$n%2&>'\"/(?)"
310
+ ];
311
+
312
+ //#endregion
313
+ exports.getEnvDefaultTypeDefinition = getEnvDefaultTypeDefinition;
314
+ exports.getEnvReflectionsPath = getEnvReflectionsPath;
315
+ exports.getEnvTypeReflectionsPath = getEnvTypeReflectionsPath;
316
+ exports.getSecretsDefaultTypeDefinition = getSecretsDefaultTypeDefinition;
317
+ exports.readEnvReflection = readEnvReflection;
318
+ exports.readEnvTypeReflection = readEnvTypeReflection;
319
+ exports.readSecretsReflection = readSecretsReflection;
320
+ exports.resolveRuntimeTypeFile = resolveRuntimeTypeFile;
321
+ exports.writeEnvReflection = writeEnvReflection;
322
+ exports.writeEnvReflectionSync = writeEnvReflectionSync;
323
+ exports.writeEnvTypeReflection = writeEnvTypeReflection;
@@ -0,0 +1,84 @@
1
+ import { EnvPluginContext, EnvPluginResolvedConfig, EnvType } from "../types/plugin.cjs";
2
+ import { Context, UnresolvedContext } from "powerlines";
3
+ import { TypeDefinition } from "@stryke/types/configuration";
4
+ import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
5
+
6
+ //#region src/helpers/persistence.d.ts
7
+ /**
8
+ * Resolves the runtime type definition file for the environment variables.
9
+ *
10
+ * @param context - The plugin context.
11
+ * @returns The runtime type definition file for the environment variables.
12
+ */
13
+ declare function resolveRuntimeTypeFile(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<string>;
14
+ /**
15
+ * Gets the default type definition for the environment variables.
16
+ *
17
+ * @param context - The plugin context.
18
+ * @returns The default type definition for the environment variables.
19
+ */
20
+ declare function getEnvDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
21
+ /** Gets the default type definition for the environment secrets.
22
+ *
23
+ * @param context - The plugin context.
24
+ * @returns The default type definition for the environment secrets.
25
+ */
26
+ declare function getSecretsDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
27
+ /**
28
+ * Gets the path to the environment type reflections.
29
+ *
30
+ * @param context - The plugin context.
31
+ * @param name - The name of the type reflections.
32
+ * @returns The path to the environment type reflections.
33
+ */
34
+ declare function getEnvTypeReflectionsPath(context: Context<EnvPluginResolvedConfig>, name?: EnvType): string;
35
+ /**
36
+ * Reads the environment type reflection from the file system.
37
+ *
38
+ * @param context - The plugin context.
39
+ * @param name - The name of the type reflections.
40
+ * @returns The environment type reflection.
41
+ */
42
+ declare function readEnvTypeReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
43
+ /**
44
+ * Writes the environment type reflection to the file system.
45
+ *
46
+ * @param context - The plugin context.
47
+ * @param reflection - The environment type reflection to write.
48
+ * @param name - The name of the type reflections.
49
+ */
50
+ declare function writeEnvTypeReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
51
+ declare function getEnvReflectionsPath(context: EnvPluginContext, name: EnvType): string;
52
+ /**
53
+ * Reads the environment reflection data from the file system.
54
+ *
55
+ * @param context - The plugin context.
56
+ * @returns The environment reflection data.
57
+ */
58
+ declare function readEnvReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
59
+ /**
60
+ * Reads the secret environment reflection data from the file system.
61
+ *
62
+ * @param context - The plugin context.
63
+ * @returns The environment reflection data.
64
+ */
65
+ declare function readSecretsReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
66
+ /**
67
+ * Writes the environment reflection data to the file system.
68
+ *
69
+ * @param context - The plugin context.
70
+ * @param reflection - The reflection data to write.
71
+ * @param name - The name of the reflection (either "env" or "secrets").
72
+ */
73
+ declare function writeEnvReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
74
+ /**
75
+ * Writes the environment reflection data to the file system.
76
+ *
77
+ * @param context - The plugin context.
78
+ * @param reflection - The reflection data to write.
79
+ * @param name - The name of the reflection (either "env" or "secrets").
80
+ */
81
+ declare function writeEnvReflectionSync(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): void;
82
+ //#endregion
83
+ export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
84
+ //# sourceMappingURL=persistence.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence.d.cts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;AAoDA;;;;iBAAsB,sBAAA,CACpB,OAAA,EAAS,iBAAA,CAAkB,uBAAA,IAC1B,OAAA;;;;;;;iBAmBmB,2BAAA,CACpB,OAAA,EAAS,iBAAA,CAAkB,uBAAA,IAC1B,OAAA,CAAQ,cAAA;;;AAFX;;;iBAcsB,+BAAA,CACpB,OAAA,EAAS,iBAAA,CAAkB,uBAAA,IAC1B,OAAA,CAAQ,cAAA;;;;;;;;iBAcK,yBAAA,CACd,OAAA,EAAS,OAAA,CAAQ,uBAAA,GACjB,IAAA,GAAM,OAAA;;;;;AAlBR;;;iBA8BsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAA,GACL,OAAA,CAAQ,eAAA;;;;;;;;iBAuCW,sBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;AAAA,iBAeP,qBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,EAAM,OAAA;;;;AA5ER;;;iBAuFsB,iBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;;;;iBAuDW,qBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;;AApIX;;;iBA+LsB,kBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;;;;;;;;iBAsBP,sBAAA,CACd,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA"}
@@ -0,0 +1,84 @@
1
+ import { EnvPluginContext, EnvPluginResolvedConfig, EnvType } from "../types/plugin.mjs";
2
+ import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
3
+ import { Context, UnresolvedContext } from "powerlines";
4
+ import { TypeDefinition } from "@stryke/types/configuration";
5
+
6
+ //#region src/helpers/persistence.d.ts
7
+ /**
8
+ * Resolves the runtime type definition file for the environment variables.
9
+ *
10
+ * @param context - The plugin context.
11
+ * @returns The runtime type definition file for the environment variables.
12
+ */
13
+ declare function resolveRuntimeTypeFile(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<string>;
14
+ /**
15
+ * Gets the default type definition for the environment variables.
16
+ *
17
+ * @param context - The plugin context.
18
+ * @returns The default type definition for the environment variables.
19
+ */
20
+ declare function getEnvDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
21
+ /** Gets the default type definition for the environment secrets.
22
+ *
23
+ * @param context - The plugin context.
24
+ * @returns The default type definition for the environment secrets.
25
+ */
26
+ declare function getSecretsDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
27
+ /**
28
+ * Gets the path to the environment type reflections.
29
+ *
30
+ * @param context - The plugin context.
31
+ * @param name - The name of the type reflections.
32
+ * @returns The path to the environment type reflections.
33
+ */
34
+ declare function getEnvTypeReflectionsPath(context: Context<EnvPluginResolvedConfig>, name?: EnvType): string;
35
+ /**
36
+ * Reads the environment type reflection from the file system.
37
+ *
38
+ * @param context - The plugin context.
39
+ * @param name - The name of the type reflections.
40
+ * @returns The environment type reflection.
41
+ */
42
+ declare function readEnvTypeReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
43
+ /**
44
+ * Writes the environment type reflection to the file system.
45
+ *
46
+ * @param context - The plugin context.
47
+ * @param reflection - The environment type reflection to write.
48
+ * @param name - The name of the type reflections.
49
+ */
50
+ declare function writeEnvTypeReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
51
+ declare function getEnvReflectionsPath(context: EnvPluginContext, name: EnvType): string;
52
+ /**
53
+ * Reads the environment reflection data from the file system.
54
+ *
55
+ * @param context - The plugin context.
56
+ * @returns The environment reflection data.
57
+ */
58
+ declare function readEnvReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
59
+ /**
60
+ * Reads the secret environment reflection data from the file system.
61
+ *
62
+ * @param context - The plugin context.
63
+ * @returns The environment reflection data.
64
+ */
65
+ declare function readSecretsReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
66
+ /**
67
+ * Writes the environment reflection data to the file system.
68
+ *
69
+ * @param context - The plugin context.
70
+ * @param reflection - The reflection data to write.
71
+ * @param name - The name of the reflection (either "env" or "secrets").
72
+ */
73
+ declare function writeEnvReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
74
+ /**
75
+ * Writes the environment reflection data to the file system.
76
+ *
77
+ * @param context - The plugin context.
78
+ * @param reflection - The reflection data to write.
79
+ * @param name - The name of the reflection (either "env" or "secrets").
80
+ */
81
+ declare function writeEnvReflectionSync(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): void;
82
+ //#endregion
83
+ export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
84
+ //# sourceMappingURL=persistence.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence.d.mts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;AAoDA;;;;iBAAsB,sBAAA,CACpB,OAAA,EAAS,iBAAA,CAAkB,uBAAA,IAC1B,OAAA;;;;;;;iBAmBmB,2BAAA,CACpB,OAAA,EAAS,iBAAA,CAAkB,uBAAA,IAC1B,OAAA,CAAQ,cAAA;;;AAFX;;;iBAcsB,+BAAA,CACpB,OAAA,EAAS,iBAAA,CAAkB,uBAAA,IAC1B,OAAA,CAAQ,cAAA;;;;;;;;iBAcK,yBAAA,CACd,OAAA,EAAS,OAAA,CAAQ,uBAAA,GACjB,IAAA,GAAM,OAAA;;;;;AAlBR;;;iBA8BsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAA,GACL,OAAA,CAAQ,eAAA;;;;;;;;iBAuCW,sBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;AAAA,iBAeP,qBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,EAAM,OAAA;;;;AA5ER;;;iBAuFsB,iBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;;;;iBAuDW,qBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;;AApIX;;;iBA+LsB,kBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;;;;;;;;iBAsBP,sBAAA,CACd,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA"}