@powerlines/plugin-env 0.16.158 → 0.16.161
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.
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/babel/index.cjs +1 -0
- package/dist/babel/index.d.cts +2 -0
- package/dist/babel/index.d.mts +2 -0
- package/dist/babel/index.mjs +1 -0
- package/dist/babel/plugin.cjs +5 -0
- package/dist/babel/plugin.d.cts +8 -0
- package/dist/babel/plugin.d.cts.map +1 -0
- package/dist/babel/plugin.d.mts +8 -0
- package/dist/babel/plugin.d.mts.map +1 -0
- package/dist/babel/plugin.mjs +6 -0
- package/dist/babel/plugin.mjs.map +1 -0
- package/dist/components/docs.cjs +1 -0
- package/dist/components/docs.d.cts +24 -0
- package/dist/components/docs.d.cts.map +1 -0
- package/dist/components/docs.d.mts +24 -0
- package/dist/components/docs.d.mts.map +1 -0
- package/dist/components/docs.mjs +2 -0
- package/dist/components/docs.mjs.map +1 -0
- package/dist/components/env-builtin.cjs +98 -0
- package/dist/components/env-builtin.d.cts +21 -0
- package/dist/components/env-builtin.d.cts.map +1 -0
- package/dist/components/env-builtin.d.mts +21 -0
- package/dist/components/env-builtin.d.mts.map +1 -0
- package/dist/components/env-builtin.mjs +96 -0
- package/dist/components/env-builtin.mjs.map +1 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.mts +3 -0
- package/dist/components/index.mjs +1 -0
- package/dist/helpers/automd-generator.cjs +1 -0
- package/dist/helpers/automd-generator.d.cts +14 -0
- package/dist/helpers/automd-generator.d.cts.map +1 -0
- package/dist/helpers/automd-generator.d.mts +14 -0
- package/dist/helpers/automd-generator.d.mts.map +1 -0
- package/dist/helpers/automd-generator.mjs +2 -0
- package/dist/helpers/automd-generator.mjs.map +1 -0
- package/dist/helpers/create-reflection-resource.cjs +1 -0
- package/dist/helpers/create-reflection-resource.d.cts +13 -0
- package/dist/helpers/create-reflection-resource.d.cts.map +1 -0
- package/dist/helpers/create-reflection-resource.d.mts +13 -0
- package/dist/helpers/create-reflection-resource.d.mts.map +1 -0
- package/dist/helpers/create-reflection-resource.mjs +2 -0
- package/dist/helpers/create-reflection-resource.mjs.map +1 -0
- package/dist/helpers/index.cjs +1 -0
- package/dist/helpers/index.d.cts +7 -0
- package/dist/helpers/index.d.mts +7 -0
- package/dist/helpers/index.mjs +1 -0
- package/dist/helpers/load.cjs +1 -0
- package/dist/helpers/load.d.cts +36 -0
- package/dist/helpers/load.d.cts.map +1 -0
- package/dist/helpers/load.d.mts +36 -0
- package/dist/helpers/load.d.mts.map +1 -0
- package/dist/helpers/load.mjs +2 -0
- package/dist/helpers/load.mjs.map +1 -0
- package/dist/helpers/persistence.cjs +1 -0
- package/dist/helpers/persistence.d.cts +84 -0
- package/dist/helpers/persistence.d.cts.map +1 -0
- package/dist/helpers/persistence.d.mts +84 -0
- package/dist/helpers/persistence.d.mts.map +1 -0
- package/dist/helpers/persistence.mjs +2 -0
- package/dist/helpers/persistence.mjs.map +1 -0
- package/dist/helpers/reflect.cjs +1 -0
- package/dist/helpers/reflect.d.cts +68 -0
- package/dist/helpers/reflect.d.cts.map +1 -0
- package/dist/helpers/reflect.d.mts +68 -0
- package/dist/helpers/reflect.d.mts.map +1 -0
- package/dist/helpers/reflect.mjs +2 -0
- package/dist/helpers/reflect.mjs.map +1 -0
- package/dist/helpers/source-file-env.cjs +1 -0
- package/dist/helpers/source-file-env.d.cts +9 -0
- package/dist/helpers/source-file-env.d.cts.map +1 -0
- package/dist/helpers/source-file-env.d.mts +9 -0
- package/dist/helpers/source-file-env.d.mts.map +1 -0
- package/dist/helpers/source-file-env.mjs +2 -0
- package/dist/helpers/source-file-env.mjs.map +1 -0
- package/dist/helpers/template-helpers.cjs +1 -0
- package/dist/helpers/template-helpers.d.cts +15 -0
- package/dist/helpers/template-helpers.d.cts.map +1 -0
- package/dist/helpers/template-helpers.d.mts +15 -0
- package/dist/helpers/template-helpers.d.mts.map +1 -0
- package/dist/helpers/template-helpers.mjs +2 -0
- package/dist/helpers/template-helpers.mjs.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +17 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +3 -0
- package/dist/types/index.d.mts +3 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +163 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +163 -0
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +2 -0
- package/dist/types/plugin.mjs.map +1 -0
- package/dist/types/runtime.cjs +1 -0
- package/dist/types/runtime.d.cts +934 -0
- package/dist/types/runtime.d.cts.map +1 -0
- package/dist/types/runtime.d.mts +934 -0
- package/dist/types/runtime.d.mts.map +1 -0
- package/dist/types/runtime.mjs +2 -0
- package/dist/types/runtime.mjs.map +1 -0
- package/package.json +19 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EnvDocsFile as e,__ΩEnvDocsFileProps as t}from"./docs.mjs";import{EnvBuiltin as n,EnvTypeDefinition as r,__ΩEnvBuiltinProps as i}from"./env-builtin.mjs";export{n as EnvBuiltin,e as EnvDocsFile,r as EnvTypeDefinition,i as __ΩEnvBuiltinProps,t as __ΩEnvDocsFileProps};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@stryke/path/join-paths`),t=require(`automd`),n=require(`powerlines/plugin-utils`);function r(e,t){return e.__type=t,e}const i=r(i=>(0,t.defineGenerator)({name:`env`,generate:r(async function(){let t=(0,e.joinPaths)((0,n.getDocsOutputPath)(i.config.root),`env.md`);return i.fs.existsSync(t)?{contents:await i.fs.read(t)||``}:{contents:``}},[`generate`,`P"/!`])}),[`context`,``,`P!2!"/"`]);exports.env=i;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UnresolvedContext } from "powerlines";
|
|
2
|
+
import * as _$automd from "automd";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/automd-generator.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* AutoMD generator to generate environment variable documentation
|
|
7
|
+
*
|
|
8
|
+
* @param context - The generator context.
|
|
9
|
+
* @returns The generated documentation content.
|
|
10
|
+
*/
|
|
11
|
+
declare const env: (context: UnresolvedContext) => _$automd.Generator;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { env };
|
|
14
|
+
//# sourceMappingURL=automd-generator.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automd-generator.d.cts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;;;AA6BA;;;cAAa,GAAA,GAAO,OAAA,EAAS,iBAAA,KAAiB,QAAA,CAAA,SAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _$automd from "automd";
|
|
2
|
+
import { UnresolvedContext } from "powerlines";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/automd-generator.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* AutoMD generator to generate environment variable documentation
|
|
7
|
+
*
|
|
8
|
+
* @param context - The generator context.
|
|
9
|
+
* @returns The generated documentation content.
|
|
10
|
+
*/
|
|
11
|
+
declare const env: (context: UnresolvedContext) => _$automd.Generator;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { env };
|
|
14
|
+
//# sourceMappingURL=automd-generator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automd-generator.d.mts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;;;AA6BA;;;cAAa,GAAA,GAAO,OAAA,EAAS,iBAAA,KAAiB,QAAA,CAAA,SAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{joinPaths as e}from"@stryke/path/join-paths";import{defineGenerator as t}from"automd";import{getDocsOutputPath as n}from"powerlines/plugin-utils";function r(e,t){return e.__type=t,e}const i=r(i=>t({name:`env`,generate:r(async function(){let t=e(n(i.config.root),`env.md`);return i.fs.existsSync(t)?{contents:await i.fs.read(t)||``}:{contents:``}},[`generate`,`P"/!`])}),[`context`,``,`P!2!"/"`]);export{i as env};
|
|
2
|
+
//# sourceMappingURL=automd-generator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.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 { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n getDocsOutputPath(context.config.root),\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":"yJAAA,SAAS,EAAa,EAAI,EAAM,CAE9B,kBAAO,EA4BT,MAAE,EAAgB,EAAA,GAAA,EAAA,CAChB,KAAM,MACN,SAAQ,EAAW,gBAAA,CACjB,IAAE,EAAiB,EAAE,EAAS,EAAA,OAAA,KAAA,CAAA,SAAA,CAO9B,OANI,EAAA,GAAA,WAAkB,EAAe,CAM/B,CACJ,SAAG,MAFM,EAAA,GAAA,KAAA,EAAA,EAEN,GACJ,CAPQ,CACN,SAAA,GAAA,uBAQN,CAAC,CAAE,CAAC,UAAO,GAAQ,UAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../types/plugin.cjs`);function t(e){return{}}t.__type=[()=>e.__ΩEnvPluginContext,`_context`,`createReflection`,`Creates a reflection resource for the environment configuration.`,`Pn!2""/#?$`],exports.createReflection=t;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EnvPluginContext } from "../types/plugin.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/create-reflection-resource.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Creates a reflection resource for the environment configuration.
|
|
6
|
+
*
|
|
7
|
+
* @param _context - The environment plugin context.
|
|
8
|
+
* @returns A resource that provides the reflection of the environment configuration.
|
|
9
|
+
*/
|
|
10
|
+
declare function createReflection(_context: EnvPluginContext): {};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { createReflection };
|
|
13
|
+
//# sourceMappingURL=create-reflection-resource.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.d.cts","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,gBAAA,CAAiB,QAAA,EAAU,gBAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EnvPluginContext } from "../types/plugin.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/create-reflection-resource.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Creates a reflection resource for the environment configuration.
|
|
6
|
+
*
|
|
7
|
+
* @param _context - The environment plugin context.
|
|
8
|
+
* @returns A resource that provides the reflection of the environment configuration.
|
|
9
|
+
*/
|
|
10
|
+
declare function createReflection(_context: EnvPluginContext): {};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { createReflection };
|
|
13
|
+
//# sourceMappingURL=create-reflection-resource.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.d.mts","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,gBAAA,CAAiB,QAAA,EAAU,gBAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__ΩEnvPluginContext as e}from"../types/plugin.mjs";function t(e){return{}}t.__type=[()=>e,`_context`,`createReflection`,`Creates a reflection resource for the environment configuration.`,`Pn!2""/#?$`];export{t as createReflection};
|
|
2
|
+
//# sourceMappingURL=create-reflection-resource.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.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 { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":"wEAYC,MAAQ,EAAE,CA4CX,EAAe,OAAQ,KAAK,EAAU,WAAA,mBAAA,mEAAA,aAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./reflect.cjs`),t=require(`./persistence.cjs`),n=require(`./template-helpers.cjs`),r=require(`./source-file-env.cjs`),i=require(`./load.cjs`),a=require(`./create-reflection-resource.cjs`);exports.BaseEnv=e.BaseEnv,exports.BaseSecrets=e.BaseSecrets,exports.__ΩCreateEnvReflectionOptions=e.__ΩCreateEnvReflectionOptions,exports.createEnvReflection=e.createEnvReflection,exports.createReflection=a.createReflection,exports.createSecretsReflection=e.createSecretsReflection,exports.createTemplateReflection=n.createTemplateReflection,exports.formatEnvField=r.formatEnvField,exports.getEnvDefaultTypeDefinition=t.getEnvDefaultTypeDefinition,exports.getEnvReflectionsPath=t.getEnvReflectionsPath,exports.getEnvTypeReflectionsPath=t.getEnvTypeReflectionsPath,exports.getSecretsDefaultTypeDefinition=t.getSecretsDefaultTypeDefinition,exports.loadEnv=i.loadEnv,exports.loadEnvFromContext=i.loadEnvFromContext,exports.mergeEnvReflections=e.mergeEnvReflections,exports.mergeSecretsReflections=e.mergeSecretsReflections,exports.readEnvReflection=t.readEnvReflection,exports.readEnvTypeReflection=t.readEnvTypeReflection,exports.readSecretsReflection=t.readSecretsReflection,exports.reflectEnv=e.reflectEnv,exports.reflectSecrets=e.reflectSecrets,exports.removeEnvPrefix=r.removeEnvPrefix,exports.resolveRuntimeTypeFile=t.resolveRuntimeTypeFile,exports.writeEnvReflection=t.writeEnvReflection,exports.writeEnvReflectionSync=t.writeEnvReflectionSync,exports.writeEnvTypeReflection=t.writeEnvTypeReflection;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createReflection } from "./create-reflection-resource.cjs";
|
|
2
|
+
import { loadEnv, loadEnvFromContext } from "./load.cjs";
|
|
3
|
+
import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./persistence.cjs";
|
|
4
|
+
import { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./reflect.cjs";
|
|
5
|
+
import { formatEnvField, removeEnvPrefix } from "./source-file-env.cjs";
|
|
6
|
+
import { createTemplateReflection } from "./template-helpers.cjs";
|
|
7
|
+
export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, createEnvReflection, createReflection, createSecretsReflection, createTemplateReflection, formatEnvField, getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, loadEnv, loadEnvFromContext, mergeEnvReflections, mergeSecretsReflections, readEnvReflection, readEnvTypeReflection, readSecretsReflection, reflectEnv, reflectSecrets, removeEnvPrefix, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createReflection } from "./create-reflection-resource.mjs";
|
|
2
|
+
import { loadEnv, loadEnvFromContext } from "./load.mjs";
|
|
3
|
+
import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./persistence.mjs";
|
|
4
|
+
import { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./reflect.mjs";
|
|
5
|
+
import { formatEnvField, removeEnvPrefix } from "./source-file-env.mjs";
|
|
6
|
+
import { createTemplateReflection } from "./template-helpers.mjs";
|
|
7
|
+
export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, createEnvReflection, createReflection, createSecretsReflection, createTemplateReflection, formatEnvField, getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, loadEnv, loadEnvFromContext, mergeEnvReflections, mergeSecretsReflections, readEnvReflection, readEnvTypeReflection, readSecretsReflection, reflectEnv, reflectSecrets, removeEnvPrefix, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BaseEnv as e,BaseSecrets as t,__ΩCreateEnvReflectionOptions as n,createEnvReflection as r,createSecretsReflection as i,mergeEnvReflections as a,mergeSecretsReflections as o,reflectEnv as s,reflectSecrets as c}from"./reflect.mjs";import{getEnvDefaultTypeDefinition as l,getEnvReflectionsPath as u,getEnvTypeReflectionsPath as d,getSecretsDefaultTypeDefinition as f,readEnvReflection as p,readEnvTypeReflection as m,readSecretsReflection as h,resolveRuntimeTypeFile as g,writeEnvReflection as _,writeEnvReflectionSync as v,writeEnvTypeReflection as y}from"./persistence.mjs";import{createTemplateReflection as b}from"./template-helpers.mjs";import{formatEnvField as x,removeEnvPrefix as S}from"./source-file-env.mjs";import{loadEnv as C,loadEnvFromContext as w}from"./load.mjs";import{createReflection as T}from"./create-reflection-resource.mjs";export{e as BaseEnv,t as BaseSecrets,n as __ΩCreateEnvReflectionOptions,r as createEnvReflection,T as createReflection,i as createSecretsReflection,b as createTemplateReflection,x as formatEnvField,l as getEnvDefaultTypeDefinition,u as getEnvReflectionsPath,d as getEnvTypeReflectionsPath,f as getSecretsDefaultTypeDefinition,C as loadEnv,w as loadEnvFromContext,a as mergeEnvReflections,o as mergeSecretsReflections,p as readEnvReflection,m as readEnvTypeReflection,h as readSecretsReflection,s as reflectEnv,c as reflectSecrets,S as removeEnvPrefix,g as resolveRuntimeTypeFile,_ as writeEnvReflection,v as writeEnvReflectionSync,y as writeEnvTypeReflection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../types/plugin.cjs`),n=require(`./source-file-env.cjs`);let r=require(`@stryke/path/join-paths`),i=require(`@storm-software/config-tools/get-config`),a=require(`@stryke/env/load-env`),o=require(`@stryke/string-format/kebab-case`),s=require(`@stryke/type-checks/is-set-object`),c=require(`c12`),l=require(`defu`);l=e.__toESM(l,1);let u=require(`powerlines/constants`);function d(e,t){return e.__type=t,e}async function f(e,t,r){let i=await(0,a.loadEnv)(r,t);if(e.additionalFiles&&e.additionalFiles?.length>0){let t=await Promise.all(e.additionalFiles.map(d(async e=>(0,a.loadEnvFile)(e,r),[`additionalEnvFile`,``,`P"2!"/"`])));for(let e of t)i=(0,l.default)(e,i)}return n.removeEnvPrefix(i)}f.__type=[()=>t.__ΩEnvPluginOptions,`options`,`mode`,`cwd`,`loadEnvFiles`,'Pn!2"&2#&2$"`/%'];async function p(e,t,n,i,a,o,s){let[u,d]=await Promise.all([(f.Ω=[[`!`]],f(t,i,n)),(0,c.loadConfig)({cwd:n,name:`storm`,envName:i,defaults:{NAME:s?.namespace&&o.name?o.name?.replace(`@${s.namespace}/`,``):e.config.name,MODE:i,ORG:e.config.organization||s?.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:(0,r.joinPaths)(a,`jiti`),moduleCache:!0}})]);return(0,l.default)(u,d.config,s)}p.__type=[()=>t.__ΩEnvPluginContext,`context`,()=>t.__ΩEnvPluginOptions,`options`,`directory`,`mode`,`cacheDir`,`packageJson`,`workspaceConfig`,`loadEnvDirectory`,`Pn!2"n#2$&2%&2&&2'!2(!2)8"\`/*`];function m(e,t,n){return(0,l.default)({APP_NAME:(0,o.kebabCase)(e.config.name),APP_VERSION:e.packageJson.version,BUILD_ID:e.meta.buildId,BUILD_TIMESTAMP:new Date(e.meta.timestamp).toISOString(),BUILD_CHECKSUM:e.meta.checksum,RELEASE_ID:e.meta.releaseId,RELEASE_TAG:`${(0,o.kebabCase)(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:n?.locale,DEFAULT_TIMEZONE:n?.timezone,LOG_LEVEL:e.config.logLevel===`trace`?`debug`:e.config.logLevel,ERROR_URL:n?.error?.url,ORGANIZATION:e.config.organization||((0,s.isSetObject)(n?.organization)?n.organization.name:n?.organization),PLATFORM:e.config.platform,MODE:e.config.mode,TEST:e.config.mode===`test`,DEBUG:e.config.mode===`development`,STACKTRACE:e.config.mode!==`production`,ENVIRONMENT:!e.environment.name||e.environment.name===u.DEFAULT_ENVIRONMENT?e.config.mode:e.environment.name},(0,s.isSetObject)(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce(d((e,n)=>(e[n.name]=t[n.name]??n.getDefaultValue(),e),[`ret`,`prop`,``,`P"2!"2""/#`]),{}):{})}m.__type=[()=>t.__ΩEnvPluginContext,`context`,`parsed`,`workspaceConfig`,`loadEnvFromContext`,`Retrieves various dotenv configuration parameters from the context.`,`Pn!2"!2#!2$8"/%?&`];async function h(e,t){let n=await(0,i.tryGetWorkspaceConfig)(),[r,a,o]=await Promise.all([(p.Ω=[[`!`]],p(e,t,e.config.root,e.config.mode,e.cachePath,e.packageJson,n)),(p.Ω=[[`!`]],p(e,t,e.config.cwd,e.config.mode,e.cachePath,e.packageJson,n)),(p.Ω=[[`!`]],p(e,t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,n))]);return(0,l.default)(m(e,process.env,n),r,a,o)}h.__type=[()=>t.__ΩEnvPluginContext,`context`,()=>t.__ΩEnvPluginOptions,`options`,`loadEnv`,'Pn!2"n#2$"`/%'],exports.loadEnv=h,exports.loadEnvFromContext=m;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginOptions } from "../types/plugin.cjs";
|
|
2
|
+
import { WorkspaceConfig } from "powerlines";
|
|
3
|
+
import { DotenvParseOutput } from "@stryke/env/types";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/load.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves various dotenv configuration parameters from the context.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context to retrieve the dotenv configuration from.
|
|
10
|
+
* @param parsed - The parsed dotenv configuration.
|
|
11
|
+
* @returns An object containing the dotenv configuration.
|
|
12
|
+
*/
|
|
13
|
+
declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvParseOutput, workspaceConfig?: WorkspaceConfig): {
|
|
14
|
+
APP_NAME: string;
|
|
15
|
+
APP_VERSION: string | undefined;
|
|
16
|
+
BUILD_ID: string;
|
|
17
|
+
BUILD_TIMESTAMP: string;
|
|
18
|
+
BUILD_CHECKSUM: string;
|
|
19
|
+
RELEASE_ID: string;
|
|
20
|
+
RELEASE_TAG: string;
|
|
21
|
+
DEFAULT_LOCALE: string | undefined;
|
|
22
|
+
DEFAULT_TIMEZONE: string | undefined;
|
|
23
|
+
LOG_LEVEL: "error" | "warn" | "info" | "debug" | null;
|
|
24
|
+
ERROR_URL: string | undefined;
|
|
25
|
+
ORGANIZATION: string | undefined;
|
|
26
|
+
PLATFORM: "node" | "browser" | "neutral";
|
|
27
|
+
MODE: "test" | "development" | "production";
|
|
28
|
+
TEST: boolean;
|
|
29
|
+
DEBUG: boolean;
|
|
30
|
+
STACKTRACE: boolean;
|
|
31
|
+
ENVIRONMENT: string;
|
|
32
|
+
};
|
|
33
|
+
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { loadEnv, loadEnvFromContext };
|
|
36
|
+
//# sourceMappingURL=load.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.cts","names":[],"sources":["../../src/helpers/load.ts"],"mappings":";;;;;;;AAqGA;;;;;iBAAgB,kBAAA,CACd,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,iBAAA,EACR,eAAA,GAAkB,eAAA;;;;;;;;;;;;;;;;;;;;iBA4CE,OAAA,cACP,iBAAA,GAAoB,iBAAA,CAAA,CACjC,OAAA,EAAS,gBAAA,EAAkB,OAAA,EAAS,gBAAA,GAAmB,OAAA,CAAQ,IAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginOptions } from "../types/plugin.mjs";
|
|
2
|
+
import { DotenvParseOutput } from "@stryke/env/types";
|
|
3
|
+
import { WorkspaceConfig } from "powerlines";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/load.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves various dotenv configuration parameters from the context.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context to retrieve the dotenv configuration from.
|
|
10
|
+
* @param parsed - The parsed dotenv configuration.
|
|
11
|
+
* @returns An object containing the dotenv configuration.
|
|
12
|
+
*/
|
|
13
|
+
declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvParseOutput, workspaceConfig?: WorkspaceConfig): {
|
|
14
|
+
APP_NAME: string;
|
|
15
|
+
APP_VERSION: string | undefined;
|
|
16
|
+
BUILD_ID: string;
|
|
17
|
+
BUILD_TIMESTAMP: string;
|
|
18
|
+
BUILD_CHECKSUM: string;
|
|
19
|
+
RELEASE_ID: string;
|
|
20
|
+
RELEASE_TAG: string;
|
|
21
|
+
DEFAULT_LOCALE: string | undefined;
|
|
22
|
+
DEFAULT_TIMEZONE: string | undefined;
|
|
23
|
+
LOG_LEVEL: "error" | "warn" | "info" | "debug" | null;
|
|
24
|
+
ERROR_URL: string | undefined;
|
|
25
|
+
ORGANIZATION: string | undefined;
|
|
26
|
+
PLATFORM: "node" | "browser" | "neutral";
|
|
27
|
+
MODE: "test" | "development" | "production";
|
|
28
|
+
TEST: boolean;
|
|
29
|
+
DEBUG: boolean;
|
|
30
|
+
STACKTRACE: boolean;
|
|
31
|
+
ENVIRONMENT: string;
|
|
32
|
+
};
|
|
33
|
+
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { loadEnv, loadEnvFromContext };
|
|
36
|
+
//# sourceMappingURL=load.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.mts","names":[],"sources":["../../src/helpers/load.ts"],"mappings":";;;;;;;AAqGA;;;;;iBAAgB,kBAAA,CACd,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,iBAAA,EACR,eAAA,GAAkB,eAAA;;;;;;;;;;;;;;;;;;;;iBA4CE,OAAA,cACP,iBAAA,GAAoB,iBAAA,CAAA,CACjC,OAAA,EAAS,gBAAA,EAAkB,OAAA,EAAS,gBAAA,GAAmB,OAAA,CAAQ,IAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__ΩEnvPluginContext as e,__ΩEnvPluginOptions as t}from"../types/plugin.mjs";import{removeEnvPrefix as n}from"./source-file-env.mjs";import{joinPaths as r}from"@stryke/path/join-paths";import{tryGetWorkspaceConfig as i}from"@storm-software/config-tools/get-config";import{loadEnv as a,loadEnvFile as o}from"@stryke/env/load-env";import{kebabCase as s}from"@stryke/string-format/kebab-case";import{isSetObject as c}from"@stryke/type-checks/is-set-object";import{loadConfig as l}from"c12";import u from"defu";import{DEFAULT_ENVIRONMENT as d}from"powerlines/constants";function f(e,t){return e.__type=t,e}async function p(e,t,r){let i=await a(r,t);if(e.additionalFiles&&e.additionalFiles?.length>0){let t=await Promise.all(e.additionalFiles.map(f(async e=>o(e,r),[`additionalEnvFile`,``,`P"2!"/"`])));for(let e of t)i=u(e,i)}return n(i)}p.__type=[()=>t,`options`,`mode`,`cwd`,`loadEnvFiles`,'Pn!2"&2#&2$"`/%'];async function m(e,t,n,i,a,o,s){let[c,d]=await Promise.all([(p.Ω=[[`!`]],p(t,i,n)),l({cwd:n,name:`storm`,envName:i,defaults:{NAME:s?.namespace&&o.name?o.name?.replace(`@${s.namespace}/`,``):e.config.name,MODE:i,ORG:e.config.organization||s?.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:r(a,`jiti`),moduleCache:!0}})]);return u(c,d.config,s)}m.__type=[()=>e,`context`,()=>t,`options`,`directory`,`mode`,`cacheDir`,`packageJson`,`workspaceConfig`,`loadEnvDirectory`,`Pn!2"n#2$&2%&2&&2'!2(!2)8"\`/*`];function h(e,t,n){return u({APP_NAME:s(e.config.name),APP_VERSION:e.packageJson.version,BUILD_ID:e.meta.buildId,BUILD_TIMESTAMP:new Date(e.meta.timestamp).toISOString(),BUILD_CHECKSUM:e.meta.checksum,RELEASE_ID:e.meta.releaseId,RELEASE_TAG:`${s(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:n?.locale,DEFAULT_TIMEZONE:n?.timezone,LOG_LEVEL:e.config.logLevel===`trace`?`debug`:e.config.logLevel,ERROR_URL:n?.error?.url,ORGANIZATION:e.config.organization||(c(n?.organization)?n.organization.name:n?.organization),PLATFORM:e.config.platform,MODE:e.config.mode,TEST:e.config.mode===`test`,DEBUG:e.config.mode===`development`,STACKTRACE:e.config.mode!==`production`,ENVIRONMENT:!e.environment.name||e.environment.name===d?e.config.mode:e.environment.name},c(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce(f((e,n)=>(e[n.name]=t[n.name]??n.getDefaultValue(),e),[`ret`,`prop`,``,`P"2!"2""/#`]),{}):{})}h.__type=[()=>e,`context`,`parsed`,`workspaceConfig`,`loadEnvFromContext`,`Retrieves various dotenv configuration parameters from the context.`,`Pn!2"!2#!2$8"/%?&`];async function g(e,t){let n=await i(),[r,a,o]=await Promise.all([(m.Ω=[[`!`]],m(e,t,e.config.root,e.config.mode,e.cachePath,e.packageJson,n)),(m.Ω=[[`!`]],m(e,t,e.config.cwd,e.config.mode,e.cachePath,e.packageJson,n)),(m.Ω=[[`!`]],m(e,t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,n))]);return u(h(e,process.env,n),r,a,o)}g.__type=[()=>e,`context`,()=>t,`options`,`loadEnv`,'Pn!2"n#2$"`/%'];export{g as loadEnv,h as loadEnvFromContext};
|
|
2
|
+
//# 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 { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\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 context: EnvPluginContext,\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:\n workspaceConfig?.namespace && packageJson.name\n ? packageJson.name?.replace(`@${workspaceConfig.namespace}/`, \"\")\n : context.config.name,\n MODE: mode,\n ORG: context.config.organization || 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 workspaceConfig?: WorkspaceConfig\n) {\n return defu(\n {\n APP_NAME: kebabCase(context.config.name),\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: workspaceConfig?.locale,\n DEFAULT_TIMEZONE: workspaceConfig?.timezone,\n LOG_LEVEL:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n ERROR_URL: workspaceConfig?.error?.url,\n ORGANIZATION:\n context.config.organization ||\n (isSetObject(workspaceConfig?.organization)\n ? workspaceConfig.organization.name\n : 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 workspaceConfig = await tryGetWorkspaceConfig();\n\n const [project, workspace, config] = await Promise.all([\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.root,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.cwd,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.envPaths.config,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n )\n ]);\n\n return defu(\n loadEnvFromContext(context, process.env, workspaceConfig),\n project,\n workspace,\n config\n ) as TEnv;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../types/plugin.cjs`),n=require(`./reflect.cjs`);let r=require(`@powerlines/deepkit/capnp`),i=require(`@powerlines/deepkit/resolve-reflections`),a=require(`@powerlines/deepkit/schemas/reflection`),o=require(`@powerlines/deepkit/vendor/type`),s=require(`@stryke/capnp`);s=e.__toESM(s,1);let c=require(`@stryke/fs/buffer`),l=require(`@stryke/path/join-paths`),u=require(`@stryke/type-checks/is-empty-object`),d=require(`node:fs`);async function f(e){let t=await e.fs.resolve(`@powerlines/plugin-env/types/runtime`);if(!t)throw Error(`Failed to resolve the runtime type definition file for the environment variables. Please ensure that the "@powerlines/plugin-env" package is installed.`);return t}f.__type=[`context`,`resolveRuntimeTypeFile`,`Resolves the runtime type definition file for the environment variables.`,'P!2!&`/"?#'];async function p(e){return{file:await f(e),name:`EnvInterface`}}p.__type=[`context`,`getEnvDefaultTypeDefinition`,`Gets the default type definition for the environment variables.`,'P!2!!`/"?#'];async function m(e){return{file:await f(e),name:`SecretsInterface`}}m.__type=[`context`,`getSecretsDefaultTypeDefinition`,'P!2!!`/"'];function h(e,t=`env`){return(0,l.joinPaths)((0,i.getReflectionsPath)(e),`env`,`${t}-types.bin`)}h.__type=[`context`,()=>t.__ΩEnvType,`name`,()=>`env`,`getEnvTypeReflectionsPath`,`Gets the path to the environment type reflections.`,`P!2!n"2#>$&/%?&`];async function g(e,t=`env`){let i=h(e,t);if(!(0,d.existsSync)(i)){if(!e.env.types.env||(0,u.isEmptyObject)(e.env.types.env)){let r=n.createEnvReflection(e),i=new s.Message;r.messageRoot=i.initRoot(a.SerializedTypes),r.dataBuffer=i.toArrayBuffer(),e.env.types.env=r,await _(e,e.env.types.env,t)}return e.env.types.env}let l=await(0,c.readFileBuffer)(i),f=new s.Message(l,!1).getRoot(a.SerializedTypes),p=(0,o.resolveClassType)((0,o.deserializeType)((0,r.convertFromCapnp)(f.types)));return e.env.types[t]=p,e.env.types[t].messageRoot=f,e.env.types[t].dataBuffer=l,p}g.__type=[()=>t.__ΩEnvPluginContext,`context`,()=>t.__ΩEnvType,`name`,()=>`env`,`readEnvTypeReflection`,`Reads the environment type reflection from the file system.`,`Pn!2"n#2$>%!\`/&?'`];async function _(e,t,n=`env`){let i=t.serializeType(),o=new s.Message;(0,r.convertToCapnp)(i,o.initRoot(a.SerializedTypes)._initTypes(i.length)),await(0,c.writeFileBuffer)(h(e,n),o.toArrayBuffer())}_.__type=[()=>t.__ΩEnvPluginContext,`context`,`reflection`,()=>t.__ΩEnvType,`name`,()=>`env`,`writeEnvTypeReflection`,`Writes the environment type reflection to the file system.`,`Pn!2"!2#n$2%>&"/'?(`];function v(e,t){return(0,l.joinPaths)((0,i.getReflectionsPath)(e),`env`,`${t}.bin`)}v.__type=[()=>t.__ΩEnvPluginContext,`context`,()=>t.__ΩEnvType,`name`,`getEnvReflectionsPath`,`Pn!2"n#2$&/%`];async function y(e){let t=v(e,`env`);if(!(0,d.existsSync)(t)){if(e.env.types.env||(e.env.types.env=await g(e,`env`)),!e.env.used.env||(0,u.isEmptyObject)(e.env.used.env)){let t=n.createEnvReflection(e,{type:{kind:o.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.env});t.name=`Env`;let r=new s.Message;t.messageRoot=r.initRoot(a.SerializedTypes),t.dataBuffer=r.toArrayBuffer(),e.env.used.env=t,await x(e,e.env.used.env,`env`)}return e.env.used.env}let i=await(0,c.readFileBuffer)(t),l=new s.Message(i,!1).getRoot(a.SerializedTypes),f=(0,o.resolveClassType)((0,o.deserializeType)((0,r.convertFromCapnp)(l.types)));return e.env.used.env=f,e.env.used.env.messageRoot=l,e.env.used.env.dataBuffer=i,f}y.__type=[()=>t.__ΩEnvPluginContext,`context`,`readEnvReflection`,`Reads the environment reflection data from the file system.`,'Pn!2"!`/#?$'];async function b(e){let t=v(e,`secrets`);if(!(0,d.existsSync)(t)){if(e.env.types.secrets||(e.env.types.secrets=await g(e,`secrets`)),!e.env.used.secrets||(0,u.isEmptyObject)(e.env.used.secrets)){let t=n.createEnvReflection(e,{type:{kind:o.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.secrets});t.name=`Secrets`;let r=new s.Message;t.messageRoot=r.initRoot(a.SerializedTypes),t.dataBuffer=r.toArrayBuffer(),e.env.used.secrets=t,await x(e,e.env.used.secrets,`secrets`)}return e.env.used.secrets}let i=await(0,c.readFileBuffer)(t),l=new s.Message(i,!1).getRoot(a.SerializedTypes),f=(0,o.resolveClassType)((0,o.deserializeType)((0,r.convertFromCapnp)(l.types)));return e.env.used.secrets=f,e.env.used.secrets.messageRoot=l,e.env.used.secrets.dataBuffer=i,f}b.__type=[()=>t.__ΩEnvPluginContext,`context`,`readSecretsReflection`,`Reads the secret environment reflection data from the file system.`,'Pn!2"!`/#?$'];async function x(e,t,n=`env`){let i=t.serializeType(),o=new s.Message;(0,r.convertToCapnp)(i,o.initRoot(a.SerializedTypes)._initTypes(i.length)),await(0,c.writeFileBuffer)(v(e,n),o.toArrayBuffer())}x.__type=[()=>t.__ΩEnvPluginContext,`context`,`reflection`,()=>t.__ΩEnvType,`name`,()=>`env`,`writeEnvReflection`,`Writes the environment reflection data to the file system.`,`Pn!2"!2#n$2%>&"/'?(`];function S(e,t,n=`env`){let i=t.serializeType(),o=new s.Message;(0,r.convertToCapnp)(i,o.initRoot(a.SerializedTypes)._initTypes(i.length)),(0,c.writeFileBufferSync)(v(e,n),o.toArrayBuffer())}S.__type=[()=>t.__ΩEnvPluginContext,`context`,`reflection`,()=>t.__ΩEnvType,`name`,()=>`env`,`writeEnvReflectionSync`,`Writes the environment reflection data to the file system.`,`Pn!2"!2#n$2%>&"/'?(`],exports.getEnvDefaultTypeDefinition=p,exports.getEnvReflectionsPath=v,exports.getEnvTypeReflectionsPath=h,exports.getSecretsDefaultTypeDefinition=m,exports.readEnvReflection=y,exports.readEnvTypeReflection=g,exports.readSecretsReflection=b,exports.resolveRuntimeTypeFile=f,exports.writeEnvReflection=x,exports.writeEnvReflectionSync=S,exports.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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__ΩEnvPluginContext as e,__ΩEnvType as t}from"../types/plugin.mjs";import{createEnvReflection as n}from"./reflect.mjs";import{convertFromCapnp as r,convertToCapnp as i}from"@powerlines/deepkit/capnp";import{getReflectionsPath as a}from"@powerlines/deepkit/resolve-reflections";import{SerializedTypes as o}from"@powerlines/deepkit/schemas/reflection";import{ReflectionKind as s,deserializeType as c,resolveClassType as l}from"@powerlines/deepkit/vendor/type";import*as u from"@stryke/capnp";import{readFileBuffer as d,writeFileBuffer as f,writeFileBufferSync as p}from"@stryke/fs/buffer";import{joinPaths as m}from"@stryke/path/join-paths";import{isEmptyObject as h}from"@stryke/type-checks/is-empty-object";import{existsSync as g}from"node:fs";async function _(e){let t=await e.fs.resolve(`@powerlines/plugin-env/types/runtime`);if(!t)throw Error(`Failed to resolve the runtime type definition file for the environment variables. Please ensure that the "@powerlines/plugin-env" package is installed.`);return t}_.__type=[`context`,`resolveRuntimeTypeFile`,`Resolves the runtime type definition file for the environment variables.`,'P!2!&`/"?#'];async function v(e){return{file:await _(e),name:`EnvInterface`}}v.__type=[`context`,`getEnvDefaultTypeDefinition`,`Gets the default type definition for the environment variables.`,'P!2!!`/"?#'];async function y(e){return{file:await _(e),name:`SecretsInterface`}}y.__type=[`context`,`getSecretsDefaultTypeDefinition`,'P!2!!`/"'];function b(e,t=`env`){return m(a(e),`env`,`${t}-types.bin`)}b.__type=[`context`,()=>t,`name`,()=>`env`,`getEnvTypeReflectionsPath`,`Gets the path to the environment type reflections.`,`P!2!n"2#>$&/%?&`];async function x(e,t=`env`){let i=b(e,t);if(!g(i)){if(!e.env.types.env||h(e.env.types.env)){let r=n(e),i=new u.Message;r.messageRoot=i.initRoot(o),r.dataBuffer=i.toArrayBuffer(),e.env.types.env=r,await S(e,e.env.types.env,t)}return e.env.types.env}let a=await d(i),s=new u.Message(a,!1).getRoot(o),f=l(c(r(s.types)));return e.env.types[t]=f,e.env.types[t].messageRoot=s,e.env.types[t].dataBuffer=a,f}x.__type=[()=>e,`context`,()=>t,`name`,()=>`env`,`readEnvTypeReflection`,`Reads the environment type reflection from the file system.`,`Pn!2"n#2$>%!\`/&?'`];async function S(e,t,n=`env`){let r=t.serializeType(),a=new u.Message;i(r,a.initRoot(o)._initTypes(r.length)),await f(b(e,n),a.toArrayBuffer())}S.__type=[()=>e,`context`,`reflection`,()=>t,`name`,()=>`env`,`writeEnvTypeReflection`,`Writes the environment type reflection to the file system.`,`Pn!2"!2#n$2%>&"/'?(`];function C(e,t){return m(a(e),`env`,`${t}.bin`)}C.__type=[()=>e,`context`,()=>t,`name`,`getEnvReflectionsPath`,`Pn!2"n#2$&/%`];async function w(e){let t=C(e,`env`);if(!g(t)){if(e.env.types.env||(e.env.types.env=await x(e,`env`)),!e.env.used.env||h(e.env.used.env)){let t=n(e,{type:{kind:s.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.env});t.name=`Env`;let r=new u.Message;t.messageRoot=r.initRoot(o),t.dataBuffer=r.toArrayBuffer(),e.env.used.env=t,await E(e,e.env.used.env,`env`)}return e.env.used.env}let i=await d(t),a=new u.Message(i,!1).getRoot(o),f=l(c(r(a.types)));return e.env.used.env=f,e.env.used.env.messageRoot=a,e.env.used.env.dataBuffer=i,f}w.__type=[()=>e,`context`,`readEnvReflection`,`Reads the environment reflection data from the file system.`,'Pn!2"!`/#?$'];async function T(e){let t=C(e,`secrets`);if(!g(t)){if(e.env.types.secrets||(e.env.types.secrets=await x(e,`secrets`)),!e.env.used.secrets||h(e.env.used.secrets)){let t=n(e,{type:{kind:s.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.secrets});t.name=`Secrets`;let r=new u.Message;t.messageRoot=r.initRoot(o),t.dataBuffer=r.toArrayBuffer(),e.env.used.secrets=t,await E(e,e.env.used.secrets,`secrets`)}return e.env.used.secrets}let i=await d(t),a=new u.Message(i,!1).getRoot(o),f=l(c(r(a.types)));return e.env.used.secrets=f,e.env.used.secrets.messageRoot=a,e.env.used.secrets.dataBuffer=i,f}T.__type=[()=>e,`context`,`readSecretsReflection`,`Reads the secret environment reflection data from the file system.`,'Pn!2"!`/#?$'];async function E(e,t,n=`env`){let r=t.serializeType(),a=new u.Message;i(r,a.initRoot(o)._initTypes(r.length)),await f(C(e,n),a.toArrayBuffer())}E.__type=[()=>e,`context`,`reflection`,()=>t,`name`,()=>`env`,`writeEnvReflection`,`Writes the environment reflection data to the file system.`,`Pn!2"!2#n$2%>&"/'?(`];function D(e,t,n=`env`){let r=t.serializeType(),a=new u.Message;i(r,a.initRoot(o)._initTypes(r.length)),p(C(e,n),a.toArrayBuffer())}D.__type=[()=>e,`context`,`reflection`,()=>t,`name`,()=>`env`,`writeEnvReflectionSync`,`Writes the environment reflection data to the file system.`,`Pn!2"!2#n$2%>&"/'?(`];export{v as getEnvDefaultTypeDefinition,C as getEnvReflectionsPath,b as getEnvTypeReflectionsPath,y as getSecretsDefaultTypeDefinition,w as readEnvReflection,x as readEnvTypeReflection,T as readSecretsReflection,_ as resolveRuntimeTypeFile,E as writeEnvReflection,D as writeEnvReflectionSync,S as writeEnvTypeReflection};
|
|
2
|
+
//# 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 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../types/runtime.cjs`),t=require(`../types/plugin.cjs`),n=require(`./persistence.cjs`);let r=require(`@stryke/string-format/title-case`),i=require(`@powerlines/deepkit/vendor/type`),a=require(`@stryke/path/join-paths`),o=require(`@powerlines/deepkit/reflect-type`),s=require(`@stryke/path/is-parent-path`);function c(e,t){return e.__type=t,e}function l(e,t){return m(e,{type:(0,i.merge)(t.map(c(e=>e.type,[`reflection`,``,`P"2!"/"`])))})}l.__type=[()=>t.__ΩEnvPluginContext,`context`,`reflections`,`mergeEnvReflections`,`Pn!2"!F2#!/$`];function u(e,t){return h(e,{type:(0,i.merge)(t.map(c(e=>e.type,[`reflection`,``,`P"2!"/"`])))})}u.__type=[()=>t.__ΩEnvPluginContext,`context`,`reflections`,`mergeSecretsReflections`,`Pn!2"!F2#!/$`];const d=[`type`,`superReflection`,`CreateEnvReflectionOptions`,`PP!!J4!8!4"8Mw#y`];var f=class{APP_NAME;APP_VERSION;BUILD_ID;BUILD_TIMESTAMP;BUILD_CHECKSUM;RELEASE_ID;RELEASE_TAG;ORGANIZATION;PLATFORM=`neutral`;MODE=`production`;ENVIRONMENT;DEBUG=!1;TEST=!1;MINIMAL=!1;NO_COLOR=!1;FORCE_COLOR=!1;FORCE_HYPERLINK=!1;STACKTRACE=!1;INCLUDE_ERROR_DATA=!1;ERROR_URL;DEFAULT_TIMEZONE;DEFAULT_LOCALE;CI=!1;static __type=[`APP_NAME`,`APP_VERSION`,`BUILD_ID`,`BUILD_TIMESTAMP`,`BUILD_CHECKSUM`,`RELEASE_ID`,`RELEASE_TAG`,`ORGANIZATION`,`node`,`browser`,`neutral`,`PLATFORM`,function(){return`neutral`},`development`,`test`,`production`,`MODE`,function(){return`production`},`ENVIRONMENT`,`DEBUG`,function(){return!1},`TEST`,function(){return!1},`MINIMAL`,function(){return!1},`NO_COLOR`,function(){return!1},`FORCE_COLOR`,function(){return!1},`FORCE_HYPERLINK`,function(){return!1},`STACKTRACE`,function(){return!1},`INCLUDE_ERROR_DATA`,function(){return!1},`ERROR_URL`,`DEFAULT_TIMEZONE`,`DEFAULT_LOCALE`,`CI`,function(){return!1},()=>e.__ΩEnvInterface,`BaseEnv`,`&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`]},p=class{ENCRYPTION_KEY;static __type=[`ENCRYPTION_KEY`,()=>e.__ΩSecretsInterface,`BaseSecrets`,`&3!5n"x"w#`]};function m(e,t={}){let n=t.superReflection??new i.ReflectionClass({kind:i.ReflectionKind.class,description:`The base environment configuration definition for the ${(0,r.titleCase)(e.config.name)} project.`,classType:f,types:[],implements:[{kind:i.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${(0,r.titleCase)(e.config.name)} project.`,types:[]}]});n.name=`Env`;let a=new i.ReflectionClass(t.type??{kind:i.ReflectionKind.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${e.config.name?`${(0,r.titleCase)(e.config.name)} application`:`application`}.`,types:[]},n);return a.name=`Env`,a}m.__type=[()=>t.__ΩEnvPluginContext,`context`,()=>d,`options`,()=>({}),`createEnvReflection`,`Pn!2"n#2$>%!/&`];function h(e,t={}){let n=t.superReflection??new i.ReflectionClass({kind:i.ReflectionKind.class,description:`The base secrets configuration definition for the ${(0,r.titleCase)(e.config.name)} project.`,classType:p,types:[],implements:[{kind:i.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${(0,r.titleCase)(e.config.name)} project.`,types:[]}]});n.name=`Secrets`;let a=new i.ReflectionClass(t.type??{kind:i.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${e.config.name?`${(0,r.titleCase)(e.config.name)} application`:`application`}.`,types:[]},n);return a.name=`Secrets`,a}h.__type=[()=>t.__ΩEnvPluginContext,`context`,()=>d,`options`,()=>({}),`createSecretsReflection`,`Pn!2"n#2$>%!/&`];async function g(e,t,r){let c;return t&&(c=(0,i.resolveClassType)(await(0,o.reflectType)(e,{file:(0,s.isParentPath)(t,e.config.cwd)?t:(0,a.joinPaths)(e.config.cwd,t),name:r}))),l(e,[await n.readEnvTypeReflection(e,`env`),c,(0,i.resolveClassType)(await(0,o.reflectType)(e,await n.getEnvDefaultTypeDefinition(e)))].filter(Boolean))}g.__type=[()=>t.__ΩEnvPluginContext,`context`,`file`,`name`,`reflectEnv`,`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.`,`Pn!2"&2#8&2$8"/%?&`];async function _(e,t,r){let c;return t&&(c=(0,i.resolveClassType)(await(0,o.reflectType)(e,{file:(0,s.isParentPath)(t,e.config.cwd)?t:(0,a.joinPaths)(e.config.cwd,t),name:r}))),u(e,[await n.readSecretsReflection(e),c,(0,i.resolveClassType)(await(0,o.reflectType)(e,await n.getSecretsDefaultTypeDefinition(e)))].filter(Boolean))}_.__type=[()=>t.__ΩEnvPluginContext,`context`,`file`,`name`,`reflectSecrets`,`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.`,`Pn!2"&2#8&2$8"/%?&`],exports.BaseEnv=f,exports.BaseSecrets=p,exports.__ΩCreateEnvReflectionOptions=d,exports.createEnvReflection=m,exports.createSecretsReflection=h,exports.mergeEnvReflections=l,exports.mergeSecretsReflections=u,exports.reflectEnv=g,exports.reflectSecrets=_;
|