@power-plant/utils 0.0.32 → 0.0.33
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/combine.cjs +1 -1
- package/dist/combine.d.cts +1 -1
- package/dist/combine.d.cts.map +1 -1
- package/dist/combine.d.mts +1 -1
- package/dist/combine.mjs +1 -1
- package/dist/helpers-BvLWl12x.mjs +2 -0
- package/dist/helpers-BvLWl12x.mjs.map +1 -0
- package/dist/helpers-lZ86SXiM.cjs +1 -0
- package/dist/pipe.cjs +1 -1
- package/dist/pipe.mjs +1 -1
- package/package.json +5 -5
- package/dist/helpers-BA83xEDk.cjs +0 -1
- package/dist/helpers-BcAJajm7.mjs +0 -2
- package/dist/helpers-BcAJajm7.mjs.map +0 -1
package/dist/combine.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-lZ86SXiM.cjs");let t=require("@power-plant/core");function n(t){let n={};for(let[r,i]of Object.entries(t))i!==void 0&&(n[r]=e.s(i));return{schema:{type:`object`,properties:n,required:Object.keys(n),additionalProperties:!1},input:async n=>{let r={};for(let i of Object.keys(t)){let a=t[i];a!==void 0&&(r[i]=await e.i(a,n,`combine`,i))}return r}}}function r(t){let n={};for(let[r,i]of Object.entries(t))n[r]=e.c(i);return{schema:{type:`object`,properties:n,required:Object.keys(n),additionalProperties:!1},output:async(n,r,i)=>{let a={};for(let o of Object.keys(t))a[o]=await e.a(t[o],`combine`,o)(n[o],r,i);return a}}}function i(t){return async(n,r)=>{let i={};for(let a of Object.keys(t)){let o=await e.r(t[a],`combine`,a)(n[a],r);Object.assign(i,o)}return i}}function a(t){let{generator:a,meta:o,schema:s,input:c,output:l}=t,u={},d={};for(let t of Object.keys(a))u[t]=e.t(a[t]),d[t]=e.n(a[t]);return{meta:o,schema:s===void 0?void 0:e.o(s),input:c??n(u),output:l??r(d),generator:i(a)}}async function o(e,n={}){return(await(0,t.createExecute)(n))(a(e),n)}exports.combine=o,exports.combineInputs=n,exports.combineOutputs=r;
|
package/dist/combine.d.cts
CHANGED
|
@@ -7,7 +7,7 @@ import { InputConfig, InputConfigObject, OutputConfig, OutputConfigObject, UserC
|
|
|
7
7
|
* @remarks
|
|
8
8
|
* Missing (`undefined`) entries are skipped. An empty map yields a noop input
|
|
9
9
|
* that resolves to `{}`. Child schemas are merged into an object schema keyed
|
|
10
|
-
* the same way; children without a schema use `
|
|
10
|
+
* the same way; children without a schema use `JSON_SCHEMA_ANY`.
|
|
11
11
|
*/
|
|
12
12
|
declare function combineInputs<TSpec extends Record<string, any>, TOptions extends object = object>(inputs: { [K in keyof TSpec]: InputConfig<TSpec[K], TOptions> | undefined; }): InputConfigObject<TSpec, TOptions>;
|
|
13
13
|
/**
|
package/dist/combine.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combine.d.cts","names":[],"sources":["../src/combine.ts"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"combine.d.cts","names":[],"sources":["../src/combine.ts"],"mappings":";;;;;;;;;;;iBAyDgB,cACd,cAAc,qBACd,kCACA,WACC,WAAW,QAAQ,YAAY,MAAM,IAAI,2BACxC,kBAAkB,OAAO;;;;;;;;;iBA6Cb,eACd,cAAc,qBACd,kCACA,oBAAoB,WAAW,oBAC5B,WAAW,iBAEd,YACC,WAAW,QAAQ,aAAa,MAAM,IAAI,UAAU,SAAS,qBAC5D,mBAAmB,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4JlB,QACpB,oBAAoB,eAAe,qBAEnC,QAAQ,wBAAwB,cAChC,UAAS,aAAa,gBAAgB,eAErC,QAAQ,gBAAgB"}
|
package/dist/combine.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import { InputConfig, InputConfigObject, OutputConfig, OutputConfigObject, UserC
|
|
|
7
7
|
* @remarks
|
|
8
8
|
* Missing (`undefined`) entries are skipped. An empty map yields a noop input
|
|
9
9
|
* that resolves to `{}`. Child schemas are merged into an object schema keyed
|
|
10
|
-
* the same way; children without a schema use `
|
|
10
|
+
* the same way; children without a schema use `JSON_SCHEMA_ANY`.
|
|
11
11
|
*/
|
|
12
12
|
declare function combineInputs<TSpec extends Record<string, any>, TOptions extends object = object>(inputs: { [K in keyof TSpec]: InputConfig<TSpec[K], TOptions> | undefined; }): InputConfigObject<TSpec, TOptions>;
|
|
13
13
|
/**
|
package/dist/combine.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./helpers-
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./helpers-BvLWl12x.mjs";import{createExecute as c}from"@power-plant/core";function l(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=o(r));return{schema:{type:`object`,properties:t,required:Object.keys(t),additionalProperties:!1},input:async t=>{let r={};for(let i of Object.keys(e)){let a=e[i];a!==void 0&&(r[i]=await n(a,t,`combine`,i))}return r}}}function u(n){let r={};for(let[e,i]of Object.entries(n))r[e]=t(i);return{schema:{type:`object`,properties:r,required:Object.keys(r),additionalProperties:!1},output:async(t,r,i)=>{let a={};for(let o of Object.keys(n))a[o]=await e(n[o],`combine`,o)(t[o],r,i);return a}}}function d(e){return async(t,n)=>{let r={};for(let i of Object.keys(e)){let o=await a(e[i],`combine`,i)(t[i],n);Object.assign(r,o)}return r}}function f(e){let{generator:t,meta:n,schema:a,input:o,output:c}=e,f={},p={};for(let e of Object.keys(t))f[e]=s(t[e]),p[e]=r(t[e]);return{meta:n,schema:a===void 0?void 0:i(a),input:o??l(f),output:c??u(p),generator:d(t)}}async function p(e,t={}){return(await c(t))(f(e),t)}export{p as combine,l as combineInputs,u as combineOutputs};
|
|
2
2
|
//# sourceMappingURL=combine.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isGeneratorConfigObject as e,isInputConfigObject as t,isOutputConfigObject as n,isSchemaConfigObject as r}from"@power-plant/core/helpers/type-checks";import{isFunction as i}from"@stryke/type-checks/is-function";const a={};function o(e,t){return e===`combine`?`Combined generator "${t}"`:`Pipe generator at index ${t}`}function s(t){if(e(t))return t.input}function c(t){if(e(t))return t.output}function l(e){return e===void 0?a:r(e)?e.schema:e}function u(e){return e!==void 0&&t(e)&&e.schema?l(e.schema):a}function d(e){return e!==void 0&&n(e)&&e.schema?l(e.schema):a}function f(e){return r(e)?e:{schema:e}}function p(e,n,r,a){let s=o(r,a),c=r===`combine`?`combined`:`pipe`;if(e===void 0)throw TypeError(`${s} has no input config. Provide \`input\` on the child generator or on the ${c} config.`);if(i(e))return e(n);if(t(e)){let t=e.input;return i(t)?t(n):t}if(typeof e==`string`)throw TypeError(`${s} uses a load-reference input, which is not supported inside ${r}(). Provide a concrete input value or function.`);return e}function m(e,t,r){let a=o(t,r);if(e===void 0)return async()=>void 0;if(i(e))return e;if(n(e)&&i(e.output))return e.output;throw TypeError(`${a} uses a load-reference output, which is not supported inside ${t}(). Provide a concrete output function.`)}function h(t,n,r){let a=o(n,r);if(!e(t))throw TypeError(`${a} must be a generator config object (load references are not supported inside ${n}()).`);if(!i(t.generator))throw TypeError(`${a} must provide an inline generator function (load references are not supported inside ${n}()).`);return t.generator}export{m as a,d as c,p as i,c as n,f as o,h as r,u as s,s as t};
|
|
2
|
+
//# sourceMappingURL=helpers-BvLWl12x.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers-BvLWl12x.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("@power-plant/core/helpers/type-checks"),t=require("@stryke/type-checks/is-function");const n={};function r(e,t){return e===`combine`?`Combined generator "${t}"`:`Pipe generator at index ${t}`}function i(t){if((0,e.isGeneratorConfigObject)(t))return t.input}function a(t){if((0,e.isGeneratorConfigObject)(t))return t.output}function o(t){return t===void 0?n:(0,e.isSchemaConfigObject)(t)?t.schema:t}function s(t){return t!==void 0&&(0,e.isInputConfigObject)(t)&&t.schema?o(t.schema):n}function c(t){return t!==void 0&&(0,e.isOutputConfigObject)(t)&&t.schema?o(t.schema):n}function l(t){return(0,e.isSchemaConfigObject)(t)?t:{schema:t}}function u(n,i,a,o){let s=r(a,o),c=a===`combine`?`combined`:`pipe`;if(n===void 0)throw TypeError(`${s} has no input config. Provide \`input\` on the child generator or on the ${c} config.`);if((0,t.isFunction)(n))return n(i);if((0,e.isInputConfigObject)(n)){let e=n.input;return(0,t.isFunction)(e)?e(i):e}if(typeof n==`string`)throw TypeError(`${s} uses a load-reference input, which is not supported inside ${a}(). Provide a concrete input value or function.`);return n}function d(n,i,a){let o=r(i,a);if(n===void 0)return async()=>void 0;if((0,t.isFunction)(n))return n;if((0,e.isOutputConfigObject)(n)&&(0,t.isFunction)(n.output))return n.output;throw TypeError(`${o} uses a load-reference output, which is not supported inside ${i}(). Provide a concrete output function.`)}function f(n,i,a){let o=r(i,a);if(!(0,e.isGeneratorConfigObject)(n))throw TypeError(`${o} must be a generator config object (load references are not supported inside ${i}()).`);if(!(0,t.isFunction)(n.generator))throw TypeError(`${o} must provide an inline generator function (load references are not supported inside ${i}()).`);return n.generator}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
|
package/dist/pipe.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-lZ86SXiM.cjs");let t=require("@power-plant/core");function n(t){let n=t.map(t=>e.s(t));return{schema:{type:`array`,prefixItems:n,items:!1,minItems:n.length,maxItems:n.length},input:async n=>{let r=[],i=t;for(let t=0;t<i.length;t++){let a=i[t];a!==void 0&&(r[t]=await e.i(a,n,`pipe`,t))}return r}}}function r(t){let n=t,r=n.map(t=>e.c(t));return{schema:{type:`array`,prefixItems:r,items:!1,minItems:r.length,maxItems:r.length},output:async(t,r,i)=>{if(n.length===0)return;let a;for(let o=0;o<n.length;o++){let s=t[o];a=await e.a(n[o],`pipe`,o)(s,r,i)}return a}}}function i(t){return async(n,r)=>{let i={};for(let a=0;a<t.length;a++){let o=await e.r(t[a],`pipe`,a)(n[a],r);Object.assign(i,o)}return i}}function a(t){let{generator:a,meta:o,schema:s,input:c,output:l}=t,u=a,d=u.map(t=>e.t(t)),f=u.map(t=>e.n(t));return{meta:o,schema:s===void 0?void 0:e.o(s),input:c??n(d),output:l??r(f),generator:i(u)}}async function o(e,n={}){return(await(0,t.createExecute)(n))(a(e),n)}exports.pipe=o,exports.pipeInputs=n,exports.pipeOutputs=r;
|
package/dist/pipe.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./helpers-
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./helpers-BvLWl12x.mjs";import{createExecute as c}from"@power-plant/core";function l(e){let t=e.map(e=>o(e));return{schema:{type:`array`,prefixItems:t,items:!1,minItems:t.length,maxItems:t.length},input:async t=>{let r=[],i=e;for(let e=0;e<i.length;e++){let a=i[e];a!==void 0&&(r[e]=await n(a,t,`pipe`,e))}return r}}}function u(n){let r=n,i=r.map(e=>t(e));return{schema:{type:`array`,prefixItems:i,items:!1,minItems:i.length,maxItems:i.length},output:async(t,n,i)=>{if(r.length===0)return;let a;for(let o=0;o<r.length;o++){let s=t[o];a=await e(r[o],`pipe`,o)(s,n,i)}return a}}}function d(e){return async(t,n)=>{let r={};for(let i=0;i<e.length;i++){let o=await a(e[i],`pipe`,i)(t[i],n);Object.assign(r,o)}return r}}function f(e){let{generator:t,meta:n,schema:a,input:o,output:c}=e,f=t,p=f.map(e=>s(e)),m=f.map(e=>r(e));return{meta:n,schema:a===void 0?void 0:i(a),input:o??l(p),output:c??u(m),generator:d(f)}}async function p(e,t={}){return(await c(t))(f(e),t)}export{p as pipe,l as pipeInputs,u as pipeOutputs};
|
|
2
2
|
//# sourceMappingURL=pipe.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@power-plant/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Various utilities that help in the development of Power Plant extensions",
|
|
6
6
|
"keywords": ["power-plant", "storm-software"],
|
|
@@ -72,18 +72,18 @@
|
|
|
72
72
|
"typings": "dist/index.d.mts",
|
|
73
73
|
"files": ["dist"],
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@power-plant/schema": "^0.0.
|
|
76
|
-
"@power-plant/core": "^0.0.
|
|
75
|
+
"@power-plant/schema": "^0.0.45",
|
|
76
|
+
"@power-plant/core": "^0.0.47",
|
|
77
77
|
"@stryke/string-format": "^0.17.40",
|
|
78
78
|
"@stryke/type-checks": "^0.6.31",
|
|
79
79
|
"@stryke/types": "^0.12.26",
|
|
80
80
|
"defu": "^6.1.7"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
83
|
+
"@powerlines/plugin-tsdown": "^0.1.565",
|
|
84
84
|
"@types/node": "^25.9.5",
|
|
85
85
|
"typescript": "^6.0.3"
|
|
86
86
|
},
|
|
87
87
|
"publishConfig": { "access": "public" },
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "0890399c7d1a665fac1b75d716ce184964439990"
|
|
89
89
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("@power-plant/core/helpers/type-checks"),t=require("@stryke/type-checks/is-function");function n(e,t){return e===`combine`?`Combined generator "${t}"`:`Pipe generator at index ${t}`}function r(t){if((0,e.isGeneratorConfigObject)(t))return t.input}function i(t){if((0,e.isGeneratorConfigObject)(t))return t.output}function a(t){return t===void 0?{type:`any`}:(0,e.isSchemaConfigObject)(t)?t.schema:t}function o(t){return t!==void 0&&(0,e.isInputConfigObject)(t)&&t.schema?a(t.schema):{type:`any`}}function s(t){return t!==void 0&&(0,e.isOutputConfigObject)(t)&&t.schema?a(t.schema):{type:`any`}}function c(t){return(0,e.isSchemaConfigObject)(t)?t:{schema:t}}function l(r,i,a,o){let s=n(a,o),c=a===`combine`?`combined`:`pipe`;if(r===void 0)throw TypeError(`${s} has no input config. Provide \`input\` on the child generator or on the ${c} config.`);if((0,t.isFunction)(r))return r(i);if((0,e.isInputConfigObject)(r)){let e=r.input;return(0,t.isFunction)(e)?e(i):e}if(typeof r==`string`)throw TypeError(`${s} uses a load-reference input, which is not supported inside ${a}(). Provide a concrete input value or function.`);return r}function u(r,i,a){let o=n(i,a);if(r===void 0)return async()=>void 0;if((0,t.isFunction)(r))return r;if((0,e.isOutputConfigObject)(r)&&(0,t.isFunction)(r.output))return r.output;throw TypeError(`${o} uses a load-reference output, which is not supported inside ${i}(). Provide a concrete output function.`)}function d(r,i,a){let o=n(i,a);if(!(0,e.isGeneratorConfigObject)(r))throw TypeError(`${o} must be a generator config object (load references are not supported inside ${i}()).`);if(!(0,t.isFunction)(r.generator))throw TypeError(`${o} must provide an inline generator function (load references are not supported inside ${i}()).`);return r.generator}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{isGeneratorConfigObject as e,isInputConfigObject as t,isOutputConfigObject as n,isSchemaConfigObject as r}from"@power-plant/core/helpers/type-checks";import{isFunction as i}from"@stryke/type-checks/is-function";function a(e,t){return e===`combine`?`Combined generator "${t}"`:`Pipe generator at index ${t}`}function o(t){if(e(t))return t.input}function s(t){if(e(t))return t.output}function c(e){return e===void 0?{type:`any`}:r(e)?e.schema:e}function l(e){return e!==void 0&&t(e)&&e.schema?c(e.schema):{type:`any`}}function u(e){return e!==void 0&&n(e)&&e.schema?c(e.schema):{type:`any`}}function d(e){return r(e)?e:{schema:e}}function f(e,n,r,o){let s=a(r,o),c=r===`combine`?`combined`:`pipe`;if(e===void 0)throw TypeError(`${s} has no input config. Provide \`input\` on the child generator or on the ${c} config.`);if(i(e))return e(n);if(t(e)){let t=e.input;return i(t)?t(n):t}if(typeof e==`string`)throw TypeError(`${s} uses a load-reference input, which is not supported inside ${r}(). Provide a concrete input value or function.`);return e}function p(e,t,r){let o=a(t,r);if(e===void 0)return async()=>void 0;if(i(e))return e;if(n(e)&&i(e.output))return e.output;throw TypeError(`${o} uses a load-reference output, which is not supported inside ${t}(). Provide a concrete output function.`)}function m(t,n,r){let o=a(n,r);if(!e(t))throw TypeError(`${o} must be a generator config object (load references are not supported inside ${n}()).`);if(!i(t.generator))throw TypeError(`${o} must provide an inline generator function (load references are not supported inside ${n}()).`);return t.generator}export{p as a,u as c,f as i,s as n,d as o,m as r,l as s,o as t};
|
|
2
|
-
//# sourceMappingURL=helpers-BcAJajm7.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers-BcAJajm7.mjs","names":[],"sources":[],"mappings":""}
|