@decaf-ts/ui-decorators 0.20.4 → 0.20.6
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/ui-decorators.cjs +1 -1
- package/lib/cjs/graph/GraphExecutionStateMapper.cjs +97 -0
- package/lib/cjs/graph/GraphExecutionStateMapper.cjs.map +1 -0
- package/lib/cjs/graph/GraphResolution.cjs +17 -0
- package/lib/cjs/graph/GraphResolution.cjs.map +1 -0
- package/lib/cjs/graph/constants.cjs +157 -1
- package/lib/cjs/graph/constants.cjs.map +1 -1
- package/lib/cjs/graph/index.cjs +3 -0
- package/lib/cjs/graph/index.cjs.map +1 -1
- package/lib/cjs/graph/nodes/agents/agent.cjs +110 -0
- package/lib/cjs/graph/nodes/agents/agent.cjs.map +1 -0
- package/lib/cjs/graph/nodes/base.cjs +36 -0
- package/lib/cjs/graph/nodes/base.cjs.map +1 -0
- package/lib/cjs/graph/nodes/boundary/input-value.cjs +57 -0
- package/lib/cjs/graph/nodes/boundary/input-value.cjs.map +1 -0
- package/lib/cjs/graph/nodes/category-styles.cjs +38 -0
- package/lib/cjs/graph/nodes/category-styles.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/break.cjs +63 -0
- package/lib/cjs/graph/nodes/flow-control/break.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/error-boundary.cjs +67 -0
- package/lib/cjs/graph/nodes/flow-control/error-boundary.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/human-approval.cjs +69 -0
- package/lib/cjs/graph/nodes/flow-control/human-approval.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/if.cjs +71 -0
- package/lib/cjs/graph/nodes/flow-control/if.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/parallel.cjs +61 -0
- package/lib/cjs/graph/nodes/flow-control/parallel.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/switch.cjs +121 -0
- package/lib/cjs/graph/nodes/flow-control/switch.cjs.map +1 -0
- package/lib/cjs/graph/nodes/index.cjs +123 -0
- package/lib/cjs/graph/nodes/index.cjs.map +1 -0
- package/lib/cjs/graph/nodes/loops/foreach.cjs +86 -0
- package/lib/cjs/graph/nodes/loops/foreach.cjs.map +1 -0
- package/lib/cjs/graph/nodes/loops/until.cjs +74 -0
- package/lib/cjs/graph/nodes/loops/until.cjs.map +1 -0
- package/lib/cjs/graph/nodes/loops/while.cjs +74 -0
- package/lib/cjs/graph/nodes/loops/while.cjs.map +1 -0
- package/lib/cjs/graph/nodes/manifests.cjs +338 -0
- package/lib/cjs/graph/nodes/manifests.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/chat.cjs +70 -0
- package/lib/cjs/graph/nodes/triggers/chat.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/event.cjs +58 -0
- package/lib/cjs/graph/nodes/triggers/event.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/form.cjs +59 -0
- package/lib/cjs/graph/nodes/triggers/form.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/manual.cjs +60 -0
- package/lib/cjs/graph/nodes/triggers/manual.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/schedule.cjs +60 -0
- package/lib/cjs/graph/nodes/triggers/schedule.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/webhook.cjs +62 -0
- package/lib/cjs/graph/nodes/triggers/webhook.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/code.cjs +99 -0
- package/lib/cjs/graph/nodes/utility/code.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/delay.cjs +61 -0
- package/lib/cjs/graph/nodes/utility/delay.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/log.cjs +62 -0
- package/lib/cjs/graph/nodes/utility/log.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/map.cjs +61 -0
- package/lib/cjs/graph/nodes/utility/map.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/merge.cjs +62 -0
- package/lib/cjs/graph/nodes/utility/merge.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/return.cjs +61 -0
- package/lib/cjs/graph/nodes/utility/return.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/utility-log.cjs +66 -0
- package/lib/cjs/graph/nodes/utility/utility-log.cjs.map +1 -0
- package/lib/cjs/index.cjs +3 -3
- package/lib/esm/graph/GraphExecutionStateMapper.js +91 -0
- package/lib/esm/graph/GraphExecutionStateMapper.js.map +1 -0
- package/lib/esm/graph/GraphResolution.js +13 -0
- package/lib/esm/graph/GraphResolution.js.map +1 -0
- package/lib/esm/graph/constants.js +179 -0
- package/lib/esm/graph/constants.js.map +1 -1
- package/lib/esm/graph/index.js +3 -0
- package/lib/esm/graph/index.js.map +1 -1
- package/lib/esm/graph/nodes/agents/agent.js +101 -0
- package/lib/esm/graph/nodes/agents/agent.js.map +1 -0
- package/lib/esm/graph/nodes/base.js +31 -0
- package/lib/esm/graph/nodes/base.js.map +1 -0
- package/lib/esm/graph/nodes/boundary/input-value.js +48 -0
- package/lib/esm/graph/nodes/boundary/input-value.js.map +1 -0
- package/lib/esm/graph/nodes/category-styles.js +34 -0
- package/lib/esm/graph/nodes/category-styles.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/break.js +54 -0
- package/lib/esm/graph/nodes/flow-control/break.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/error-boundary.js +58 -0
- package/lib/esm/graph/nodes/flow-control/error-boundary.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/human-approval.js +60 -0
- package/lib/esm/graph/nodes/flow-control/human-approval.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/if.js +62 -0
- package/lib/esm/graph/nodes/flow-control/if.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/parallel.js +52 -0
- package/lib/esm/graph/nodes/flow-control/parallel.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/switch.js +112 -0
- package/lib/esm/graph/nodes/flow-control/switch.js.map +1 -0
- package/lib/esm/graph/nodes/index.js +105 -0
- package/lib/esm/graph/nodes/index.js.map +1 -0
- package/lib/esm/graph/nodes/loops/foreach.js +77 -0
- package/lib/esm/graph/nodes/loops/foreach.js.map +1 -0
- package/lib/esm/graph/nodes/loops/until.js +65 -0
- package/lib/esm/graph/nodes/loops/until.js.map +1 -0
- package/lib/esm/graph/nodes/loops/while.js +65 -0
- package/lib/esm/graph/nodes/loops/while.js.map +1 -0
- package/lib/esm/graph/nodes/manifests.js +334 -0
- package/lib/esm/graph/nodes/manifests.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/chat.js +61 -0
- package/lib/esm/graph/nodes/triggers/chat.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/event.js +49 -0
- package/lib/esm/graph/nodes/triggers/event.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/form.js +50 -0
- package/lib/esm/graph/nodes/triggers/form.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/manual.js +51 -0
- package/lib/esm/graph/nodes/triggers/manual.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/schedule.js +51 -0
- package/lib/esm/graph/nodes/triggers/schedule.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/webhook.js +53 -0
- package/lib/esm/graph/nodes/triggers/webhook.js.map +1 -0
- package/lib/esm/graph/nodes/utility/code.js +90 -0
- package/lib/esm/graph/nodes/utility/code.js.map +1 -0
- package/lib/esm/graph/nodes/utility/delay.js +52 -0
- package/lib/esm/graph/nodes/utility/delay.js.map +1 -0
- package/lib/esm/graph/nodes/utility/log.js +53 -0
- package/lib/esm/graph/nodes/utility/log.js.map +1 -0
- package/lib/esm/graph/nodes/utility/map.js +52 -0
- package/lib/esm/graph/nodes/utility/map.js.map +1 -0
- package/lib/esm/graph/nodes/utility/merge.js +53 -0
- package/lib/esm/graph/nodes/utility/merge.js.map +1 -0
- package/lib/esm/graph/nodes/utility/return.js +52 -0
- package/lib/esm/graph/nodes/utility/return.js.map +1 -0
- package/lib/esm/graph/nodes/utility/utility-log.js +57 -0
- package/lib/esm/graph/nodes/utility/utility-log.js.map +1 -0
- package/lib/esm/index.js +3 -3
- package/lib/types/graph/GraphExecutionStateMapper.d.cts +66 -0
- package/lib/types/graph/GraphExecutionStateMapper.d.mts +66 -0
- package/lib/types/graph/GraphResolution.d.cts +53 -0
- package/lib/types/graph/GraphResolution.d.mts +53 -0
- package/lib/types/graph/constants.d.cts +165 -0
- package/lib/types/graph/constants.d.mts +165 -0
- package/lib/types/graph/index.d.cts +3 -0
- package/lib/types/graph/index.d.mts +3 -0
- package/lib/types/graph/nodes/agents/agent.d.cts +44 -0
- package/lib/types/graph/nodes/agents/agent.d.mts +44 -0
- package/lib/types/graph/nodes/base.d.cts +28 -0
- package/lib/types/graph/nodes/base.d.mts +28 -0
- package/lib/types/graph/nodes/boundary/input-value.d.cts +13 -0
- package/lib/types/graph/nodes/boundary/input-value.d.mts +13 -0
- package/lib/types/graph/nodes/category-styles.d.cts +8 -0
- package/lib/types/graph/nodes/category-styles.d.mts +8 -0
- package/lib/types/graph/nodes/flow-control/break.d.cts +15 -0
- package/lib/types/graph/nodes/flow-control/break.d.mts +15 -0
- package/lib/types/graph/nodes/flow-control/error-boundary.d.cts +12 -0
- package/lib/types/graph/nodes/flow-control/error-boundary.d.mts +12 -0
- package/lib/types/graph/nodes/flow-control/human-approval.d.cts +13 -0
- package/lib/types/graph/nodes/flow-control/human-approval.d.mts +13 -0
- package/lib/types/graph/nodes/flow-control/if.d.cts +16 -0
- package/lib/types/graph/nodes/flow-control/if.d.mts +16 -0
- package/lib/types/graph/nodes/flow-control/parallel.d.cts +11 -0
- package/lib/types/graph/nodes/flow-control/parallel.d.mts +11 -0
- package/lib/types/graph/nodes/flow-control/switch.d.cts +21 -0
- package/lib/types/graph/nodes/flow-control/switch.d.mts +21 -0
- package/lib/types/graph/nodes/index.d.cts +79 -0
- package/lib/types/graph/nodes/index.d.mts +79 -0
- package/lib/types/graph/nodes/loops/foreach.d.cts +19 -0
- package/lib/types/graph/nodes/loops/foreach.d.mts +19 -0
- package/lib/types/graph/nodes/loops/until.d.cts +16 -0
- package/lib/types/graph/nodes/loops/until.d.mts +16 -0
- package/lib/types/graph/nodes/loops/while.d.cts +16 -0
- package/lib/types/graph/nodes/loops/while.d.mts +16 -0
- package/lib/types/graph/nodes/manifests.d.cts +62 -0
- package/lib/types/graph/nodes/manifests.d.mts +62 -0
- package/lib/types/graph/nodes/triggers/chat.d.cts +13 -0
- package/lib/types/graph/nodes/triggers/chat.d.mts +13 -0
- package/lib/types/graph/nodes/triggers/event.d.cts +10 -0
- package/lib/types/graph/nodes/triggers/event.d.mts +10 -0
- package/lib/types/graph/nodes/triggers/form.d.cts +11 -0
- package/lib/types/graph/nodes/triggers/form.d.mts +11 -0
- package/lib/types/graph/nodes/triggers/manual.d.cts +12 -0
- package/lib/types/graph/nodes/triggers/manual.d.mts +12 -0
- package/lib/types/graph/nodes/triggers/schedule.d.cts +11 -0
- package/lib/types/graph/nodes/triggers/schedule.d.mts +11 -0
- package/lib/types/graph/nodes/triggers/webhook.d.cts +11 -0
- package/lib/types/graph/nodes/triggers/webhook.d.mts +11 -0
- package/lib/types/graph/nodes/utility/code.d.cts +31 -0
- package/lib/types/graph/nodes/utility/code.d.mts +31 -0
- package/lib/types/graph/nodes/utility/delay.d.cts +11 -0
- package/lib/types/graph/nodes/utility/delay.d.mts +11 -0
- package/lib/types/graph/nodes/utility/log.d.cts +13 -0
- package/lib/types/graph/nodes/utility/log.d.mts +13 -0
- package/lib/types/graph/nodes/utility/map.d.cts +11 -0
- package/lib/types/graph/nodes/utility/map.d.mts +11 -0
- package/lib/types/graph/nodes/utility/merge.d.cts +12 -0
- package/lib/types/graph/nodes/utility/merge.d.mts +12 -0
- package/lib/types/graph/nodes/utility/return.d.cts +11 -0
- package/lib/types/graph/nodes/utility/return.d.mts +11 -0
- package/lib/types/graph/nodes/utility/utility-log.d.cts +15 -0
- package/lib/types/graph/nodes/utility/utility-log.d.mts +15 -0
- package/lib/types/graph/types.d.cts +286 -0
- package/lib/types/graph/types.d.mts +286 -0
- package/lib/types/index.d.cts +3 -3
- package/lib/types/index.d.mts +3 -3
- package/package.json +1 -1
package/dist/ui-decorators.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e,t,r,a,o){"use strict";var s;e.UIMediaBreakPoints=void 0,(s=e.UIMediaBreakPoints||(e.UIMediaBreakPoints={})).SMALL="small",s.MEDIUM="medium",s.LARGE="large",s.XLARGE="xlarge";const n={REFLECT:"ui",UIMODEL:"uimodel",RENDERED_BY:"rendered-by",ELEMENT:"uielement",PROP:"uiprop",CHILD:"uichild",NAME:"name",NAME_PREFIX:"input-",VALIDATION_MESSAGE:"validationMessage",UILISTMODEL:"uilistmodel",UILISTPROP:"uilistprop",UILAYOUT:"uilayout",UILAYOUTPROP:"uilayoutprop",HANDLERS:"handlers",TYPE:"type",SUB_TYPE:"subType",HIDDEN:"hidden",HIDE_FOR:"hide-for",SHOW_FOR:"show-for",RENDER_IF:"render-if",FORMAT:"format",ORDER:"order",PAGE:"page",EVENTS:"events",FIRST:"first",LAST:"last",READ_ONLY:"readonly",SEQUENCE:"sequence",REQUIRED:t.ValidationKeys.REQUIRED,MIN:t.ValidationKeys.MIN,MIN_LENGTH:t.ValidationKeys.MIN_LENGTH,MAX:t.ValidationKeys.MAX,MAX_LENGTH:t.ValidationKeys.MAX_LENGTH,PATTERN:t.ValidationKeys.PATTERN,URL:t.ValidationKeys.URL,STEP:t.ValidationKeys.STEP,DATE:t.ValidationKeys.DATE,EMAIL:t.ValidationKeys.EMAIL,PASSWORD:t.ValidationKeys.PASSWORD,EQUALS:t.ValidationKeys.EQUALS,DIFF:t.ValidationKeys.DIFF,LESS_THAN:t.ValidationKeys.LESS_THAN,LESS_THAN_OR_EQUAL:t.ValidationKeys.LESS_THAN_OR_EQUAL,GREATER_THAN:t.ValidationKeys.GREATER_THAN,GREATER_THAN_OR_EQUAL:t.ValidationKeys.GREATER_THAN_OR_EQUAL},i={[n.EMAIL]:t.EmailValidator,[n.URL]:t.URLValidator,[n.DATE]:t.DateValidator,[n.PASSWORD]:t.PasswordValidator},d={[n.REQUIRED]:t.RequiredValidator,[n.MIN]:t.MinValidator,[n.MAX]:t.MaxValidator,[n.STEP]:t.StepValidator,[n.MIN_LENGTH]:t.MinLengthValidator,[n.MAX_LENGTH]:t.MaxLengthValidator,[n.PATTERN]:t.PatternValidator,[n.EQUALS]:t.EqualsValidator,[n.DIFF]:t.DiffValidator,[n.LESS_THAN]:t.LessThanValidator,[n.LESS_THAN_OR_EQUAL]:t.LessThanOrEqualValidator,[n.GREATER_THAN]:t.GreaterThanValidator,[n.GREATER_THAN_OR_EQUAL]:t.GreaterThanOrEqualValidator},l="yyyy-MM-dd",c={BUTTON:"button",CHECKBOX:"checkbox",COLOR:"color",DATE:n.DATE,DATETIME_LOCAL:"datetime-local",EMAIL:n.EMAIL,FILE:"file",HIDDEN:"hidden",IMAGE:"image",MONTH:"month",NUMBER:"number",PASSWORD:n.PASSWORD,RADIO:"radio",RANGE:"range",RESET:"reset",SEARCH:"search",SUBMIT:"submit",TEL:"tel",TEXT:"text",TEXTAREA:"textarea",SELECT:"select",TIME:"time",URL:n.URL,WEEK:"week"},p=[c.CHECKBOX,c.RADIO],E={cancel:"cancel",confirm:"confirm",submit:"submit",clear:"clear",back:"back",[r.OperationKeys.CREATE]:r.OperationKeys.CREATE,[r.OperationKeys.READ]:r.OperationKeys.READ,[r.OperationKeys.UPDATE]:r.OperationKeys.UPDATE,[r.OperationKeys.DELETE]:r.OperationKeys.DELETE};class u extends r.InternalError{constructor(e){super(e,u.name)}}const f=e=>"function"==typeof e&&/^class\s/.test(e+"");function h(e,t){return a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES,e,t)}function y(e,r,...a){if(e===n.DATE){if(!r)return"";const e=a.shift()||l;return t.formatDate(new Date(r),e)}return r}function M(e){if("number"==typeof e&&!isNaN(e))return e;const t=Number(e);return isNaN(t)?void 0:t}function R(e){if(!e)return e;const t={"&":"&","<":"<",">":">"};return(""+e).replace(/[&<>]/g,e=>t[e]||e)}function T(e){let r=Date.now();try{t.Model.pk(e.constructor)&&(r=e[t.Model.pk(e.constructor)])}catch(e){}return`${e.constructor.name}-${r}`}class m{static{this.cache={}}constructor(e){this.flavour=e,this.initialized=!1,m.register(this)}translate(e,r=!0){if(r)switch(e){case t.ReservedModels.STRING.name.toLowerCase():return c.TEXT;case t.ReservedModels.NUMBER.name.toLowerCase():case t.ReservedModels.BIGINT.name.toLowerCase():return c.NUMBER;case t.ReservedModels.BOOLEAN.name.toLowerCase():return c.CHECKBOX;case t.ReservedModels.DATE.name.toLowerCase():return c.DATE}else switch(e){case c.SELECT:case c.TEXT:case c.EMAIL:case c.COLOR:case c.PASSWORD:case c.TEL:case c.URL:case c.SEARCH:case c.HIDDEN:case c.TEXTAREA:case c.RADIO:return t.ReservedModels.STRING.name.toLowerCase();case c.NUMBER:return t.ReservedModels.NUMBER.name.toLowerCase();case c.CHECKBOX:return t.ReservedModels.BOOLEAN.name.toLowerCase();case c.DATE:case c.DATETIME_LOCAL:case c.TIME:return t.ReservedModels.DATE.name.toLowerCase()}return e}getClassDecoratorsMetadata(e){return[t.Model.uiModelOf(e.constructor),t.Model.uiListModelOf(e.constructor),t.Model.uiHandlersFor(e.constructor),t.Model.uiLayoutOf(e.constructor)].filter(Boolean)}sortChildrenByOrder(e=[]){return e.sort((r,a)=>{const o=r.props?.order??0,s=a.props?.order??0,i=r=>r===n.FIRST?0:typeof r===t.Primitives.NUMBER?1:r===n.LAST?e.length+e.indexOf(a):1,d=i(o),l=i(s);return d!==l?d-l:1===d&&typeof o===t.Primitives.NUMBER&&typeof s===t.Primitives.NUMBER?o-s:0})}isCustomValidator(e){return!Object.values(t.ValidationKeys).includes(e)&&!Object.values(n).includes(e)}isValidatableByType(e){return Object.keys(i).includes(e)}isValidatableByAttribute(e){return Object.keys(d).includes(e)}toAttributeValue(e,t){if(!Object.keys(d).includes(e))throw Error(`Invalid attribute key "${e}". Expected one of: ${Object.keys(d).join(", ")}.`);return e===n.REQUIRED||t[e]}toFieldDefinition(e,o={},s=!0){const{inheritProps:i,...d}=o;o=d;const p=this.getClassDecoratorsMetadata(e);if(!p.length)throw new u(`No ui definitions set for model ${e.constructor.name}. Did you use @uimodel?`);const E=Object.assign({},...p,i||{}),{tag:f,props:h,item:M,handlers:R}=E,m=t.Model.uiPropertiesOf(e.constructor);let O,g=M?.props||{},L={};const A=(e,t)=>e?[e,t].join("."):t;if(m){const s=a.Metadata.get(e.constructor,t.ValidationKeys.REFLECT)||{};for(const i of m){const d=t.Model.uiDecorationOf(e.constructor,i);let p;try{p=t.Model.uiTypeOf(e.constructor,i)}catch(e){if(!(e instanceof r.NotFoundError))throw e}if(t.Model.uiIsHidden(e.constructor,i)&&!t.Model.uiElementOf(e.constructor,i))throw new u(`@uielement no found in "${i}". It is required to use hiddenOn decorator.`);Object.entries(d).map(([e,t])=>({key:e,props:t})).sort(e=>[n.ELEMENT,n.CHILD].includes(e.key)?-1:1).forEach(r=>{if(!r)throw new u("No decorator found");switch(r.key){case n.PROP:g[i]=r.props;break;case n.CHILD:{const a=r.props?.props?.name||i;try{if(!t.Model.isModel(t.Model.build({},a))&&!t.Model.isPropertyModel(e,a))throw new u(`Child "${a}" must be a model.`)}catch(e){throw new u(`Child "${a}" must be a model.`)}let s;const n=e[i];if("object"!=typeof n||null===n||Array.isArray(n)){const e=r.props.props?.name;s=new(t.Model.get(e))}O=O||[];const d=Object.assign({},o||{},{model:s},{inheritProps:r.props,childOf:A(o?.childOf,i)}),l=this.toFieldDefinition(n||s,d,!1),{inheritProps:c}=d;c&&(l.props=Object.assign({},l.props,c.props||{})),O.push(l);break}case n.UILISTPROP:{L=L||{};const e=r.props;e.name&&(L[e.name]="object"==typeof e?.props&&n.SEQUENCE in e.props?e.props:i);const t=Object.assign({},E.props?.item||{},M?.props||{},e?.props||{},o);g={tag:M?.tag||t.render||"",props:Object.assign({},g?.props,{mapper:L},t)};break}case n.EVENTS:case n.HIDDEN:case n.HIDE_FOR:case n.SHOW_FOR:case n.PAGE:case n.ORDER:case n.UILAYOUTPROP:case n.ELEMENT:{O=O||[];const t=r.props,d=r.key===n.HIDE_FOR?{hideFor:r.props}:r.key===n.SHOW_FOR?{showFor:r.props}:{},p=Object.assign({},g?.props,t.props||{},d,t?.props?.name?{path:A(o?.childOf,t.props.name),childOf:void 0}:{},o,{name:t.props?.name||i});if(r.key===n.ELEMENT){const r={tag:t.tag||g?.tag||f||"",props:p},o=s[i];if(o)for(const e of Object.entries(o).map(([e,t])=>({key:e,props:t})))this.isValidatableByAttribute(e.key)?r.props[this.translate(e.key)]=this.toAttributeValue(e.key,e.props):this.isValidatableByType(e.key)?(e.key===c.DATE&&(r.props[n.FORMAT]=e.props.format||l),r.props[n.TYPE]=e.key):this.isCustomValidator(e.key)&&(p[n.SUB_TYPE]=e.key,e.props?.message&&(p[n.VALIDATION_MESSAGE]=e.props.message));if(!r.props[n.TYPE]){const t=a.Metadata.type(e.constructor,i).name;r.props[n.TYPE]=this.translate(t.toLowerCase(),!0)}r.props.value=y(r.props[n.TYPE],e[i],r.props[n.FORMAT]),O.push(r)}else{const e=O.find(e=>e.props?.name===i||[n.UILAYOUTPROP,n.PAGE,n.EVENTS].includes(r.key)&&(e.props?.childOf===i||e.props?.childOf?.endsWith("."+i)));if(e)if(r.key===n.HIDE_FOR||r.key===n.SHOW_FOR)e.props=Object.assign({},e.props,d);else if(r.key!==n.UILAYOUTPROP)e.props=Object.assign({},e.props,{[r.key]:t});else{const{row:t,col:a,props:o}=r.props;e.props=Object.assign({},o||{},e.props,t,a)}}break}default:throw new u("Invalid key: "+r.key)}})}}o=Object.assign({},h,o,{handlers:R||{}});const D=new Set([...Array.isArray(o?.namespaces)?o.namespaces:[],..."string"==typeof o?.namespace?[o.namespace]:[]].filter(Boolean)),I=o?.operation;O=this.sortChildrenByOrder(O).filter(e=>{const t=e?.props?.hidden||[];if(t.length>0&&t.includes(I))return!1;const r=e?.props?.hideFor||[],a=e?.props?.showFor||[];return!(r.length>0&&[...D].some(e=>r.includes(e))||a.length>0&&![...D].some(e=>a.includes(e)))});const N={tag:f,item:g,props:o,children:O?.length?O:void 0};return s&&(N.rendererId=T(e)),N}static register(e){if(e.flavour in this.cache)throw new r.InternalError(`Rendering engine under ${e.flavour} already exists`);this.cache[e.flavour]=e,this.current=e}static getOrBoot(e){if(e instanceof m)return e;const t=new e;return t.initialize(),t}static get(e){if(!e)return this.getOrBoot(this.current);if(!(e in this.cache))throw new r.InternalError(`Rendering engine under ${e} does not exist`);return this.getOrBoot(this.cache[e])}static render(e,...a){if(!t.Model.get(e.constructor.name)&&!t.Model.fromObject(e))throw new r.InternalError("No model registered found");const o=t.Model.renderedBy(e.constructor);return m.get(o).render(e,...a)}}function O(...e){return(t,r)=>a.propMetadata(h(r,n.HIDDEN),e)(t,r)}function g(...e){return(t,r)=>a.propMetadata(h(r,n.SHOW_FOR),e)(t,r)}function L(e,t){return(r,o)=>{a.propMetadata(h(o,n.EVENTS),{..."object"==typeof e?e:{[e]:t}})(r,o)}}class A extends t.Validator{getMessage(e,...t){return A.translateService?A.translateService.translate(e,...t):super.getMessage(e,...t)}}class D extends o.LoggedClass{constructor(){super(),this.enableDarkMode=!0,this.isDarkMode=!1,this.item={tag:""},this.props={},this.route="",this.borders=!1,this.OperationKeys=r.OperationKeys,this.initialized=!1,this.events={},this.handlers={}}get repository(){return this._repository}set repository(e){this._repository=e}async render(...e){this.log.for(this.render).info(`render for ${this.componentName} with ${JSON.stringify(e)}`)}async refresh(...e){this.log.for(this.refresh).info("Refresh called with args: "+e)}async initialize(...e){this.initialized=!0}async translate(...e){this.log.for(this.translate).info(`translate for ${this.componentName} with ${JSON.stringify(e)}`)}async preview(...e){this.log.for(this.preview).debug("Preview called with args: "+e)}async submit(...e){this.log.for(this.submit).info(`submit for ${this.componentName} with ${JSON.stringify(e)}`)}parseHandlers(e,t){const r={};return Object.entries(e).forEach(([e,a])=>{if(f(a)){const o=new a,s=e in o?o[e]:o.handle;r[e]=s,t.handlers[e]=s}else r[e]=a,t.handlers[e]=a}),r}parseEvents(e,t){const r={};return Object.entries(e).forEach(([e,a])=>{const o=e,s=a();if(f(s)){const a=(new s)[e];a&&(r[o]=a,t.events[o]=a)}else r[o]=a,t.events[o]=a}),r}}class I extends o.LoggedClass{translate(e,t){this.log.for(this.translate).info(`Must translate ${e} with params ${JSON.stringify(t||{})}`)}instant(e,t){this.log.for(this.instant).info(`Must translate ${e} with params ${JSON.stringify(t||{})}`)}}function N(e,t){return(r,o)=>{const s={tag:e||r.name,props:t};return a.metadata(a.Metadata.key(n.REFLECT,n.UIMODEL),s)(r)}}function b(e){return a.apply(a.metadata(a.Metadata.key(n.REFLECT,n.RENDERED_BY),e))}function C(e,t){return(r,o)=>{const s={item:{tag:e||r.name,props:t}};return a.metadata(a.Metadata.key(n.REFLECT,n.UILISTMODEL),s)(r)}}function S(e){return t=>{const r={handlers:e};return a.metadata(a.Metadata.key(n.REFLECT,n.HANDLERS),r)(t)}}function P(t,r=1,o=1,s={}){const i=Object.assign({..."boolean"==typeof r?{flexMode:r,cols:1}:{flexMode:!1,cols:r},rows:o,...Object.assign({breakpoint:e.UIMediaBreakPoints.LARGE},s)});return(e,r)=>(a.metadata(a.Metadata.key(n.REFLECT,n.UILAYOUT),i)(e),N(t,i)(e,r))}function k(e,t=1,r=!1,a={}){let o=[];return"object"==typeof t&&(o=t,t=o.length),N(e,{pages:t,paginated:r,pageTitles:o,props:a})}t.Model.prototype.render=function(...e){return m.render(this,...e)},t.Model.renderedBy=(e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.RENDERED_BY))).bind(t.Model),t.Model.uiPropertiesOf=(e=>{const t=a.Metadata.get(e,a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES));if(t)return Object.keys(t)}).bind(t.Model),t.Model.uiDecorationOf=(e,t,r)=>{const o=a.Metadata.get(e,a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES,t));if(o)return r?o[r]:o},t.Model.uiModelOf=e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.UIMODEL)),t.Model.uiElementOf=(e,t)=>a.Metadata.get(e,h(t,n.ELEMENT)),t.Model.uiListModelOf=e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.UILISTMODEL)),t.Model.uiHandlersFor=e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.HANDLERS)),t.Model.uiLayoutOf=e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.UILAYOUT)),t.Model.uiIsHidden=(e,t)=>!!a.Metadata.get(e,h(t,n.HIDDEN)),t.Model.uiIsHiddenOn=(e,t,r)=>{const o=a.Metadata.get(e,h(t,n.HIDDEN));return!!o&&(r?o.includes(r):o)},t.Model.uiTypeOf=(e,t)=>{const o=a.Metadata.get(e,a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES,t));if(!o)throw new r.NotFoundError(`No metadata found for property '${t}' on model '${e.name}'`);const s=Object.keys(o).filter(e=>[n.PROP,n.ELEMENT,n.CHILD].includes(e));if(0===s.length)throw new r.NotFoundError(`No UI type metadata found for property '${t}' on model '${e.name}'`);if(s.length>1)throw new u("Only one type of decoration is allowed. Please choose between @uiprop, @uichild or @uielement");return o[s[0]]},t.Model.uiListItems=(e=>{const t=a.Metadata.get(e,a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES));if(t)return Object.keys(t)}).bind(t.Model);const U=t.ModelBuilder.prototype;U.decorateClass||(U.decorateClass=function(e){return this._classDecorators||(this._classDecorators=[]),this._classDecorators.push(e),this}),U.uimodel=function(e,t){return this.decorateClass(N(e,t))},U.renderedBy=function(e){return this.decorateClass(b(e))},U.uilistmodel=function(e,t){return this.decorateClass(C(e,t))},U.uihandlers=function(e){return this.decorateClass(S(e))},U.uilayout=function(e,t,r,a){return this.decorateClass(P(e,t,r,a))},U.uisteppedmodel=function(e,t,r,a){return this.decorateClass(k(e,t,r,a))};const w="##VERSION##",v="##PACKAGE##";a.Metadata.registerLibrary(v,w),e.ActionRoles=E,e.COMMIT="b1ab2bc",e.ComponentEventNames={Render:"render",BackButtonClickEvent:"backButtonNavigationEndEvent",Refresh:"RefreshEvent",Click:"ClickEvent",Change:"ChangeEvent",Submit:"SubmitEvent",ValidationError:"validationErrorEvent",ThemeChange:"themeChangeEvent",FormGroupLoaded:"formGroupLoadedEvent"},e.DecafComponent=D,e.DecafEventHandler=class extends D{constructor(){super()}handle(...e){this.log.for(this.handle).info(`component ${this.componentName} handling ${JSON.stringify(e)}`)}handleClick(...e){this.log.for(this.handleClick).info(`component ${this.componentName} handling click ${JSON.stringify(e)}`)}handleAction(...e){this.log.for(this.handleAction).info(`component ${this.componentName} handling action ${JSON.stringify(e)}`)}},e.DecafTranslateService=I,e.ElementPositions={left:"left",center:"center",right:"right",top:"top",bottom:"bottom"},e.ElementSizes={xsmall:"xsmall",small:"small",medium:"medium",default:"default",large:"large",xLarge:"xlarge","2xLarge":"2xlarge",auto:"auto",expand:"expand",block:"block",half:"half",full:"full"},e.FULL_VERSION="0.20.4-b1ab2bc",e.HTML5CheckTypes=p,e.HTML5DateFormat=l,e.HTML5InputTypes=c,e.LayoutGridGaps={small:"small",medium:"medium",large:"large",collapse:"collapse",none:""},e.PACKAGE_NAME=v,e.RenderingEngine=m,e.RenderingError=u,e.TransactionHooks={BeforeRead:"beforeRead",AfterRead:"afterRead",BeforeCreate:"beforeCreate",AfterCreate:"afterCreate",BeforeUpdate:"beforeUpdate",AfterUpdate:"afterUpdate",BeforeDelete:"beforeDelete",AfterDelete:"afterDelete"},e.UIKeys=n,e.UIValidator=A,e.VERSION=w,e.ValidatableByAttribute=d,e.ValidatableByType=i,e.WindowColorSchemes={light:"light",dark:"dark",undefined:"undefined"},e.escapeHtml=R,e.formatByType=y,e.generateUIModelID=T,e.getUIAttributeKey=h,e.hidden=()=>O(r.OperationKeys.CREATE,r.OperationKeys.READ,r.OperationKeys.UPDATE,r.OperationKeys.DELETE),e.hideFor=(...e)=>(t,r)=>a.propMetadata(h(r,n.HIDE_FOR),e)(t,r),e.hideOn=O,e.isClassConstructor=f,e.parseToNumber=M,e.parseValueByType=function e(a,o,s){let n;switch(a){case Array.name:n=(Array.isArray(o)?o.map(r=>e(t.ReservedModels.STRING.name.toLowerCase(),r,s)):[o]).join(",");break;case c.NUMBER:n=M(o);break;case c.DATE:{const e=s.format;o&&(""+o).trim().length&&(n=typeof o===t.ReservedModels.NUMBER.name.toLowerCase()?new Date(o):o?e?t.parseDate(e,o):new Date(o):void 0);break}default:n=typeof o===t.ReservedModels.OBJECT.name.toLowerCase()?Array.isArray(o)?o.join(","):JSON.stringify(o):typeof o===t.ReservedModels.BOOLEAN.name.toLowerCase()?o:typeof o===t.ReservedModels.STRING.name.toLowerCase()?R(o):n}if(void 0===n)throw new r.InternalError(`Failed to parse value of type ${a} from ${typeof o} - ${o}`);return n},e.renderIf=(...e)=>g(...e),e.renderedBy=b,e.revertHtml=e=>{const t={"&":"&","<":"<",">":">"};return(""+e).replace(/<|>|&/g,e=>t[e]||e)},e.showFor=g,e.uichild=(e,t,r={},o=!1,s=!1)=>(i,d)=>{const l={tag:t,serialize:s,props:Object.assign({},r||{},{name:e||d},o?{customTypes:[Array.name],multiple:!0}:{multiple:r?.multiple||!1})};a.propMetadata(h(d,n.CHILD),l)(i,d)},e.uielement=(e,t,r=!1)=>(o,s)=>{"object"==typeof e&&(t=e,e="");const i={tag:e,serialize:r,props:Object.assign({},t||{},{name:s})};return a.propMetadata(h(s,n.ELEMENT),i)(o,s)},e.uihandlers=S,e.uilayout=P,e.uilayoutprop=(e=1,t=1)=>(r,o)=>{const s={name:o,props:Object.assign({},{row:t,col:e})};a.propMetadata(h(o,n.UILAYOUTPROP),s)(r,o)},e.uilistmodel=C,e.uilistprop=(e=void 0,t)=>(r,o)=>{const s={name:e||o,props:t||{}};a.propMetadata(h(o,n.UILISTPROP),s)(r,o)},e.uimodel=N,e.uion=L,e.uionclick=e=>L("handleClick",e),e.uionrender=e=>L("render",e),e.uiorder=(e=n.FIRST)=>(t,r)=>a.propMetadata(h(r,n.ORDER),e)(t,r),e.uipageprop=(e=1)=>(t,r)=>a.propMetadata(h(r,n.PAGE),e)(t,r),e.uiprop=(e=void 0,t=!1)=>(r,o)=>{const s={name:e||o,stringify:t};a.propMetadata(h(o,n.PROP),s)(r,o)},e.uisteppedmodel=k,e.uitablecol=(e=n.LAST,t)=>(r,o)=>{const s={name:o,props:{sequence:e,...t?{valueParserFn:t}:{}}};a.propMetadata(h(o,n.UILISTPROP),s)(r,o)}},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@decaf-ts/decorator-validation"),require("@decaf-ts/db-decorators"),require("@decaf-ts/decoration"),require("@decaf-ts/logging")):"function"==typeof define&&define.amd?define(["exports","@decaf-ts/decorator-validation","@decaf-ts/db-decorators","@decaf-ts/decoration","@decaf-ts/logging"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["ui-decorators"]={},e.decafTsDecoratorValidation,e.decafTsDbDecorators,e.decafTsDecoration,e.decafTsLogging);
|
|
1
|
+
var e,t;e=this,t=function(e,t,r,a,o){"use strict";var s;e.UIMediaBreakPoints=void 0,(s=e.UIMediaBreakPoints||(e.UIMediaBreakPoints={})).SMALL="small",s.MEDIUM="medium",s.LARGE="large",s.XLARGE="xlarge";const n={REFLECT:"ui",UIMODEL:"uimodel",RENDERED_BY:"rendered-by",ELEMENT:"uielement",PROP:"uiprop",CHILD:"uichild",NAME:"name",NAME_PREFIX:"input-",VALIDATION_MESSAGE:"validationMessage",UILISTMODEL:"uilistmodel",UILISTPROP:"uilistprop",UILAYOUT:"uilayout",UILAYOUTPROP:"uilayoutprop",HANDLERS:"handlers",TYPE:"type",SUB_TYPE:"subType",HIDDEN:"hidden",HIDE_FOR:"hide-for",SHOW_FOR:"show-for",RENDER_IF:"render-if",FORMAT:"format",ORDER:"order",PAGE:"page",EVENTS:"events",FIRST:"first",LAST:"last",READ_ONLY:"readonly",SEQUENCE:"sequence",REQUIRED:t.ValidationKeys.REQUIRED,MIN:t.ValidationKeys.MIN,MIN_LENGTH:t.ValidationKeys.MIN_LENGTH,MAX:t.ValidationKeys.MAX,MAX_LENGTH:t.ValidationKeys.MAX_LENGTH,PATTERN:t.ValidationKeys.PATTERN,URL:t.ValidationKeys.URL,STEP:t.ValidationKeys.STEP,DATE:t.ValidationKeys.DATE,EMAIL:t.ValidationKeys.EMAIL,PASSWORD:t.ValidationKeys.PASSWORD,EQUALS:t.ValidationKeys.EQUALS,DIFF:t.ValidationKeys.DIFF,LESS_THAN:t.ValidationKeys.LESS_THAN,LESS_THAN_OR_EQUAL:t.ValidationKeys.LESS_THAN_OR_EQUAL,GREATER_THAN:t.ValidationKeys.GREATER_THAN,GREATER_THAN_OR_EQUAL:t.ValidationKeys.GREATER_THAN_OR_EQUAL},i={[n.EMAIL]:t.EmailValidator,[n.URL]:t.URLValidator,[n.DATE]:t.DateValidator,[n.PASSWORD]:t.PasswordValidator},d={[n.REQUIRED]:t.RequiredValidator,[n.MIN]:t.MinValidator,[n.MAX]:t.MaxValidator,[n.STEP]:t.StepValidator,[n.MIN_LENGTH]:t.MinLengthValidator,[n.MAX_LENGTH]:t.MaxLengthValidator,[n.PATTERN]:t.PatternValidator,[n.EQUALS]:t.EqualsValidator,[n.DIFF]:t.DiffValidator,[n.LESS_THAN]:t.LessThanValidator,[n.LESS_THAN_OR_EQUAL]:t.LessThanOrEqualValidator,[n.GREATER_THAN]:t.GreaterThanValidator,[n.GREATER_THAN_OR_EQUAL]:t.GreaterThanOrEqualValidator},l="yyyy-MM-dd",c={BUTTON:"button",CHECKBOX:"checkbox",COLOR:"color",DATE:n.DATE,DATETIME_LOCAL:"datetime-local",EMAIL:n.EMAIL,FILE:"file",HIDDEN:"hidden",IMAGE:"image",MONTH:"month",NUMBER:"number",PASSWORD:n.PASSWORD,RADIO:"radio",RANGE:"range",RESET:"reset",SEARCH:"search",SUBMIT:"submit",TEL:"tel",TEXT:"text",TEXTAREA:"textarea",SELECT:"select",TIME:"time",URL:n.URL,WEEK:"week"},p=[c.CHECKBOX,c.RADIO],E={cancel:"cancel",confirm:"confirm",submit:"submit",clear:"clear",back:"back",[r.OperationKeys.CREATE]:r.OperationKeys.CREATE,[r.OperationKeys.READ]:r.OperationKeys.READ,[r.OperationKeys.UPDATE]:r.OperationKeys.UPDATE,[r.OperationKeys.DELETE]:r.OperationKeys.DELETE};class u extends r.InternalError{constructor(e){super(e,u.name)}}const f=e=>"function"==typeof e&&/^class\s/.test(e+"");function h(e,t){return a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES,e,t)}function y(e,r,...a){if(e===n.DATE){if(!r)return"";const e=a.shift()||l;return t.formatDate(new Date(r),e)}return r}function M(e){if("number"==typeof e&&!isNaN(e))return e;const t=Number(e);return isNaN(t)?void 0:t}function R(e){if(!e)return e;const t={"&":"&","<":"<",">":">"};return(""+e).replace(/[&<>]/g,e=>t[e]||e)}function T(e){let r=Date.now();try{t.Model.pk(e.constructor)&&(r=e[t.Model.pk(e.constructor)])}catch(e){}return`${e.constructor.name}-${r}`}class m{static{this.cache={}}constructor(e){this.flavour=e,this.initialized=!1,m.register(this)}translate(e,r=!0){if(r)switch(e){case t.ReservedModels.STRING.name.toLowerCase():return c.TEXT;case t.ReservedModels.NUMBER.name.toLowerCase():case t.ReservedModels.BIGINT.name.toLowerCase():return c.NUMBER;case t.ReservedModels.BOOLEAN.name.toLowerCase():return c.CHECKBOX;case t.ReservedModels.DATE.name.toLowerCase():return c.DATE}else switch(e){case c.SELECT:case c.TEXT:case c.EMAIL:case c.COLOR:case c.PASSWORD:case c.TEL:case c.URL:case c.SEARCH:case c.HIDDEN:case c.TEXTAREA:case c.RADIO:return t.ReservedModels.STRING.name.toLowerCase();case c.NUMBER:return t.ReservedModels.NUMBER.name.toLowerCase();case c.CHECKBOX:return t.ReservedModels.BOOLEAN.name.toLowerCase();case c.DATE:case c.DATETIME_LOCAL:case c.TIME:return t.ReservedModels.DATE.name.toLowerCase()}return e}getClassDecoratorsMetadata(e){return[t.Model.uiModelOf(e.constructor),t.Model.uiListModelOf(e.constructor),t.Model.uiHandlersFor(e.constructor),t.Model.uiLayoutOf(e.constructor)].filter(Boolean)}sortChildrenByOrder(e=[]){return e.sort((r,a)=>{const o=r.props?.order??0,s=a.props?.order??0,i=r=>r===n.FIRST?0:typeof r===t.Primitives.NUMBER?1:r===n.LAST?e.length+e.indexOf(a):1,d=i(o),l=i(s);return d!==l?d-l:1===d&&typeof o===t.Primitives.NUMBER&&typeof s===t.Primitives.NUMBER?o-s:0})}isCustomValidator(e){return!Object.values(t.ValidationKeys).includes(e)&&!Object.values(n).includes(e)}isValidatableByType(e){return Object.keys(i).includes(e)}isValidatableByAttribute(e){return Object.keys(d).includes(e)}toAttributeValue(e,t){if(!Object.keys(d).includes(e))throw Error(`Invalid attribute key "${e}". Expected one of: ${Object.keys(d).join(", ")}.`);return e===n.REQUIRED||t[e]}toFieldDefinition(e,o={},s=!0){const{inheritProps:i,...d}=o;o=d;const p=this.getClassDecoratorsMetadata(e);if(!p.length)throw new u(`No ui definitions set for model ${e.constructor.name}. Did you use @uimodel?`);const E=Object.assign({},...p,i||{}),{tag:f,props:h,item:M,handlers:R}=E,m=t.Model.uiPropertiesOf(e.constructor);let O,g=M?.props||{},L={};const A=(e,t)=>e?[e,t].join("."):t;if(m){const s=a.Metadata.get(e.constructor,t.ValidationKeys.REFLECT)||{};for(const i of m){const d=t.Model.uiDecorationOf(e.constructor,i);let p;try{p=t.Model.uiTypeOf(e.constructor,i)}catch(e){if(!(e instanceof r.NotFoundError))throw e}if(t.Model.uiIsHidden(e.constructor,i)&&!t.Model.uiElementOf(e.constructor,i))throw new u(`@uielement no found in "${i}". It is required to use hiddenOn decorator.`);Object.entries(d).map(([e,t])=>({key:e,props:t})).sort(e=>[n.ELEMENT,n.CHILD].includes(e.key)?-1:1).forEach(r=>{if(!r)throw new u("No decorator found");switch(r.key){case n.PROP:g[i]=r.props;break;case n.CHILD:{const a=r.props?.props?.name||i;try{if(!t.Model.isModel(t.Model.build({},a))&&!t.Model.isPropertyModel(e,a))throw new u(`Child "${a}" must be a model.`)}catch(e){throw new u(`Child "${a}" must be a model.`)}let s;const n=e[i];if("object"!=typeof n||null===n||Array.isArray(n)){const e=r.props.props?.name;s=new(t.Model.get(e))}O=O||[];const d=Object.assign({},o||{},{model:s},{inheritProps:r.props,childOf:A(o?.childOf,i)}),l=this.toFieldDefinition(n||s,d,!1),{inheritProps:c}=d;c&&(l.props=Object.assign({},l.props,c.props||{})),O.push(l);break}case n.UILISTPROP:{L=L||{};const e=r.props;e.name&&(L[e.name]="object"==typeof e?.props&&n.SEQUENCE in e.props?e.props:i);const t=Object.assign({},E.props?.item||{},M?.props||{},e?.props||{},o);g={tag:M?.tag||t.render||"",props:Object.assign({},g?.props,{mapper:L},t)};break}case n.EVENTS:case n.HIDDEN:case n.HIDE_FOR:case n.SHOW_FOR:case n.PAGE:case n.ORDER:case n.UILAYOUTPROP:case n.ELEMENT:{O=O||[];const t=r.props,d=r.key===n.HIDE_FOR?{hideFor:r.props}:r.key===n.SHOW_FOR?{showFor:r.props}:{},p=Object.assign({},g?.props,t.props||{},d,t?.props?.name?{path:A(o?.childOf,t.props.name),childOf:void 0}:{},o,{name:t.props?.name||i});if(r.key===n.ELEMENT){const r={tag:t.tag||g?.tag||f||"",props:p},o=s[i];if(o)for(const e of Object.entries(o).map(([e,t])=>({key:e,props:t})))this.isValidatableByAttribute(e.key)?r.props[this.translate(e.key)]=this.toAttributeValue(e.key,e.props):this.isValidatableByType(e.key)?(e.key===c.DATE&&(r.props[n.FORMAT]=e.props.format||l),r.props[n.TYPE]=e.key):this.isCustomValidator(e.key)&&(p[n.SUB_TYPE]=e.key,e.props?.message&&(p[n.VALIDATION_MESSAGE]=e.props.message));if(!r.props[n.TYPE]){const t=a.Metadata.type(e.constructor,i).name;r.props[n.TYPE]=this.translate(t.toLowerCase(),!0)}r.props.value=y(r.props[n.TYPE],e[i],r.props[n.FORMAT]),O.push(r)}else{const e=O.find(e=>e.props?.name===i||[n.UILAYOUTPROP,n.PAGE,n.EVENTS].includes(r.key)&&(e.props?.childOf===i||e.props?.childOf?.endsWith("."+i)));if(e)if(r.key===n.HIDE_FOR||r.key===n.SHOW_FOR)e.props=Object.assign({},e.props,d);else if(r.key!==n.UILAYOUTPROP)e.props=Object.assign({},e.props,{[r.key]:t});else{const{row:t,col:a,props:o}=r.props;e.props=Object.assign({},o||{},e.props,t,a)}}break}default:throw new u("Invalid key: "+r.key)}})}}o=Object.assign({},h,o,{handlers:R||{}});const D=new Set([...Array.isArray(o?.namespaces)?o.namespaces:[],..."string"==typeof o?.namespace?[o.namespace]:[]].filter(Boolean)),I=o?.operation;O=this.sortChildrenByOrder(O).filter(e=>{const t=e?.props?.hidden||[];if(t.length>0&&t.includes(I))return!1;const r=e?.props?.hideFor||[],a=e?.props?.showFor||[];return!(r.length>0&&[...D].some(e=>r.includes(e))||a.length>0&&![...D].some(e=>a.includes(e)))});const N={tag:f,item:g,props:o,children:O?.length?O:void 0};return s&&(N.rendererId=T(e)),N}static register(e){if(e.flavour in this.cache)throw new r.InternalError(`Rendering engine under ${e.flavour} already exists`);this.cache[e.flavour]=e,this.current=e}static getOrBoot(e){if(e instanceof m)return e;const t=new e;return t.initialize(),t}static get(e){if(!e)return this.getOrBoot(this.current);if(!(e in this.cache))throw new r.InternalError(`Rendering engine under ${e} does not exist`);return this.getOrBoot(this.cache[e])}static render(e,...a){if(!t.Model.get(e.constructor.name)&&!t.Model.fromObject(e))throw new r.InternalError("No model registered found");const o=t.Model.renderedBy(e.constructor);return m.get(o).render(e,...a)}}function O(...e){return(t,r)=>a.propMetadata(h(r,n.HIDDEN),e)(t,r)}function g(...e){return(t,r)=>a.propMetadata(h(r,n.SHOW_FOR),e)(t,r)}function L(e,t){return(r,o)=>{a.propMetadata(h(o,n.EVENTS),{..."object"==typeof e?e:{[e]:t}})(r,o)}}class A extends t.Validator{getMessage(e,...t){return A.translateService?A.translateService.translate(e,...t):super.getMessage(e,...t)}}class D extends o.LoggedClass{constructor(){super(),this.enableDarkMode=!0,this.isDarkMode=!1,this.item={tag:""},this.props={},this.route="",this.borders=!1,this.OperationKeys=r.OperationKeys,this.initialized=!1,this.events={},this.handlers={}}get repository(){return this._repository}set repository(e){this._repository=e}async render(...e){this.log.for(this.render).info(`render for ${this.componentName} with ${JSON.stringify(e)}`)}async refresh(...e){this.log.for(this.refresh).info("Refresh called with args: "+e)}async initialize(...e){this.initialized=!0}async translate(...e){this.log.for(this.translate).info(`translate for ${this.componentName} with ${JSON.stringify(e)}`)}async preview(...e){this.log.for(this.preview).debug("Preview called with args: "+e)}async submit(...e){this.log.for(this.submit).info(`submit for ${this.componentName} with ${JSON.stringify(e)}`)}parseHandlers(e,t){const r={};return Object.entries(e).forEach(([e,a])=>{if(f(a)){const o=new a,s=e in o?o[e]:o.handle;r[e]=s,t.handlers[e]=s}else r[e]=a,t.handlers[e]=a}),r}parseEvents(e,t){const r={};return Object.entries(e).forEach(([e,a])=>{const o=e,s=a();if(f(s)){const a=(new s)[e];a&&(r[o]=a,t.events[o]=a)}else r[o]=a,t.events[o]=a}),r}}class I extends o.LoggedClass{translate(e,t){this.log.for(this.translate).info(`Must translate ${e} with params ${JSON.stringify(t||{})}`)}instant(e,t){this.log.for(this.instant).info(`Must translate ${e} with params ${JSON.stringify(t||{})}`)}}function N(e,t){return(r,o)=>{const s={tag:e||r.name,props:t};return a.metadata(a.Metadata.key(n.REFLECT,n.UIMODEL),s)(r)}}function b(e){return a.apply(a.metadata(a.Metadata.key(n.REFLECT,n.RENDERED_BY),e))}function C(e,t){return(r,o)=>{const s={item:{tag:e||r.name,props:t}};return a.metadata(a.Metadata.key(n.REFLECT,n.UILISTMODEL),s)(r)}}function S(e){return t=>{const r={handlers:e};return a.metadata(a.Metadata.key(n.REFLECT,n.HANDLERS),r)(t)}}function P(t,r=1,o=1,s={}){const i=Object.assign({..."boolean"==typeof r?{flexMode:r,cols:1}:{flexMode:!1,cols:r},rows:o,...Object.assign({breakpoint:e.UIMediaBreakPoints.LARGE},s)});return(e,r)=>(a.metadata(a.Metadata.key(n.REFLECT,n.UILAYOUT),i)(e),N(t,i)(e,r))}function k(e,t=1,r=!1,a={}){let o=[];return"object"==typeof t&&(o=t,t=o.length),N(e,{pages:t,paginated:r,pageTitles:o,props:a})}t.Model.prototype.render=function(...e){return m.render(this,...e)},t.Model.renderedBy=(e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.RENDERED_BY))).bind(t.Model),t.Model.uiPropertiesOf=(e=>{const t=a.Metadata.get(e,a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES));if(t)return Object.keys(t)}).bind(t.Model),t.Model.uiDecorationOf=(e,t,r)=>{const o=a.Metadata.get(e,a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES,t));if(o)return r?o[r]:o},t.Model.uiModelOf=e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.UIMODEL)),t.Model.uiElementOf=(e,t)=>a.Metadata.get(e,h(t,n.ELEMENT)),t.Model.uiListModelOf=e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.UILISTMODEL)),t.Model.uiHandlersFor=e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.HANDLERS)),t.Model.uiLayoutOf=e=>a.Metadata.get(e,a.Metadata.key(n.REFLECT,n.UILAYOUT)),t.Model.uiIsHidden=(e,t)=>!!a.Metadata.get(e,h(t,n.HIDDEN)),t.Model.uiIsHiddenOn=(e,t,r)=>{const o=a.Metadata.get(e,h(t,n.HIDDEN));return!!o&&(r?o.includes(r):o)},t.Model.uiTypeOf=(e,t)=>{const o=a.Metadata.get(e,a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES,t));if(!o)throw new r.NotFoundError(`No metadata found for property '${t}' on model '${e.name}'`);const s=Object.keys(o).filter(e=>[n.PROP,n.ELEMENT,n.CHILD].includes(e));if(0===s.length)throw new r.NotFoundError(`No UI type metadata found for property '${t}' on model '${e.name}'`);if(s.length>1)throw new u("Only one type of decoration is allowed. Please choose between @uiprop, @uichild or @uielement");return o[s[0]]},t.Model.uiListItems=(e=>{const t=a.Metadata.get(e,a.Metadata.key(n.REFLECT,a.DecorationKeys.PROPERTIES));if(t)return Object.keys(t)}).bind(t.Model);const U=t.ModelBuilder.prototype;U.decorateClass||(U.decorateClass=function(e){return this._classDecorators||(this._classDecorators=[]),this._classDecorators.push(e),this}),U.uimodel=function(e,t){return this.decorateClass(N(e,t))},U.renderedBy=function(e){return this.decorateClass(b(e))},U.uilistmodel=function(e,t){return this.decorateClass(C(e,t))},U.uihandlers=function(e){return this.decorateClass(S(e))},U.uilayout=function(e,t,r,a){return this.decorateClass(P(e,t,r,a))},U.uisteppedmodel=function(e,t,r,a){return this.decorateClass(k(e,t,r,a))};const w="##VERSION##",v="##PACKAGE##";a.Metadata.registerLibrary(v,w),e.ActionRoles=E,e.COMMIT="4e03aa0",e.ComponentEventNames={Render:"render",BackButtonClickEvent:"backButtonNavigationEndEvent",Refresh:"RefreshEvent",Click:"ClickEvent",Change:"ChangeEvent",Submit:"SubmitEvent",ValidationError:"validationErrorEvent",ThemeChange:"themeChangeEvent",FormGroupLoaded:"formGroupLoadedEvent"},e.DecafComponent=D,e.DecafEventHandler=class extends D{constructor(){super()}handle(...e){this.log.for(this.handle).info(`component ${this.componentName} handling ${JSON.stringify(e)}`)}handleClick(...e){this.log.for(this.handleClick).info(`component ${this.componentName} handling click ${JSON.stringify(e)}`)}handleAction(...e){this.log.for(this.handleAction).info(`component ${this.componentName} handling action ${JSON.stringify(e)}`)}},e.DecafTranslateService=I,e.ElementPositions={left:"left",center:"center",right:"right",top:"top",bottom:"bottom"},e.ElementSizes={xsmall:"xsmall",small:"small",medium:"medium",default:"default",large:"large",xLarge:"xlarge","2xLarge":"2xlarge",auto:"auto",expand:"expand",block:"block",half:"half",full:"full"},e.FULL_VERSION="0.20.5-4e03aa0",e.HTML5CheckTypes=p,e.HTML5DateFormat=l,e.HTML5InputTypes=c,e.LayoutGridGaps={small:"small",medium:"medium",large:"large",collapse:"collapse",none:""},e.PACKAGE_NAME=v,e.RenderingEngine=m,e.RenderingError=u,e.TransactionHooks={BeforeRead:"beforeRead",AfterRead:"afterRead",BeforeCreate:"beforeCreate",AfterCreate:"afterCreate",BeforeUpdate:"beforeUpdate",AfterUpdate:"afterUpdate",BeforeDelete:"beforeDelete",AfterDelete:"afterDelete"},e.UIKeys=n,e.UIValidator=A,e.VERSION=w,e.ValidatableByAttribute=d,e.ValidatableByType=i,e.WindowColorSchemes={light:"light",dark:"dark",undefined:"undefined"},e.escapeHtml=R,e.formatByType=y,e.generateUIModelID=T,e.getUIAttributeKey=h,e.hidden=()=>O(r.OperationKeys.CREATE,r.OperationKeys.READ,r.OperationKeys.UPDATE,r.OperationKeys.DELETE),e.hideFor=(...e)=>(t,r)=>a.propMetadata(h(r,n.HIDE_FOR),e)(t,r),e.hideOn=O,e.isClassConstructor=f,e.parseToNumber=M,e.parseValueByType=function e(a,o,s){let n;switch(a){case Array.name:n=(Array.isArray(o)?o.map(r=>e(t.ReservedModels.STRING.name.toLowerCase(),r,s)):[o]).join(",");break;case c.NUMBER:n=M(o);break;case c.DATE:{const e=s.format;o&&(""+o).trim().length&&(n=typeof o===t.ReservedModels.NUMBER.name.toLowerCase()?new Date(o):o?e?t.parseDate(e,o):new Date(o):void 0);break}default:n=typeof o===t.ReservedModels.OBJECT.name.toLowerCase()?Array.isArray(o)?o.join(","):JSON.stringify(o):typeof o===t.ReservedModels.BOOLEAN.name.toLowerCase()?o:typeof o===t.ReservedModels.STRING.name.toLowerCase()?R(o):n}if(void 0===n)throw new r.InternalError(`Failed to parse value of type ${a} from ${typeof o} - ${o}`);return n},e.renderIf=(...e)=>g(...e),e.renderedBy=b,e.revertHtml=e=>{const t={"&":"&","<":"<",">":">"};return(""+e).replace(/<|>|&/g,e=>t[e]||e)},e.showFor=g,e.uichild=(e,t,r={},o=!1,s=!1)=>(i,d)=>{const l={tag:t,serialize:s,props:Object.assign({},r||{},{name:e||d},o?{customTypes:[Array.name],multiple:!0}:{multiple:r?.multiple||!1})};a.propMetadata(h(d,n.CHILD),l)(i,d)},e.uielement=(e,t,r=!1)=>(o,s)=>{"object"==typeof e&&(t=e,e="");const i={tag:e,serialize:r,props:Object.assign({},t||{},{name:s})};return a.propMetadata(h(s,n.ELEMENT),i)(o,s)},e.uihandlers=S,e.uilayout=P,e.uilayoutprop=(e=1,t=1)=>(r,o)=>{const s={name:o,props:Object.assign({},{row:t,col:e})};a.propMetadata(h(o,n.UILAYOUTPROP),s)(r,o)},e.uilistmodel=C,e.uilistprop=(e=void 0,t)=>(r,o)=>{const s={name:e||o,props:t||{}};a.propMetadata(h(o,n.UILISTPROP),s)(r,o)},e.uimodel=N,e.uion=L,e.uionclick=e=>L("handleClick",e),e.uionrender=e=>L("render",e),e.uiorder=(e=n.FIRST)=>(t,r)=>a.propMetadata(h(r,n.ORDER),e)(t,r),e.uipageprop=(e=1)=>(t,r)=>a.propMetadata(h(r,n.PAGE),e)(t,r),e.uiprop=(e=void 0,t=!1)=>(r,o)=>{const s={name:e||o,stringify:t};a.propMetadata(h(o,n.PROP),s)(r,o)},e.uisteppedmodel=k,e.uitablecol=(e=n.LAST,t)=>(r,o)=>{const s={name:o,props:{sequence:e,...t?{valueParserFn:t}:{}}};a.propMetadata(h(o,n.UILISTPROP),s)(r,o)}},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@decaf-ts/decorator-validation"),require("@decaf-ts/db-decorators"),require("@decaf-ts/decoration"),require("@decaf-ts/logging")):"function"==typeof define&&define.amd?define(["exports","@decaf-ts/decorator-validation","@decaf-ts/db-decorators","@decaf-ts/decoration","@decaf-ts/logging"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["ui-decorators"]={},e.decafTsDecoratorValidation,e.decafTsDbDecorators,e.decafTsDecoration,e.decafTsLogging);
|
|
2
2
|
//# sourceMappingURL=ui-decorators.cjs.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapExecutionStatus = mapExecutionStatus;
|
|
4
|
+
exports.deriveNodeVisualState = deriveNodeVisualState;
|
|
5
|
+
exports.visualStateOfEvent = visualStateOfEvent;
|
|
6
|
+
const constants_js_1 = require("./constants.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Maps an engine execution `GraphExecutionStatus` to the shared visual
|
|
9
|
+
* state. `CACHED` collapses onto `GraphVisualState.SUCCEEDED` for
|
|
10
|
+
* rendering; `CANCELLED`/`PENDING`/`PLANNING` yield `IDLE`.
|
|
11
|
+
*
|
|
12
|
+
* @param status - The engine execution status, if any.
|
|
13
|
+
* @returns The visual state for the node/edge.
|
|
14
|
+
*/
|
|
15
|
+
function mapExecutionStatus(status) {
|
|
16
|
+
switch (status) {
|
|
17
|
+
case constants_js_1.GraphExecutionStatus.RUNNING:
|
|
18
|
+
return constants_js_1.GraphVisualState.RUNNING;
|
|
19
|
+
case constants_js_1.GraphExecutionStatus.SUCCEEDED:
|
|
20
|
+
case constants_js_1.GraphExecutionStatus.CACHED:
|
|
21
|
+
return constants_js_1.GraphVisualState.SUCCEEDED;
|
|
22
|
+
case constants_js_1.GraphExecutionStatus.FAILED:
|
|
23
|
+
return constants_js_1.GraphVisualState.FAILED;
|
|
24
|
+
case constants_js_1.GraphExecutionStatus.SKIPPED:
|
|
25
|
+
return constants_js_1.GraphVisualState.SKIPPED;
|
|
26
|
+
case constants_js_1.GraphExecutionStatus.PENDING:
|
|
27
|
+
case constants_js_1.GraphExecutionStatus.PLANNING:
|
|
28
|
+
case constants_js_1.GraphExecutionStatus.CANCELLED:
|
|
29
|
+
default:
|
|
30
|
+
return constants_js_1.GraphVisualState.IDLE;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Derives the visual state for one node from its execution signals.
|
|
35
|
+
*
|
|
36
|
+
* Rules (DECAF-48 §4.4 / Req-5/Req-6):
|
|
37
|
+
* - currently running → `GraphVisualState.RUNNING`
|
|
38
|
+
* - failed → `GraphVisualState.FAILED`
|
|
39
|
+
* - executed and succeeded (or from cache) → `GraphVisualState.SUCCEEDED`
|
|
40
|
+
* - unexecuted and reachable with incomplete upstream deps → `GraphVisualState.BLOCKED`
|
|
41
|
+
* - unexecuted with `runFailed` → `GraphVisualState.SKIPPED` (faded/disabled)
|
|
42
|
+
* - otherwise → `GraphVisualState.IDLE`
|
|
43
|
+
*
|
|
44
|
+
* @param options - The node execution signals.
|
|
45
|
+
* @returns The derived visual state.
|
|
46
|
+
*/
|
|
47
|
+
function deriveNodeVisualState(options) {
|
|
48
|
+
if (options.running)
|
|
49
|
+
return constants_js_1.GraphVisualState.RUNNING;
|
|
50
|
+
if (options.failed)
|
|
51
|
+
return constants_js_1.GraphVisualState.FAILED;
|
|
52
|
+
if (options.executed && options.succeeded !== false) {
|
|
53
|
+
return options.succeeded
|
|
54
|
+
? constants_js_1.GraphVisualState.SUCCEEDED
|
|
55
|
+
: constants_js_1.GraphVisualState.FAILED;
|
|
56
|
+
}
|
|
57
|
+
const upstream = options.upstreamCount ?? 0;
|
|
58
|
+
const completed = options.completedUpstreams ?? 0;
|
|
59
|
+
if (upstream > 0 && completed < upstream)
|
|
60
|
+
return constants_js_1.GraphVisualState.BLOCKED;
|
|
61
|
+
if (options.runFailed)
|
|
62
|
+
return constants_js_1.GraphVisualState.SKIPPED;
|
|
63
|
+
return constants_js_1.GraphVisualState.IDLE;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Translates a `GraphExecutionEvent` into a node visual state when the
|
|
67
|
+
* event carries enough information. Used by contract conformance checks and
|
|
68
|
+
* engine-agnostic consumers that derive state from the shared event stream.
|
|
69
|
+
*
|
|
70
|
+
* @param event - The graph execution event.
|
|
71
|
+
* @returns The corresponding `GraphVisualState`, or `IDLE` when the
|
|
72
|
+
* event does not indicate a specific visual transition.
|
|
73
|
+
*/
|
|
74
|
+
function visualStateOfEvent(event) {
|
|
75
|
+
if (event.status)
|
|
76
|
+
return mapExecutionStatus(event.status);
|
|
77
|
+
const payloadState = event.payload
|
|
78
|
+
?.state;
|
|
79
|
+
if (payloadState)
|
|
80
|
+
return payloadState;
|
|
81
|
+
switch (event.type) {
|
|
82
|
+
case constants_js_1.GraphExecutionEventType.NODE_STARTED:
|
|
83
|
+
case constants_js_1.GraphExecutionEventType.EDGE_STATE_CHANGED:
|
|
84
|
+
case constants_js_1.GraphExecutionEventType.NODE_STATE_CHANGED:
|
|
85
|
+
return constants_js_1.GraphVisualState.RUNNING;
|
|
86
|
+
case constants_js_1.GraphExecutionEventType.NODE_COMPLETED:
|
|
87
|
+
return constants_js_1.GraphVisualState.SUCCEEDED;
|
|
88
|
+
case constants_js_1.GraphExecutionEventType.NODE_FAILED:
|
|
89
|
+
return constants_js_1.GraphVisualState.FAILED;
|
|
90
|
+
case constants_js_1.GraphExecutionEventType.NODE_SKIPPED:
|
|
91
|
+
return constants_js_1.GraphVisualState.SKIPPED;
|
|
92
|
+
default:
|
|
93
|
+
return constants_js_1.GraphVisualState.IDLE;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=GraphExecutionStateMapper.js.map
|
|
97
|
+
//# sourceMappingURL=GraphExecutionStateMapper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph/GraphExecutionStateMapper.cjs","sourceRoot":"","sources":["graph/GraphExecutionStateMapper.js"],"names":[],"mappings":";;AASA,gDAiBC;AAeD,sDAiBC;AAUD,gDAqBC;AAzFD,iDAAkG;AAClG;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAC,MAAM;IACrC,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,mCAAoB,CAAC,OAAO;YAC7B,OAAO,+BAAgB,CAAC,OAAO,CAAC;QACpC,KAAK,mCAAoB,CAAC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ACZ,OAAO,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO;QAC9B,EAAE,KAAK,CAAC;IACZ,IAAI,YAAY;QACZ,OAAO,YAAY,CAAC;IACxB,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,sCAAuB,CAAC,YAAY,CAAC;QAC1C,KAAK,sCAAuB,CAAC,kBAAkB,CAAC;QAChD,KAAK,sCAAuB,CAAC,kBAAkB;YAC3C,OAAO,+BAAgB,CAAC,OAAO,CAAC;QACpC,KAAK,sCAAuB,CAAC,cAAc;YACvC,OAAO,+BAAgB,CAAC,SAAS,CAAC;QACtC,KAAK,sCAAuB,CAAC,WAAW;YACpC,OAAO,+BAAgB,CAAC,MAAM,CAAC;QACnC,KAAK,sCAAuB,CAAC,YAAY;YACrC,OAAO,+BAAgB,CAAC,OAAO,CAAC;QACpC;YACI,OAAO,+BAAgB,CAAC,IAAI,CAAC;IACrC,CAAC;AACL,CAAC;AACD,qDAAqD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isGraphResolvedNodeManifest = isGraphResolvedNodeManifest;
|
|
4
|
+
/** Structural type guard for `GraphResolvedNodeManifest`. */
|
|
5
|
+
function isGraphResolvedNodeManifest(value) {
|
|
6
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
7
|
+
return false;
|
|
8
|
+
const record = value;
|
|
9
|
+
return (typeof record["kind"] === "string" &&
|
|
10
|
+
typeof record["display"] === "object" &&
|
|
11
|
+
record["display"] !== null &&
|
|
12
|
+
Array.isArray(record["inputs"]) &&
|
|
13
|
+
Array.isArray(record["outputs"]) &&
|
|
14
|
+
Array.isArray(record["parameters"]));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=GraphResolution.js.map
|
|
17
|
+
//# sourceMappingURL=GraphResolution.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph/GraphResolution.cjs","sourceRoot":"","sources":["graph/GraphResolution.js"],"names":[],"mappings":";;AACA,kEAUC;AAXD,6DAA6D;AAC7D,SAAgB,2BAA2B,CAAC,KAAK;IAC7C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAC3D,OAAO,KAAK,CAAC;IACjB,MAAM,MAAM,GAAG,KAAK,CAAC;IACrB,OAAO,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,QAAQ;QACtC,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,QAAQ;QACrC,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI;QAC1B,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/B,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAChC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AACD,2CAA2C"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GRAPH_DEFAULT_CATEGORY_STYLE = exports.GRAPH_VISUAL_STATE_STYLES = exports.PortDirection = exports.GraphKeys = void 0;
|
|
3
|
+
exports.GRAPH_RUN_TERMINAL_EVENT_TYPES = exports.DEFAULT_GRAPH_RUN_LIMITS = exports.GraphExecutionEventType = exports.GraphLogAttribute = exports.GRAPH_RUN_STATE_TOPIC = exports.GRAPH_RUN_LOG_TOPIC = exports.GRAPH_RUN_TOPIC = exports.GraphVisualState = exports.GraphExecutionStatus = exports.GRAPH_DEFAULT_DISABLED_NODE_BEHAVIOR = exports.GRAPH_DISABLED_NODE_BEHAVIORS = exports.GRAPH_DEFAULT_CATEGORY_STYLE = exports.GRAPH_VISUAL_STATE_STYLES = exports.PortDirection = exports.GraphKeys = void 0;
|
|
4
4
|
exports.graphVisualStyleOf = graphVisualStyleOf;
|
|
5
5
|
exports.registerGraphCategoryStyle = registerGraphCategoryStyle;
|
|
6
6
|
exports.graphCategoryStyleOf = graphCategoryStyleOf;
|
|
7
7
|
exports.resolveEffectiveColor = resolveEffectiveColor;
|
|
8
8
|
exports.resolveEffectiveIcon = resolveEffectiveIcon;
|
|
9
|
+
exports.isGraphDisabledNodeBehavior = isGraphDisabledNodeBehavior;
|
|
10
|
+
exports.graphRunTopicOf = graphRunTopicOf;
|
|
11
|
+
exports.isGraphRunTerminalEventType = isGraphRunTerminalEventType;
|
|
12
|
+
exports.isGraphRunTerminalStatus = isGraphRunTerminalStatus;
|
|
13
|
+
exports.isGraphRunStatus = isGraphRunStatus;
|
|
9
14
|
(function (GraphKeys) {
|
|
10
15
|
GraphKeys["GRAPH"] = "graph";
|
|
11
16
|
GraphKeys["NODE"] = "graph.node";
|
|
@@ -95,5 +100,156 @@ function resolveEffectiveIcon(explicitIcon, category) {
|
|
|
95
100
|
return explicitIcon;
|
|
96
101
|
return graphCategoryStyleOf(category).icon ?? exports.GRAPH_DEFAULT_CATEGORY_STYLE.icon;
|
|
97
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Disabled-node execution semantics (DECAF-50 §4.9).
|
|
105
|
+
*
|
|
106
|
+
* - `skip` — the node does not execute and produces no outputs.
|
|
107
|
+
* - `passThroughFirstInput` — the first incoming edge value is forwarded on
|
|
108
|
+
* the node's first declared output port.
|
|
109
|
+
* - `emitDefaults` — every declared output port is emitted with its default
|
|
110
|
+
* (absent a declared default, `undefined`).
|
|
111
|
+
*/
|
|
112
|
+
exports.GRAPH_DISABLED_NODE_BEHAVIORS = [
|
|
113
|
+
"skip",
|
|
114
|
+
"passThroughFirstInput",
|
|
115
|
+
"emitDefaults",
|
|
116
|
+
];
|
|
117
|
+
/** The disabled-node behavior applied when a node declares none. */
|
|
118
|
+
exports.GRAPH_DEFAULT_DISABLED_NODE_BEHAVIOR = "skip";
|
|
119
|
+
/** Type guard for {@link GraphDisabledNodeBehavior}. */
|
|
120
|
+
function isGraphDisabledNodeBehavior(value) {
|
|
121
|
+
return exports.GRAPH_DISABLED_NODE_BEHAVIORS.includes(value);
|
|
122
|
+
}
|
|
123
|
+
(function (GraphExecutionStatus) {
|
|
124
|
+
GraphExecutionStatus["PENDING"] = "pending";
|
|
125
|
+
GraphExecutionStatus["PLANNING"] = "planning";
|
|
126
|
+
GraphExecutionStatus["RUNNING"] = "running";
|
|
127
|
+
GraphExecutionStatus["SUCCEEDED"] = "succeeded";
|
|
128
|
+
GraphExecutionStatus["FAILED"] = "failed";
|
|
129
|
+
GraphExecutionStatus["SKIPPED"] = "skipped";
|
|
130
|
+
GraphExecutionStatus["CANCELLED"] = "cancelled";
|
|
131
|
+
GraphExecutionStatus["CACHED"] = "cached";
|
|
132
|
+
})(exports.GraphExecutionStatus || (exports.GraphExecutionStatus = {}));
|
|
133
|
+
(function (GraphVisualState) {
|
|
134
|
+
GraphVisualState["IDLE"] = "idle";
|
|
135
|
+
GraphVisualState["RUNNING"] = "running";
|
|
136
|
+
GraphVisualState["BLOCKED"] = "blocked";
|
|
137
|
+
GraphVisualState["SUCCEEDED"] = "succeeded";
|
|
138
|
+
GraphVisualState["FAILED"] = "failed";
|
|
139
|
+
GraphVisualState["SKIPPED"] = "skipped";
|
|
140
|
+
})(exports.GraphVisualState || (exports.GraphVisualState = {}));
|
|
141
|
+
/**
|
|
142
|
+
* Namespace root for graph run SSE topics (DECAF-48 §4.2). A subscription
|
|
143
|
+
* filters on these granular topics before `observer.next(...)`.
|
|
144
|
+
*/
|
|
145
|
+
exports.GRAPH_RUN_TOPIC = "graph.run";
|
|
146
|
+
/**
|
|
147
|
+
* SSE sub-topic streaming per-node log lines during a run.
|
|
148
|
+
*/
|
|
149
|
+
exports.GRAPH_RUN_LOG_TOPIC = `${exports.GRAPH_RUN_TOPIC}.log`;
|
|
150
|
+
/**
|
|
151
|
+
* SSE sub-topic streaming node/edge execution-state updates during a run.
|
|
152
|
+
*/
|
|
153
|
+
exports.GRAPH_RUN_STATE_TOPIC = `${exports.GRAPH_RUN_TOPIC}.state`;
|
|
154
|
+
(function (GraphLogAttribute) {
|
|
155
|
+
GraphLogAttribute["NODE_ID"] = "nodeId";
|
|
156
|
+
GraphLogAttribute["WORKFLOW_ID"] = "workflowId";
|
|
157
|
+
GraphLogAttribute["RUN_ID"] = "runId";
|
|
158
|
+
GraphLogAttribute["USER"] = "user";
|
|
159
|
+
})(exports.GraphLogAttribute || (exports.GraphLogAttribute = {}));
|
|
160
|
+
/**
|
|
161
|
+
* Namespace topic helper for a graph execution event.
|
|
162
|
+
*
|
|
163
|
+
* Log-carrier events resolve to `graph.run.log`; node/edge execution-state
|
|
164
|
+
* events resolve to `graph.run.state`; everything else stays under the shared
|
|
165
|
+
* `graph.run` topic and is only delivered to subscribers that match it.
|
|
166
|
+
*
|
|
167
|
+
* @param eventType - The graph execution event type to scope to a topic.
|
|
168
|
+
* @returns The SSE topic constant for the given event type.
|
|
169
|
+
*/
|
|
170
|
+
function graphRunTopicOf(eventType) {
|
|
171
|
+
switch (eventType) {
|
|
172
|
+
case exports.GraphExecutionEventType.GRAPH_RUN_LOG:
|
|
173
|
+
return exports.GRAPH_RUN_LOG_TOPIC;
|
|
174
|
+
case exports.GraphExecutionEventType.NODE_STATE_CHANGED:
|
|
175
|
+
case exports.GraphExecutionEventType.EDGE_STATE_CHANGED:
|
|
176
|
+
return exports.GRAPH_RUN_STATE_TOPIC;
|
|
177
|
+
default:
|
|
178
|
+
return exports.GRAPH_RUN_TOPIC;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
(function (GraphExecutionEventType) {
|
|
182
|
+
GraphExecutionEventType["WORKFLOW_STARTED"] = "workflow.started";
|
|
183
|
+
GraphExecutionEventType["WORKFLOW_PLANNED"] = "workflow.planned";
|
|
184
|
+
GraphExecutionEventType["WORKFLOW_COMPLETED"] = "workflow.completed";
|
|
185
|
+
GraphExecutionEventType["WORKFLOW_FAILED"] = "workflow.failed";
|
|
186
|
+
GraphExecutionEventType["WORKFLOW_CANCELLED"] = "workflow.cancelled";
|
|
187
|
+
GraphExecutionEventType["NODE_QUEUED"] = "node.queued";
|
|
188
|
+
GraphExecutionEventType["NODE_STARTED"] = "node.started";
|
|
189
|
+
GraphExecutionEventType["NODE_OUTPUT"] = "node.output";
|
|
190
|
+
GraphExecutionEventType["NODE_COMPLETED"] = "node.completed";
|
|
191
|
+
GraphExecutionEventType["NODE_FAILED"] = "node.failed";
|
|
192
|
+
GraphExecutionEventType["NODE_SKIPPED"] = "node.skipped";
|
|
193
|
+
GraphExecutionEventType["NODE_CACHE_HIT"] = "node.cacheHit";
|
|
194
|
+
GraphExecutionEventType["NODE_PINNED"] = "node.pinned";
|
|
195
|
+
GraphExecutionEventType["NODE_UNPINNED"] = "node.unpinned";
|
|
196
|
+
/** Node execution-state transition carrying a `GraphNodeStateChangedPayload` (DECAF-48 §4.4). */
|
|
197
|
+
GraphExecutionEventType["NODE_STATE_CHANGED"] = "node.stateChanged";
|
|
198
|
+
GraphExecutionEventType["EDGE_VALUE_ROUTED"] = "edge.valueRouted";
|
|
199
|
+
/** Edge execution-state transition carrying a `GraphEdgeStateChangedPayload` (DECAF-48 §4.4). */
|
|
200
|
+
GraphExecutionEventType["EDGE_STATE_CHANGED"] = "edge.stateChanged";
|
|
201
|
+
/** Structured run log line carrying a `GraphRunLogEntry` (DECAF-48 §4.3). */
|
|
202
|
+
GraphExecutionEventType["GRAPH_RUN_LOG"] = "graph.run.log";
|
|
203
|
+
GraphExecutionEventType["LOOP_STARTED"] = "loop.started";
|
|
204
|
+
GraphExecutionEventType["LOOP_ITERATION_STARTED"] = "loop.iteration.started";
|
|
205
|
+
GraphExecutionEventType["LOOP_ITERATION_COMPLETED"] = "loop.iteration.completed";
|
|
206
|
+
GraphExecutionEventType["LOOP_CONDITION_EVALUATED"] = "loop.condition.evaluated";
|
|
207
|
+
GraphExecutionEventType["LOOP_COMPLETED"] = "loop.completed";
|
|
208
|
+
GraphExecutionEventType["LOOP_LIMIT_REACHED"] = "loop.limitReached";
|
|
209
|
+
GraphExecutionEventType["VALIDATION_STARTED"] = "validation.started";
|
|
210
|
+
GraphExecutionEventType["VALIDATION_FAILED"] = "validation.failed";
|
|
211
|
+
GraphExecutionEventType["VALIDATION_COMPLETED"] = "validation.completed";
|
|
212
|
+
GraphExecutionEventType["STORE_READ"] = "store.read";
|
|
213
|
+
GraphExecutionEventType["STORE_WRITE"] = "store.write";
|
|
214
|
+
GraphExecutionEventType["STORE_DELETE"] = "store.delete";
|
|
215
|
+
})(exports.GraphExecutionEventType || (exports.GraphExecutionEventType = {}));
|
|
216
|
+
/** Default run limits: request size, per-caller concurrency, event retention/payload size, execution timeout, and post-terminal event replay window. */
|
|
217
|
+
exports.DEFAULT_GRAPH_RUN_LIMITS = {
|
|
218
|
+
maxRequestBytes: 4_000_000,
|
|
219
|
+
maxConcurrentRuns: 32,
|
|
220
|
+
maxEventsPerRun: 10_000,
|
|
221
|
+
maxEventPayloadBytes: 256_000,
|
|
222
|
+
executionTimeoutMs: 600_000,
|
|
223
|
+
eventReplayWindowMs: 300_000,
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Terminal graph event types closing a run's SSE stream
|
|
227
|
+
* (DECAF-50 §4.15). The run SSE endpoint never emits anything after these.
|
|
228
|
+
*/
|
|
229
|
+
exports.GRAPH_RUN_TERMINAL_EVENT_TYPES = [
|
|
230
|
+
exports.GraphExecutionEventType.WORKFLOW_COMPLETED,
|
|
231
|
+
exports.GraphExecutionEventType.WORKFLOW_FAILED,
|
|
232
|
+
exports.GraphExecutionEventType.WORKFLOW_CANCELLED,
|
|
233
|
+
];
|
|
234
|
+
/** Whether the event type is a run-stream terminal type (see {@link GRAPH_RUN_TERMINAL_EVENT_TYPES}). */
|
|
235
|
+
function isGraphRunTerminalEventType(type) {
|
|
236
|
+
return exports.GRAPH_RUN_TERMINAL_EVENT_TYPES.includes(type);
|
|
237
|
+
}
|
|
238
|
+
/** Whether the run status is terminal (`succeeded`, `failed`, or `cancelled`). */
|
|
239
|
+
function isGraphRunTerminalStatus(status) {
|
|
240
|
+
return status === "succeeded" || status === "failed" || status === "cancelled";
|
|
241
|
+
}
|
|
242
|
+
/** Type guard for {@link GraphRunStatus}. */
|
|
243
|
+
function isGraphRunStatus(value) {
|
|
244
|
+
return (typeof value === "string" &&
|
|
245
|
+
[
|
|
246
|
+
"queued",
|
|
247
|
+
"validating",
|
|
248
|
+
"running",
|
|
249
|
+
"succeeded",
|
|
250
|
+
"failed",
|
|
251
|
+
"cancelled",
|
|
252
|
+
].includes(value));
|
|
253
|
+
}
|
|
98
254
|
//# sourceMappingURL=constants.js.map
|
|
99
255
|
//# sourceMappingURL=constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph/constants.cjs","sourceRoot":"","sources":["graph/constants.js"],"names":[],"mappings":";;;AAoCA,gDAEC;AAuBD,gEAEC;AAID,oDAKC;AAKD,sDAIC;AAKD,oDAIC;
|
|
1
|
+
{"version":3,"file":"graph/constants.cjs","sourceRoot":"","sources":["graph/constants.js"],"names":[],"mappings":";;;AAoCA,gDAEC;AAuBD,gEAEC;AAID,oDAKC;AAKD,sDAIC;AAKD,oDAIC;AAkBD,kEAEC;AAmED,0CAUC;AAgED,kEAEC;AAED,4DAEC;AAED,4CAUC;AA5QD,CAAC,UAAU,SAAS;IAChB,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAC7B,SAAS,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;IACjC,SAAS,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;IACjC,SAAS,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;AACrC,CAAC,CAAC,CAAC,iBAAS,IAAI,CAAC,iBAAS,GAAG,EAAE,CAAC,CAAC,CAAC;A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ACR,YAAY;YACZ,SAAS;YACT,WAAW;YACX,QAAQ;YACR,WAAW;SACd,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3B,CAAC;AACD,qCAAqC"}
|
package/lib/cjs/graph/index.cjs
CHANGED
|
@@ -25,6 +25,9 @@ __exportStar(require("./reader.cjs"), exports);
|
|
|
25
25
|
__exportStar(require("./document/index.cjs"), exports);
|
|
26
26
|
__exportStar(require("./catalog/index.cjs"), exports);
|
|
27
27
|
__exportStar(require("./types.cjs"), exports);
|
|
28
|
+
__exportStar(require("./GraphExecutionStateMapper.cjs"), exports);
|
|
29
|
+
__exportStar(require("./GraphResolution.cjs"), exports);
|
|
30
|
+
__exportStar(require("./nodes/index.cjs"), exports);
|
|
28
31
|
__exportStar(require("./overrides/index.cjs"), exports);
|
|
29
32
|
//# sourceMappingURL=index.js.map
|
|
30
33
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph/index.cjs","sourceRoot":"","sources":["graph/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAAiC;AACjC,gCAA8B;AAC9B,iDAA+B;AAC/B,kDAAgC;AAChC,gDAA8B;AAC9B,uDAAqC;AACrC,gDAA8B;AAC9B,8CAA4B;AAC5B,sDAAoC;AACpC,qDAAmC;AACnC,6CAA2B;AAC3B,uDAAqC;AACrC,iCAAiC"}
|
|
1
|
+
{"version":3,"file":"graph/index.cjs","sourceRoot":"","sources":["graph/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAAiC;AACjC,gCAA8B;AAC9B,iDAA+B;AAC/B,kDAAgC;AAChC,gDAA8B;AAC9B,uDAAqC;AACrC,gDAA8B;AAC9B,8CAA4B;AAC5B,sDAAoC;AACpC,qDAAmC;AACnC,6CAA2B;AAC3B,iEAA+C;AAC/C,uDAAqC;AACrC,mDAAiC;AACjC,uDAAqC;AACrC,iCAAiC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GRAPH_AGENT_NODES = exports.AgentNode = void 0;
|
|
4
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
5
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
+
else
|
|
9
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
10
|
+
if (d = decorators[i])
|
|
11
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
|
+
};
|
|
14
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
16
|
+
return Reflect.metadata(k, v);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @module ui-decorators/graph/nodes/agents/agent
|
|
20
|
+
* @summary Production Agent node declaration.
|
|
21
|
+
* @description The Agent node is the primary AI agent entrypoint. It is a
|
|
22
|
+
* rectangular node with `@connection()` ports for its structural
|
|
23
|
+
* dependencies: `model` (the LLM), `memory` (the memory store), and
|
|
24
|
+
* `workspace` (the workspace/context). Connections are rendered on the
|
|
25
|
+
* bottom side of the node (DECAF-32 §21.3). Each connection category has a
|
|
26
|
+
* distinct color defined in the category style registry.
|
|
27
|
+
*
|
|
28
|
+
* The single `prompt` input accepts placeholder expressions (§22.4) such as
|
|
29
|
+
* `{{ $input.brief }}` or `{{ $node["Research"].output.summary }}` that are
|
|
30
|
+
* resolved at execution time by the placeholder compiler.
|
|
31
|
+
*/
|
|
32
|
+
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
33
|
+
const decorators_js_1 = require("./../../../ui/decorators.cjs");
|
|
34
|
+
const decorators_js_2 = require("./../../decorators.cjs");
|
|
35
|
+
// Ensure category styles are registered (idempotent).
|
|
36
|
+
require("./../category-styles.cjs");
|
|
37
|
+
/**
|
|
38
|
+
* Agent node — an AI agent that orchestrates a model, memory, and workspace.
|
|
39
|
+
*
|
|
40
|
+
* The agent has:
|
|
41
|
+
* - `@input` port on the **left**: `prompt` (the task prompt; supports
|
|
42
|
+
* placeholder expressions like `{{ $input.something }}` per §22.4).
|
|
43
|
+
* - `@output` ports on the **right**: `response` (the agent's output), `actions`
|
|
44
|
+
* (any actions the agent decided to take).
|
|
45
|
+
* - `@connection` ports on the **bottom**: `model` (LLM), `memory` (memory
|
|
46
|
+
* store), `workspace` (workspace/context). Each connection has a distinct
|
|
47
|
+
* category color.
|
|
48
|
+
*
|
|
49
|
+
* The node is rectangular (not rounded) to visually distinguish it from
|
|
50
|
+
* regular processing nodes. The `color` and `icon` are omitted from `@node()`
|
|
51
|
+
* so they are resolved from the `"Agent"` category style.
|
|
52
|
+
*/
|
|
53
|
+
let AgentNode = class AgentNode extends decorator_validation_1.Model {
|
|
54
|
+
};
|
|
55
|
+
exports.AgentNode = AgentNode;
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, decorator_validation_1.required)(),
|
|
58
|
+
(0, decorators_js_1.uielement)("textarea", {
|
|
59
|
+
label: "Prompt",
|
|
60
|
+
placeholder: "Enter task prompt. Supports placeholders like {{ $input.brief }} or {{ $node[\"Research\"].output.summary }}",
|
|
61
|
+
}),
|
|
62
|
+
(0, decorators_js_2.input)({ handle: "prompt" }),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], AgentNode.prototype, "prompt", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, decorator_validation_1.required)(),
|
|
67
|
+
(0, decorators_js_1.uielement)("textarea", { label: "Response", placeholder: "Agent response" }),
|
|
68
|
+
(0, decorators_js_2.output)({ handle: "response" }),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], AgentNode.prototype, "response", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, decorator_validation_1.required)(),
|
|
73
|
+
(0, decorators_js_1.uielement)("textarea", { label: "Actions", placeholder: "Actions taken by the agent" }),
|
|
74
|
+
(0, decorators_js_2.output)({ handle: "actions" }),
|
|
75
|
+
__metadata("design:type", Array)
|
|
76
|
+
], AgentNode.prototype, "actions", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, decorators_js_2.connection)({ category: "model", handle: "model" }),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], AgentNode.prototype, "model", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, decorators_js_2.connection)({ category: "memory", handle: "memory" }),
|
|
83
|
+
__metadata("design:type", Object)
|
|
84
|
+
], AgentNode.prototype, "memory", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, decorators_js_2.connection)({ category: "workspace", handle: "workspace" }),
|
|
87
|
+
__metadata("design:type", Object)
|
|
88
|
+
], AgentNode.prototype, "workspace", void 0);
|
|
89
|
+
exports.AgentNode = AgentNode = __decorate([
|
|
90
|
+
(0, decorators_js_2.node)("core.agent", {
|
|
91
|
+
kind: "core.agent",
|
|
92
|
+
category: "Agent",
|
|
93
|
+
// color and icon omitted — resolved from the "Agent" category style
|
|
94
|
+
width: 120,
|
|
95
|
+
height: 140,
|
|
96
|
+
labels: ["agent", "ai", "orchestrator"],
|
|
97
|
+
metadata: {
|
|
98
|
+
title: "Agent",
|
|
99
|
+
description: "AI agent that orchestrates a model, memory, and workspace to complete a task.",
|
|
100
|
+
shape: "rectangle",
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
(0, decorator_validation_1.model)()
|
|
104
|
+
], AgentNode);
|
|
105
|
+
/**
|
|
106
|
+
* All built-in agent node constructors.
|
|
107
|
+
*/
|
|
108
|
+
exports.GRAPH_AGENT_NODES = [AgentNode];
|
|
109
|
+
//# sourceMappingURL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F,KAAK,EAAE,WAAW;SACrB;KACJ,CAAC;IACF,IAAA,4BAAK,GAAE;CACV,EAAE,SAAS,CAAC,CAAC;AAEd;;GAEG;AACU,QAAA,iBAAiB,GAAG,CAAC,SAAS,CAAC,CAAC;AAC7C,iCAAiC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphNode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module ui-decorators/graph/nodes/base
|
|
6
|
+
* @summary Base class for shared graph node declarations.
|
|
7
|
+
* @description `GraphNode` extends `Model` with an overridable
|
|
8
|
+
* `applyMetadata` static method. Concrete node kinds that support dynamic
|
|
9
|
+
* metadata changes (e.g. `SwitchFlowNode` adding case output ports) override
|
|
10
|
+
* this method to compute their own ports, size, and data patches — the node
|
|
11
|
+
* is exclusively responsible for itself in every way.
|
|
12
|
+
*/
|
|
13
|
+
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
14
|
+
class GraphNode extends decorator_validation_1.Model {
|
|
15
|
+
/**
|
|
16
|
+
* Applies a metadata patch to this node class, returning the resulting
|
|
17
|
+
* ports, size, and data patches.
|
|
18
|
+
*
|
|
19
|
+
* The default implementation returns `null` (no changes). Concrete node
|
|
20
|
+
* kinds that support dynamic metadata override this to compute their own
|
|
21
|
+
* ports and size from the metadata — the caller (renderer) simply relays
|
|
22
|
+
* the result to the diagram model.
|
|
23
|
+
*
|
|
24
|
+
* @param _meta - The metadata patch (node-kind-specific, e.g.
|
|
25
|
+
* `SwitchNodeMetadata`).
|
|
26
|
+
* @returns The computed change, or `null` when the node kind does not
|
|
27
|
+
* support dynamic metadata.
|
|
28
|
+
*/
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
+
static applyMetadata(_meta) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.GraphNode = GraphNode;
|
|
35
|
+
//# sourceMappingURL=base.js.map
|
|
36
|
+
//# sourceMappingURL=base.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph/nodes/base.cjs","sourceRoot":"","sources":["graph/nodes/base.js"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,yEAAuD;AACvD,MAAa,SAAU,SAAQ,4BAAK;IAChC;;;;;;;;;;;;;OAaG;IACH,6DAA6D;IAC7D,MAAM,CAAC,aAAa,CAAC,KAAK;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAnBD,8BAmBC;AACD,gCAAgC"}
|