@power-plant/utils 0.0.79 → 0.0.80

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/README.md CHANGED
@@ -33,7 +33,7 @@ The Power Plant monorepo is a collection of packages that are designed to work t
33
33
 
34
34
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
35
35
 
36
- [![Version](https://img.shields.io/badge/version-0.0.78-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://docs.stormsoftware.com/projects/power-plant)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/power-plant/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
36
+ [![Version](https://img.shields.io/badge/version-0.0.79-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://docs.stormsoftware.com/projects/power-plant)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/power-plant/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
37
37
 
38
38
  <!-- prettier-ignore-start -->
39
39
  <!-- markdownlint-disable -->
package/dist/combine.cjs CHANGED
@@ -1 +1 @@
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;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-CXo1yfOE.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.c(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.a(a,n,`combine`,i))}return r}}}function r(t){let n={};for(let[r,i]of Object.entries(t))n[r]=e.l(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.o(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.i(t[a],`combine`,a)(n[a],r);for(let i of e.r(t[a],`combine`,a))o=await i(n[a],r,o);Object.assign(i,o)}return i}}function a(t){let{generator:a,meta:o,schema:s,input:c,output:l,format:u}=t,d={},f={};for(let t of Object.keys(a))d[t]=e.t(a[t]),f[t]=e.n(a[t]);return{meta:o,schema:s===void 0?void 0:e.s(s),input:c??n(d),output:l??r(f),format:u,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;
@@ -26,7 +26,9 @@ declare function combineOutputs<TSpec extends Record<string, any>, TOptions exte
26
26
  * `config.generator` is a string-keyed map of child generator configs.
27
27
  * Spec / schema / input / output shapes are joined by those same keys
28
28
  * (e.g. `{ typescript: TsSpec; python: PySpec }`). Child generators run in
29
- * key order; documents are merged; returns are keyed the same way.
29
+ * key order; each child's `format` formatters run on its own documents, which
30
+ * are then merged (the combined `format` runs last); returns are keyed the
31
+ * same way.
30
32
  *
31
33
  * @example
32
34
  * ```ts
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"combine.d.cts","names":[],"sources":["../src/combine.ts"],"mappings":";;;;;;;;;;;iBA0DgB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsKlB,QACpB,oBAAoB,eAAe,qBAEnC,QAAQ,wBAAwB,cAChC,UAAS,aAAa,gBAAgB,eAErC,QAAQ,gBAAgB"}
@@ -26,7 +26,9 @@ declare function combineOutputs<TSpec extends Record<string, any>, TOptions exte
26
26
  * `config.generator` is a string-keyed map of child generator configs.
27
27
  * Spec / schema / input / output shapes are joined by those same keys
28
28
  * (e.g. `{ typescript: TsSpec; python: PySpec }`). Child generators run in
29
- * key order; documents are merged; returns are keyed the same way.
29
+ * key order; each child's `format` formatters run on its own documents, which
30
+ * are then merged (the combined `format` runs last); returns are keyed the
31
+ * same way.
30
32
  *
31
33
  * @example
32
34
  * ```ts
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-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};
1
+ import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./helpers-CF2F12zs.mjs";import{createExecute as l}from"@power-plant/core";function u(n){let r={};for(let[e,i]of Object.entries(n))i!==void 0&&(r[e]=t(i));return{schema:{type:`object`,properties:r,required:Object.keys(r),additionalProperties:!1},input:async t=>{let r={};for(let i of Object.keys(n)){let a=n[i];a!==void 0&&(r[i]=await e(a,t,`combine`,i))}return r}}}function d(e){let t={};for(let[n,i]of Object.entries(e))t[n]=r(i);return{schema:{type:`object`,properties:t,required:Object.keys(t),additionalProperties:!1},output:async(t,n,r)=>{let i={};for(let o of Object.keys(e))i[o]=await a(e[o],`combine`,o)(t[o],n,r);return i}}}function f(e){return async(t,r)=>{let i={};for(let a of Object.keys(e)){let s=await n(e[a],`combine`,a)(t[a],r);for(let n of o(e[a],`combine`,a))s=await n(t[a],r,s);Object.assign(i,s)}return i}}function p(e){let{generator:t,meta:n,schema:r,input:a,output:o,format:l}=e,p={},m={};for(let e of Object.keys(t))p[e]=c(t[e]),m[e]=i(t[e]);return{meta:n,schema:r===void 0?void 0:s(r),input:a??u(p),output:o??d(m),format:l,generator:f(t)}}async function m(e,t={}){return(await l(t))(p(e),t)}export{m as combine,u as combineInputs,d as combineOutputs};
2
2
  //# sourceMappingURL=combine.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"combine.mjs","names":[],"sources":[],"mappings":""}
1
+ {"version":3,"file":"combine.mjs","names":["resolveInputValue","unwrapInputSchemaSource","resolveGeneratorFunction","unwrapOutputSchemaSource","resolveChildOutput","resolveOutputFunction","resolveFormatterFunctions","resolveChildInput","combineInputs","properties","key","input","inputs","spec","options","combineOutputs","output","outputs","returns","documents","buildCombinedGenerator","generators","childDocuments","formatterFn","toExecutableConfig","config","childInputs","childOutputs","schema","resolveSchemaOverride","combine","createExecute"],"sources":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{isFormatterConfigObject as e,isGeneratorConfigObject as t,isInputConfigObject as n,isOutputConfigObject as r,isSchemaConfigObject as i}from"@power-plant/core/helpers/type-checks";import{isFunction as a}from"@stryke/type-checks/is-function";const o={};function s(e,t){return e===`combine`?`Combined generator "${t}"`:`Pipe generator at index ${t}`}function c(e){if(t(e))return e.input}function l(e){if(t(e))return e.output}function u(e){return e===void 0?o:i(e)?e.schema:e}function d(e){return e!==void 0&&n(e)&&e.schema?u(e.schema):o}function f(e){return e!==void 0&&r(e)&&e.schema?u(e.schema):o}function p(e){return i(e)?e:{schema:e}}function m(e,t,r,i){let o=s(r,i),c=r===`combine`?`combined`:`pipe`;if(e===void 0)throw TypeError(`${o} has no input config. Provide \`input\` on the child generator or on the ${c} config.`);if(a(e))return e(t);if(n(e)){let n=e.input;return a(n)?n(t):n}if(typeof e==`string`)throw TypeError(`${o} uses a load-reference input, which is not supported inside ${r}(). Provide a concrete input value or function.`);return e}function h(e,t,n){let i=s(t,n);if(e===void 0)return async()=>void 0;if(a(e))return e;if(r(e)&&a(e.output))return e.output;throw TypeError(`${i} uses a load-reference output, which is not supported inside ${t}(). Provide a concrete output function.`)}function g(e,n,r){let i=s(n,r);if(!t(e))throw TypeError(`${i} must be a generator config object (load references are not supported inside ${n}()).`);if(!a(e.generator))throw TypeError(`${i} must provide an inline generator function (load references are not supported inside ${n}()).`);return e.generator}function _(n,r,i){if(!t(n)||n.format===void 0)return[];let o=s(r,i);return(Array.isArray(n.format)?n.format:[n.format]).map(t=>{if(a(t))return t;if(e(t)&&a(t.format))return t.format;throw TypeError(`${o} uses a load-reference formatter, which is not supported inside ${r}(). Provide a concrete formatter function.`)})}export{m as a,d as c,g as i,f as l,l as n,h as o,_ as r,p as s,c as t};
2
+ //# sourceMappingURL=helpers-CF2F12zs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers-CF2F12zs.mjs","names":["JSON_SCHEMA_ANY","formatChildLabel","utility","identifier","resolveChildInput","isGeneratorConfigObject","config","resolveChildOutput","unwrapSchemaSource","schema","isSchemaConfigObject","unwrapInputSchemaSource","input","isInputConfigObject","unwrapOutputSchemaSource","output","isOutputConfigObject","resolveSchemaOverride","schemaOverride","resolveInputValue","label","configLabel","isFunction","options","inner","resolveOutputFunction","resolveGeneratorFunction","resolveFormatterFunctions","format","isFormatterConfigObject"],"sources":[],"mappings":""}
@@ -1 +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}});
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}function p(n,i,a){if(!(0,e.isGeneratorConfigObject)(n)||n.format===void 0)return[];let o=r(i,a);return(Array.isArray(n.format)?n.format:[n.format]).map(n=>{if((0,t.isFunction)(n))return n;if((0,e.isFormatterConfigObject)(n)&&(0,t.isFunction)(n.format))return n.format;throw TypeError(`${o} uses a load-reference formatter, which is not supported inside ${i}(). Provide a concrete formatter function.`)})}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 f}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return l}}),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-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;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-CXo1yfOE.cjs");let t=require("@power-plant/core");function n(t){let n=t.map(t=>e.c(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.a(a,n,`pipe`,t))}return r}}}function r(t){let n=t,r=n.map(t=>e.l(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.o(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=e.i(t[a],`pipe`,a),s=n[a],c=await o(s,r);for(let n of e.r(t[a],`pipe`,a))c=await n(s,r,c);Object.assign(i,c)}return i}}function a(t){let{generator:a,meta:o,schema:s,input:c,output:l,format:u}=t,d=a,f=d.map(t=>e.t(t)),p=d.map(t=>e.n(t));return{meta:o,schema:s===void 0?void 0:e.s(s),input:c??n(f),output:l??r(p),format:u,generator:i(d)}}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.d.cts CHANGED
@@ -25,7 +25,8 @@ declare function pipeOutputs<TSpec extends any[], TOptions extends object = obje
25
25
  * @remarks
26
26
  * `config.generator` is an ordered array of child generator configs.
27
27
  * Spec / schema / input shapes are a tuple aligned with that array.
28
- * Child generators run in array order; documents are merged; every child
28
+ * Child generators run in array order; each child's `format` formatters run
29
+ * on its own documents, which are then merged (the pipe's `format` runs last); every child
29
30
  * output runs (own spec slice) and returns come from the last generator only.
30
31
  *
31
32
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"pipe.d.cts","names":[],"sources":["../src/pipe.ts"],"mappings":";;;;;;;;;;;iBAuDgB,WACd,qBACA,kCACA,WACC,WAAW,QAAQ,YAAY,MAAM,IAAI,2BACxC,kBAAkB,OAAO;;;;;;;;;iBA4Cb,YACd,qBACA,kCACA,iBACA,YACC,WAAW,QAAQ,aAAa,MAAM,IAAI,gCACzC,mBAAmB,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuIlB,KAAK,oBAAoB,sBAC7C,QAAQ,oBAAoB,cAC5B,UAAS,aAAa,YAAY,eAEjC,QAAQ,YAAY"}
1
+ {"version":3,"file":"pipe.d.cts","names":[],"sources":["../src/pipe.ts"],"mappings":";;;;;;;;;;;iBAwDgB,WACd,qBACA,kCACA,WACC,WAAW,QAAQ,YAAY,MAAM,IAAI,2BACxC,kBAAkB,OAAO;;;;;;;;;iBA4Cb,YACd,qBACA,kCACA,iBACA,YACC,WAAW,QAAQ,aAAa,MAAM,IAAI,gCACzC,mBAAmB,OAAO,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgJlB,KAAK,oBAAoB,sBAC7C,QAAQ,oBAAoB,cAC5B,UAAS,aAAa,YAAY,eAEjC,QAAQ,YAAY"}
package/dist/pipe.d.mts CHANGED
@@ -25,7 +25,8 @@ declare function pipeOutputs<TSpec extends any[], TOptions extends object = obje
25
25
  * @remarks
26
26
  * `config.generator` is an ordered array of child generator configs.
27
27
  * Spec / schema / input shapes are a tuple aligned with that array.
28
- * Child generators run in array order; documents are merged; every child
28
+ * Child generators run in array order; each child's `format` formatters run
29
+ * on its own documents, which are then merged (the pipe's `format` runs last); every child
29
30
  * output runs (own spec slice) and returns come from the last generator only.
30
31
  *
31
32
  * @example
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-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};
1
+ import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./helpers-CF2F12zs.mjs";import{createExecute as l}from"@power-plant/core";function u(n){let r=n.map(e=>t(e));return{schema:{type:`array`,prefixItems:r,items:!1,minItems:r.length,maxItems:r.length},input:async t=>{let r=[],i=n;for(let n=0;n<i.length;n++){let a=i[n];a!==void 0&&(r[n]=await e(a,t,`pipe`,n))}return r}}}function d(e){let t=e,n=t.map(e=>r(e));return{schema:{type:`array`,prefixItems:n,items:!1,minItems:n.length,maxItems:n.length},output:async(e,n,r)=>{if(t.length===0)return;let i;for(let o=0;o<t.length;o++){let s=e[o];i=await a(t[o],`pipe`,o)(s,n,r)}return i}}}function f(e){return async(t,r)=>{let i={};for(let a=0;a<e.length;a++){let s=n(e[a],`pipe`,a),c=t[a],l=await s(c,r);for(let t of o(e[a],`pipe`,a))l=await t(c,r,l);Object.assign(i,l)}return i}}function p(e){let{generator:t,meta:n,schema:r,input:a,output:o,format:l}=e,p=t,m=p.map(e=>c(e)),h=p.map(e=>i(e));return{meta:n,schema:r===void 0?void 0:s(r),input:a??u(m),output:o??d(h),format:l,generator:f(p)}}async function m(e,t={}){return(await l(t))(p(e),t)}export{m as pipe,u as pipeInputs,d as pipeOutputs};
2
2
  //# sourceMappingURL=pipe.mjs.map
package/dist/pipe.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pipe.mjs","names":[],"sources":[],"mappings":""}
1
+ {"version":3,"file":"pipe.mjs","names":["resolveInputValue","unwrapInputSchemaSource","resolveGeneratorFunction","unwrapOutputSchemaSource","resolveChildOutput","resolveOutputFunction","resolveFormatterFunctions","resolveChildInput","pipeInputs","prefixItems","inputs","input","spec","list","index","options","pipeOutputs","outputs","output","lastReturns","slice","documents","buildPipeGenerator","generators","generatorFn","childSpec","childDocuments","formatterFn","toExecutableConfig","config","generator","childInputs","child","childOutputs","schema","resolveSchemaOverride","pipe","createExecute"],"sources":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@power-plant/utils",
3
- "version": "0.0.79",
3
+ "version": "0.0.80",
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.91",
76
- "@power-plant/core": "^0.0.93",
77
- "@stryke/string-format": "^0.17.56",
78
- "@stryke/type-checks": "^0.6.47",
79
- "@stryke/types": "^0.12.42",
75
+ "@power-plant/schema": "^0.0.92",
76
+ "@power-plant/core": "^0.0.94",
77
+ "@stryke/string-format": "^0.17.58",
78
+ "@stryke/type-checks": "^0.6.49",
79
+ "@stryke/types": "^0.12.44",
80
80
  "defu": "^6.1.7"
81
81
  },
82
82
  "devDependencies": {
83
- "@powerlines/plugin-tsdown": "^0.1.613",
84
- "@types/node": "^25.9.7",
83
+ "@powerlines/plugin-tsdown": "^0.1.615",
84
+ "@types/node": "^25.9.9",
85
85
  "typescript": "^6.0.3"
86
86
  },
87
87
  "publishConfig": { "access": "public" },
88
- "gitHead": "69972a15b0f31c62b1cccd38a1811acef609ee06"
88
+ "gitHead": "082d4ef1a20adf7d4f5e11bf1f4f4efcf191dec0"
89
89
  }
@@ -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";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
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers-BvLWl12x.mjs","names":[],"sources":[],"mappings":""}