@power-plant/core 0.0.18 → 0.0.20

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 (37) hide show
  1. package/dist/{context-JdUVz1C4.d.cts → context-DY5B2aBE.d.cts} +2 -2
  2. package/dist/{context-JdUVz1C4.d.cts.map → context-DY5B2aBE.d.cts.map} +1 -1
  3. package/dist/{context-BGQun77j.d.mts → context-IDaXHmjn.d.mts} +2 -2
  4. package/dist/context-IDaXHmjn.d.mts.map +1 -0
  5. package/dist/context.cjs +1 -1
  6. package/dist/context.d.cts +30 -5
  7. package/dist/context.d.cts.map +1 -1
  8. package/dist/context.d.mts +30 -5
  9. package/dist/context.mjs +1 -1
  10. package/dist/execute-BL5L5XgC.mjs +2 -0
  11. package/dist/execute-BL5L5XgC.mjs.map +1 -0
  12. package/dist/execute-Bz9Yw67j.cjs +1 -0
  13. package/dist/execute.cjs +1 -1
  14. package/dist/execute.d.cts +1 -1
  15. package/dist/execute.d.mts +1 -1
  16. package/dist/execute.mjs +1 -1
  17. package/dist/{execution-BQs3Rtsf.d.cts → execution-C1pMcv6_.d.cts} +2 -2
  18. package/dist/{execution-BQs3Rtsf.d.cts.map → execution-C1pMcv6_.d.cts.map} +1 -1
  19. package/dist/{execution-DQVv-_js.d.mts → execution-kTyaWKPh.d.mts} +2 -2
  20. package/dist/execution-kTyaWKPh.d.mts.map +1 -0
  21. package/dist/helpers/type-checks.d.cts +1 -1
  22. package/dist/helpers/type-checks.d.mts +1 -1
  23. package/dist/index-D6NsxfvJ.d.mts +3 -0
  24. package/dist/index-DxjmLh4R.d.cts +3 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.cts +5 -5
  27. package/dist/index.d.mts +5 -5
  28. package/dist/index.mjs +1 -1
  29. package/dist/meta-CiPl-8rq.d.cts.map +1 -1
  30. package/package.json +15 -15
  31. package/dist/context-BGQun77j.d.mts.map +0 -1
  32. package/dist/execute-2-Za_7Lh.cjs +0 -1
  33. package/dist/execute-P-XlJq_k.mjs +0 -2
  34. package/dist/execute-P-XlJq_k.mjs.map +0 -1
  35. package/dist/execution-DQVv-_js.d.mts.map +0 -1
  36. package/dist/index-AYwVg3Xj.d.cts +0 -3
  37. package/dist/index-sOf9r_tG.d.mts +0 -3
@@ -1,5 +1,5 @@
1
1
  import { V as SchemaOf, c as Settings, j as Input, m as GeneratedDocument, s as Logger, u as Output } from "./config-CC41Bqgl.cjs";
2
- import { n as Execution } from "./execution-BQs3Rtsf.cjs";
2
+ import { n as Execution } from "./execution-C1pMcv6_.cjs";
3
3
  import { Storage } from "unstorage";
4
4
  //#region src/types/base.d.ts
5
5
  interface Base {
@@ -102,4 +102,4 @@ interface LocalStore {
102
102
  }
103
103
  //#endregion
104
104
  export { Base as a, Session as i, LocalStore as n, SessionContext as r, ExecutionContext as t };
105
- //# sourceMappingURL=context-JdUVz1C4.d.cts.map
105
+ //# sourceMappingURL=context-DY5B2aBE.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-JdUVz1C4.d.cts","names":[],"sources":["../src/types/base.ts","../src/types/session.ts","../src/types/context.ts"],"mappings":";;;;UAkBiB;;;;EAIf;;;;EAKA,WAAW;;;;EAKX,WAAW;;;;EAKX;;;;UChBe,gBAAgB;;;;EAI/B;;;;EAKA;;;;EAKA,YAAY;;;;UCRG;;;;EAIf;;;;EAKA,UAAU;;;;;;;EAQV,SAAS;;;;EAKT,QAAQ;;;;EAKR,SAAS;;UAGM,iBACf,OACA,yBACA,yBAEQ,gBAAgB,UAAU;;;;EAIlC,SAAS;;;;MAKL,QAAQ;;;;MAKR,UAAU,SAAS;;;;MAKnB,SAAS,MAAM,OAAO;;;;MAKtB,UAAU,OAAO,OAAO,UAAU;;;;MAKlC,aAAa,eAAe;;;;;;;EAQhC,cACE,yBAAyB,mBACzB,WAAW,KAAK;;UAIH;EACf;EACA"}
1
+ {"version":3,"file":"context-DY5B2aBE.d.cts","names":[],"sources":["../src/types/base.ts","../src/types/session.ts","../src/types/context.ts"],"mappings":";;;;UAkBiB;;;;EAIf;;;;EAKA,WAAW;;;;EAKX,WAAW;;;;EAKX;;;;UChBe,gBAAgB;;;;EAI/B;;;;EAKA;;;;EAKA,YAAY;;;;UCRG;;;;EAIf;;;;EAKA,UAAU;;;;;;;EAQV,SAAS;;;;EAKT,QAAQ;;;;EAKR,SAAS;;UAGM,iBACf,OACA,yBACA,yBAEQ,gBAAgB,UAAU;;;;EAIlC,SAAS;;;;MAKL,QAAQ;;;;MAKR,UAAU,SAAS;;;;MAKnB,SAAS,MAAM,OAAO;;;;MAKtB,UAAU,OAAO,OAAO,UAAU;;;;MAKlC,aAAa,eAAe;;;;;;;EAQhC,cACE,yBAAyB,mBACzB,WAAW,KAAK;;UAIH;EACf;EACA"}
@@ -1,5 +1,5 @@
1
1
  import { V as SchemaOf, c as Settings, j as Input, m as GeneratedDocument, s as Logger, u as Output } from "./config-Fi_Jtk6F.mjs";
2
- import { n as Execution } from "./execution-DQVv-_js.mjs";
2
+ import { n as Execution } from "./execution-kTyaWKPh.mjs";
3
3
  import { Storage } from "unstorage";
4
4
  //#region src/types/base.d.ts
5
5
  interface Base {
@@ -102,4 +102,4 @@ interface LocalStore {
102
102
  }
103
103
  //#endregion
104
104
  export { Base as a, Session as i, LocalStore as n, SessionContext as r, ExecutionContext as t };
105
- //# sourceMappingURL=context-BGQun77j.d.mts.map
105
+ //# sourceMappingURL=context-IDaXHmjn.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-IDaXHmjn.d.mts","names":[],"sources":["../src/types/base.ts","../src/types/session.ts","../src/types/context.ts"],"mappings":""}
package/dist/context.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@stryke/string-format/snake-case"),t=require("@stryke/string-format/title-case"),n=require("node:async_hooks");const r=globalThis;function i(i){let a=`$$__power_plant_{key}_context__`.replace(`{key}`,(0,e.snakeCase)(i.trim().replace(/^[_-]*/g,``).replace(/[_-]*$/g,``)));return r[a]??(r[a]={asyncLocalStorage:new n.AsyncLocalStorage,use(){let e=this.asyncLocalStorage.getStore();if(e===void 0)throw Error(`The ${(0,t.titleCase)(i.trim().replace(/^[_-]*/g,``).replace(/[_-]*$/g,``))} context is not available. Please ensure that the context has been initialized before using it.`);return e},tryUse(){return this.asyncLocalStorage.getStore()},call(e,t){return this.asyncLocalStorage.run(e,t)},async callAsync(e,t){return this.asyncLocalStorage.run(e,t)}}),r[a]}const a=i(`session`),o=a.asyncLocalStorage,s=a.use,c=s,l=a.tryUse,u=l,d=a.call,f=d,p=a.callAsync,m=p,h=i(`execution`),g=h.asyncLocalStorage,_=h.use,v=_,y=h.tryUse,b=y,x=h.call,S=x,C=h.callAsync,w=C;exports.callAsyncExecution=w,exports.callAsyncExecutionContext=C,exports.callAsyncSession=m,exports.callAsyncSessionContext=p,exports.callExecution=S,exports.callExecutionContext=x,exports.callSession=f,exports.callSessionContext=d,exports.executionAsyncLocalStorage=g,exports.executionContext=h,exports.sessionAsyncLocalStorage=o,exports.sessionContext=a,exports.tryUseExecution=b,exports.tryUseExecutionContext=y,exports.tryUseSession=u,exports.tryUseSessionContext=l,exports.useExecution=v,exports.useExecutionContext=_,exports.useSession=c,exports.useSessionContext=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@stryke/string-format/snake-case"),t=require("@stryke/string-format/title-case"),n=require("node:async_hooks");const r=globalThis;function i(i){let a=`$$__power_plant_{key}_context__`.replace(`{key}`,(0,e.snakeCase)(i.trim().replace(/^[_-]*/g,``).replace(/[_-]*$/g,``)));return r[a]??(r[a]={asyncLocalStorage:new n.AsyncLocalStorage,use(){let e=this.asyncLocalStorage.getStore();if(e===void 0)throw Error(`The ${(0,t.titleCase)(i.trim().replace(/^[_-]*/g,``).replace(/[_-]*$/g,``))} context is not available. Please ensure that the context has been initialized before using it.`);return e},tryUse(){return this.asyncLocalStorage.getStore()},call(e,t){return this.asyncLocalStorage.run(e,t)},async callAsync(e,t){return this.asyncLocalStorage.run(e,t)}}),r[a]}const a=i(`session`),o=a.asyncLocalStorage,s=a.use,c=s,l=a.tryUse,u=l,d=a.call,f=d,p=a.callAsync,m=p,h=i(`execution`),g=h.asyncLocalStorage;function _(){return h.use()}function v(){return _()}function y(){return _()}const b=h.tryUse,x=b,S=h.call,C=S,w=h.callAsync,T=w;exports.callAsyncExecution=T,exports.callAsyncExecutionContext=w,exports.callAsyncSession=m,exports.callAsyncSessionContext=p,exports.callExecution=C,exports.callExecutionContext=S,exports.callSession=f,exports.callSessionContext=d,exports.executionAsyncLocalStorage=g,exports.executionContext=h,exports.sessionAsyncLocalStorage=o,exports.sessionContext=a,exports.tryUseExecution=x,exports.tryUseExecutionContext=b,exports.tryUseSession=u,exports.tryUseSessionContext=l,exports.useContext=y,exports.useExecution=v,exports.useExecutionContext=_,exports.useSession=c,exports.useSessionContext=s;
@@ -1,4 +1,4 @@
1
- import { r as SessionContext, t as ExecutionContext } from "./context-JdUVz1C4.cjs";
1
+ import { r as SessionContext, t as ExecutionContext } from "./context-DY5B2aBE.cjs";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/context.d.ts
4
4
  /**
@@ -73,16 +73,41 @@ declare const executionContext: ContextStore<ExecutionContext<any, any, any>>;
73
73
  */
74
74
  declare const executionAsyncLocalStorage: AsyncLocalStorage<ExecutionContext<any, any, any>>;
75
75
  /**
76
- * The function to use the execution context.
76
+ * A hook to allow access to the execution context.
77
77
  *
78
+ * @template TSpec - The type of the specification that the generator will produce.
79
+ * @template TOptions - The type of the options that will be passed to the generator during generation.
80
+ * @template TReturns - The type of the returns that the generator will produce.
78
81
  * @returns The execution context.
79
82
  * @throws An error if the execution context is not available.
80
83
  */
81
- declare const useExecutionContext: () => ExecutionContext<any, any, any>;
84
+ declare function useExecutionContext<TSpec, TOptions extends object, TReturns = void>(): ExecutionContext<TSpec, TOptions, TReturns>;
82
85
  /**
86
+ * A hook to allow access to the execution context.
87
+ *
88
+ * @remarks
83
89
  * Alias for {@link useExecutionContext}.
90
+ *
91
+ * @template TSpec - The type of the specification that the generator will produce.
92
+ * @template TOptions - The type of the options that will be passed to the generator during generation.
93
+ * @template TReturns - The type of the returns that the generator will produce.
94
+ * @returns The execution context.
95
+ * @throws An error if the execution context is not available.
96
+ */
97
+ declare function useExecution<TSpec, TOptions extends object, TReturns = void>(): ExecutionContext<TSpec, TOptions, TReturns>;
98
+ /**
99
+ * A hook to allow access to the execution context.
100
+ *
101
+ * @remarks
102
+ * Alias for {@link useExecutionContext}.
103
+ *
104
+ * @template TSpec - The type of the specification that the generator will produce.
105
+ * @template TOptions - The type of the options that will be passed to the generator during generation.
106
+ * @template TReturns - The type of the returns that the generator will produce.
107
+ * @returns The execution context.
108
+ * @throws An error if the execution context is not available.
84
109
  */
85
- declare const useExecution: () => ExecutionContext<any, any, any>;
110
+ declare function useContext<TSpec, TOptions extends object, TReturns = void>(): ExecutionContext<TSpec, TOptions, TReturns>;
86
111
  /**
87
112
  * The function to try to use the execution context.
88
113
  *
@@ -118,5 +143,5 @@ declare const callAsyncExecutionContext: <R>(instance: ExecutionContext<any, any
118
143
  */
119
144
  declare const callAsyncExecution: <R>(instance: ExecutionContext<any, any, any>, callback: () => R | Promise<R>) => Promise<R>;
120
145
  //#endregion
121
- export { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useExecution, useExecutionContext, useSession, useSessionContext };
146
+ export { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext };
122
147
  //# sourceMappingURL=context.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.cts","names":[],"sources":["../src/context.ts"],"mappings":";;;;;;UA0BiB,aAAa,iBAAiB;EAC7C,mBAAmB,kBAAkB;EACrC,WAAW;EACX,cAAc;EACd,OAAO,GAAG,UAAU,UAAU,gBAAgB,MAAM;EACpD,YAAY,GACV,UAAU,UACV,gBAAgB,IAAI,QAAQ,OACzB,QAAQ;;;;;cAyDF,gBAAc,aAAA;;;;cAKd,0BAAwB,kBAAA;;;;;;;cAQxB,yBAAiB;;;;cAKjB,kBAAU;;;;;;cAOV,4BAAoB;;;;cAKpB,qBAAa;;;;;;;;cASb,qBApGJ,GAAC,UAAA,gBAAA,gBAAA,MAAA;;;;cAyGG,cAzGJ,GAAC,UAAA,gBAAA,gBAAA,MAAA;;;;;;;;cAkHG,0BAjHC,GAAC,UAAA,gBAAA,gBAAA,IAAA,QAAA,OAAA,QAAA;;;;cAsHF,mBAtHC,GAAC,UAAA,gBAAA,gBAAA,IAAA,QAAA,OAAA,QAAA;;;;cA2HF,kBAAgB,aAAA;;;;cAMhB,4BAA0B,kBAAA;;;;;;;cAQ1B,2BAAmB;;;;cAKnB,oBAAY;;;;;;cAOZ,8BAAsB;;;;cAKtB,uBAAe;;;;;;;;cASf,uBApKJ,GAAC,UAAA,iCAAA,gBAAA,MAAA;;;;cAyKG,gBAzKJ,GAAC,UAAA,iCAAA,gBAAA,MAAA;;;;;;;;cAkLG,4BAjLC,GAAC,UAAA,iCAAA,gBAAA,IAAA,QAAA,OAAA,QAAA;;;;cAsLF,qBAtLC,GAAC,UAAA,iCAAA,gBAAA,IAAA,QAAA,OAAA,QAAA"}
1
+ {"version":3,"file":"context.d.cts","names":[],"sources":["../src/context.ts"],"mappings":";;;;;;UA0BiB,aAAa,iBAAiB;EAC7C,mBAAmB,kBAAkB;EACrC,WAAW;EACX,cAAc;EACd,OAAO,GAAG,UAAU,UAAU,gBAAgB,MAAM;EACpD,YAAY,GACV,UAAU,UACV,gBAAgB,IAAI,QAAQ,OACzB,QAAQ;;;;;cAyDF,gBAAc,aAAA;;;;cAKd,0BAAwB,kBAAA;;;;;;;cAQxB,yBAAiB;;;;cAKjB,kBAAU;;;;;;cAOV,4BAAoB;;;;cAKpB,qBAAa;;;;;;;;cASb,qBApGJ,GAAC,UAAA,gBAAA,gBAAA,MAAA;;;;cAyGG,cAzGJ,GAAC,UAAA,gBAAA,gBAAA,MAAA;;;;;;;;cAkHG,0BAjHC,GAAC,UAAA,gBAAA,gBAAA,IAAA,QAAA,OAAA,QAAA;;;;cAsHF,mBAtHC,GAAC,UAAA,gBAAA,gBAAA,IAAA,QAAA,OAAA,QAAA;;;;cA2HF,kBAAgB,aAAA;;;;cAMhB,4BAA0B,kBAAA;;;;;;;;;;iBAWvB,oBACd,OACA,yBACA,oBAEiC,iBAAiB,OAAO,UAAU;;;;;;;;;;;;;iBAerD,aACd,OACA,yBACA,oBAAe,iBAAA,OAAA,UAAA;;;;;;;;;;;;;iBAiBD,WAAW,OAAO,yBAAyB,oBAAe,iBAAA,OAAA,UAAA;;;;;;cAS7D,8BAAsB;;;;cAKtB,uBAAe;;;;;;;;cASf,uBA5MJ,GAAC,UAAA,iCAAA,gBAAA,MAAA;;;;cAiNG,gBAjNJ,GAAC,UAAA,iCAAA,gBAAA,MAAA;;;;;;;;cA0NG,4BAzNC,GAAC,UAAA,iCAAA,gBAAA,IAAA,QAAA,OAAA,QAAA;;;;cA8NF,qBA9NC,GAAC,UAAA,iCAAA,gBAAA,IAAA,QAAA,OAAA,QAAA"}
@@ -1,4 +1,4 @@
1
- import { r as SessionContext, t as ExecutionContext } from "./context-BGQun77j.mjs";
1
+ import { r as SessionContext, t as ExecutionContext } from "./context-IDaXHmjn.mjs";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/context.d.ts
4
4
  /**
@@ -73,16 +73,41 @@ declare const executionContext: ContextStore<ExecutionContext<any, any, any>>;
73
73
  */
74
74
  declare const executionAsyncLocalStorage: AsyncLocalStorage<ExecutionContext<any, any, any>>;
75
75
  /**
76
- * The function to use the execution context.
76
+ * A hook to allow access to the execution context.
77
77
  *
78
+ * @template TSpec - The type of the specification that the generator will produce.
79
+ * @template TOptions - The type of the options that will be passed to the generator during generation.
80
+ * @template TReturns - The type of the returns that the generator will produce.
78
81
  * @returns The execution context.
79
82
  * @throws An error if the execution context is not available.
80
83
  */
81
- declare const useExecutionContext: () => ExecutionContext<any, any, any>;
84
+ declare function useExecutionContext<TSpec, TOptions extends object, TReturns = void>(): ExecutionContext<TSpec, TOptions, TReturns>;
82
85
  /**
86
+ * A hook to allow access to the execution context.
87
+ *
88
+ * @remarks
83
89
  * Alias for {@link useExecutionContext}.
90
+ *
91
+ * @template TSpec - The type of the specification that the generator will produce.
92
+ * @template TOptions - The type of the options that will be passed to the generator during generation.
93
+ * @template TReturns - The type of the returns that the generator will produce.
94
+ * @returns The execution context.
95
+ * @throws An error if the execution context is not available.
96
+ */
97
+ declare function useExecution<TSpec, TOptions extends object, TReturns = void>(): ExecutionContext<TSpec, TOptions, TReturns>;
98
+ /**
99
+ * A hook to allow access to the execution context.
100
+ *
101
+ * @remarks
102
+ * Alias for {@link useExecutionContext}.
103
+ *
104
+ * @template TSpec - The type of the specification that the generator will produce.
105
+ * @template TOptions - The type of the options that will be passed to the generator during generation.
106
+ * @template TReturns - The type of the returns that the generator will produce.
107
+ * @returns The execution context.
108
+ * @throws An error if the execution context is not available.
84
109
  */
85
- declare const useExecution: () => ExecutionContext<any, any, any>;
110
+ declare function useContext<TSpec, TOptions extends object, TReturns = void>(): ExecutionContext<TSpec, TOptions, TReturns>;
86
111
  /**
87
112
  * The function to try to use the execution context.
88
113
  *
@@ -118,5 +143,5 @@ declare const callAsyncExecutionContext: <R>(instance: ExecutionContext<any, any
118
143
  */
119
144
  declare const callAsyncExecution: <R>(instance: ExecutionContext<any, any, any>, callback: () => R | Promise<R>) => Promise<R>;
120
145
  //#endregion
121
- export { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useExecution, useExecutionContext, useSession, useSessionContext };
146
+ export { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext };
122
147
  //# sourceMappingURL=context.d.mts.map
package/dist/context.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{snakeCase as e}from"@stryke/string-format/snake-case";import{titleCase as t}from"@stryke/string-format/title-case";import{AsyncLocalStorage as n}from"node:async_hooks";const r=globalThis;function i(i){let a=`$$__power_plant_{key}_context__`.replace(`{key}`,e(i.trim().replace(/^[_-]*/g,``).replace(/[_-]*$/g,``)));return r[a]??(r[a]={asyncLocalStorage:new n,use(){let e=this.asyncLocalStorage.getStore();if(e===void 0)throw Error(`The ${t(i.trim().replace(/^[_-]*/g,``).replace(/[_-]*$/g,``))} context is not available. Please ensure that the context has been initialized before using it.`);return e},tryUse(){return this.asyncLocalStorage.getStore()},call(e,t){return this.asyncLocalStorage.run(e,t)},async callAsync(e,t){return this.asyncLocalStorage.run(e,t)}}),r[a]}const a=i(`session`),o=a.asyncLocalStorage,s=a.use,c=s,l=a.tryUse,u=l,d=a.call,f=d,p=a.callAsync,m=p,h=i(`execution`),g=h.asyncLocalStorage,_=h.use,v=_,y=h.tryUse,b=y,x=h.call,S=x,C=h.callAsync,w=C;export{w as callAsyncExecution,C as callAsyncExecutionContext,m as callAsyncSession,p as callAsyncSessionContext,S as callExecution,x as callExecutionContext,f as callSession,d as callSessionContext,g as executionAsyncLocalStorage,h as executionContext,o as sessionAsyncLocalStorage,a as sessionContext,b as tryUseExecution,y as tryUseExecutionContext,u as tryUseSession,l as tryUseSessionContext,v as useExecution,_ as useExecutionContext,c as useSession,s as useSessionContext};
1
+ import{snakeCase as e}from"@stryke/string-format/snake-case";import{titleCase as t}from"@stryke/string-format/title-case";import{AsyncLocalStorage as n}from"node:async_hooks";const r=globalThis;function i(i){let a=`$$__power_plant_{key}_context__`.replace(`{key}`,e(i.trim().replace(/^[_-]*/g,``).replace(/[_-]*$/g,``)));return r[a]??(r[a]={asyncLocalStorage:new n,use(){let e=this.asyncLocalStorage.getStore();if(e===void 0)throw Error(`The ${t(i.trim().replace(/^[_-]*/g,``).replace(/[_-]*$/g,``))} context is not available. Please ensure that the context has been initialized before using it.`);return e},tryUse(){return this.asyncLocalStorage.getStore()},call(e,t){return this.asyncLocalStorage.run(e,t)},async callAsync(e,t){return this.asyncLocalStorage.run(e,t)}}),r[a]}const a=i(`session`),o=a.asyncLocalStorage,s=a.use,c=s,l=a.tryUse,u=l,d=a.call,f=d,p=a.callAsync,m=p,h=i(`execution`),g=h.asyncLocalStorage;function _(){return h.use()}function v(){return _()}function y(){return _()}const b=h.tryUse,x=b,S=h.call,C=S,w=h.callAsync,T=w;export{T as callAsyncExecution,w as callAsyncExecutionContext,m as callAsyncSession,p as callAsyncSessionContext,C as callExecution,S as callExecutionContext,f as callSession,d as callSessionContext,g as executionAsyncLocalStorage,h as executionContext,o as sessionAsyncLocalStorage,a as sessionContext,x as tryUseExecution,b as tryUseExecutionContext,u as tryUseSession,l as tryUseSessionContext,y as useContext,v as useExecution,_ as useExecutionContext,c as useSession,s as useSessionContext};
2
2
  //# sourceMappingURL=context.mjs.map
@@ -0,0 +1,2 @@
1
+ import{callAsyncExecutionContext as e,callAsyncSessionContext as t}from"./context.mjs";import{isGeneratorConfigObject as n,isInputConfigObject as r,isOutputConfigObject as i,isSchemaConfigObject as a}from"./helpers/type-checks.mjs";import{resolveMeta as o,resolveMetaDescription as s,resolveMetaExample as c}from"./helpers/meta.mjs";import{uuid as l}from"@stryke/unique-id/uuid";import{getEnvPaths as u}from"@stryke/env/get-env-paths";import{readFileIfExisting as d}from"@stryke/fs/read-file";import{writeFile as f}from"@stryke/fs/write-file";import{joinPaths as p}from"@stryke/path/join-paths";import{isSetString as m}from"@stryke/type-checks/is-set-string";import h from"defu";import g from"node:os";import{createStorage as _}from"unstorage";import v from"unstorage/drivers/fs-lite";import{mapStorageToFileSystem as y}from"@power-plant/schema/storage";import{load as b}from"@stryke/resolve/load";import{isFunction as x}from"@stryke/type-checks/is-function";import{assertSchemasDoNotContradict as S,extractSchemaWithSource as C,mergeMetadata as w}from"@power-plant/schema";import{isLoadReference as T}from"@stryke/resolve/type-checks";const E={debug:console.debug,info:console.info,warn:console.warn,error:console.error},D=u({appId:`power-plant`,orgId:`storm-software`});async function O(e={}){let t=e.cwd||process.cwd(),n=new Date,r=_({driver:v({base:t})}),i=JSON.parse(await d(p(D.data,`.local-store.json`))||`{}`),a=i.device||g.hostname()||l(),o=i.user||g.userInfo().username||l();return(!m(i.device)||!m(i.user))&&await f(p(D.data,`.local-store.json`),JSON.stringify({device:a,user:o},null,2)),h({cwd:t,session:{id:l(),createdAt:n,updatedAt:n,device:a,user:o,executions:[]}},e,{storage:r,settings:{},logger:E})}async function k(e,t,n,r,i,a){let o={},s=(e,t)=>{m(e)?o[e]=h({path:e},t,{chunks:[],meta:{}}):o[e.path]=h(e,t)},c,l={...t,id:e,createdAt:new Date,updatedAt:new Date,options:n,schema:r,input:i,output:a,documents:o,spec(){if(!c)throw Error(`The specification was accessed prior to the input processing.`);return c},addDocument:s,meta:{id:e,executedAt:new Date,executedBy:``}};return Object.defineProperty(l,"~spec",{get(){return c},set(e){c=e},enumerable:!1}),l}async function A(e,t,n){return e}function j(e,t){let n=e?.schema??{},r=o(e,t);return r.description=s(`Accepts a ${r.title??``} specification and processes it with a {title} sink.`,n,r,t?.description),r.examples=c(n,r,t?.examples),r}async function M(e,t={}){let{meta:n,schema:r}=a(e)?e:{schema:e,meta:{}},i=await C(r,t);return{...i,meta:j(i,n)}}function N(e,t,n){t&&t.schema!==e&&S(e.schema,t.schema.schema,`input`),n&&n.schema!==e&&S(e.schema,n.schema.schema,`output`)}function P(e,t){let n=e?.schema??{},r=o(e,t);return r.description=s(`Determines the ${r.title??``} specification from a {title} input.`,n,r,t?.description),r}async function F(e,t,n={}){let{input:i,meta:a,schema:o}=r(t)?t:{input:t,meta:{}},s=e;if(o){let t;if(T(o))try{t=await b(o,n)}catch{}else t=o;t&&(s=await M(t,n),s.schema=w(s.schema,e.schema))}let c;if(T(i))try{let e=await b(i,n);c=r(e)?await F(s,e.input,n).then(e=>e.input):e}catch{}return c||=i,{schema:s,input:c,meta:P(s,a)}}function I(e,t){let n=e?.schema??{},r=o(e,t);return r.description=s(`Accepts a ${r.title??``} specification and processes it with a {title} output.`,n,r,t?.description),r}async function L(e,t,n={}){let{output:r,meta:a,schema:o}=i(t)?t:{output:t,meta:{}},s=e;if(o){let t;if(T(o))try{t=await b(o,n)}catch{}else t=o;t&&(s=await M(t,n),s.schema=w(s.schema,e.schema))}let c;if(T(r))try{let e=await b(r,n);c=i(e)?await L(s,e.output,n).then(e=>e.output):e}catch{}return c||=r,{schema:s,output:c,meta:I(s,a)}}async function R(t,r,i,a={}){let o;o=n(i)?i:await b(i,{fs:y(r.storage),...a}),o.schema||={type:`any`};let s=await M(o.schema,{storage:r.storage,...a}),c=o.input;if(!c)if(a.inputPath)c=`@power-plant/unstorage-input`;else throw Error("No input configuration provided. Please provide an input configuration, a valid specification, or a `inputPath` option that points to a valid input file.");let l=o.output;l||=`@power-plant/unstorage-output`;let[u,d]=await Promise.all([F(s,c,{storage:r.storage,...a}),L(s,l,{storage:r.storage,...a})]);return N(s,u,d),{meta:o.meta,schema:s,input:u,output:d,generator:async n=>{let i=await k(t,r,n,s,u,d);return e(i,async()=>{let e=x(u.input)?await u.input({storage:i.storage,...n}):u.input;i[`~spec`]=e;let t;t=x(o.generator)?o.generator:await b(o.generator,{storage:i.storage,...n});let r=await t(e,n);return{spec:e,options:n,documents:r,returns:await d.output(e,n,r)}})}}}async function z(e={}){let n=await O(e);return async(e,r={})=>t(n,async()=>{let t=l(),{generator:i}=await R(t,n,e,r),{documents:a,returns:o,spec:s,options:c}=await i(r),u=await A({documents:Object.fromEntries(Object.entries(a).map(([e,n])=>[e,{...n,path:e,meta:{executionId:t}}])),meta:{executionId:t,executedAt:new Date,executedBy:n.session.user}},s,c);return n.session.executions.push(u),o})}async function B(e,t={}){return(await z(t))(e,t)}export{B as n,z as t};
2
+ //# sourceMappingURL=execute-BL5L5XgC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-BL5L5XgC.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require("./context.cjs"),l=require("./helpers/type-checks.cjs"),u=require("./helpers/meta.cjs");let d=require("@stryke/unique-id/uuid"),f=require("@stryke/env/get-env-paths"),p=require("@stryke/fs/read-file"),m=require("@stryke/fs/write-file"),h=require("@stryke/path/join-paths"),g=require("@stryke/type-checks/is-set-string"),_=require("defu");_=s(_,1);let v=require("node:os");v=s(v,1);let y=require("unstorage"),b=require("unstorage/drivers/fs-lite");b=s(b,1);let x=require("@power-plant/schema/storage"),S=require("@stryke/resolve/load"),C=require("@stryke/type-checks/is-function"),w=require("@power-plant/schema"),T=require("@stryke/resolve/type-checks");const E={debug:console.debug,info:console.info,warn:console.warn,error:console.error},D=(0,f.getEnvPaths)({appId:`power-plant`,orgId:`storm-software`});async function O(e={}){let t=e.cwd||process.cwd(),n=new Date,r=(0,y.createStorage)({driver:(0,b.default)({base:t})}),i=JSON.parse(await(0,p.readFileIfExisting)((0,h.joinPaths)(D.data,`.local-store.json`))||`{}`),a=i.device||v.default.hostname()||(0,d.uuid)(),o=i.user||v.default.userInfo().username||(0,d.uuid)();return(!(0,g.isSetString)(i.device)||!(0,g.isSetString)(i.user))&&await(0,m.writeFile)((0,h.joinPaths)(D.data,`.local-store.json`),JSON.stringify({device:a,user:o},null,2)),(0,_.default)({cwd:t,session:{id:(0,d.uuid)(),createdAt:n,updatedAt:n,device:a,user:o,executions:[]}},e,{storage:r,settings:{},logger:E})}async function k(e,t,n,r,i,a){let o={},s=(e,t)=>{(0,g.isSetString)(e)?o[e]=(0,_.default)({path:e},t,{chunks:[],meta:{}}):o[e.path]=(0,_.default)(e,t)},c,l={...t,id:e,createdAt:new Date,updatedAt:new Date,options:n,schema:r,input:i,output:a,documents:o,spec(){if(!c)throw Error(`The specification was accessed prior to the input processing.`);return c},addDocument:s,meta:{id:e,executedAt:new Date,executedBy:``}};return Object.defineProperty(l,"~spec",{get(){return c},set(e){c=e},enumerable:!1}),l}async function A(e,t,n){return e}function j(e,t){let n=e?.schema??{},r=u.resolveMeta(e,t);return r.description=u.resolveMetaDescription(`Accepts a ${r.title??``} specification and processes it with a {title} sink.`,n,r,t?.description),r.examples=u.resolveMetaExample(n,r,t?.examples),r}async function M(e,t={}){let{meta:n,schema:r}=l.isSchemaConfigObject(e)?e:{schema:e,meta:{}},i=await(0,w.extractSchemaWithSource)(r,t);return{...i,meta:j(i,n)}}function N(e,t,n){t&&t.schema!==e&&(0,w.assertSchemasDoNotContradict)(e.schema,t.schema.schema,`input`),n&&n.schema!==e&&(0,w.assertSchemasDoNotContradict)(e.schema,n.schema.schema,`output`)}function P(e,t){let n=e?.schema??{},r=u.resolveMeta(e,t);return r.description=u.resolveMetaDescription(`Determines the ${r.title??``} specification from a {title} input.`,n,r,t?.description),r}async function F(e,t,n={}){let{input:r,meta:i,schema:a}=l.isInputConfigObject(t)?t:{input:t,meta:{}},o=e;if(a){let t;if((0,T.isLoadReference)(a))try{t=await(0,S.load)(a,n)}catch{}else t=a;t&&(o=await M(t,n),o.schema=(0,w.mergeMetadata)(o.schema,e.schema))}let s;if((0,T.isLoadReference)(r))try{let e=await(0,S.load)(r,n);s=l.isInputConfigObject(e)?await F(o,e.input,n).then(e=>e.input):e}catch{}return s||=r,{schema:o,input:s,meta:P(o,i)}}function I(e,t){let n=e?.schema??{},r=u.resolveMeta(e,t);return r.description=u.resolveMetaDescription(`Accepts a ${r.title??``} specification and processes it with a {title} output.`,n,r,t?.description),r}async function L(e,t,n={}){let{output:r,meta:i,schema:a}=l.isOutputConfigObject(t)?t:{output:t,meta:{}},o=e;if(a){let t;if((0,T.isLoadReference)(a))try{t=await(0,S.load)(a,n)}catch{}else t=a;t&&(o=await M(t,n),o.schema=(0,w.mergeMetadata)(o.schema,e.schema))}let s;if((0,T.isLoadReference)(r))try{let e=await(0,S.load)(r,n);s=l.isOutputConfigObject(e)?await L(o,e.output,n).then(e=>e.output):e}catch{}return s||=r,{schema:o,output:s,meta:I(o,i)}}async function R(e,t,n,r={}){let i;i=l.isGeneratorConfigObject(n)?n:await(0,S.load)(n,{fs:(0,x.mapStorageToFileSystem)(t.storage),...r}),i.schema||={type:`any`};let a=await M(i.schema,{storage:t.storage,...r}),o=i.input;if(!o)if(r.inputPath)o=`@power-plant/unstorage-input`;else throw Error("No input configuration provided. Please provide an input configuration, a valid specification, or a `inputPath` option that points to a valid input file.");let s=i.output;s||=`@power-plant/unstorage-output`;let[u,d]=await Promise.all([F(a,o,{storage:t.storage,...r}),L(a,s,{storage:t.storage,...r})]);return N(a,u,d),{meta:i.meta,schema:a,input:u,output:d,generator:async n=>{let r=await k(e,t,n,a,u,d);return c.callAsyncExecutionContext(r,async()=>{let e=(0,C.isFunction)(u.input)?await u.input({storage:r.storage,...n}):u.input;r[`~spec`]=e;let t;t=(0,C.isFunction)(i.generator)?i.generator:await(0,S.load)(i.generator,{storage:r.storage,...n});let a=await t(e,n);return{spec:e,options:n,documents:a,returns:await d.output(e,n,a)}})}}}async function z(e={}){let t=await O(e);return async(e,n={})=>c.callAsyncSessionContext(t,async()=>{let r=(0,d.uuid)(),{generator:i}=await R(r,t,e,n),{documents:a,returns:o,spec:s,options:c}=await i(n),l=await A({documents:Object.fromEntries(Object.entries(a).map(([e,t])=>[e,{...t,path:e,meta:{executionId:r}}])),meta:{executionId:r,executedAt:new Date,executedBy:t.session.user}},s,c);return t.session.executions.push(l),o})}async function B(e,t={}){return(await z(t))(e,t)}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return z}});
package/dist/execute.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./execute-2-Za_7Lh.cjs");require("./context.cjs"),exports.createExecute=e.t,exports.execute=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./execute-Bz9Yw67j.cjs");require("./context.cjs"),exports.createExecute=e.t,exports.execute=e.n;
@@ -1,5 +1,5 @@
1
1
  import { _ as GeneratorConfig, t as UserConfig } from "./config-CC41Bqgl.cjs";
2
- import { a as InferEngineOptions, t as ExecuteFunction } from "./execution-BQs3Rtsf.cjs";
2
+ import { a as InferEngineOptions, t as ExecuteFunction } from "./execution-C1pMcv6_.cjs";
3
3
  //#region src/execute.d.ts
4
4
  /**
5
5
  * Creates an execution function that can be used to execute a generator.
@@ -1,5 +1,5 @@
1
1
  import { _ as GeneratorConfig, t as UserConfig } from "./config-Fi_Jtk6F.mjs";
2
- import { a as InferEngineOptions, t as ExecuteFunction } from "./execution-DQVv-_js.mjs";
2
+ import { a as InferEngineOptions, t as ExecuteFunction } from "./execution-kTyaWKPh.mjs";
3
3
  //#region src/execute.d.ts
4
4
  /**
5
5
  * Creates an execution function that can be used to execute a generator.
package/dist/execute.mjs CHANGED
@@ -1 +1 @@
1
- import"./context.mjs";import{n as e,t}from"./execute-P-XlJq_k.mjs";export{t as createExecute,e as execute};
1
+ import"./context.mjs";import{n as e,t}from"./execute-BL5L5XgC.mjs";export{t as createExecute,e as execute};
@@ -55,7 +55,7 @@ type ExecutionResult<TReturns = void> = GeneratedDocument & {
55
55
  returns?: TReturns;
56
56
  };
57
57
  type InferEngineOptions<TGeneratorConfig extends GeneratorConfig<any, any, any>> = TGeneratorConfig extends LoadReference ? InferLoadOptions<TGeneratorConfig> & UserConfig : UserConfig;
58
- type ExecuteFunction = <TSpec, TOptions extends object, TReturns = void>(generatorConfig: GeneratorConfig<TSpec, TOptions, TReturns>, options: InferEngineOptions<typeof generatorConfig> & TOptions) => Promise<TReturns>;
58
+ type ExecuteFunction = <TSpec, TOptions extends object, TReturns = void>(generatorConfig: GeneratorConfig<TSpec, TOptions, TReturns>, options?: InferEngineOptions<typeof generatorConfig> & TOptions) => Promise<TReturns>;
59
59
  //#endregion
60
60
  export { InferEngineOptions as a, ExecutionResult as i, Execution as n, ExecutionMeta as r, ExecuteFunction as t };
61
- //# sourceMappingURL=execution-BQs3Rtsf.d.cts.map
61
+ //# sourceMappingURL=execution-C1pMcv6_.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execution-BQs3Rtsf.d.cts","names":[],"sources":["../src/types/execution.ts"],"mappings":";;;UAwBiB,cAAc,eAAe;;;;;;;EAO5C;;;;EAKA,YAAY;;;;EAKZ;;;;EAKA,MAAM;;;;EAKN,QAAQ,iBAAiB;;;;EAKzB,OAAO;;;;EAKP,QAAQ;;;;EAKR,WAAW;;UAGI,UAAU;;;;EAIzB,WAAW,eAAe;;;;EAK1B,MAAM,cAAc;;KAGV,gBAAgB,mBAAmB;;;;EAI7C,UAAU;;KAGA,mBACV,yBAAyB,kCACvB,yBAAyB,gBACzB,iBAAiB,oBAAoB,aACrC;KAEQ,mBAAmB,OAAO,yBAAyB,iBAC7D,iBAAiB,gBAAgB,OAAO,UAAU,WAClD,SAAS,0BAA0B,mBAAmB,aACnD,QAAQ"}
1
+ {"version":3,"file":"execution-C1pMcv6_.d.cts","names":[],"sources":["../src/types/execution.ts"],"mappings":";;;UAwBiB,cAAc,eAAe;;;;;;;EAO5C;;;;EAKA,YAAY;;;;EAKZ;;;;EAKA,MAAM;;;;EAKN,QAAQ,iBAAiB;;;;EAKzB,OAAO;;;;EAKP,QAAQ;;;;EAKR,WAAW;;UAGI,UAAU;;;;EAIzB,WAAW,eAAe;;;;EAK1B,MAAM,cAAc;;KAGV,gBAAgB,mBAAmB;;;;EAI7C,UAAU;;KAGA,mBACV,yBAAyB,kCACvB,yBAAyB,gBACzB,iBAAiB,oBAAoB,aACrC;KAEQ,mBAAmB,OAAO,yBAAyB,iBAC7D,iBAAiB,gBAAgB,OAAO,UAAU,WAClD,UAAU,0BAA0B,mBAAmB,aACpD,QAAQ"}
@@ -55,7 +55,7 @@ type ExecutionResult<TReturns = void> = GeneratedDocument & {
55
55
  returns?: TReturns;
56
56
  };
57
57
  type InferEngineOptions<TGeneratorConfig extends GeneratorConfig<any, any, any>> = TGeneratorConfig extends LoadReference ? InferLoadOptions<TGeneratorConfig> & UserConfig : UserConfig;
58
- type ExecuteFunction = <TSpec, TOptions extends object, TReturns = void>(generatorConfig: GeneratorConfig<TSpec, TOptions, TReturns>, options: InferEngineOptions<typeof generatorConfig> & TOptions) => Promise<TReturns>;
58
+ type ExecuteFunction = <TSpec, TOptions extends object, TReturns = void>(generatorConfig: GeneratorConfig<TSpec, TOptions, TReturns>, options?: InferEngineOptions<typeof generatorConfig> & TOptions) => Promise<TReturns>;
59
59
  //#endregion
60
60
  export { InferEngineOptions as a, ExecutionResult as i, Execution as n, ExecutionMeta as r, ExecuteFunction as t };
61
- //# sourceMappingURL=execution-DQVv-_js.d.mts.map
61
+ //# sourceMappingURL=execution-kTyaWKPh.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-kTyaWKPh.d.mts","names":[],"sources":["../src/types/execution.ts"],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { N as InputConfigObject, R as SchemaConfigObject, f as OutputConfigObject, v as GeneratorConfigObject } from "../config-CC41Bqgl.cjs";
2
- import "../index-AYwVg3Xj.cjs";
2
+ import "../index-DxjmLh4R.cjs";
3
3
  //#region src/helpers/type-checks.d.ts
4
4
  /**
5
5
  * Checks if the provided configuration is a {@link GeneratorConfigObject}.
@@ -1,5 +1,5 @@
1
1
  import { N as InputConfigObject, R as SchemaConfigObject, f as OutputConfigObject, v as GeneratorConfigObject } from "../config-Fi_Jtk6F.mjs";
2
- import "../index-sOf9r_tG.mjs";
2
+ import "../index-D6NsxfvJ.mjs";
3
3
  //#region src/helpers/type-checks.d.ts
4
4
  /**
5
5
  * Checks if the provided configuration is a {@link GeneratorConfigObject}.
@@ -0,0 +1,3 @@
1
+ import "./config-Fi_Jtk6F.mjs";
2
+ import "./execution-kTyaWKPh.mjs";
3
+ import "./context-IDaXHmjn.mjs";
@@ -0,0 +1,3 @@
1
+ import "./config-CC41Bqgl.cjs";
2
+ import "./execution-C1pMcv6_.cjs";
3
+ import "./context-DY5B2aBE.cjs";
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./execute-2-Za_7Lh.cjs"),t=require("./config.cjs"),n=require("./context.cjs"),r=require("./define.cjs");exports.callAsyncExecution=n.callAsyncExecution,exports.callAsyncExecutionContext=n.callAsyncExecutionContext,exports.callAsyncSession=n.callAsyncSession,exports.callAsyncSessionContext=n.callAsyncSessionContext,exports.callExecution=n.callExecution,exports.callExecutionContext=n.callExecutionContext,exports.callSession=n.callSession,exports.callSessionContext=n.callSessionContext,exports.createExecute=e.t,exports.defineConfig=t.defineConfig,exports.defineGenerator=r.defineGenerator,exports.defineInput=r.defineInput,exports.defineOutput=r.defineOutput,exports.defineSchema=r.defineSchema,exports.execute=e.n,exports.executionAsyncLocalStorage=n.executionAsyncLocalStorage,exports.executionContext=n.executionContext,exports.sessionAsyncLocalStorage=n.sessionAsyncLocalStorage,exports.sessionContext=n.sessionContext,exports.tryUseExecution=n.tryUseExecution,exports.tryUseExecutionContext=n.tryUseExecutionContext,exports.tryUseSession=n.tryUseSession,exports.tryUseSessionContext=n.tryUseSessionContext,exports.useExecution=n.useExecution,exports.useExecutionContext=n.useExecutionContext,exports.useSession=n.useSession,exports.useSessionContext=n.useSessionContext;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./execute-Bz9Yw67j.cjs"),t=require("./config.cjs"),n=require("./context.cjs"),r=require("./define.cjs");exports.callAsyncExecution=n.callAsyncExecution,exports.callAsyncExecutionContext=n.callAsyncExecutionContext,exports.callAsyncSession=n.callAsyncSession,exports.callAsyncSessionContext=n.callAsyncSessionContext,exports.callExecution=n.callExecution,exports.callExecutionContext=n.callExecutionContext,exports.callSession=n.callSession,exports.callSessionContext=n.callSessionContext,exports.createExecute=e.t,exports.defineConfig=t.defineConfig,exports.defineGenerator=r.defineGenerator,exports.defineInput=r.defineInput,exports.defineOutput=r.defineOutput,exports.defineSchema=r.defineSchema,exports.execute=e.n,exports.executionAsyncLocalStorage=n.executionAsyncLocalStorage,exports.executionContext=n.executionContext,exports.sessionAsyncLocalStorage=n.sessionAsyncLocalStorage,exports.sessionContext=n.sessionContext,exports.tryUseExecution=n.tryUseExecution,exports.tryUseExecutionContext=n.tryUseExecutionContext,exports.tryUseSession=n.tryUseSession,exports.tryUseSessionContext=n.tryUseSessionContext,exports.useContext=n.useContext,exports.useExecution=n.useExecution,exports.useExecutionContext=n.useExecutionContext,exports.useSession=n.useSession,exports.useSessionContext=n.useSessionContext;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { A as InferCreateInputOptions, B as SchemaMetaExample, C as InferGenerator, D as InferMeta, E as InferInputConfig, F as InputMetaConfig, G as MetaLink, H as BaseMetaConfig, I as InferCreateSchemaOptions, L as Schema, M as InputConfig, N as InputConfigObject, O as InferOutputConfig, P as InputFunction, R as SchemaConfigObject, S as InferCreateGeneratorOptions, T as InferGeneratorResult, U as MetaConfig, V as SchemaOf, W as MetaDeprecated, _ as GeneratorConfig, a as UserConfigFnPromise, b as GeneratorFunctionResult, c as Settings, d as OutputConfig, f as OutputConfigObject, g as Generator, h as GeneratedDocumentChunk, i as UserConfigFnObject, j as Input, k as InferSchemaConfig, l as InferCreateOutputOptions, m as GeneratedDocument, n as UserConfigExport, o as UserConfigParams, p as OutputFunction, r as UserConfigFn, s as Logger, t as UserConfig, u as Output, v as GeneratorConfigObject, w as InferGeneratorFunction, x as GeneratorResult, y as GeneratorFunction, z as SchemaMetaConfig } from "./config-CC41Bqgl.cjs";
2
2
  import { defineConfig } from "./config.cjs";
3
- import { a as InferEngineOptions, i as ExecutionResult, n as Execution, r as ExecutionMeta, t as ExecuteFunction } from "./execution-BQs3Rtsf.cjs";
4
- import { a as Base, i as Session, n as LocalStore, r as SessionContext, t as ExecutionContext } from "./context-JdUVz1C4.cjs";
5
- import { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useExecution, useExecutionContext, useSession, useSessionContext } from "./context.cjs";
3
+ import { a as InferEngineOptions, i as ExecutionResult, n as Execution, r as ExecutionMeta, t as ExecuteFunction } from "./execution-C1pMcv6_.cjs";
4
+ import { a as Base, i as Session, n as LocalStore, r as SessionContext, t as ExecutionContext } from "./context-DY5B2aBE.cjs";
5
+ import { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext } from "./context.cjs";
6
6
  import { defineGenerator, defineInput, defineOutput, defineSchema } from "./define.cjs";
7
7
  import { createExecute, execute } from "./execute.cjs";
8
- import "./index-AYwVg3Xj.cjs";
9
- export { type Base, type BaseMetaConfig, ContextStore, type ExecuteFunction, type Execution, type ExecutionContext, type ExecutionMeta, type ExecutionResult, type GeneratedDocument, type GeneratedDocumentChunk, type Generator, type GeneratorConfig, type GeneratorConfigObject, type GeneratorFunction, type GeneratorFunctionResult, type GeneratorResult, type InferCreateGeneratorOptions, type InferCreateInputOptions, type InferCreateOutputOptions, type InferCreateSchemaOptions, type InferEngineOptions, type InferGenerator, type InferGeneratorFunction, type InferGeneratorResult, type InferInputConfig, type InferMeta, type InferOutputConfig, type InferSchemaConfig, type Input, type InputConfig, type InputConfigObject, type InputFunction, type InputMetaConfig, type LocalStore, type Logger, type MetaConfig, type MetaDeprecated, type MetaLink, type Output, type OutputConfig, type OutputConfigObject, type OutputFunction, type Schema, type SchemaConfigObject, type SchemaMetaConfig, type SchemaMetaExample, type SchemaOf, type Session, type SessionContext, type Settings, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, createExecute, defineConfig, defineGenerator, defineInput, defineOutput, defineSchema, execute, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useExecution, useExecutionContext, useSession, useSessionContext };
8
+ import "./index-DxjmLh4R.cjs";
9
+ export { type Base, type BaseMetaConfig, ContextStore, type ExecuteFunction, type Execution, type ExecutionContext, type ExecutionMeta, type ExecutionResult, type GeneratedDocument, type GeneratedDocumentChunk, type Generator, type GeneratorConfig, type GeneratorConfigObject, type GeneratorFunction, type GeneratorFunctionResult, type GeneratorResult, type InferCreateGeneratorOptions, type InferCreateInputOptions, type InferCreateOutputOptions, type InferCreateSchemaOptions, type InferEngineOptions, type InferGenerator, type InferGeneratorFunction, type InferGeneratorResult, type InferInputConfig, type InferMeta, type InferOutputConfig, type InferSchemaConfig, type Input, type InputConfig, type InputConfigObject, type InputFunction, type InputMetaConfig, type LocalStore, type Logger, type MetaConfig, type MetaDeprecated, type MetaLink, type Output, type OutputConfig, type OutputConfigObject, type OutputFunction, type Schema, type SchemaConfigObject, type SchemaMetaConfig, type SchemaMetaExample, type SchemaOf, type Session, type SessionContext, type Settings, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, createExecute, defineConfig, defineGenerator, defineInput, defineOutput, defineSchema, execute, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { A as InferCreateInputOptions, B as SchemaMetaExample, C as InferGenerator, D as InferMeta, E as InferInputConfig, F as InputMetaConfig, G as MetaLink, H as BaseMetaConfig, I as InferCreateSchemaOptions, L as Schema, M as InputConfig, N as InputConfigObject, O as InferOutputConfig, P as InputFunction, R as SchemaConfigObject, S as InferCreateGeneratorOptions, T as InferGeneratorResult, U as MetaConfig, V as SchemaOf, W as MetaDeprecated, _ as GeneratorConfig, a as UserConfigFnPromise, b as GeneratorFunctionResult, c as Settings, d as OutputConfig, f as OutputConfigObject, g as Generator, h as GeneratedDocumentChunk, i as UserConfigFnObject, j as Input, k as InferSchemaConfig, l as InferCreateOutputOptions, m as GeneratedDocument, n as UserConfigExport, o as UserConfigParams, p as OutputFunction, r as UserConfigFn, s as Logger, t as UserConfig, u as Output, v as GeneratorConfigObject, w as InferGeneratorFunction, x as GeneratorResult, y as GeneratorFunction, z as SchemaMetaConfig } from "./config-Fi_Jtk6F.mjs";
2
2
  import { defineConfig } from "./config.mjs";
3
- import { a as InferEngineOptions, i as ExecutionResult, n as Execution, r as ExecutionMeta, t as ExecuteFunction } from "./execution-DQVv-_js.mjs";
4
- import { a as Base, i as Session, n as LocalStore, r as SessionContext, t as ExecutionContext } from "./context-BGQun77j.mjs";
5
- import { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useExecution, useExecutionContext, useSession, useSessionContext } from "./context.mjs";
3
+ import { a as InferEngineOptions, i as ExecutionResult, n as Execution, r as ExecutionMeta, t as ExecuteFunction } from "./execution-kTyaWKPh.mjs";
4
+ import { a as Base, i as Session, n as LocalStore, r as SessionContext, t as ExecutionContext } from "./context-IDaXHmjn.mjs";
5
+ import { ContextStore, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext } from "./context.mjs";
6
6
  import { defineGenerator, defineInput, defineOutput, defineSchema } from "./define.mjs";
7
7
  import { createExecute, execute } from "./execute.mjs";
8
- import "./index-sOf9r_tG.mjs";
9
- export { type Base, type BaseMetaConfig, ContextStore, type ExecuteFunction, type Execution, type ExecutionContext, type ExecutionMeta, type ExecutionResult, type GeneratedDocument, type GeneratedDocumentChunk, type Generator, type GeneratorConfig, type GeneratorConfigObject, type GeneratorFunction, type GeneratorFunctionResult, type GeneratorResult, type InferCreateGeneratorOptions, type InferCreateInputOptions, type InferCreateOutputOptions, type InferCreateSchemaOptions, type InferEngineOptions, type InferGenerator, type InferGeneratorFunction, type InferGeneratorResult, type InferInputConfig, type InferMeta, type InferOutputConfig, type InferSchemaConfig, type Input, type InputConfig, type InputConfigObject, type InputFunction, type InputMetaConfig, type LocalStore, type Logger, type MetaConfig, type MetaDeprecated, type MetaLink, type Output, type OutputConfig, type OutputConfigObject, type OutputFunction, type Schema, type SchemaConfigObject, type SchemaMetaConfig, type SchemaMetaExample, type SchemaOf, type Session, type SessionContext, type Settings, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, createExecute, defineConfig, defineGenerator, defineInput, defineOutput, defineSchema, execute, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useExecution, useExecutionContext, useSession, useSessionContext };
8
+ import "./index-D6NsxfvJ.mjs";
9
+ export { type Base, type BaseMetaConfig, ContextStore, type ExecuteFunction, type Execution, type ExecutionContext, type ExecutionMeta, type ExecutionResult, type GeneratedDocument, type GeneratedDocumentChunk, type Generator, type GeneratorConfig, type GeneratorConfigObject, type GeneratorFunction, type GeneratorFunctionResult, type GeneratorResult, type InferCreateGeneratorOptions, type InferCreateInputOptions, type InferCreateOutputOptions, type InferCreateSchemaOptions, type InferEngineOptions, type InferGenerator, type InferGeneratorFunction, type InferGeneratorResult, type InferInputConfig, type InferMeta, type InferOutputConfig, type InferSchemaConfig, type Input, type InputConfig, type InputConfigObject, type InputFunction, type InputMetaConfig, type LocalStore, type Logger, type MetaConfig, type MetaDeprecated, type MetaLink, type Output, type OutputConfig, type OutputConfigObject, type OutputFunction, type Schema, type SchemaConfigObject, type SchemaMetaConfig, type SchemaMetaExample, type SchemaOf, type Session, type SessionContext, type Settings, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type UserConfigParams, callAsyncExecution, callAsyncExecutionContext, callAsyncSession, callAsyncSessionContext, callExecution, callExecutionContext, callSession, callSessionContext, createExecute, defineConfig, defineGenerator, defineInput, defineOutput, defineSchema, execute, executionAsyncLocalStorage, executionContext, sessionAsyncLocalStorage, sessionContext, tryUseExecution, tryUseExecutionContext, tryUseSession, tryUseSessionContext, useContext, useExecution, useExecutionContext, useSession, useSessionContext };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{defineConfig as e}from"./config.mjs";import{callAsyncExecution as t,callAsyncExecutionContext as n,callAsyncSession as r,callAsyncSessionContext as i,callExecution as a,callExecutionContext as o,callSession as s,callSessionContext as c,executionAsyncLocalStorage as l,executionContext as u,sessionAsyncLocalStorage as d,sessionContext as f,tryUseExecution as p,tryUseExecutionContext as m,tryUseSession as h,tryUseSessionContext as g,useExecution as _,useExecutionContext as v,useSession as y,useSessionContext as b}from"./context.mjs";import{defineGenerator as x,defineInput as S,defineOutput as C,defineSchema as w}from"./define.mjs";import{n as T,t as E}from"./execute-P-XlJq_k.mjs";export{t as callAsyncExecution,n as callAsyncExecutionContext,r as callAsyncSession,i as callAsyncSessionContext,a as callExecution,o as callExecutionContext,s as callSession,c as callSessionContext,E as createExecute,e as defineConfig,x as defineGenerator,S as defineInput,C as defineOutput,w as defineSchema,T as execute,l as executionAsyncLocalStorage,u as executionContext,d as sessionAsyncLocalStorage,f as sessionContext,p as tryUseExecution,m as tryUseExecutionContext,h as tryUseSession,g as tryUseSessionContext,_ as useExecution,v as useExecutionContext,y as useSession,b as useSessionContext};
1
+ import{defineConfig as e}from"./config.mjs";import{callAsyncExecution as t,callAsyncExecutionContext as n,callAsyncSession as r,callAsyncSessionContext as i,callExecution as a,callExecutionContext as o,callSession as s,callSessionContext as c,executionAsyncLocalStorage as l,executionContext as u,sessionAsyncLocalStorage as d,sessionContext as f,tryUseExecution as p,tryUseExecutionContext as m,tryUseSession as h,tryUseSessionContext as g,useContext as _,useExecution as v,useExecutionContext as y,useSession as b,useSessionContext as x}from"./context.mjs";import{defineGenerator as S,defineInput as C,defineOutput as w,defineSchema as T}from"./define.mjs";import{n as E,t as D}from"./execute-BL5L5XgC.mjs";export{t as callAsyncExecution,n as callAsyncExecutionContext,r as callAsyncSession,i as callAsyncSessionContext,a as callExecution,o as callExecutionContext,s as callSession,c as callSessionContext,D as createExecute,e as defineConfig,S as defineGenerator,C as defineInput,w as defineOutput,T as defineSchema,E as execute,l as executionAsyncLocalStorage,u as executionContext,d as sessionAsyncLocalStorage,f as sessionContext,p as tryUseExecution,m as tryUseExecutionContext,h as tryUseSession,g as tryUseSessionContext,_ as useContext,v as useExecution,y as useExecutionContext,b as useSession,x as useSessionContext};
@@ -1 +1 @@
1
- {"version":3,"file":"meta-CiPl-8rq.d.cts","names":[],"sources":["config-CC41Bqgl.d.cts","config.d.cts","execution-BQs3Rtsf.d.cts","context-JdUVz1C4.d.cts","context.d.cts","define.d.cts","execute.d.cts","index-AYwVg3Xj.d.cts","index.d.cts","../src/helpers/meta.ts"],"mappings":";;;;;;;;iBSwCgB,kBAAkB,yBAAyB;;;;;;;iBAkB3C,mBACd,QAAQ,YACR,MAAM,QAAQ,aACd,0BAA0B;;;;;;;;;iBAeZ,gBACd,QAAQ,YACR,MAAM,QAAQ,aACd;;;;;;;;iBAsBc,cACd,QAAQ,YACR,MAAM,QAAQ;;;;;;;;;iBAgBA,iBACd,QAAQ,YACR,MAAM,QAAQ,aACd;;;;;;;;;;iBAmBc,uBACd,kBACA,QAAQ,YACR,MAAM,QAAQ,aACd;;;;;;;;;;iBAoBc,mBAAmB,OACjC,QAAQ,YACR,MAAM,QAAQ,iBAAiB,SAC/B,QAAQ,kBAAkB,SAAS,kBAAkB,WACpD,kBAAkB;;;;;;;;;iBAsCL,iBACd,QAAQ,YACR,MAAM,QAAQ,aACd,QAAQ,aACP;;;;;;;;iBAea,YAAY,OAC1B,QAAQ,wBAAwB,SAAS,SAAS,QAClD,SAAS,aACR"}
1
+ {"version":3,"file":"meta-CiPl-8rq.d.cts","names":[],"sources":["config-CC41Bqgl.d.cts","config.d.cts","execution-C1pMcv6_.d.cts","context-DY5B2aBE.d.cts","context.d.cts","define.d.cts","execute.d.cts","index-DxjmLh4R.d.cts","index.d.cts","../src/helpers/meta.ts"],"mappings":";;;;;;;;iBSwCgB,kBAAkB,yBAAyB;;;;;;;iBAkB3C,mBACd,QAAQ,YACR,MAAM,QAAQ,aACd,0BAA0B;;;;;;;;;iBAeZ,gBACd,QAAQ,YACR,MAAM,QAAQ,aACd;;;;;;;;iBAsBc,cACd,QAAQ,YACR,MAAM,QAAQ;;;;;;;;;iBAgBA,iBACd,QAAQ,YACR,MAAM,QAAQ,aACd;;;;;;;;;;iBAmBc,uBACd,kBACA,QAAQ,YACR,MAAM,QAAQ,aACd;;;;;;;;;;iBAoBc,mBAAmB,OACjC,QAAQ,YACR,MAAM,QAAQ,iBAAiB,SAC/B,QAAQ,kBAAkB,SAAS,kBAAkB,WACpD,kBAAkB;;;;;;;;;iBAsCL,iBACd,QAAQ,YACR,MAAM,QAAQ,aACd,QAAQ,aACP;;;;;;;;iBAea,YAAY,OAC1B,QAAQ,wBAAwB,SAAS,SAAS,QAClD,SAAS,aACR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@power-plant/core",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "private": false,
5
5
  "description": "☢️ Generate anything from a specification",
6
6
  "keywords": ["power-plant", "storm-software"],
@@ -160,19 +160,19 @@
160
160
  "typings": "dist/index.d.mts",
161
161
  "files": ["dist"],
162
162
  "dependencies": {
163
- "@power-plant/schema": "^0.0.17",
164
- "@stryke/string-format": "^0.17.37",
165
- "@stryke/type-checks": "^0.6.28",
166
- "@stryke/types": "^0.12.23",
167
- "@stryke/convert": "^0.7.26",
168
- "@stryke/date": "^0.0.7",
169
- "@stryke/env": "^0.20.113",
170
- "@stryke/fs": "^0.33.96",
171
- "@stryke/helpers": "^0.10.35",
172
- "@stryke/json": "^0.15.19",
173
- "@stryke/path": "^0.29.22",
174
- "@stryke/resolve": "^0.0.11",
175
- "@stryke/unique-id": "^0.3.107",
163
+ "@power-plant/schema": "^0.0.19",
164
+ "@stryke/string-format": "^0.17.38",
165
+ "@stryke/type-checks": "^0.6.29",
166
+ "@stryke/types": "^0.12.24",
167
+ "@stryke/convert": "^0.7.27",
168
+ "@stryke/date": "^0.0.8",
169
+ "@stryke/env": "^0.20.114",
170
+ "@stryke/fs": "^0.33.97",
171
+ "@stryke/helpers": "^0.10.36",
172
+ "@stryke/json": "^0.15.20",
173
+ "@stryke/path": "^0.29.23",
174
+ "@stryke/resolve": "^0.0.12",
175
+ "@stryke/unique-id": "^0.3.108",
176
176
  "c12": "^3.3.4",
177
177
  "jiti": "^2.7.0",
178
178
  "defu": "^6.1.7",
@@ -184,5 +184,5 @@
184
184
  "typescript": "^6.0.3"
185
185
  },
186
186
  "publishConfig": { "access": "public" },
187
- "gitHead": "aa40c0225b9ebb2dec0336ee72b90c92e401bbc3"
187
+ "gitHead": "0639d772e3b45c9a4060f913fd5ee26c68ac48ad"
188
188
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-BGQun77j.d.mts","names":[],"sources":["../src/types/base.ts","../src/types/session.ts","../src/types/context.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require("./context.cjs"),l=require("./helpers/type-checks.cjs"),u=require("./helpers/meta.cjs");let d=require("@stryke/unique-id/uuid"),f=require("@stryke/env/get-env-paths"),p=require("@stryke/fs/read-file"),m=require("@stryke/fs/write-file"),h=require("@stryke/path/join-paths"),g=require("@stryke/type-checks/is-set-string"),_=require("defu");_=s(_,1);let v=require("node:os");v=s(v,1);let y=require("unstorage"),b=require("unstorage/drivers/fs-lite");b=s(b,1);let x=require("@power-plant/schema/storage"),S=require("@stryke/resolve/load"),C=require("@stryke/type-checks/is-function"),w=require("@power-plant/schema"),T=require("@stryke/resolve/type-checks");const E={debug:console.debug,info:console.info,warn:console.warn,error:console.error},D=(0,f.getEnvPaths)({appId:`power-plant`,orgId:`storm-software`});async function O(e={}){let t=e.cwd||process.cwd(),n=new Date,r=(0,y.createStorage)({driver:(0,b.default)({base:t})}),i=JSON.parse(await(0,p.readFileIfExisting)((0,h.joinPaths)(D.data,`.local-store.json`))||`{}`),a=i.device||v.default.hostname()||(0,d.uuid)(),o=i.user||v.default.userInfo().username||(0,d.uuid)();return(!(0,g.isSetString)(i.device)||!(0,g.isSetString)(i.user))&&await(0,m.writeFile)((0,h.joinPaths)(D.data,`.local-store.json`),JSON.stringify({device:a,user:o},null,2)),(0,_.default)({cwd:t,session:{id:(0,d.uuid)(),createdAt:n,updatedAt:n,device:a,user:o,executions:[]}},e,{storage:r,settings:{},logger:E})}async function k(e,t,n,r,i,a){let o={},s=(e,t)=>{(0,g.isSetString)(e)?o[e]=(0,_.default)({path:e},t,{chunks:[],meta:{}}):o[e.path]=(0,_.default)(e,t)},c,l={...t,id:e,createdAt:new Date,updatedAt:new Date,options:n,schema:r,input:i,output:a,documents:o,spec(){if(!c)throw Error(`The specification was accessed prior to the input processing.`);return c},addDocument:s,meta:{id:e,executedAt:new Date,executedBy:``}};return Object.defineProperty(l,"~spec",{get(){return c},set(e){c=e},enumerable:!1}),l}async function A(e,t,n){return e}function j(e,t){let n=e?.schema??{},r=u.resolveMeta(e,t);return r.description=u.resolveMetaDescription(`Accepts a ${r.title??``} specification and processes it with a {title} sink.`,n,r,t?.description),r.examples=u.resolveMetaExample(n,r,t?.examples),r}async function M(e,t={}){let{meta:n,schema:r}=l.isSchemaConfigObject(e)?e:{schema:e,meta:{}},i=await(0,w.extractSchemaWithSource)(r,t);return{...i,meta:j(i,n)}}function N(e,t){let n=e?.schema??{},r=u.resolveMeta(e,t);return r.description=u.resolveMetaDescription(`Determines the ${r.title??``} specification from a {title} input.`,n,r,t?.description),r}async function P(e,t,n={}){let{input:r,meta:i,schema:a}=l.isInputConfigObject(t)?t:{input:t,meta:{}},o=e;if(a){let t;if((0,T.isLoadReference)(a))try{t=await(0,S.load)(a,n)}catch{}else t=a;t&&(o=await M(t,n),o.schema=(0,w.mergeMetadata)(o.schema,e.schema))}let s;if((0,T.isLoadReference)(r))try{let e=await(0,S.load)(r,n);s=l.isInputConfigObject(e)?await P(o,e.input,n).then(e=>e.input):e}catch{}return s||=r,{schema:o,input:s,meta:N(o,i)}}function F(e,t){let n=e?.schema??{},r=u.resolveMeta(e,t);return r.description=u.resolveMetaDescription(`Accepts a ${r.title??``} specification and processes it with a {title} output.`,n,r,t?.description),r}async function I(e,t,n={}){let{output:r,meta:i,schema:a}=l.isOutputConfigObject(t)?t:{output:t,meta:{}},o=e;if(a){let t;if((0,T.isLoadReference)(a))try{t=await(0,S.load)(a,n)}catch{}else t=a;t&&(o=await M(t,n),o.schema=(0,w.mergeMetadata)(o.schema,e.schema))}let s;if((0,T.isLoadReference)(r))try{let e=await(0,S.load)(r,n);s=l.isOutputConfigObject(e)?await I(o,e.output,n).then(e=>e.output):e}catch{}return s||=r,{schema:o,output:s,meta:F(o,i)}}async function L(e,t,n,r={}){let i;i=l.isGeneratorConfigObject(n)?n:await(0,S.load)(n,{fs:(0,x.mapStorageToFileSystem)(t.storage),...r}),i.schema||={type:`any`};let a=await M(i.schema,{storage:t.storage,...r}),o=i.input;if(!o)if(r.inputPath)o=`@power-plant/unstorage-input`;else throw Error("No input configuration provided. Please provide an input configuration, a valid specification, or a `inputPath` option that points to a valid input file.");let s=i.output;s||=`@power-plant/unstorage-output`;let[u,d]=await Promise.all([P(a,o,{storage:t.storage,...r}),I(a,s,{storage:t.storage,...r})]);return{meta:i.meta,schema:a,input:u,output:d,generator:async n=>{let r=await k(e,t,n,a,u,d);return c.callAsyncExecutionContext(r,async()=>{let e=(0,C.isFunction)(u.input)?await u.input({storage:r.storage,...n}):u.input;r[`~spec`]=e;let t;t=(0,C.isFunction)(i.generator)?i.generator:await(0,S.load)(i.generator,{storage:r.storage,...n});let a=await t(e,n);return{spec:e,options:n,documents:a,returns:await d.output(e,n,a)}})}}}async function R(e={}){let t=await O(e);return async(e,n={})=>c.callAsyncSessionContext(t,async()=>{let r=(0,d.uuid)(),{generator:i}=await L(r,t,e,n),{documents:a,returns:o,spec:s,options:c}=await i(n),l=await A({documents:Object.fromEntries(Object.entries(a).map(([e,t])=>[e,{...t,path:e,meta:{executionId:r}}])),meta:{executionId:r,executedAt:new Date,executedBy:t.session.user}},s,c);return t.session.executions.push(l),o})}async function z(e,t={}){return(await R(t))(e,t)}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return R}});
@@ -1,2 +0,0 @@
1
- import{callAsyncExecutionContext as e,callAsyncSessionContext as t}from"./context.mjs";import{isGeneratorConfigObject as n,isInputConfigObject as r,isOutputConfigObject as i,isSchemaConfigObject as a}from"./helpers/type-checks.mjs";import{resolveMeta as o,resolveMetaDescription as s,resolveMetaExample as c}from"./helpers/meta.mjs";import{uuid as l}from"@stryke/unique-id/uuid";import{getEnvPaths as u}from"@stryke/env/get-env-paths";import{readFileIfExisting as d}from"@stryke/fs/read-file";import{writeFile as f}from"@stryke/fs/write-file";import{joinPaths as p}from"@stryke/path/join-paths";import{isSetString as m}from"@stryke/type-checks/is-set-string";import h from"defu";import g from"node:os";import{createStorage as _}from"unstorage";import v from"unstorage/drivers/fs-lite";import{mapStorageToFileSystem as y}from"@power-plant/schema/storage";import{load as b}from"@stryke/resolve/load";import{isFunction as x}from"@stryke/type-checks/is-function";import{extractSchemaWithSource as S,mergeMetadata as C}from"@power-plant/schema";import{isLoadReference as w}from"@stryke/resolve/type-checks";const T={debug:console.debug,info:console.info,warn:console.warn,error:console.error},E=u({appId:`power-plant`,orgId:`storm-software`});async function D(e={}){let t=e.cwd||process.cwd(),n=new Date,r=_({driver:v({base:t})}),i=JSON.parse(await d(p(E.data,`.local-store.json`))||`{}`),a=i.device||g.hostname()||l(),o=i.user||g.userInfo().username||l();return(!m(i.device)||!m(i.user))&&await f(p(E.data,`.local-store.json`),JSON.stringify({device:a,user:o},null,2)),h({cwd:t,session:{id:l(),createdAt:n,updatedAt:n,device:a,user:o,executions:[]}},e,{storage:r,settings:{},logger:T})}async function O(e,t,n,r,i,a){let o={},s=(e,t)=>{m(e)?o[e]=h({path:e},t,{chunks:[],meta:{}}):o[e.path]=h(e,t)},c,l={...t,id:e,createdAt:new Date,updatedAt:new Date,options:n,schema:r,input:i,output:a,documents:o,spec(){if(!c)throw Error(`The specification was accessed prior to the input processing.`);return c},addDocument:s,meta:{id:e,executedAt:new Date,executedBy:``}};return Object.defineProperty(l,"~spec",{get(){return c},set(e){c=e},enumerable:!1}),l}async function k(e,t,n){return e}function A(e,t){let n=e?.schema??{},r=o(e,t);return r.description=s(`Accepts a ${r.title??``} specification and processes it with a {title} sink.`,n,r,t?.description),r.examples=c(n,r,t?.examples),r}async function j(e,t={}){let{meta:n,schema:r}=a(e)?e:{schema:e,meta:{}},i=await S(r,t);return{...i,meta:A(i,n)}}function M(e,t){let n=e?.schema??{},r=o(e,t);return r.description=s(`Determines the ${r.title??``} specification from a {title} input.`,n,r,t?.description),r}async function N(e,t,n={}){let{input:i,meta:a,schema:o}=r(t)?t:{input:t,meta:{}},s=e;if(o){let t;if(w(o))try{t=await b(o,n)}catch{}else t=o;t&&(s=await j(t,n),s.schema=C(s.schema,e.schema))}let c;if(w(i))try{let e=await b(i,n);c=r(e)?await N(s,e.input,n).then(e=>e.input):e}catch{}return c||=i,{schema:s,input:c,meta:M(s,a)}}function P(e,t){let n=e?.schema??{},r=o(e,t);return r.description=s(`Accepts a ${r.title??``} specification and processes it with a {title} output.`,n,r,t?.description),r}async function F(e,t,n={}){let{output:r,meta:a,schema:o}=i(t)?t:{output:t,meta:{}},s=e;if(o){let t;if(w(o))try{t=await b(o,n)}catch{}else t=o;t&&(s=await j(t,n),s.schema=C(s.schema,e.schema))}let c;if(w(r))try{let e=await b(r,n);c=i(e)?await F(s,e.output,n).then(e=>e.output):e}catch{}return c||=r,{schema:s,output:c,meta:P(s,a)}}async function I(t,r,i,a={}){let o;o=n(i)?i:await b(i,{fs:y(r.storage),...a}),o.schema||={type:`any`};let s=await j(o.schema,{storage:r.storage,...a}),c=o.input;if(!c)if(a.inputPath)c=`@power-plant/unstorage-input`;else throw Error("No input configuration provided. Please provide an input configuration, a valid specification, or a `inputPath` option that points to a valid input file.");let l=o.output;l||=`@power-plant/unstorage-output`;let[u,d]=await Promise.all([N(s,c,{storage:r.storage,...a}),F(s,l,{storage:r.storage,...a})]);return{meta:o.meta,schema:s,input:u,output:d,generator:async n=>{let i=await O(t,r,n,s,u,d);return e(i,async()=>{let e=x(u.input)?await u.input({storage:i.storage,...n}):u.input;i[`~spec`]=e;let t;t=x(o.generator)?o.generator:await b(o.generator,{storage:i.storage,...n});let r=await t(e,n);return{spec:e,options:n,documents:r,returns:await d.output(e,n,r)}})}}}async function L(e={}){let n=await D(e);return async(e,r={})=>t(n,async()=>{let t=l(),{generator:i}=await I(t,n,e,r),{documents:a,returns:o,spec:s,options:c}=await i(r),u=await k({documents:Object.fromEntries(Object.entries(a).map(([e,n])=>[e,{...n,path:e,meta:{executionId:t}}])),meta:{executionId:t,executedAt:new Date,executedBy:n.session.user}},s,c);return n.session.executions.push(u),o})}async function R(e,t={}){return(await L(t))(e,t)}export{R as n,L as t};
2
- //# sourceMappingURL=execute-P-XlJq_k.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execute-P-XlJq_k.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"execution-DQVv-_js.d.mts","names":[],"sources":["../src/types/execution.ts"],"mappings":""}
@@ -1,3 +0,0 @@
1
- import "./config-CC41Bqgl.cjs";
2
- import "./execution-BQs3Rtsf.cjs";
3
- import "./context-JdUVz1C4.cjs";
@@ -1,3 +0,0 @@
1
- import "./config-Fi_Jtk6F.mjs";
2
- import "./execution-DQVv-_js.mjs";
3
- import "./context-BGQun77j.mjs";