@blue-labs/document-processor 1.29.0 → 1.31.0
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/BlueDocumentProcessor.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +88 -82
- package/dist/processors/MyOSTimelineChannelProcessor.d.ts +1 -1
- package/dist/processors/MyOSTimelineChannelProcessor.d.ts.map +1 -1
- package/dist/utils/document.d.ts +8 -1
- package/dist/utils/document.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlueDocumentProcessor.d.ts","sourceRoot":"","sources":["../src/BlueDocumentProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,EAEZ,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAmBjB,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAI3C;;;;;GAKG;AACH,qBAAa,qBAAqB;IAc9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAbvB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;IAEzD;;;;OAIG;gBAEgB,IAAI,EAAE,IAAI,EAC3B,UAAU,GAAE,iBAAiB,EAAsB;IAkBrD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,iBAAiB,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAIzD;;;;;OAKG;IACG,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAuBnE;;;;;;OAMG;IACG,aAAa,CACjB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,OAAO,CAAC,gBAAgB,CAAC;IA8B5B;;OAEG;YACW,UAAU;
|
|
1
|
+
{"version":3,"file":"BlueDocumentProcessor.d.ts","sourceRoot":"","sources":["../src/BlueDocumentProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,EAEZ,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAmBjB,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAI3C;;;;;GAKG;AACH,qBAAa,qBAAqB;IAc9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAbvB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;IAEzD;;;;OAIG;gBAEgB,IAAI,EAAE,IAAI,EAC3B,UAAU,GAAE,iBAAiB,EAAsB;IAkBrD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,iBAAiB,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAIzD;;;;;OAKG;IACG,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAuBnE;;;;;;OAMG;IACG,aAAa,CACjB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,OAAO,CAAC,gBAAgB,CAAC;IA8B5B;;OAEG;YACW,UAAU;CAsFzB"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var ye=Object.defineProperty;var ge=(s,e,t)=>e in s?ye(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var l=(s,e,t)=>ge(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@blue-repository/core-dev"),m=require("@blue-labs/language"),T=require("@blue-labs/shared-utils"),P=require("@blue-repository/myos-dev"),Ee=(s,e)=>({on:(t,n)=>({end:()=>n(null)})});async function we(s){return new Promise((e,t)=>{Ee().on("error",t).end()})}const b=(...s)=>s.map((e,t)=>{if(typeof e!="string")return"";if(t===0&&e==="/")return"/";const n=t>0?e.replace(/^\/+/,""):e;return t<s.length-1?n.replace(/\/+$/,""):n}).filter(Boolean).join("/").replace(/\/{2,}/g,"/");class K{constructor(e,t,n,o){l(this,"actions",[]);this.getDocument=e,this.taskInfo=t,this.blue=n,this.onFlush=o}get(e){const t=this.getDocument(),n=b(this.taskInfo.nodePath,e);return t.get(n)}addPatch(e){this.actions.push({kind:"patch",patch:{...e,path:b(this.taskInfo.nodePath,e.path)}})}emitEvent(e){const t=this.taskInfo.event,n=t.trace??[],o={...e,originNodePath:e.originNodePath??this.taskInfo.nodePath,rootEvent:e.rootEvent??t.rootEvent??t,trace:[...n]};this.actions.push({kind:"event",event:o})}async flush(){var t;if(!this.actions.length)return[];const e=[...this.actions];return this.actions.length=0,await((t=this.onFlush)==null?void 0:t.call(this,e)),e}getNodePath(){return this.taskInfo.nodePath}resolvePath(e){return b(this.taskInfo.nodePath,e)}getTaskInfo(){return this.taskInfo}getBlue(){return this.blue}loadExternalModule(e){if(!/^https?:\/\//.test(e))throw new Error("Only http/https URLs are allowed");return we()}loadBlueContent(e){throw new Error("Not implemented")}}class A extends Error{constructor(e,t){super(`Cannot apply patch ${JSON.stringify(e)}`),this.patch=e,this.cause=t,this.name="PatchApplicationError"}}class j extends Error{constructor(e,t,n){super(`Patch ${JSON.stringify(e)} touches "${e.op==="move"||e.op==="copy"?`${e.from} → ${e.path}`:e.path}" which is inside embedded document "${t}" (Process Embedded @ "${n}")`),this.patch=e,this.offendingPath=t,this.contractNodePath=n,this.name="EmbeddedDocumentModificationError"}}class M extends Error{constructor(e,t){super(`Failed to evaluate expression "${e}"`),this.code=e,this.cause=t,this.name="ExpressionEvaluationError"}}class q extends Error{constructor(e,t){super(`Failed to evaluate code block "${e}"`),this.code=e,this.cause=t,this.name="CodeBlockEvaluationError"}}function N(s){return T.deepFreeze(s)}function B(s){return s.clone()}function x(s,e,t="/",n=[]){const o=s.getContracts()??{};for(const[r,a]of Object.entries(o))if(m.BlueNodeTypeSchema.isTypeOf(a,d.ProcessEmbeddedSchema)){const h=e.nodeToSchemaOutput(a,d.ProcessEmbeddedSchema).paths??[];for(const u of h)n.push({absPath:b(t,u),contractPath:b(t,`contracts/${r}`)})}for(const[r,a]of Object.entries(s.getProperties()??{}))x(a,e,b(t,r),n);return n}function J(s,e){return s===e||s.startsWith(e.endsWith("/")?e:e+"/")}function _(s,e){if(!e.length)return s;let t=B(s);for(const n of e)try{t=m.applyBlueNodePatch(t,n,!0)}catch(o){throw new A(n,o)}return N(t)}function y(s){return s!=null}function C(s){return s instanceof m.BlueNode}class ve{constructor(e=[],t=(n,o)=>n<o?-1:n>o?1:0){l(this,"data");l(this,"length");l(this,"compare");if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,o=t[e];for(;e>0;){const r=e-1>>1,a=t[r];if(n(o,a)>=0)break;t[e]=a,e=r}t[e]=o}_down(e){const{data:t,compare:n}=this,o=this.length>>1,r=t[e];for(;e<o;){let a=(e<<1)+1;const c=a+1;if(c<this.length&&n(t[c],t[a])<0&&(a=c),n(t[a],r)>=0)break;t[e]=t[a],e=a}t[e]=r}}const be=(s,e,t,n,o,r)=>[-s,e,t,n,o,r],Se=(s,e)=>{for(let t=0;t<s.key.length;t++){const n=s.key[t],o=e.key[t];if(n!==o)return typeof n=="number"&&typeof o=="number"?n-o:typeof n=="string"&&typeof o=="string"?n.localeCompare(o):0}return 0};class Pe{constructor(){l(this,"queue");this.queue=new ve([],Se)}push(e){this.queue.push(e)}pop(){return this.queue.pop()}get length(){return this.queue.length}}class Te{constructor(e=[]){l(this,"processors",new Map);l(this,"typeOrder",new Map);e.forEach((t,n)=>this.register(t,n))}register(e,t){if(this.processors.has(e.contractBlueId))throw new Error(`Processor for ${e.contractType} already registered`);this.processors.set(e.contractBlueId,e),this.typeOrder.has(e.contractBlueId)||this.typeOrder.set(e.contractBlueId,t??this.typeOrder.size)}get(e){if(!e)return;const t=e.getBlueId();if(t)return this.processors.get(t)}orderOf(e){if(!e)return 0;const t=e.getBlueId();return t?this.typeOrder.get(t)??0:0}values(){return this.processors.values()}}class Ce{constructor(){l(this,"isEnabled");this.isEnabled=process.env.TRACE_BLUE_ENABLED==="true"}makeHop(e,t){return`${e}#${t}`}shouldTrace(){return this.isEnabled}addHop(e,t,n){if(!this.shouldTrace())return{...e};const o=[...e.trace??[],this.makeHop(t,n)];return{...e,trace:o}}getTrace(e){return e.trace??[]}clearTrace(e){return{...e,trace:[]}}isTracingEnabled(){return this.isEnabled}}const ke=64;class Ie{constructor(e,t,n,o,r){l(this,"traceManager");this.blue=e,this.registry=t,this.queue=n,this.getNextTaskId=o,this.getNextEventSeq=r,this.traceManager=new Ce}async route(e,t,n,o,r=0){var i;if(n.seq===void 0&&(n.seq=this.getNextEventSeq()),t.length===0){if(n.dispatchPath){const h=n.dispatchPath.split("/").filter(Boolean),u={...n};return delete u.dispatchPath,this.route(e,h,u,o,r)}if(n.source==="channel"&&n.originNodePath&&n.originNodePath!=="/"){const h=((i=n.originNodePath)==null?void 0:i.split("/").filter(Boolean))??[];return this.route(e,h,n,o,r)}}const a=b("/",t.join("/")),c=e.get(a);C(c)&&await this.traverseContracts({doc:e,node:c,nodePath:a,event:n,afterTaskId:o,pathSegments:t,inlineDepth:r})}async traverseContracts(e){const{doc:t,node:n,nodePath:o,event:r,afterTaskId:a,pathSegments:c,inlineDepth:i}=e;if(!this.shouldSkipForChannel(r,o))for(const[h,u]of Object.entries(n.getContracts()??{})){if(!u.getType())continue;const p=this.registry.get(u.getType());if(!p){console.warn(`No processor registered for contract: ${h}`);continue}const f={nodePath:o,contractName:h,contractNode:u,event:r},g=new K(()=>t,f,this.blue);if(p.supports(r,u,g,h))switch(p.role){case"adapter":await this.processAdapter({cp:p,event:r,contractNode:u,ctx:g,contractName:h,doc:t,afterTaskId:a,inlineDepth:i});break;case"handler":this.scheduleHandler({contractNode:u,contractName:h,nodePath:o,event:r,depth:c.length,afterTaskId:a});break}}}async processAdapter(e){var v;const{cp:t,event:n,contractNode:o,ctx:r,contractName:a,doc:c,afterTaskId:i,inlineDepth:h}=e;if(h>=ke)throw new Error("Adapter recursion limit reached");const u=this.traceManager.addHop(n,((v=r.getTaskInfo())==null?void 0:v.nodePath)??"",a);await t.handle(u,o,r,a);const p=await r.flush();if(p.find(S=>S.kind==="patch"))throw new Error(`Contract "${a}" (adapter) attempted to patch the document`);const g=p.filter(S=>S.kind==="event");for(const S of g)await this.route(c,[],S.event,i,h+1)}scheduleHandler(e){const{contractNode:t,contractName:n,nodePath:o,event:r,depth:a,afterTaskId:c}=e,i=t.getType();if(!i){console.warn(`Contract node type is not defined for: ${n}`);return}const h=this.registry.orderOf(i),u=t.get("/order"),p=m.isBigNumber(u)?u.toNumber():0,f=this.getNextTaskId()+c,g=be(a,r.seq,h,p,n,f),v=this.traceManager.addHop(r,o,n);this.queue.push({key:g,nodePath:o,contractName:n,contractNode:t,event:v})}shouldSkipForChannel(e,t){return e.source==="channel"&&!!e.originNodePath&&e.originNodePath!==t}}const Ne=(s,e,t)=>{(t instanceof A||t instanceof j)&&console.error(`[Blue] Failed to apply patches for contract "${s}" on event ${JSON.stringify(e)}`,t)};function U(s,e){const t=B(s),n=o=>{if(!C(o))return;const r=o.getContracts();(!(r!=null&&r.checkpoint)||!m.BlueNodeTypeSchema.isTypeOf(r.checkpoint,d.ChannelEventCheckpointSchema))&&o.addContract("checkpoint",e.jsonValueToNode({type:{name:"Channel Event Checkpoint",blueId:d.blueIds["Channel Event Checkpoint"]},lastEvents:{}}))};n(t);for(const{absPath:o}of x(t,e)){const r=t.get(o);C(r)&&n(r)}return N(t)}function Be(s,e){const t=B(s);return C(t)&&(X(t,e)||t.addContract("initialized",e.jsonValueToNode({type:{name:"Initialized Marker",blueId:d.blueIds["Initialized Marker"]}}))),N(t)}function X(s,e){const t=s.getContracts();return Object.values(t??{}).some(n=>e.isTypeOf(n,d.InitializedMarkerSchema,{checkSchemaExtensions:!0}))}class Y{constructor(e){l(this,"contractType","Channel Event Checkpoint");l(this,"contractBlueId",d.blueIds["Channel Event Checkpoint"]);l(this,"role","handler");this.cache=e}supports(e){var t,n;return e.source==="channel"&&((t=e.rootEvent)==null?void 0:t.payload)===e.payload&&((n=e.rootEvent)==null?void 0:n.source)==="external"}async getEventBlueId(e,t){var o;const n=(o=e.rootEvent)==null?void 0:o.payload;if(!n)throw new Error("Cannot calculate blueId for checkpoint: missing root event payload");if(n instanceof m.ResolvedBlueNode){const r=n.getMinimalNode();return await t.getBlue().calculateBlueId(r)}return await t.getBlue().calculateBlueId(n)}async handle(e,t,n){var a;if(!e.channelName||!((a=e.rootEvent)!=null&&a.seq))return;const o=await this.getEventBlueId(e,n),r=n.getNodePath().replace(/\/contracts\/checkpoint$/,"");this.cache.record(r,e,o)}}const F=(s,e)=>s.get(e)!==void 0;class Oe{constructor(){l(this,"firstSeen",new Map)}record(e,t,n){const o=e;this.firstSeen.has(o)||this.firstSeen.set(o,{docBase:e,event:t,eventBlueId:n})}flush(e){const t=[];for(const{docBase:n,event:o,eventBlueId:r}of this.firstSeen.values()){if(!o.channelName)continue;const a=b(n,"contracts/checkpoint/lastEvents",o.channelName),c=`${a}/blueId`;F(e,a)?t.push({op:F(e,c)?"replace":"add",path:c,val:r}):t.push({op:"add",path:a,val:{blueId:r}})}return t}clear(){this.firstSeen.clear()}}class k{constructor(){l(this,"role","adapter")}baseSupports(e){return e.source!=="channel"}}class Z extends k{constructor(){super(...arguments);l(this,"contractType","Composite Timeline Channel");l(this,"contractBlueId",d.blueIds["Composite Timeline Channel"])}supports(t,n,o){const r=o.getBlue().nodeToSchemaOutput(n,d.CompositeTimelineChannelSchema);return!r.channels||!t.channelName?!1:r.channels.includes(t.channelName)}handle(t,n,o,r){o.emitEvent({payload:t.payload,channelName:r,source:"channel"})}}class G extends k{constructor(){super(...arguments);l(this,"contractType","Document Update Channel");l(this,"contractBlueId",d.blueIds["Document Update Channel"])}supports(t,n,o,r){if(!this.baseSupports(t))return!1;const a=o.getBlue().nodeToSchemaOutput(n,d.DocumentUpdateChannelSchema),c=t.payload.get("/path");if(!c||t.channelName===r)return!1;const i=a.path;return T.isNonNullable(i)&&c===o.resolvePath(i)}handle(t,n,o,r){const a=t.payload;a&&o.emitEvent({payload:a,channelName:r,source:"channel"})}}class ee extends k{constructor(){super(...arguments);l(this,"contractType","Embedded Node Channel");l(this,"contractBlueId",d.blueIds["Embedded Node Channel"])}supports(t,n,o){if(!this.baseSupports(t))return!1;const r=o.getBlue().nodeToSchemaOutput(n,d.EmbeddedNodeChannelSchema);return y(t.originNodePath)&&y(r.path)&&t.originNodePath===o.resolvePath(r.path)}handle(t,n,o,r){const a=o.getBlue().nodeToSchemaOutput(n,d.EmbeddedNodeChannelSchema),{originNodePath:c,payload:i}=t;y(a.path)&&c===o.resolvePath(a.path)&&o.emitEvent({payload:i,channelName:r,source:"channel"})}}class te{constructor(){l(this,"contractType","Initialized Marker");l(this,"contractBlueId",d.blueIds["Initialized Marker"]);l(this,"role","marker")}supports(){return!1}handle(){}}class ne extends k{constructor(){super(...arguments);l(this,"contractType","Lifecycle Event Channel");l(this,"contractBlueId",d.blueIds["Lifecycle Event Channel"])}supports(t,n,o){return!this.baseSupports(t)||!this.isLifecycleEvent(t,o)?!1:this.isEventPatternMatch(t,n,o)}handle(t,n,o,r){o.emitEvent({payload:t.payload,channelName:r,source:"channel"})}isLifecycleEvent(t,n){const o=n.getBlue(),r=t.payload;return o.isTypeOf(r,d.LifecycleEventSchema,{checkSchemaExtensions:!0})}isEventPatternMatch(t,n,o){var a;const r=(a=n.getProperties())==null?void 0:a.event;if(!r)return!0;try{const c=o.getBlue(),i=c.nodeToJson(t.payload),h=c.nodeToJson(r);return T.deepContains(i,h)}catch(c){return console.warn("Error during lifecycle event pattern matching:",c),!1}}}const L=(s,e)=>{const t=e.getBlue();return t.isTypeOf(s.payload,d.TimelineEntrySchema)||t.isTypeOf(s.payload,P.MyOSTimelineEntrySchema)};class oe extends k{constructor(){super(...arguments);l(this,"contractType","MyOS Timeline Channel");l(this,"contractBlueId",P.blueIds["MyOS Timeline Channel"])}supports(t,n,o){var f;if(!this.baseSupports(t)||!L(t,o))return!1;const a=o.getBlue().nodeToSchemaOutput(t.payload,P.MyOSTimelineEntrySchema),c=o.getBlue().nodeToSchemaOutput(n,P.MyOSTimelineChannelSchema),i=(f=a.timeline)==null?void 0:f.timelineId,h=y(c.timelineId)&&y(i),u=y(c.account)&&y(a.account),p=y(c.email)&&y(a.email);return h&&i===c.timelineId||u&&a.account===c.account||p&&a.email===c.email}handle(t,n,o,r){L(t,o)&&o.emitEvent({payload:t.payload,channelName:r,source:"channel"})}}class re extends k{constructor(){super(...arguments);l(this,"contractType","MyOS Agent Channel");l(this,"contractBlueId",P.blueIds["MyOS Agent Channel"])}supports(t,n,o){if(!this.baseSupports(t))return!1;try{const{myosAgentEvent:r,myosAgentChannel:a}=this.parseEventAndChannel(t,n,o);return this.isAgentMatch(r,a)&&this.isEventPatternMatch(r,a,o)}catch(r){return console.warn("Error in MyOSAgentChannelProcessor.supports:",r),!1}}handle(t,n,o,r){o.emitEvent({payload:t.payload,channelName:r,source:"channel"})}parseEventAndChannel(t,n,o){const r=o.getBlue(),a=r.nodeToSchemaOutput(t.payload,P.MyOSAgentEventSchema),c=r.nodeToSchemaOutput(n,P.MyOSAgentChannelSchema);return{myosAgentEvent:a,myosAgentChannel:c}}isAgentMatch(t,n){var a;const o=t.agentId,r=(a=n.agent)==null?void 0:a.agentId;return y(o)&&y(r)&&o===r}isEventPatternMatch(t,n,o){const r=n.event;if(!r)return!0;const a=t.event;if(!a)return!1;try{const c=o.getBlue(),i=c.nodeToJson(a),h=c.nodeToJson(r);return T.deepContains(i,h)}catch(c){return console.warn("Error during event pattern matching:",c),!1}}}class ae{constructor(){l(this,"contractType","Operation");l(this,"contractBlueId",d.blueIds.Operation);l(this,"role","adapter")}supports(e,t,n,o){const a=n.getBlue().nodeToSchemaOutput(t,d.OperationSchema),c=this.parseEventPayload(e,n);return y(c==null?void 0:c.operation)&&c.operation===o&&e.source==="channel"&&e.channelName===a.channel}async handle(e,t,n,o){n.emitEvent({payload:e.payload,channelName:o,source:"channel"})}parseEventPayload(e,t){const n=t.getBlue();if(n.isTypeOf(e.payload,d.TimelineEntrySchema,{checkSchemaExtensions:!0})){const o=n.nodeToSchemaOutput(e.payload,d.TimelineEntrySchema);if(o.message)return n.nodeToSchemaOutput(o.message,d.OperationRequestSchema)}return null}}class se{constructor(){l(this,"contractType","Process Embedded");l(this,"role","adapter");l(this,"contractBlueId",d.blueIds["Process Embedded"])}supports(e){return e.source!=="channel"}handle(e,t,n){const o=n.getBlue().nodeToSchemaOutput(t,d.ProcessEmbeddedSchema);for(const r of o.paths??[])n.emitEvent({...e,dispatchPath:n.resolvePath(r)})}}const ce=!process.env.SKIP_ISOLATED_VM;let w=null;if(ce)try{w=require("isolated-vm")}catch{console.warn("isolated-vm not available, using fallback evaluation method")}function z(s){return/\bimport\s.+\sfrom\s+['"][^'"]+['"]/.test(s)||/\bexport\s+/.test(s)}class ${static async evaluate({code:e,ctx:t,bindings:n={},options:o={}}){return!w||!ce?this.evaluateSimple(e,n,o):this.evaluateSecure(e,n,t,o)}static async evaluateSimple(e,t,n={}){if(z(e))throw new Error("Static import/export syntax requires isolated-vm – start Node without SKIP_ISOLATED_VM.");try{if(n.isCodeBlock){const o=Object.keys(t);return await(await new Function(...o,`return async function codeBlock(${o.join(", ")}) { ${e} }`)(...o.map(c=>t[c])))(...o.map(c=>t[c]))}else return new Function(...Object.keys(t),`return ${e};`)(...Object.values(t))}catch(o){throw n.isCodeBlock?new q(e,o):new M(e,o)}}static async evaluateSecure(e,t,n,o={}){if(!w)throw new Error("isolated-vm not available");const r=new w.Isolate({memoryLimit:32}),a=await r.createContext(),c=a.global;try{await this.setupIsolateEnvironment(c,t);const i=new Map,h=this.createModuleResolver(r,a,i,n);let u;return z(e)?u=await this.evaluateESModule(r,a,e,o,h):u=await this.evaluateSimpleScript(r,a,e,t,o),this.deepClone(u)}catch(i){throw o.isCodeBlock?new q(e,i):new M(e,i)}finally{a.release(),r.dispose()}}static async setupIsolateEnvironment(e,t){if(!w)throw new Error("isolated-vm not available");const n=new w.Callback((...r)=>console.log(...r)),o=new w.ExternalCopy({log:n}).copyInto();await e.set("console",o);for(const[r,a]of Object.entries(t))typeof a=="function"?await e.set(r,new w.Callback(a)):await e.set(r,new w.ExternalCopy(a).copyInto())}static createModuleResolver(e,t,n,o){return async r=>{if(n.has(r))return n.get(r);if(r.startsWith("blue:")){const a=r.slice(5),c=o.loadBlueContent;if(typeof c!="function")throw new Error(`ProcessingContext is missing a loadBlueContent(blueId) implementation (needed for ${r})`);const i=await c(a),h=await e.compileModule(i);return n.set(r,h),await h.instantiate(t,this.createModuleResolver(e,t,n,o)),h}if(/^https?:\/\//.test(r)){let a;if(typeof o.loadExternalModule=="function")a=await o.loadExternalModule(r);else throw new Error(`ProcessingContext is missing a loadExternalModule(url) implementation (needed for ${r})`);const c=await e.compileModule(a);return n.set(r,c),await c.instantiate(t,this.createModuleResolver(e,t,n,o)),c}throw new Error(`Unsupported module specifier "${r}"`)}}static async evaluateSimpleScript(e,t,n,o,r){const a=Object.keys(o).join(", "),c=Object.keys(o).map(u=>u),i=`(async (${a}) => { ${r.isCodeBlock?n:`return (${n});`} })(${c.join(", ")})`;return await(await e.compileScript(i)).run(t,{timeout:r.timeout??500,promise:!0,copy:!0,release:!0})}static async evaluateESModule(e,t,n,o,r){let a=n;if(o.isCodeBlock){const h=/^\s*(import\s.+?;|export\s.+?;)/gm,u=(n.match(h)||[]).join(`
|
|
2
|
-
`),
|
|
1
|
+
"use strict";var ye=Object.defineProperty;var ge=(s,e,t)=>e in s?ye(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var l=(s,e,t)=>ge(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@blue-repository/core-dev"),p=require("@blue-labs/language"),T=require("@blue-labs/shared-utils"),P=require("@blue-repository/myos-dev"),Ee=(s,e)=>({on:(t,n)=>({end:()=>n(null)})});async function we(s){return new Promise((e,t)=>{Ee().on("error",t).end()})}const S=(...s)=>s.map((e,t)=>{if(typeof e!="string")return"";if(t===0&&e==="/")return"/";const n=t>0?e.replace(/^\/+/,""):e;return t<s.length-1?n.replace(/\/+$/,""):n}).filter(Boolean).join("/").replace(/\/{2,}/g,"/");class K{constructor(e,t,n,o){l(this,"actions",[]);this.getDocument=e,this.taskInfo=t,this.blue=n,this.onFlush=o}get(e){const t=this.getDocument(),n=S(this.taskInfo.nodePath,e);return t.get(n)}addPatch(e){this.actions.push({kind:"patch",patch:{...e,path:S(this.taskInfo.nodePath,e.path)}})}emitEvent(e){const t=this.taskInfo.event,n=t.trace??[],o={...e,originNodePath:e.originNodePath??this.taskInfo.nodePath,rootEvent:e.rootEvent??t.rootEvent??t,trace:[...n]};this.actions.push({kind:"event",event:o})}async flush(){var t;if(!this.actions.length)return[];const e=[...this.actions];return this.actions.length=0,await((t=this.onFlush)==null?void 0:t.call(this,e)),e}getNodePath(){return this.taskInfo.nodePath}resolvePath(e){return S(this.taskInfo.nodePath,e)}getTaskInfo(){return this.taskInfo}getBlue(){return this.blue}loadExternalModule(e){if(!/^https?:\/\//.test(e))throw new Error("Only http/https URLs are allowed");return we()}loadBlueContent(e){throw new Error("Not implemented")}}class j extends Error{constructor(e,t){super(`Cannot apply patch ${JSON.stringify(e)}`),this.patch=e,this.cause=t,this.name="PatchApplicationError"}}class x extends Error{constructor(e,t,n){super(`Patch ${JSON.stringify(e)} touches "${e.op==="move"||e.op==="copy"?`${e.from} → ${e.path}`:e.path}" which is inside embedded document "${t}" (Process Embedded @ "${n}")`),this.patch=e,this.offendingPath=t,this.contractNodePath=n,this.name="EmbeddedDocumentModificationError"}}class q extends Error{constructor(e,t){super(`Failed to evaluate expression "${e}"`),this.code=e,this.cause=t,this.name="ExpressionEvaluationError"}}class $ extends Error{constructor(e,t){super(`Failed to evaluate code block "${e}"`),this.code=e,this.cause=t,this.name="CodeBlockEvaluationError"}}function N(s){return T.deepFreeze(s)}function B(s){return s.clone()}function M(s,e,t="/",n=[]){const o=s.getContracts()??{};for(const[r,a]of Object.entries(o))if(e.isTypeOf(a,d.ProcessEmbeddedSchema)){const h=e.nodeToSchemaOutput(a,d.ProcessEmbeddedSchema).paths??[];for(const u of h)n.push({absPath:S(t,u),contractPath:S(t,`contracts/${r}`)})}for(const[r,a]of Object.entries(s.getProperties()??{}))M(a,e,S(t,r),n);return n}function J(s,e){return s===e||s.startsWith(e.endsWith("/")?e:e+"/")}function _(s,e){if(!e.length)return s;let t=B(s);for(const n of e)try{t=p.applyBlueNodePatch(t,n,!0)}catch(o){throw new j(n,o)}return N(t)}function E(s){return s!=null}function C(s){return s instanceof p.BlueNode}class ve{constructor(e=[],t=(n,o)=>n<o?-1:n>o?1:0){l(this,"data");l(this,"length");l(this,"compare");if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,o=t[e];for(;e>0;){const r=e-1>>1,a=t[r];if(n(o,a)>=0)break;t[e]=a,e=r}t[e]=o}_down(e){const{data:t,compare:n}=this,o=this.length>>1,r=t[e];for(;e<o;){let a=(e<<1)+1;const c=a+1;if(c<this.length&&n(t[c],t[a])<0&&(a=c),n(t[a],r)>=0)break;t[e]=t[a],e=a}t[e]=r}}const Se=(s,e,t,n,o,r)=>[-s,e,t,n,o,r],be=(s,e)=>{for(let t=0;t<s.key.length;t++){const n=s.key[t],o=e.key[t];if(n!==o)return typeof n=="number"&&typeof o=="number"?n-o:typeof n=="string"&&typeof o=="string"?n.localeCompare(o):0}return 0};class Pe{constructor(){l(this,"queue");this.queue=new ve([],be)}push(e){this.queue.push(e)}pop(){return this.queue.pop()}get length(){return this.queue.length}}class Te{constructor(e=[]){l(this,"processors",new Map);l(this,"typeOrder",new Map);e.forEach((t,n)=>this.register(t,n))}register(e,t){if(this.processors.has(e.contractBlueId))throw new Error(`Processor for ${e.contractType} already registered`);this.processors.set(e.contractBlueId,e),this.typeOrder.has(e.contractBlueId)||this.typeOrder.set(e.contractBlueId,t??this.typeOrder.size)}get(e){if(!e)return;const t=e.getBlueId();if(t)return this.processors.get(t)}orderOf(e){if(!e)return 0;const t=e.getBlueId();return t?this.typeOrder.get(t)??0:0}values(){return this.processors.values()}}class Ce{constructor(){l(this,"isEnabled");this.isEnabled=process.env.TRACE_BLUE_ENABLED==="true"}makeHop(e,t){return`${e}#${t}`}shouldTrace(){return this.isEnabled}addHop(e,t,n){if(!this.shouldTrace())return{...e};const o=[...e.trace??[],this.makeHop(t,n)];return{...e,trace:o}}getTrace(e){return e.trace??[]}clearTrace(e){return{...e,trace:[]}}isTracingEnabled(){return this.isEnabled}}const ke=64;class Ie{constructor(e,t,n,o,r){l(this,"traceManager");this.blue=e,this.registry=t,this.queue=n,this.getNextTaskId=o,this.getNextEventSeq=r,this.traceManager=new Ce}async route(e,t,n,o,r=0){var i;if(n.seq===void 0&&(n.seq=this.getNextEventSeq()),t.length===0){if(n.dispatchPath){const h=n.dispatchPath.split("/").filter(Boolean),u={...n};return delete u.dispatchPath,this.route(e,h,u,o,r)}if(n.source==="channel"&&n.originNodePath&&n.originNodePath!=="/"){const h=((i=n.originNodePath)==null?void 0:i.split("/").filter(Boolean))??[];return this.route(e,h,n,o,r)}}const a=S("/",t.join("/")),c=e.get(a);C(c)&&await this.traverseContracts({doc:e,node:c,nodePath:a,event:n,afterTaskId:o,pathSegments:t,inlineDepth:r})}async traverseContracts(e){const{doc:t,node:n,nodePath:o,event:r,afterTaskId:a,pathSegments:c,inlineDepth:i}=e;if(!this.shouldSkipForChannel(r,o))for(const[h,u]of Object.entries(n.getContracts()??{})){if(!u.getType())continue;const m=this.registry.get(u.getType());if(!m){console.warn(`No processor registered for contract: ${h}`);continue}const f={nodePath:o,contractName:h,contractNode:u,event:r},y=new K(()=>t,f,this.blue);if(m.supports(r,u,y,h))switch(m.role){case"adapter":await this.processAdapter({cp:m,event:r,contractNode:u,ctx:y,contractName:h,doc:t,afterTaskId:a,inlineDepth:i});break;case"handler":this.scheduleHandler({contractNode:u,contractName:h,nodePath:o,event:r,depth:c.length,afterTaskId:a});break}}}async processAdapter(e){var v;const{cp:t,event:n,contractNode:o,ctx:r,contractName:a,doc:c,afterTaskId:i,inlineDepth:h}=e;if(h>=ke)throw new Error("Adapter recursion limit reached");const u=this.traceManager.addHop(n,((v=r.getTaskInfo())==null?void 0:v.nodePath)??"",a);await t.handle(u,o,r,a);const m=await r.flush();if(m.find(b=>b.kind==="patch"))throw new Error(`Contract "${a}" (adapter) attempted to patch the document`);const y=m.filter(b=>b.kind==="event");for(const b of y)await this.route(c,[],b.event,i,h+1)}scheduleHandler(e){const{contractNode:t,contractName:n,nodePath:o,event:r,depth:a,afterTaskId:c}=e,i=t.getType();if(!i){console.warn(`Contract node type is not defined for: ${n}`);return}const h=this.registry.orderOf(i),u=t.get("/order"),m=p.isBigNumber(u)?u.toNumber():0,f=this.getNextTaskId()+c,y=Se(a,r.seq,h,m,n,f),v=this.traceManager.addHop(r,o,n);this.queue.push({key:y,nodePath:o,contractName:n,contractNode:t,event:v})}shouldSkipForChannel(e,t){return e.source==="channel"&&!!e.originNodePath&&e.originNodePath!==t}}const Ne=(s,e,t)=>{(t instanceof j||t instanceof x)&&console.error(`[Blue] Failed to apply patches for contract "${s}" on event ${JSON.stringify(e)}`,t)};function U(s,e){const t=B(s),n=o=>{if(!C(o))return;const r=o.getContracts();(!(r!=null&&r.checkpoint)||!p.BlueNodeTypeSchema.isTypeOf(r.checkpoint,d.ChannelEventCheckpointSchema))&&o.addContract("checkpoint",e.jsonValueToNode({type:{name:"Channel Event Checkpoint",blueId:d.blueIds["Channel Event Checkpoint"]},lastEvents:{}}))};n(t);for(const{absPath:o}of M(t,e)){const r=t.get(o);C(r)&&n(r)}return N(t)}function Be(s,e){const t=B(s);return C(t)&&(X(t,e)||t.addContract("initialized",e.jsonValueToNode({type:{name:"Initialized Marker",blueId:d.blueIds["Initialized Marker"]}}))),N(t)}function X(s,e){const t=s.getContracts();return Object.values(t??{}).some(n=>e.isTypeOf(n,d.InitializedMarkerSchema,{checkSchemaExtensions:!0}))}class Y{constructor(e){l(this,"contractType","Channel Event Checkpoint");l(this,"contractBlueId",d.blueIds["Channel Event Checkpoint"]);l(this,"role","handler");this.cache=e}supports(e){var t,n;return e.source==="channel"&&((t=e.rootEvent)==null?void 0:t.payload)===e.payload&&((n=e.rootEvent)==null?void 0:n.source)==="external"}async getEventBlueId(e,t){var o;const n=(o=e.rootEvent)==null?void 0:o.payload;if(!n)throw new Error("Cannot calculate blueId for checkpoint: missing root event payload");if(n instanceof p.ResolvedBlueNode){const r=n.getMinimalNode();return await t.getBlue().calculateBlueId(r)}return await t.getBlue().calculateBlueId(n)}async handle(e,t,n){var a;if(!e.channelName||!((a=e.rootEvent)!=null&&a.seq))return;const o=await this.getEventBlueId(e,n),r=n.getNodePath().replace(/\/contracts\/checkpoint$/,"");this.cache.record(r,e,o)}}const F=(s,e)=>s.get(e)!==void 0;class Oe{constructor(){l(this,"firstSeen",new Map)}record(e,t,n){const o=e;this.firstSeen.has(o)||this.firstSeen.set(o,{docBase:e,event:t,eventBlueId:n})}flush(e){const t=[];for(const{docBase:n,event:o,eventBlueId:r}of this.firstSeen.values()){if(!o.channelName)continue;const a=S(n,"contracts/checkpoint/lastEvents",o.channelName),c=`${a}/blueId`;F(e,a)?t.push({op:F(e,c)?"replace":"add",path:c,val:r}):t.push({op:"add",path:a,val:{blueId:r}})}return t}clear(){this.firstSeen.clear()}}class k{constructor(){l(this,"role","adapter")}baseSupports(e){return e.source!=="channel"}}class Z extends k{constructor(){super(...arguments);l(this,"contractType","Composite Timeline Channel");l(this,"contractBlueId",d.blueIds["Composite Timeline Channel"])}supports(t,n,o){const r=o.getBlue().nodeToSchemaOutput(n,d.CompositeTimelineChannelSchema);return!r.channels||!t.channelName?!1:r.channels.includes(t.channelName)}handle(t,n,o,r){o.emitEvent({payload:t.payload,channelName:r,source:"channel"})}}class G extends k{constructor(){super(...arguments);l(this,"contractType","Document Update Channel");l(this,"contractBlueId",d.blueIds["Document Update Channel"])}supports(t,n,o,r){if(!this.baseSupports(t))return!1;const a=o.getBlue().nodeToSchemaOutput(n,d.DocumentUpdateChannelSchema),c=t.payload.get("/path");if(!c||t.channelName===r)return!1;const i=a.path;return T.isNonNullable(i)&&c===o.resolvePath(i)}handle(t,n,o,r){const a=t.payload;a&&o.emitEvent({payload:a,channelName:r,source:"channel"})}}class ee extends k{constructor(){super(...arguments);l(this,"contractType","Embedded Node Channel");l(this,"contractBlueId",d.blueIds["Embedded Node Channel"])}supports(t,n,o){if(!this.baseSupports(t))return!1;const r=o.getBlue().nodeToSchemaOutput(n,d.EmbeddedNodeChannelSchema);return E(t.originNodePath)&&E(r.path)&&t.originNodePath===o.resolvePath(r.path)}handle(t,n,o,r){const a=o.getBlue().nodeToSchemaOutput(n,d.EmbeddedNodeChannelSchema),{originNodePath:c,payload:i}=t;E(a.path)&&c===o.resolvePath(a.path)&&o.emitEvent({payload:i,channelName:r,source:"channel"})}}class te{constructor(){l(this,"contractType","Initialized Marker");l(this,"contractBlueId",d.blueIds["Initialized Marker"]);l(this,"role","marker")}supports(){return!1}handle(){}}class ne extends k{constructor(){super(...arguments);l(this,"contractType","Lifecycle Event Channel");l(this,"contractBlueId",d.blueIds["Lifecycle Event Channel"])}supports(t,n,o){return!this.baseSupports(t)||!this.isLifecycleEvent(t,o)?!1:this.isEventPatternMatch(t,n,o)}handle(t,n,o,r){o.emitEvent({payload:t.payload,channelName:r,source:"channel"})}isLifecycleEvent(t,n){const o=n.getBlue(),r=t.payload;return o.isTypeOf(r,d.LifecycleEventSchema,{checkSchemaExtensions:!0})}isEventPatternMatch(t,n,o){var a;const r=(a=n.getProperties())==null?void 0:a.event;if(!r)return!0;try{const c=o.getBlue(),i=c.nodeToJson(t.payload),h=c.nodeToJson(r);return T.deepContains(i,h)}catch(c){return console.warn("Error during lifecycle event pattern matching:",c),!1}}}const L=(s,e)=>{const t=e.getBlue();return t.isTypeOf(s.payload,d.TimelineEntrySchema)||t.isTypeOf(s.payload,P.MyOSTimelineEntrySchema)};class oe extends k{constructor(){super(...arguments);l(this,"contractType","MyOS Timeline Channel");l(this,"contractBlueId",P.blueIds["MyOS Timeline Channel"])}supports(t,n,o){var u;if(!this.baseSupports(t)||!L(t,o))return!1;const a=o.getBlue().nodeToSchemaOutput(t.payload,P.MyOSTimelineEntrySchema),c=o.getBlue().nodeToSchemaOutput(n,P.MyOSTimelineChannelSchema),i=(u=a.timeline)==null?void 0:u.timelineId;return E(c.timelineId)&&E(i)&&i===c.timelineId}handle(t,n,o,r){L(t,o)&&o.emitEvent({payload:t.payload,channelName:r,source:"channel"})}}class re extends k{constructor(){super(...arguments);l(this,"contractType","MyOS Agent Channel");l(this,"contractBlueId",P.blueIds["MyOS Agent Channel"])}supports(t,n,o){if(!this.baseSupports(t))return!1;try{const{myosAgentEvent:r,myosAgentChannel:a}=this.parseEventAndChannel(t,n,o);return this.isAgentMatch(r,a)&&this.isEventPatternMatch(r,a,o)}catch(r){return console.warn("Error in MyOSAgentChannelProcessor.supports:",r),!1}}handle(t,n,o,r){o.emitEvent({payload:t.payload,channelName:r,source:"channel"})}parseEventAndChannel(t,n,o){const r=o.getBlue(),a=r.nodeToSchemaOutput(t.payload,P.MyOSAgentEventSchema),c=r.nodeToSchemaOutput(n,P.MyOSAgentChannelSchema);return{myosAgentEvent:a,myosAgentChannel:c}}isAgentMatch(t,n){var a;const o=t.agentId,r=(a=n.agent)==null?void 0:a.agentId;return E(o)&&E(r)&&o===r}isEventPatternMatch(t,n,o){const r=n.event;if(!r)return!0;const a=t.event;if(!a)return!1;try{const c=o.getBlue(),i=c.nodeToJson(a),h=c.nodeToJson(r);return T.deepContains(i,h)}catch(c){return console.warn("Error during event pattern matching:",c),!1}}}class ae{constructor(){l(this,"contractType","Operation");l(this,"contractBlueId",d.blueIds.Operation);l(this,"role","adapter")}supports(e,t,n,o){const a=n.getBlue().nodeToSchemaOutput(t,d.OperationSchema),c=this.parseEventPayload(e,n);return E(c==null?void 0:c.operation)&&c.operation===o&&e.source==="channel"&&e.channelName===a.channel}async handle(e,t,n,o){n.emitEvent({payload:e.payload,channelName:o,source:"channel"})}parseEventPayload(e,t){const n=t.getBlue();if(n.isTypeOf(e.payload,d.TimelineEntrySchema,{checkSchemaExtensions:!0})){const o=n.nodeToSchemaOutput(e.payload,d.TimelineEntrySchema);if(o.message)return n.nodeToSchemaOutput(o.message,d.OperationRequestSchema)}return null}}class se{constructor(){l(this,"contractType","Process Embedded");l(this,"role","adapter");l(this,"contractBlueId",d.blueIds["Process Embedded"])}supports(e){return e.source!=="channel"}handle(e,t,n){const o=n.getBlue().nodeToSchemaOutput(t,d.ProcessEmbeddedSchema);for(const r of o.paths??[])n.emitEvent({...e,dispatchPath:n.resolvePath(r)})}}const ce=!process.env.SKIP_ISOLATED_VM;let w=null;if(ce)try{w=require("isolated-vm")}catch{console.warn("isolated-vm not available, using fallback evaluation method")}function z(s){return/\bimport\s.+\sfrom\s+['"][^'"]+['"]/.test(s)||/\bexport\s+/.test(s)}class D{static async evaluate({code:e,ctx:t,bindings:n={},options:o={}}){return!w||!ce?this.evaluateSimple(e,n,o):this.evaluateSecure(e,n,t,o)}static async evaluateSimple(e,t,n={}){if(z(e))throw new Error("Static import/export syntax requires isolated-vm – start Node without SKIP_ISOLATED_VM.");try{if(n.isCodeBlock){const o=Object.keys(t);return await(await new Function(...o,`return async function codeBlock(${o.join(", ")}) { ${e} }`)(...o.map(c=>t[c])))(...o.map(c=>t[c]))}else return new Function(...Object.keys(t),`return ${e};`)(...Object.values(t))}catch(o){throw n.isCodeBlock?new $(e,o):new q(e,o)}}static async evaluateSecure(e,t,n,o={}){if(!w)throw new Error("isolated-vm not available");const r=new w.Isolate({memoryLimit:32}),a=await r.createContext(),c=a.global;try{await this.setupIsolateEnvironment(c,t);const i=new Map,h=this.createModuleResolver(r,a,i,n);let u;return z(e)?u=await this.evaluateESModule(r,a,e,o,h):u=await this.evaluateSimpleScript(r,a,e,t,o),this.deepClone(u)}catch(i){throw o.isCodeBlock?new $(e,i):new q(e,i)}finally{a.release(),r.dispose()}}static async setupIsolateEnvironment(e,t){if(!w)throw new Error("isolated-vm not available");const n=new w.Callback((...r)=>console.log(...r)),o=new w.ExternalCopy({log:n}).copyInto();await e.set("console",o);for(const[r,a]of Object.entries(t))typeof a=="function"?await e.set(r,new w.Callback(a)):await e.set(r,new w.ExternalCopy(a).copyInto())}static createModuleResolver(e,t,n,o){return async r=>{if(n.has(r))return n.get(r);if(r.startsWith("blue:")){const a=r.slice(5),c=o.loadBlueContent;if(typeof c!="function")throw new Error(`ProcessingContext is missing a loadBlueContent(blueId) implementation (needed for ${r})`);const i=await c(a),h=await e.compileModule(i);return n.set(r,h),await h.instantiate(t,this.createModuleResolver(e,t,n,o)),h}if(/^https?:\/\//.test(r)){let a;if(typeof o.loadExternalModule=="function")a=await o.loadExternalModule(r);else throw new Error(`ProcessingContext is missing a loadExternalModule(url) implementation (needed for ${r})`);const c=await e.compileModule(a);return n.set(r,c),await c.instantiate(t,this.createModuleResolver(e,t,n,o)),c}throw new Error(`Unsupported module specifier "${r}"`)}}static async evaluateSimpleScript(e,t,n,o,r){const a=Object.keys(o).join(", "),c=Object.keys(o).map(u=>u),i=`(async (${a}) => { ${r.isCodeBlock?n:`return (${n});`} })(${c.join(", ")})`;return await(await e.compileScript(i)).run(t,{timeout:r.timeout??500,promise:!0,copy:!0,release:!0})}static async evaluateESModule(e,t,n,o,r){let a=n;if(o.isCodeBlock){const h=/^\s*(import\s.+?;|export\s.+?;)/gm,u=(n.match(h)||[]).join(`
|
|
2
|
+
`),m=n.replace(h,"").trim();a=`
|
|
3
3
|
${u}
|
|
4
4
|
const run = function() {
|
|
5
|
-
${
|
|
5
|
+
${m}
|
|
6
6
|
};
|
|
7
7
|
export default run();
|
|
8
|
-
`}const c=await e.compileModule(a);return await c.instantiate(t,r),await c.evaluate({timeout:o.timeout??500,promise:!0,reference:!0,release:!0}),await c.namespace.get("default",{timeout:o.timeout??500,promise:!0,copy:!0,release:!0})}static deepClone(e){return typeof e>"u"?e:JSON.parse(JSON.stringify(e))}}class
|
|
8
|
+
`}const c=await e.compileModule(a);return await c.instantiate(t,r),await c.evaluate({timeout:o.timeout??500,promise:!0,reference:!0,release:!0}),await c.namespace.get("default",{timeout:o.timeout??500,promise:!0,copy:!0,release:!0})}static deepClone(e){return typeof e>"u"?e:JSON.parse(JSON.stringify(e))}}class A{static createStandardBindings(e,t,n){const o=e.getBlue(),r=o.nodeToJson(t.payload,"simple"),a=p.isBigNumber(r)?r.toNumber():r;return{document:c=>{const i=e.get(c);return p.isBigNumber(i)?i.toNumber():C(i)?o.nodeToJson(i,"original"):i},event:a,steps:n}}}function R(s,e){const{op:t,path:n,val:o,from:r}=s;if((t==="move"||t==="copy")&&!r)throw new Error(`${t} operation requires 'from' path`);if((t==="add"||t==="replace")&&o===void 0)throw new Error(`${t} operation requires 'val' property`);const a={type:"Document Update",op:t,path:n};return o!==void 0&&(a.val=o),r!==void 0&&(a.from=r),e.jsonValueToNode(a)}function Me(s){return s.jsonValueToNode({type:"Document Processing Initiated"})}const qe=/^\$\{(.*)\}$/,O=s=>typeof s!="string"?!1:qe.test(s),H=s=>{if(!O(s))throw new Error(`Invalid expression: ${s}`);return s.slice(2,-1)};class $e{constructor(){l(this,"stepType","Update Document")}supports(e){return p.BlueNodeTypeSchema.isTypeOf(e,d.UpdateDocumentSchema)}async execute(e,t,n,o,r){const a=n.getBlue();if(!p.BlueNodeTypeSchema.isTypeOf(e,d.UpdateDocumentSchema))return;const c=await this.evaluateChangeset(e.get("/changeset"),n,t,r),i=p.applyBlueNodePatch(e,{op:"replace",path:"/changeset",val:c}),h=n.getBlue().nodeToSchemaOutput(i,d.UpdateDocumentSchema);for(const u of h.changeset??[]){if(!u.path)continue;const m=u.val;if((u.op==="replace"||u.op==="add")&&T.isNonNullable(m)){const f=await this.evaluateChangeValue(m,n,t,r);n.addPatch({op:u.op,path:u.path,val:f}),n.emitEvent({payload:R({op:u.op,path:n.resolvePath(u.path),val:a.nodeToJson(f,"original")},a)})}u.op==="remove"&&(n.addPatch({op:u.op,path:u.path}),n.emitEvent({payload:R({op:u.op,path:n.resolvePath(u.path),val:null},a)}))}}async evaluateChangeset(e,t,n,o){const r=t.getBlue();if(O(e)){const a=H(e),c=await D.evaluate({code:a,ctx:t,bindings:A.createStandardBindings(t,n,o)});return r.jsonValueToNode(c??null)}if(C(e))return e;throw new Error("Invalid changeset: expected a string or document node")}async evaluateChangeValue(e,t,n,o){const r=e.getValue(),a=t.getBlue();if(O(r)){const c=H(r),i=await D.evaluate({code:c,ctx:t,bindings:A.createStandardBindings(t,n,o)});return a.jsonValueToNode(i??null)}return e}}class De{constructor(){l(this,"stepType","Trigger Event")}supports(e){return p.BlueNodeTypeSchema.isTypeOf(e,d.TriggerEventSchema)}async execute(e,t,n){const o=n.getBlue();if(!p.BlueNodeTypeSchema.isTypeOf(e,d.TriggerEventSchema))return;const r=o.nodeToSchemaOutput(e,d.TriggerEventSchema);r.event&&n.emitEvent({payload:r.event})}}class Ae{constructor(){l(this,"stepType","JavaScript Code")}supports(e){return p.BlueNodeTypeSchema.isTypeOf(e,d.JavaScriptCodeSchema)}async execute(e,t,n,o,r){if(!p.BlueNodeTypeSchema.isTypeOf(e,d.JavaScriptCodeSchema))return;const a=n.getBlue(),c=a.nodeToSchemaOutput(e,d.JavaScriptCodeSchema);if(!c.code)throw new Error("JavaScript code is required");const i=await D.evaluate({code:c.code,ctx:n,bindings:A.createStandardBindings(n,t,r),options:{isCodeBlock:!0,timeout:500}});if(i&&typeof i=="object"&&"events"in i){const h=i;if(Array.isArray(h.events))for(const u of h.events)n.emitEvent({payload:a.jsonValueToNode(u)})}return i}}const je=[new $e,new De,new Ae];class V{constructor(e=je){l(this,"contractType","Sequential Workflow");l(this,"contractBlueId",d.blueIds["Sequential Workflow"]);l(this,"role","handler");l(this,"executors",[]);this.executors=e}registerExecutor(e){this.executors.push(e)}supports(e,t,n){const a=n.getBlue().nodeToSchemaOutput(t,d.SequentialWorkflowSchema).channel;return e.source==="channel"&&e.channelName===a}async handle(e,t,n,o){var c;const r={},a=(c=t.getProperties())==null?void 0:c.steps.getItems();for(const[i,h]of(a??[]).entries()){const u=this.executors.find(f=>f.supports(h));if(!u)throw new Error(`Unsupported workflow step type "${h.getType()}"`);const m=await u.execute(h,e,n,o,r);if(m!==void 0){const f=h.getName(),y=typeof f=="string"?f:`Step${i+1}`;r[y]=m}await n.flush()}}}class ie{constructor(e){l(this,"contractType","Sequential Workflow Operation");l(this,"contractBlueId",d.blueIds["Sequential Workflow Operation"]);l(this,"role","handler");l(this,"sequentialWorkflowProcessor");this.sequentialWorkflowProcessor=e||new V}supports(e,t,n){const a=n.getBlue().nodeToSchemaOutput(t,d.SequentialWorkflowOperationSchema).operation,c=e.channelName;return e.source==="channel"&&T.isNonNullable(c)&&T.isNonNullable(a)&&c===a}async handle(e,t,n,o){try{await this.sequentialWorkflowProcessor.handle(e,t,n,o)}catch(r){throw console.error("Error in SequentialWorkflowOperationProcessor.handle:",r),r}}}const Q=s=>p.BlueNodeTypeSchema.isTypeOf(s.payload,d.TimelineEntrySchema);class le extends k{constructor(){super(...arguments);l(this,"contractType","Timeline Channel");l(this,"contractBlueId",d.blueIds["Timeline Channel"])}supports(t,n,o){var u;if(!this.baseSupports(t)||!Q(t))return!1;const a=o.getBlue().nodeToSchemaOutput(t.payload,d.TimelineEntrySchema),c=o.getBlue().nodeToSchemaOutput(n,d.TimelineChannelSchema),i=(u=a.timeline)==null?void 0:u.timelineId;return E(c.timelineId)&&E(i)&&i===c.timelineId}handle(t,n,o,r){Q(t)&&o.emitEvent({payload:t.payload,channelName:r,source:"channel"})}}const xe=[new se,new ee,new G,new le,new oe,new re,new Z,new ne,new ae,new V,new ie,new te];class Ve{constructor(e,t=xe){l(this,"taskCounter",0);l(this,"eventCounter",0);l(this,"registry");l(this,"queue");l(this,"router");l(this,"checkpointCache",new Oe);this.blue=e,this.registry=new Te(t),this.queue=new Pe,this.router=new Ie(this.blue,this.registry,this.queue,()=>++this.taskCounter,()=>++this.eventCounter),this.register(new Y(this.checkpointCache),9999)}register(e,t){this.registry.register(e,t)}async initialize(e){let t=U(N(e),this.blue);const n={payload:Me(this.blue)},o=[n.payload];await this.router.route(t,[],n,0);const r=await this.drainQueue(t);return t=r.state,o.push(...r.emitted),t=Be(t,this.blue),{state:B(t),emitted:o}}async processEvents(e,t){let n=U(N(e),this.blue);const o=[];if(!X(n,this.blue))throw new Error("Document is not initialized");for(const r of t)try{const a={payload:r,source:"external"};await this.router.route(n,[],a,0);const c=await this.drainQueue(n);n=c.state,o.push(...c.emitted);const i=this.checkpointCache.flush(n);i.length&&(n=_(n,i))}finally{this.checkpointCache.clear()}return{state:B(n),emitted:o}}async drainQueue(e){var a;let t=e;const n=[],o=1e4;let r=0;for(;this.queue.length;){if(++r>o)throw new Error("Possible cycle – too many iterations");const c=this.queue.pop(),{nodePath:i,contractName:h,contractNode:u,event:m}=c,f=t.get(i);if(!C(f)||!((a=f.getContracts())!=null&&a[h])||!u.getType())continue;const y=this.registry.get(u.getType());if(!y){console.warn(`No processor registered for contract: ${h}`);continue}const v=new K(()=>t,c,this.blue,async b=>{for(const g of b)if(g.kind==="patch"){const he=M(t,this.blue);for(const I of he){const de=g.patch.op==="move"||g.patch.op==="copy"?[g.patch.from,g.patch.path]:[g.patch.path],W=v.getNodePath(),pe=de.some(fe=>J(fe,I.absPath)),me=J(W,I.absPath);if(pe&&!me)throw new x(g.patch,I.absPath,W)}try{t=_(t,[g.patch])}catch(I){throw Ne(h,m,I),I}}else g.kind==="event"&&(n.push(g.event.payload),await this.router.route(t,[],g.event,c.key[5]))});await y.handle(m,u,v,h),await v.flush()}return{state:t,emitted:n}}}class ue{process(e,t){const n=t.getValue();if(O(n)){const o=t.clone();return o.setValue(n),o.setProperties(void 0),o.setItems(void 0),o.setType(void 0),o}return e}postProcess(e,t){const n=t.getValue();if(O(n)&&e.getValue()!==n&&n!==void 0){const o=e.clone();return o.setValue(n),o}return e}}const We=Object.freeze(Object.defineProperty({__proto__:null,ExpressionPreserver:ue},Symbol.toStringTag,{value:"Module"}));function Je(){return new p.MergingProcessors.SequentialMergingProcessor([new p.MergingProcessors.ValuePropagator,new ue,new p.MergingProcessors.TypeAssigner,new p.MergingProcessors.ListProcessor,new p.MergingProcessors.DictionaryProcessor,new p.MergingProcessors.BasicTypesVerifier])}exports.BlueDocumentProcessor=Ve;exports.ChannelEventCheckpointProcessor=Y;exports.CodeBlockEvaluationError=$;exports.CompositeTimelineChannelProcessor=Z;exports.DocumentUpdateChannelProcessor=G;exports.EmbeddedDocumentModificationError=x;exports.EmbeddedNodeChannelProcessor=ee;exports.ExpressionEvaluationError=q;exports.InitializedMarkerProcessor=te;exports.LifecycleEventChannelProcessor=ne;exports.MergingProcessors=We;exports.MyOSAgentChannelProcessor=re;exports.MyOSTimelineChannelProcessor=oe;exports.OperationProcessor=ae;exports.PatchApplicationError=j;exports.ProcessEmbeddedProcessor=se;exports.SequentialWorkflowOperationProcessor=ie;exports.SequentialWorkflowProcessor=V;exports.TimelineChannelProcessor=le;exports.collectEmbeddedPathSpecs=M;exports.createDefaultMergingProcessor=Je;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var me = Object.defineProperty;
|
|
2
2
|
var ye = (s, e, t) => e in s ? me(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
3
|
var l = (s, e, t) => ye(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { ProcessEmbeddedSchema as D, ChannelEventCheckpointSchema as ge, blueIds as
|
|
5
|
-
import { applyBlueNodePatch as G,
|
|
4
|
+
import { ProcessEmbeddedSchema as D, ChannelEventCheckpointSchema as ge, blueIds as f, InitializedMarkerSchema as Ee, CompositeTimelineChannelSchema as we, DocumentUpdateChannelSchema as ve, EmbeddedNodeChannelSchema as _, LifecycleEventSchema as be, TimelineEntrySchema as N, OperationSchema as Te, OperationRequestSchema as Pe, UpdateDocumentSchema as $, TriggerEventSchema as q, JavaScriptCodeSchema as A, SequentialWorkflowSchema as Se, SequentialWorkflowOperationSchema as Ce, TimelineChannelSchema as ke } from "@blue-repository/core-dev";
|
|
5
|
+
import { applyBlueNodePatch as G, BlueNode as Ie, isBigNumber as x, BlueNodeTypeSchema as b, ResolvedBlueNode as Ne, MergingProcessors as k } from "@blue-labs/language";
|
|
6
6
|
import { deepFreeze as Be, isNonNullable as M, deepContains as ee } from "@blue-labs/shared-utils";
|
|
7
7
|
import { blueIds as te, MyOSTimelineEntrySchema as ne, MyOSTimelineChannelSchema as Oe, MyOSAgentEventSchema as Me, MyOSAgentChannelSchema as $e } from "@blue-repository/myos-dev";
|
|
8
8
|
const qe = (s, e) => ({
|
|
@@ -13,7 +13,7 @@ async function Ae(s) {
|
|
|
13
13
|
qe().on("error", t).end();
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
const
|
|
16
|
+
const v = (...s) => s.map((e, t) => {
|
|
17
17
|
if (typeof e != "string") return "";
|
|
18
18
|
if (t === 0 && e === "/") return "/";
|
|
19
19
|
const n = t > 0 ? e.replace(/^\/+/, "") : e;
|
|
@@ -25,7 +25,7 @@ class oe {
|
|
|
25
25
|
this.getDocument = e, this.taskInfo = t, this.blue = n, this.onFlush = o;
|
|
26
26
|
}
|
|
27
27
|
get(e) {
|
|
28
|
-
const t = this.getDocument(), n =
|
|
28
|
+
const t = this.getDocument(), n = v(this.taskInfo.nodePath, e);
|
|
29
29
|
return t.get(n);
|
|
30
30
|
}
|
|
31
31
|
addPatch(e) {
|
|
@@ -33,7 +33,7 @@ class oe {
|
|
|
33
33
|
kind: "patch",
|
|
34
34
|
patch: {
|
|
35
35
|
...e,
|
|
36
|
-
path:
|
|
36
|
+
path: v(this.taskInfo.nodePath, e.path)
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -56,7 +56,7 @@ class oe {
|
|
|
56
56
|
return this.taskInfo.nodePath;
|
|
57
57
|
}
|
|
58
58
|
resolvePath(e) {
|
|
59
|
-
return
|
|
59
|
+
return v(this.taskInfo.nodePath, e);
|
|
60
60
|
}
|
|
61
61
|
getTaskInfo() {
|
|
62
62
|
return this.taskInfo;
|
|
@@ -105,22 +105,24 @@ function B(s) {
|
|
|
105
105
|
function W(s, e, t = "/", n = []) {
|
|
106
106
|
const o = s.getContracts() ?? {};
|
|
107
107
|
for (const [r, a] of Object.entries(o))
|
|
108
|
-
if (
|
|
109
|
-
a,
|
|
110
|
-
D
|
|
111
|
-
)) {
|
|
108
|
+
if (e.isTypeOf(a, D)) {
|
|
112
109
|
const h = e.nodeToSchemaOutput(
|
|
113
110
|
a,
|
|
114
111
|
D
|
|
115
112
|
).paths ?? [];
|
|
116
113
|
for (const u of h)
|
|
117
114
|
n.push({
|
|
118
|
-
absPath:
|
|
119
|
-
contractPath:
|
|
115
|
+
absPath: v(t, u),
|
|
116
|
+
contractPath: v(t, `contracts/${r}`)
|
|
120
117
|
});
|
|
121
118
|
}
|
|
122
119
|
for (const [r, a] of Object.entries(s.getProperties() ?? {}))
|
|
123
|
-
W(
|
|
120
|
+
W(
|
|
121
|
+
a,
|
|
122
|
+
e,
|
|
123
|
+
v(t, r),
|
|
124
|
+
n
|
|
125
|
+
);
|
|
124
126
|
return n;
|
|
125
127
|
}
|
|
126
128
|
function z(s, e) {
|
|
@@ -137,10 +139,10 @@ function U(s, e) {
|
|
|
137
139
|
}
|
|
138
140
|
return I(t);
|
|
139
141
|
}
|
|
140
|
-
function
|
|
142
|
+
function g(s) {
|
|
141
143
|
return s != null;
|
|
142
144
|
}
|
|
143
|
-
function
|
|
145
|
+
function P(s) {
|
|
144
146
|
return s instanceof Ie;
|
|
145
147
|
}
|
|
146
148
|
class De {
|
|
@@ -385,8 +387,8 @@ class Fe {
|
|
|
385
387
|
return this.route(e, h, n, o, r);
|
|
386
388
|
}
|
|
387
389
|
}
|
|
388
|
-
const a =
|
|
389
|
-
|
|
390
|
+
const a = v("/", t.join("/")), c = e.get(a);
|
|
391
|
+
P(c) && await this.traverseContracts({
|
|
390
392
|
doc: e,
|
|
391
393
|
node: c,
|
|
392
394
|
nodePath: a,
|
|
@@ -424,15 +426,15 @@ class Fe {
|
|
|
424
426
|
contractName: h,
|
|
425
427
|
contractNode: u,
|
|
426
428
|
event: r
|
|
427
|
-
},
|
|
428
|
-
if (d.supports(r, u,
|
|
429
|
+
}, m = new oe(() => t, p, this.blue);
|
|
430
|
+
if (d.supports(r, u, m, h))
|
|
429
431
|
switch (d.role) {
|
|
430
432
|
case "adapter":
|
|
431
433
|
await this.processAdapter({
|
|
432
434
|
cp: d,
|
|
433
435
|
event: r,
|
|
434
436
|
contractNode: u,
|
|
435
|
-
ctx:
|
|
437
|
+
ctx: m,
|
|
436
438
|
contractName: h,
|
|
437
439
|
doc: t,
|
|
438
440
|
afterTaskId: a,
|
|
@@ -456,7 +458,7 @@ class Fe {
|
|
|
456
458
|
* Processes an adapter contract and routes any emitted events
|
|
457
459
|
*/
|
|
458
460
|
async processAdapter(e) {
|
|
459
|
-
var
|
|
461
|
+
var w;
|
|
460
462
|
const {
|
|
461
463
|
cp: t,
|
|
462
464
|
event: n,
|
|
@@ -471,18 +473,18 @@ class Fe {
|
|
|
471
473
|
throw new Error("Adapter recursion limit reached");
|
|
472
474
|
const u = this.traceManager.addHop(
|
|
473
475
|
n,
|
|
474
|
-
((
|
|
476
|
+
((w = r.getTaskInfo()) == null ? void 0 : w.nodePath) ?? "",
|
|
475
477
|
a
|
|
476
478
|
);
|
|
477
479
|
await t.handle(u, o, r, a);
|
|
478
480
|
const d = await r.flush();
|
|
479
|
-
if (d.find((
|
|
481
|
+
if (d.find((T) => T.kind === "patch"))
|
|
480
482
|
throw new Error(
|
|
481
483
|
`Contract "${a}" (adapter) attempted to patch the document`
|
|
482
484
|
);
|
|
483
|
-
const
|
|
484
|
-
for (const
|
|
485
|
-
await this.route(c, [],
|
|
485
|
+
const m = d.filter((T) => T.kind === "event");
|
|
486
|
+
for (const T of m)
|
|
487
|
+
await this.route(c, [], T.event, i, h + 1);
|
|
486
488
|
}
|
|
487
489
|
/**
|
|
488
490
|
* Schedules a handler contract for future execution
|
|
@@ -493,20 +495,20 @@ class Fe {
|
|
|
493
495
|
console.warn(`Contract node type is not defined for: ${n}`);
|
|
494
496
|
return;
|
|
495
497
|
}
|
|
496
|
-
const h = this.registry.orderOf(i), u = t.get("/order"), d = x(u) ? u.toNumber() : 0, p = this.getNextTaskId() + c,
|
|
498
|
+
const h = this.registry.orderOf(i), u = t.get("/order"), d = x(u) ? u.toNumber() : 0, p = this.getNextTaskId() + c, m = xe(
|
|
497
499
|
a,
|
|
498
500
|
r.seq,
|
|
499
501
|
h,
|
|
500
502
|
d,
|
|
501
503
|
n,
|
|
502
504
|
p
|
|
503
|
-
),
|
|
505
|
+
), w = this.traceManager.addHop(r, o, n);
|
|
504
506
|
this.queue.push({
|
|
505
|
-
key:
|
|
507
|
+
key: m,
|
|
506
508
|
nodePath: o,
|
|
507
509
|
contractName: n,
|
|
508
510
|
contractNode: t,
|
|
509
|
-
event:
|
|
511
|
+
event: w
|
|
510
512
|
});
|
|
511
513
|
}
|
|
512
514
|
/**
|
|
@@ -524,9 +526,9 @@ const Le = (s, e, t) => {
|
|
|
524
526
|
};
|
|
525
527
|
function R(s, e) {
|
|
526
528
|
const t = B(s), n = (o) => {
|
|
527
|
-
if (!
|
|
529
|
+
if (!P(o)) return;
|
|
528
530
|
const r = o.getContracts();
|
|
529
|
-
(!(r != null && r.checkpoint) || !
|
|
531
|
+
(!(r != null && r.checkpoint) || !b.isTypeOf(
|
|
530
532
|
r.checkpoint,
|
|
531
533
|
ge
|
|
532
534
|
)) && o.addContract(
|
|
@@ -534,7 +536,7 @@ function R(s, e) {
|
|
|
534
536
|
e.jsonValueToNode({
|
|
535
537
|
type: {
|
|
536
538
|
name: "Channel Event Checkpoint",
|
|
537
|
-
blueId:
|
|
539
|
+
blueId: f["Channel Event Checkpoint"]
|
|
538
540
|
},
|
|
539
541
|
lastEvents: {}
|
|
540
542
|
})
|
|
@@ -543,18 +545,18 @@ function R(s, e) {
|
|
|
543
545
|
n(t);
|
|
544
546
|
for (const { absPath: o } of W(t, e)) {
|
|
545
547
|
const r = t.get(o);
|
|
546
|
-
|
|
548
|
+
P(r) && n(r);
|
|
547
549
|
}
|
|
548
550
|
return I(t);
|
|
549
551
|
}
|
|
550
552
|
function ze(s, e) {
|
|
551
553
|
const t = B(s);
|
|
552
|
-
return
|
|
554
|
+
return P(t) && (se(t, e) || t.addContract(
|
|
553
555
|
"initialized",
|
|
554
556
|
e.jsonValueToNode({
|
|
555
557
|
type: {
|
|
556
558
|
name: "Initialized Marker",
|
|
557
|
-
blueId:
|
|
559
|
+
blueId: f["Initialized Marker"]
|
|
558
560
|
}
|
|
559
561
|
})
|
|
560
562
|
)), I(t);
|
|
@@ -570,7 +572,7 @@ function se(s, e) {
|
|
|
570
572
|
class Ue {
|
|
571
573
|
constructor(e) {
|
|
572
574
|
l(this, "contractType", "Channel Event Checkpoint");
|
|
573
|
-
l(this, "contractBlueId",
|
|
575
|
+
l(this, "contractBlueId", f["Channel Event Checkpoint"]);
|
|
574
576
|
l(this, "role", "handler");
|
|
575
577
|
this.cache = e;
|
|
576
578
|
}
|
|
@@ -612,7 +614,7 @@ class Re {
|
|
|
612
614
|
const t = [];
|
|
613
615
|
for (const { docBase: n, event: o, eventBlueId: r } of this.firstSeen.values()) {
|
|
614
616
|
if (!o.channelName) continue;
|
|
615
|
-
const a =
|
|
617
|
+
const a = v(
|
|
616
618
|
n,
|
|
617
619
|
"contracts/checkpoint/lastEvents",
|
|
618
620
|
o.channelName
|
|
@@ -649,7 +651,7 @@ class He extends S {
|
|
|
649
651
|
constructor() {
|
|
650
652
|
super(...arguments);
|
|
651
653
|
l(this, "contractType", "Composite Timeline Channel");
|
|
652
|
-
l(this, "contractBlueId",
|
|
654
|
+
l(this, "contractBlueId", f["Composite Timeline Channel"]);
|
|
653
655
|
}
|
|
654
656
|
supports(t, n, o) {
|
|
655
657
|
const r = o.getBlue().nodeToSchemaOutput(n, we);
|
|
@@ -667,7 +669,7 @@ class Qe extends S {
|
|
|
667
669
|
constructor() {
|
|
668
670
|
super(...arguments);
|
|
669
671
|
l(this, "contractType", "Document Update Channel");
|
|
670
|
-
l(this, "contractBlueId",
|
|
672
|
+
l(this, "contractBlueId", f["Document Update Channel"]);
|
|
671
673
|
}
|
|
672
674
|
supports(t, n, o, r) {
|
|
673
675
|
if (!this.baseSupports(t)) return !1;
|
|
@@ -689,16 +691,16 @@ class Ke extends S {
|
|
|
689
691
|
constructor() {
|
|
690
692
|
super(...arguments);
|
|
691
693
|
l(this, "contractType", "Embedded Node Channel");
|
|
692
|
-
l(this, "contractBlueId",
|
|
694
|
+
l(this, "contractBlueId", f["Embedded Node Channel"]);
|
|
693
695
|
}
|
|
694
696
|
supports(t, n, o) {
|
|
695
697
|
if (!this.baseSupports(t)) return !1;
|
|
696
698
|
const r = o.getBlue().nodeToSchemaOutput(n, _);
|
|
697
|
-
return
|
|
699
|
+
return g(t.originNodePath) && g(r.path) && t.originNodePath === o.resolvePath(r.path);
|
|
698
700
|
}
|
|
699
701
|
handle(t, n, o, r) {
|
|
700
702
|
const a = o.getBlue().nodeToSchemaOutput(n, _), { originNodePath: c, payload: i } = t;
|
|
701
|
-
|
|
703
|
+
g(a.path) && c === o.resolvePath(a.path) && o.emitEvent({
|
|
702
704
|
payload: i,
|
|
703
705
|
channelName: r,
|
|
704
706
|
source: "channel"
|
|
@@ -708,7 +710,7 @@ class Ke extends S {
|
|
|
708
710
|
class Xe {
|
|
709
711
|
constructor() {
|
|
710
712
|
l(this, "contractType", "Initialized Marker");
|
|
711
|
-
l(this, "contractBlueId",
|
|
713
|
+
l(this, "contractBlueId", f["Initialized Marker"]);
|
|
712
714
|
l(this, "role", "marker");
|
|
713
715
|
}
|
|
714
716
|
supports() {
|
|
@@ -721,7 +723,7 @@ class Ye extends S {
|
|
|
721
723
|
constructor() {
|
|
722
724
|
super(...arguments);
|
|
723
725
|
l(this, "contractType", "Lifecycle Event Channel");
|
|
724
|
-
l(this, "contractBlueId",
|
|
726
|
+
l(this, "contractBlueId", f["Lifecycle Event Channel"]);
|
|
725
727
|
}
|
|
726
728
|
supports(t, n, o) {
|
|
727
729
|
return !this.baseSupports(t) || !this.isLifecycleEvent(t, o) ? !1 : this.isEventPatternMatch(t, n, o);
|
|
@@ -769,13 +771,13 @@ class Ze extends S {
|
|
|
769
771
|
l(this, "contractBlueId", te["MyOS Timeline Channel"]);
|
|
770
772
|
}
|
|
771
773
|
supports(t, n, o) {
|
|
772
|
-
var
|
|
774
|
+
var u;
|
|
773
775
|
if (!this.baseSupports(t) || !Q(t, o)) return !1;
|
|
774
776
|
const a = o.getBlue().nodeToSchemaOutput(
|
|
775
777
|
t.payload,
|
|
776
778
|
ne
|
|
777
|
-
), c = o.getBlue().nodeToSchemaOutput(n, Oe), i = (
|
|
778
|
-
return
|
|
779
|
+
), c = o.getBlue().nodeToSchemaOutput(n, Oe), i = (u = a.timeline) == null ? void 0 : u.timelineId;
|
|
780
|
+
return g(c.timelineId) && g(i) && i === c.timelineId;
|
|
779
781
|
}
|
|
780
782
|
handle(t, n, o, r) {
|
|
781
783
|
Q(t, o) && o.emitEvent({
|
|
@@ -834,7 +836,7 @@ class Ge extends S {
|
|
|
834
836
|
isAgentMatch(t, n) {
|
|
835
837
|
var a;
|
|
836
838
|
const o = t.agentId, r = (a = n.agent) == null ? void 0 : a.agentId;
|
|
837
|
-
return
|
|
839
|
+
return g(o) && g(r) && o === r;
|
|
838
840
|
}
|
|
839
841
|
/**
|
|
840
842
|
* Checks if the event pattern matches the channel's event filter
|
|
@@ -867,12 +869,12 @@ class Ge extends S {
|
|
|
867
869
|
class et {
|
|
868
870
|
constructor() {
|
|
869
871
|
l(this, "contractType", "Operation");
|
|
870
|
-
l(this, "contractBlueId",
|
|
872
|
+
l(this, "contractBlueId", f.Operation);
|
|
871
873
|
l(this, "role", "adapter");
|
|
872
874
|
}
|
|
873
875
|
supports(e, t, n, o) {
|
|
874
|
-
const a = n.getBlue().nodeToSchemaOutput(t,
|
|
875
|
-
return
|
|
876
|
+
const a = n.getBlue().nodeToSchemaOutput(t, Te), c = this.parseEventPayload(e, n);
|
|
877
|
+
return g(c == null ? void 0 : c.operation) && c.operation === o && e.source === "channel" && e.channelName === a.channel;
|
|
876
878
|
}
|
|
877
879
|
async handle(e, t, n, o) {
|
|
878
880
|
n.emitEvent({
|
|
@@ -893,7 +895,7 @@ class et {
|
|
|
893
895
|
if (o.message)
|
|
894
896
|
return n.nodeToSchemaOutput(
|
|
895
897
|
o.message,
|
|
896
|
-
|
|
898
|
+
Pe
|
|
897
899
|
);
|
|
898
900
|
}
|
|
899
901
|
return null;
|
|
@@ -903,7 +905,7 @@ class tt {
|
|
|
903
905
|
constructor() {
|
|
904
906
|
l(this, "contractType", "Process Embedded");
|
|
905
907
|
l(this, "role", "adapter");
|
|
906
|
-
l(this, "contractBlueId",
|
|
908
|
+
l(this, "contractBlueId", f["Process Embedded"]);
|
|
907
909
|
}
|
|
908
910
|
supports(e) {
|
|
909
911
|
return e.source !== "channel";
|
|
@@ -1115,7 +1117,7 @@ class V {
|
|
|
1115
1117
|
return {
|
|
1116
1118
|
document: (c) => {
|
|
1117
1119
|
const i = e.get(c);
|
|
1118
|
-
return x(i) ? i.toNumber() :
|
|
1120
|
+
return x(i) ? i.toNumber() : P(i) ? o.nodeToJson(i, "original") : i;
|
|
1119
1121
|
},
|
|
1120
1122
|
event: a,
|
|
1121
1123
|
steps: n
|
|
@@ -1150,11 +1152,11 @@ class rt {
|
|
|
1150
1152
|
l(this, "stepType", "Update Document");
|
|
1151
1153
|
}
|
|
1152
1154
|
supports(e) {
|
|
1153
|
-
return
|
|
1155
|
+
return b.isTypeOf(e, $);
|
|
1154
1156
|
}
|
|
1155
1157
|
async execute(e, t, n, o, r) {
|
|
1156
1158
|
const a = n.getBlue();
|
|
1157
|
-
if (!
|
|
1159
|
+
if (!b.isTypeOf(e, $)) return;
|
|
1158
1160
|
const c = await this.evaluateChangeset(
|
|
1159
1161
|
e.get("/changeset"),
|
|
1160
1162
|
n,
|
|
@@ -1216,7 +1218,7 @@ class rt {
|
|
|
1216
1218
|
});
|
|
1217
1219
|
return r.jsonValueToNode(c ?? null);
|
|
1218
1220
|
}
|
|
1219
|
-
if (
|
|
1221
|
+
if (P(e))
|
|
1220
1222
|
return e;
|
|
1221
1223
|
throw new Error("Invalid changeset: expected a string or document node");
|
|
1222
1224
|
}
|
|
@@ -1242,11 +1244,11 @@ class at {
|
|
|
1242
1244
|
l(this, "stepType", "Trigger Event");
|
|
1243
1245
|
}
|
|
1244
1246
|
supports(e) {
|
|
1245
|
-
return
|
|
1247
|
+
return b.isTypeOf(e, q);
|
|
1246
1248
|
}
|
|
1247
1249
|
async execute(e, t, n) {
|
|
1248
1250
|
const o = n.getBlue();
|
|
1249
|
-
if (!
|
|
1251
|
+
if (!b.isTypeOf(e, q)) return;
|
|
1250
1252
|
const r = o.nodeToSchemaOutput(e, q);
|
|
1251
1253
|
r.event && n.emitEvent({
|
|
1252
1254
|
payload: r.event
|
|
@@ -1258,10 +1260,10 @@ class st {
|
|
|
1258
1260
|
l(this, "stepType", "JavaScript Code");
|
|
1259
1261
|
}
|
|
1260
1262
|
supports(e) {
|
|
1261
|
-
return
|
|
1263
|
+
return b.isTypeOf(e, A);
|
|
1262
1264
|
}
|
|
1263
1265
|
async execute(e, t, n, o, r) {
|
|
1264
|
-
if (!
|
|
1266
|
+
if (!b.isTypeOf(e, A)) return;
|
|
1265
1267
|
const a = n.getBlue(), c = a.nodeToSchemaOutput(
|
|
1266
1268
|
e,
|
|
1267
1269
|
A
|
|
@@ -1296,7 +1298,7 @@ const ct = [
|
|
|
1296
1298
|
class ie {
|
|
1297
1299
|
constructor(e = ct) {
|
|
1298
1300
|
l(this, "contractType", "Sequential Workflow");
|
|
1299
|
-
l(this, "contractBlueId",
|
|
1301
|
+
l(this, "contractBlueId", f["Sequential Workflow"]);
|
|
1300
1302
|
l(this, "role", "handler");
|
|
1301
1303
|
l(this, "executors", []);
|
|
1302
1304
|
this.executors = e;
|
|
@@ -1327,8 +1329,8 @@ class ie {
|
|
|
1327
1329
|
r
|
|
1328
1330
|
);
|
|
1329
1331
|
if (d !== void 0) {
|
|
1330
|
-
const p = h.getName(),
|
|
1331
|
-
r[
|
|
1332
|
+
const p = h.getName(), m = typeof p == "string" ? p : `Step${i + 1}`;
|
|
1333
|
+
r[m] = d;
|
|
1332
1334
|
}
|
|
1333
1335
|
await n.flush();
|
|
1334
1336
|
}
|
|
@@ -1337,7 +1339,7 @@ class ie {
|
|
|
1337
1339
|
class it {
|
|
1338
1340
|
constructor(e) {
|
|
1339
1341
|
l(this, "contractType", "Sequential Workflow Operation");
|
|
1340
|
-
l(this, "contractBlueId",
|
|
1342
|
+
l(this, "contractBlueId", f["Sequential Workflow Operation"]);
|
|
1341
1343
|
l(this, "role", "handler");
|
|
1342
1344
|
l(this, "sequentialWorkflowProcessor");
|
|
1343
1345
|
this.sequentialWorkflowProcessor = e || new ie();
|
|
@@ -1360,12 +1362,12 @@ class it {
|
|
|
1360
1362
|
}
|
|
1361
1363
|
}
|
|
1362
1364
|
}
|
|
1363
|
-
const Z = (s) =>
|
|
1365
|
+
const Z = (s) => b.isTypeOf(s.payload, N);
|
|
1364
1366
|
class lt extends S {
|
|
1365
1367
|
constructor() {
|
|
1366
1368
|
super(...arguments);
|
|
1367
1369
|
l(this, "contractType", "Timeline Channel");
|
|
1368
|
-
l(this, "contractBlueId",
|
|
1370
|
+
l(this, "contractBlueId", f["Timeline Channel"]);
|
|
1369
1371
|
}
|
|
1370
1372
|
supports(t, n, o) {
|
|
1371
1373
|
var u;
|
|
@@ -1374,7 +1376,7 @@ class lt extends S {
|
|
|
1374
1376
|
t.payload,
|
|
1375
1377
|
N
|
|
1376
1378
|
), c = o.getBlue().nodeToSchemaOutput(n, ke), i = (u = a.timeline) == null ? void 0 : u.timelineId;
|
|
1377
|
-
return
|
|
1379
|
+
return g(c.timelineId) && g(i) && i === c.timelineId;
|
|
1378
1380
|
}
|
|
1379
1381
|
handle(t, n, o, r) {
|
|
1380
1382
|
Z(t) && o.emitEvent({
|
|
@@ -1486,22 +1488,25 @@ class gt {
|
|
|
1486
1488
|
if (++r > o)
|
|
1487
1489
|
throw new Error("Possible cycle – too many iterations");
|
|
1488
1490
|
const c = this.queue.pop(), { nodePath: i, contractName: h, contractNode: u, event: d } = c, p = t.get(i);
|
|
1489
|
-
if (!
|
|
1490
|
-
const
|
|
1491
|
-
if (!
|
|
1491
|
+
if (!P(p) || !((a = p.getContracts()) != null && a[h]) || !u.getType()) continue;
|
|
1492
|
+
const m = this.registry.get(u.getType());
|
|
1493
|
+
if (!m) {
|
|
1492
1494
|
console.warn(`No processor registered for contract: ${h}`);
|
|
1493
1495
|
continue;
|
|
1494
1496
|
}
|
|
1495
|
-
const
|
|
1497
|
+
const w = new oe(
|
|
1496
1498
|
() => t,
|
|
1497
1499
|
c,
|
|
1498
1500
|
this.blue,
|
|
1499
|
-
async (
|
|
1500
|
-
for (const
|
|
1501
|
-
if (
|
|
1502
|
-
const ue = W(
|
|
1501
|
+
async (T) => {
|
|
1502
|
+
for (const y of T)
|
|
1503
|
+
if (y.kind === "patch") {
|
|
1504
|
+
const ue = W(
|
|
1505
|
+
t,
|
|
1506
|
+
this.blue
|
|
1507
|
+
);
|
|
1503
1508
|
for (const C of ue) {
|
|
1504
|
-
const he =
|
|
1509
|
+
const he = y.patch.op === "move" || y.patch.op === "copy" ? [y.patch.from, y.patch.path] : [y.patch.path], J = w.getNodePath(), de = he.some(
|
|
1505
1510
|
(fe) => z(fe, C.absPath)
|
|
1506
1511
|
), pe = z(
|
|
1507
1512
|
J,
|
|
@@ -1509,20 +1514,20 @@ class gt {
|
|
|
1509
1514
|
);
|
|
1510
1515
|
if (de && !pe)
|
|
1511
1516
|
throw new ae(
|
|
1512
|
-
|
|
1517
|
+
y.patch,
|
|
1513
1518
|
C.absPath,
|
|
1514
1519
|
J
|
|
1515
1520
|
);
|
|
1516
1521
|
}
|
|
1517
1522
|
try {
|
|
1518
|
-
t = U(t, [
|
|
1523
|
+
t = U(t, [y.patch]);
|
|
1519
1524
|
} catch (C) {
|
|
1520
1525
|
throw Le(h, d, C), C;
|
|
1521
1526
|
}
|
|
1522
|
-
} else
|
|
1527
|
+
} else y.kind === "event" && (n.push(y.event.payload), await this.router.route(t, [], y.event, c.key[5]));
|
|
1523
1528
|
}
|
|
1524
1529
|
);
|
|
1525
|
-
await
|
|
1530
|
+
await m.handle(d, u, w, h), await w.flush();
|
|
1526
1531
|
}
|
|
1527
1532
|
return { state: t, emitted: n };
|
|
1528
1533
|
}
|
|
@@ -1582,5 +1587,6 @@ export {
|
|
|
1582
1587
|
it as SequentialWorkflowOperationProcessor,
|
|
1583
1588
|
ie as SequentialWorkflowProcessor,
|
|
1584
1589
|
lt as TimelineChannelProcessor,
|
|
1590
|
+
W as collectEmbeddedPathSpecs,
|
|
1585
1591
|
wt as createDefaultMergingProcessor
|
|
1586
1592
|
};
|
|
@@ -2,7 +2,7 @@ import { EventNode, DocumentNode, ProcessingContext } from '../types';
|
|
|
2
2
|
import { BaseChannelProcessor } from './BaseChannelProcessor';
|
|
3
3
|
export declare class MyOSTimelineChannelProcessor extends BaseChannelProcessor {
|
|
4
4
|
readonly contractType = "MyOS Timeline Channel";
|
|
5
|
-
readonly contractBlueId: "
|
|
5
|
+
readonly contractBlueId: "Bx3dgXf5uFkGf9KxkUTFWQhbEw9QBc9cTgz1KP1Qtgh6";
|
|
6
6
|
supports(event: EventNode, node: DocumentNode, ctx: ProcessingContext): boolean;
|
|
7
7
|
handle(event: EventNode, node: DocumentNode, ctx: ProcessingContext, path: string): void;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MyOSTimelineChannelProcessor.d.ts","sourceRoot":"","sources":["../../src/processors/MyOSTimelineChannelProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAmB9D,qBAAa,4BAA6B,SAAQ,oBAAoB;IACpE,QAAQ,CAAC,YAAY,2BAA2B;IAChD,QAAQ,CAAC,cAAc,iDAAoC;IAE3D,QAAQ,CACN,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,iBAAiB,GACrB,OAAO;
|
|
1
|
+
{"version":3,"file":"MyOSTimelineChannelProcessor.d.ts","sourceRoot":"","sources":["../../src/processors/MyOSTimelineChannelProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAmB9D,qBAAa,4BAA6B,SAAQ,oBAAoB;IACpE,QAAQ,CAAC,YAAY,2BAA2B;IAChD,QAAQ,CAAC,cAAc,iDAAoC;IAE3D,QAAQ,CACN,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,iBAAiB,GACrB,OAAO;IAyBV,MAAM,CACJ,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,iBAAiB,EACtB,IAAI,EAAE,MAAM,GACX,IAAI;CASR"}
|
package/dist/utils/document.d.ts
CHANGED
|
@@ -12,7 +12,14 @@ export declare function freeze(doc: DocumentNode): DocumentNode;
|
|
|
12
12
|
* Creates a mutable copy of a document for processing
|
|
13
13
|
*/
|
|
14
14
|
export declare function mutable(doc: DocumentNode): DocumentNode;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Collects all paths to embedded documents
|
|
17
|
+
* @param doc - The document to collect embedded paths from
|
|
18
|
+
* @param blue - The Blue instance
|
|
19
|
+
* @param base - The base path
|
|
20
|
+
* @param out - The output array
|
|
21
|
+
*/
|
|
22
|
+
export declare function collectEmbeddedPathSpecs(doc: DocumentNode, blue: Blue, base?: string, out?: EmbeddedSpec[]): EmbeddedSpec[];
|
|
16
23
|
export declare function isInside(target: string, root: string): boolean;
|
|
17
24
|
/**
|
|
18
25
|
* Apply a collection of patches to a document
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/utils/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIxC,OAAO,EAEL,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/utils/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIxC,OAAO,EAEL,KAAK,aAAa,EAClB,IAAI,EACL,MAAM,qBAAqB,CAAC;AAM7B,KAAK,YAAY,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D;;GAEG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,YAAY,GAAG,YAAY,CAEtD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,YAAY,GAAG,YAAY,CAEvD;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,IAAI,EACV,IAAI,SAAM,EACV,GAAG,GAAE,YAAY,EAAO,GACvB,YAAY,EAAE,CA8BhB;AAKD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAI9D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,aAAa,EAAE,GACvB,YAAY,CAcd"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blue-labs/document-processor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@blue-labs/language": "1.
|
|
6
|
-
"@blue-labs/shared-utils": "1.
|
|
5
|
+
"@blue-labs/language": "1.31.0",
|
|
6
|
+
"@blue-labs/shared-utils": "1.31.0",
|
|
7
7
|
"isolated-vm": "^5.0.4"
|
|
8
8
|
},
|
|
9
9
|
"main": "./dist/index.js",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@blue-repository/core-dev": "^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0 || ^0.16.0",
|
|
37
|
-
"@blue-repository/myos-dev": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0"
|
|
37
|
+
"@blue-repository/myos-dev": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0 || ^0.19.0"
|
|
38
38
|
}
|
|
39
39
|
}
|