@power-plant/core 0.0.18 → 0.0.19

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/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 _()}const 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;
@@ -73,16 +73,28 @@ 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.
84
96
  */
85
- declare const useExecution: () => ExecutionContext<any, any, any>;
97
+ declare function useExecution<TSpec, TOptions extends object, TReturns = void>(): ExecutionContext<TSpec, TOptions, TReturns>;
86
98
  /**
87
99
  * The function to try to use the execution context.
88
100
  *
@@ -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,u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C,UAAA,iCAAA,gBAAA,IAAA,QAAA,OAAA,QAAA;;;;cA8MF,qBA9MC,GAAC,UAAA,iCAAA,gBAAA,IAAA,QAAA,OAAA,QAAA"}
@@ -73,16 +73,28 @@ 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.
84
96
  */
85
- declare const useExecution: () => ExecutionContext<any, any, any>;
97
+ declare function useExecution<TSpec, TOptions extends object, TReturns = void>(): ExecutionContext<TSpec, TOptions, TReturns>;
86
98
  /**
87
99
  * The function to try to use the execution context.
88
100
  *
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 _()}const 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};
2
2
  //# sourceMappingURL=context.mjs.map
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.19",
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.18",
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": "e74eca4c7a32c5289a37be1cf42240e6abd051ac"
188
188
  }