@dnotifier-realtime/dnotifier 1.1.10 → 1.1.15

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.
@@ -1 +1 @@
1
- import{WorkflowObservabilityClient}from'./workflowObservabilityClient.js';import{shortId}from'./ids.js';import{resolveStepType}from'./stepTypes.js';export class WorkflowObservability{constructor({appId:_0x390c06,token:_0x45fc09=null,client:_0x27a002}){this['appId']=_0x390c06,this['token']=_0x45fc09,this['client']=null!=_0x27a002?_0x27a002:new WorkflowObservabilityClient({'appId':_0x390c06,'token':_0x45fc09}),this['client']['configure']({'appId':_0x390c06,'token':_0x45fc09}),this['_registeredWorkflowNames']=new Set(),this['_stepCounter']=0x0;}async['registerWorkflow'](_0x486a6e){var _0x3a6cac,_0x2fd49d;if(!this['_registeredWorkflowNames']['has'](_0x486a6e['name'])){this['_registeredWorkflowNames']['add'](_0x486a6e['name']);try{await this['client']['registerWorkflow']({'appId':this['appId'],'workflowId':_0x486a6e['name'],'name':_0x486a6e['name'],'description':null!==(_0x3a6cac=_0x486a6e['description'])&&void 0x0!==_0x3a6cac?_0x3a6cac:null});}catch(_0x1c3ff3){console['warn']('[WorkflowObservability]\x20registerWorkflow\x20failed:',null!==(_0x2fd49d=null==_0x1c3ff3?void 0x0:_0x1c3ff3['message'])&&void 0x0!==_0x2fd49d?_0x2fd49d:_0x1c3ff3);}}}async['startExecution'](_0x3bddc2){var _0x9e09a7,_0x3e61da;const _0xedcc43=shortId('exec'),_0x2ec6dc=new Date()['toISOString']();try{await this['client']['createExecution']({'id':_0xedcc43,'appId':this['appId'],'workflowId':_0x3bddc2['workflowId'],'userId':_0x3bddc2['userId'],'input':null!==(_0x9e09a7=_0x3bddc2['input'])&&void 0x0!==_0x9e09a7?_0x9e09a7:null,'startedAt':_0x2ec6dc});}catch(_0x4843a1){console['warn']('[WorkflowObservability]\x20startExecution\x20failed:',null!==(_0x3e61da=null==_0x4843a1?void 0x0:_0x4843a1['message'])&&void 0x0!==_0x3e61da?_0x3e61da:_0x4843a1);}return this['_stepCounter']=0x0,{'executionId':_0xedcc43,'startedAt':_0x2ec6dc};}async['recordStep'](_0x34d904,_0xbfd81){var _0x3a3b2d,_0x4dedd4,_0x40bc18,_0x130cc1,_0x27393f,_0x9528ca,_0x525a80,_0x2927d4;if(!_0x34d904)return;this['_stepCounter']+=0x1;const _0x325581=null!==(_0x3a3b2d=_0xbfd81['id'])&&void 0x0!==_0x3a3b2d?_0x3a3b2d:'n'+this['_stepCounter'],_0x280381=resolveStepType(_0xbfd81),_0x56b42e=null!==(_0x130cc1=null!==(_0x40bc18=null!==(_0x4dedd4=_0xbfd81['agentName'])&&void 0x0!==_0x4dedd4?_0x4dedd4:_0xbfd81['kind'])&&void 0x0!==_0x40bc18?_0x40bc18:_0xbfd81['apiName'])&&void 0x0!==_0x130cc1?_0x130cc1:null,_0x160ca4={..._0xbfd81,'id':_0x325581,'executionId':_0x34d904,'executedAt':null!==(_0x27393f=_0xbfd81['executedAt'])&&void 0x0!==_0x27393f?_0x27393f:new Date()['toISOString'](),'apiName':null!==(_0x9528ca=_0xbfd81['apiName'])&&void 0x0!==_0x9528ca?_0x9528ca:null,'agentName':null!==(_0x525a80=_0xbfd81['agentName'])&&void 0x0!==_0x525a80?_0x525a80:null,'kind':_0x56b42e,'type':_0x280381,'step_type':_0x280381};try{await this['client']['addStep'](_0x34d904,_0x160ca4);}catch(_0x592ba2){console['warn']('[WorkflowObservability]\x20recordStep\x20failed:',null!==(_0x2927d4=null==_0x592ba2?void 0x0:_0x592ba2['message'])&&void 0x0!==_0x2927d4?_0x2927d4:_0x592ba2);}return _0x160ca4;}async['completeExecution'](_0x29d546){var _0x21cec1,_0x208525,_0x4a9177;if(_0x29d546['executionId'])try{await this['client']['updateExecution'](_0x29d546['executionId'],{'status':_0x29d546['status'],'endedAt':_0x29d546['endedAt'],'durationMs':_0x29d546['durationMs'],'stepCount':_0x29d546['stepCount'],'error':null!==(_0x21cec1=_0x29d546['error'])&&void 0x0!==_0x21cec1?_0x21cec1:null,'result':null!==(_0x208525=_0x29d546['result'])&&void 0x0!==_0x208525?_0x208525:null});}catch(_0x27a35a){console['warn']('[WorkflowObservability]\x20completeExecution\x20failed:',null!==(_0x4a9177=null==_0x27a35a?void 0x0:_0x27a35a['message'])&&void 0x0!==_0x4a9177?_0x4a9177:_0x27a35a);}}['getStepCount'](){return this['_stepCounter'];}}export function createWorkflowObservability(_0x3b1924){return new WorkflowObservability(_0x3b1924);}
1
+ import{WorkflowObservabilityClient}from'./workflowObservabilityClient.js';import{shortId}from'./ids.js';import{resolveStepType}from'./stepTypes.js';export class WorkflowObservability{constructor({appId:_0x49917b,token:_0x245dc8=null,client:_0x44b658}){this['appId']=_0x49917b,this['token']=_0x245dc8,this['client']=null!=_0x44b658?_0x44b658:new WorkflowObservabilityClient({'appId':_0x49917b,'token':_0x245dc8}),this['client']['configure']({'appId':_0x49917b,'token':_0x245dc8}),this['_registeredWorkflowNames']=new Set(),this['_stepCounter']=0x0;}async['registerWorkflow'](_0x5a255e){var _0x4a1294;if(!this['_registeredWorkflowNames']['has'](_0x5a255e['name'])){this['_registeredWorkflowNames']['add'](_0x5a255e['name']);try{await this['client']['registerWorkflow']({'appId':this['appId'],'workflowId':_0x5a255e['name'],'name':_0x5a255e['name'],'description':null!==(_0x4a1294=_0x5a255e['description'])&&void 0x0!==_0x4a1294?_0x4a1294:null});}catch{}}}async['startExecution'](_0x2db114){var _0x1cf1c6;const _0x1ead1a=shortId('exec'),_0x34c5f1=new Date()['toISOString']();try{await this['client']['createExecution']({'id':_0x1ead1a,'appId':this['appId'],'workflowId':_0x2db114['workflowId'],'userId':_0x2db114['userId'],'input':null!==(_0x1cf1c6=_0x2db114['input'])&&void 0x0!==_0x1cf1c6?_0x1cf1c6:null,'startedAt':_0x34c5f1});}catch{}return this['_stepCounter']=0x0,{'executionId':_0x1ead1a,'startedAt':_0x34c5f1};}async['recordStep'](_0x592e2a,_0x209cce){var _0x51179c,_0x16cf20,_0x1a1ae4,_0x4848f7,_0x18b23f,_0x49c8e2,_0x58cc18;if(!_0x592e2a)return;this['_stepCounter']+=0x1;const _0x5218af=null!==(_0x51179c=_0x209cce['id'])&&void 0x0!==_0x51179c?_0x51179c:'n'+this['_stepCounter'],_0x4e02db=resolveStepType(_0x209cce),_0x5ac5be=null!==(_0x4848f7=null!==(_0x1a1ae4=null!==(_0x16cf20=_0x209cce['agentName'])&&void 0x0!==_0x16cf20?_0x16cf20:_0x209cce['kind'])&&void 0x0!==_0x1a1ae4?_0x1a1ae4:_0x209cce['apiName'])&&void 0x0!==_0x4848f7?_0x4848f7:null,_0x1024c3={..._0x209cce,'id':_0x5218af,'executionId':_0x592e2a,'executedAt':null!==(_0x18b23f=_0x209cce['executedAt'])&&void 0x0!==_0x18b23f?_0x18b23f:new Date()['toISOString'](),'apiName':null!==(_0x49c8e2=_0x209cce['apiName'])&&void 0x0!==_0x49c8e2?_0x49c8e2:null,'agentName':null!==(_0x58cc18=_0x209cce['agentName'])&&void 0x0!==_0x58cc18?_0x58cc18:null,'kind':_0x5ac5be,'type':_0x4e02db,'step_type':_0x4e02db};try{await this['client']['addStep'](_0x592e2a,_0x1024c3);}catch{}return _0x1024c3;}async['completeExecution'](_0x172c5c){var _0x31a1ea,_0x67355e;if(_0x172c5c['executionId'])try{await this['client']['updateExecution'](_0x172c5c['executionId'],{'status':_0x172c5c['status'],'endedAt':_0x172c5c['endedAt'],'durationMs':_0x172c5c['durationMs'],'stepCount':_0x172c5c['stepCount'],'error':null!==(_0x31a1ea=_0x172c5c['error'])&&void 0x0!==_0x31a1ea?_0x31a1ea:null,'result':null!==(_0x67355e=_0x172c5c['result'])&&void 0x0!==_0x67355e?_0x67355e:null});}catch{}}['getStepCount'](){return this['_stepCounter'];}}export function createWorkflowObservability(_0x2cae13){return new WorkflowObservability(_0x2cae13);}
@@ -1 +1 @@
1
- import{WorkflowContext}from'./context.js';import{createWorkflowObservability}from'./observability.js';import{WorkflowError}from'./errors.js';export class WorkflowRunner{constructor({notifier:_0x578fd9,senderId:_0x3b7344,workflow:_0x2ad537}){if(!_0x578fd9)throw new WorkflowError('WorkflowRunner\x20requires\x20a\x20DNotifier\x20instance');if(!_0x3b7344)throw new WorkflowError('WorkflowRunner\x20requires\x20senderId');if(!_0x2ad537)throw new WorkflowError('WorkflowRunner\x20requires\x20a\x20workflow');this['notifier']=_0x578fd9,this['senderId']=_0x3b7344,this['workflow']=_0x2ad537;}async['run'](_0x3e51d2){var _0x1c3026,_0x40a3f4;const _0x4d6157=null==_0x3e51d2?void 0x0:_0x3e51d2['input'],_0x25cc65={};let _0x17fd62=null,_0x2f15b7=null,_0x150a40=null;const _0x559a86=Date['now']();if(this['workflow']['observability']){_0x17fd62=createWorkflowObservability({'appId':this['notifier']['appId'],'token':null!==(_0x1c3026=this['notifier']['authToken'])&&void 0x0!==_0x1c3026?_0x1c3026:null}),await _0x17fd62['registerWorkflow'](this['workflow']);const _0x2548e5=await _0x17fd62['startExecution']({'workflowId':this['workflow']['name'],'userId':this['senderId'],'input':_0x4d6157});_0x2f15b7=_0x2548e5['executionId'],_0x150a40=_0x2548e5['startedAt'];}const _0x2519e9=new WorkflowContext({'notifier':this['notifier'],'senderId':this['senderId'],'workflow':this['workflow'],'input':_0x4d6157,'state':_0x25cc65,'observability':_0x17fd62,'executionId':_0x2f15b7});let _0x35ad04,_0x431d33='ok',_0x1fd4ba=null;try{_0x35ad04=await this['workflow']['entry'](_0x2519e9);}catch(_0x50c9d9){throw _0x431d33='error',_0x1fd4ba={'message':null!==(_0x40a3f4=null==_0x50c9d9?void 0x0:_0x50c9d9['message'])&&void 0x0!==_0x40a3f4?_0x40a3f4:String(_0x50c9d9),'stack':null==_0x50c9d9?void 0x0:_0x50c9d9['stack']},_0x50c9d9;}finally{if(_0x17fd62&&_0x2f15b7){const _0xdfbef8=new Date()['toISOString'](),_0x44eece=_0x17fd62['getStepCount']();await _0x17fd62['completeExecution']({'executionId':_0x2f15b7,'status':_0x431d33,'endedAt':_0xdfbef8,'durationMs':Date['now']()-_0x559a86,'stepCount':_0x44eece,'error':_0x1fd4ba,'result':'ok'===_0x431d33?_0x35ad04:null,'startedAt':_0x150a40});}}const _0x24a322={'result':_0x35ad04,'state':_0x25cc65};return _0x2f15b7&&(_0x24a322['executionId']=_0x2f15b7),_0x24a322;}}
1
+ import{WorkflowContext}from'./context.js';import{createWorkflowObservability}from'./observability.js';import{WorkflowError}from'./errors.js';export class WorkflowRunner{constructor({notifier:_0x9ed4de,senderId:_0x318a88,workflow:_0x19ad94}){if(!_0x9ed4de)throw new WorkflowError('WorkflowRunner\x20requires\x20a\x20DNotifier\x20instance');if(!_0x318a88)throw new WorkflowError('WorkflowRunner\x20requires\x20senderId');if(!_0x19ad94)throw new WorkflowError('WorkflowRunner\x20requires\x20a\x20workflow');this['notifier']=_0x9ed4de,this['senderId']=_0x318a88,this['workflow']=_0x19ad94;}async['run'](_0x8b144f){var _0x128670,_0x462e04;const _0x16cd29=null==_0x8b144f?void 0x0:_0x8b144f['input'],_0xfe89f2={};let _0x1e4326=null,_0x2266a2=null,_0x5be079=null;const _0x1196eb=Date['now']();if(this['workflow']['observability']){_0x1e4326=createWorkflowObservability({'appId':this['notifier']['appId'],'token':null!==(_0x128670=this['notifier']['authToken'])&&void 0x0!==_0x128670?_0x128670:null}),await _0x1e4326['registerWorkflow'](this['workflow']);const _0xc93b03=await _0x1e4326['startExecution']({'workflowId':this['workflow']['name'],'userId':this['senderId'],'input':_0x16cd29});_0x2266a2=_0xc93b03['executionId'],_0x5be079=_0xc93b03['startedAt'];}const _0x59220b=new WorkflowContext({'notifier':this['notifier'],'senderId':this['senderId'],'workflow':this['workflow'],'input':_0x16cd29,'state':_0xfe89f2,'observability':_0x1e4326,'executionId':_0x2266a2});let _0xdad100,_0x1c4d3b='ok',_0x34fb86=null;try{_0xdad100=await this['workflow']['entry'](_0x59220b);}catch(_0x22fa3b){throw _0x1c4d3b='error',_0x34fb86={'message':null!==(_0x462e04=null==_0x22fa3b?void 0x0:_0x22fa3b['message'])&&void 0x0!==_0x462e04?_0x462e04:String(_0x22fa3b),'stack':null==_0x22fa3b?void 0x0:_0x22fa3b['stack']},_0x22fa3b;}finally{if(_0x1e4326&&_0x2266a2){const _0x1d2c11=new Date()['toISOString'](),_0x1171f3=_0x1e4326['getStepCount']();await _0x1e4326['completeExecution']({'executionId':_0x2266a2,'status':_0x1c4d3b,'endedAt':_0x1d2c11,'durationMs':Date['now']()-_0x1196eb,'stepCount':_0x1171f3,'error':_0x34fb86,'result':'ok'===_0x1c4d3b?_0xdad100:null,'startedAt':_0x5be079});}}const _0x55da4c={'result':_0xdad100,'state':_0xfe89f2};return _0x2266a2&&(_0x55da4c['executionId']=_0x2266a2),_0x55da4c;}}
@@ -1 +1 @@
1
- export const STEP_TYPE_AGENT='Agent';export const STEP_TYPE_CUSTOM='Custom';export const SDK_API_STEP_TYPES=['sendAI','fetchAIHistory','search','addDocument','updateDocument','deleteDocument','listDocuments','getDocument'];export const LOG_TYPE_BY_API={'sendAI':'AI-LLM','fetchAIHistory':'AI\x20History','search':'Vector\x20Search','semanticSearch':'Vector\x20Search','addDocument':'Document\x20Add','updateDocument':'Document\x20Update','deleteDocument':'Document\x20Delete','listDocuments':'Document\x20List','getDocument':'Document\x20Get','agent':'Agent'};const LEGACY_KIND_TO_API={'ai_call':'sendAI','vector_call':'search'};export function toLogStepType(_0x58c5ec){if(null==_0x58c5ec||''===String(_0x58c5ec)['trim']())return'Custom';const _0x54f36f=String(_0x58c5ec);if(LOG_TYPE_BY_API[_0x54f36f])return LOG_TYPE_BY_API[_0x54f36f];const _0x11bf8d=_0x54f36f['toLowerCase']();for(const [_0x3c36d0,_0x56e3c2]of Object['entries'](LOG_TYPE_BY_API))if(_0x3c36d0['toLowerCase']()===_0x11bf8d)return _0x56e3c2;return _0x54f36f;}export function resolveApiName(_0x308ca2){const _0x4d6b1e=null==_0x308ca2?void 0x0:_0x308ca2['kind'];if(null==_0x4d6b1e||''===String(_0x4d6b1e)['trim']())return null;const _0x5ccdb8=String(_0x4d6b1e);return LEGACY_KIND_TO_API[_0x5ccdb8]?LEGACY_KIND_TO_API[_0x5ccdb8]:'agent'===_0x5ccdb8||SDK_API_STEP_TYPES['includes'](_0x5ccdb8)||'semanticSearch'===_0x5ccdb8?_0x5ccdb8:null;}export function resolveStepType(_0x5a2f67){if(null!=(null==_0x5a2f67?void 0x0:_0x5a2f67['type'])&&''!==String(_0x5a2f67['type'])['trim']()){const _0x5ee9ec=String(_0x5a2f67['type'])['trim']();return Object['values'](LOG_TYPE_BY_API)['includes'](_0x5ee9ec)?_0x5ee9ec:toLogStepType(_0x5ee9ec);}const _0x1b8ef4=resolveApiName(_0x5a2f67);return _0x1b8ef4?toLogStepType(_0x1b8ef4):'Custom';}
1
+ export const STEP_TYPE_AGENT='Agent';export const STEP_TYPE_CUSTOM='Custom';export const SDK_API_STEP_TYPES=['sendAI','fetchAIHistory','search','addDocument','updateDocument','deleteDocument','listDocuments','getDocument'];export const LOG_TYPE_BY_API={'sendAI':'AI-LLM','fetchAIHistory':'AI\x20History','search':'Vector\x20Search','semanticSearch':'Vector\x20Search','addDocument':'Document\x20Add','updateDocument':'Document\x20Update','deleteDocument':'Document\x20Delete','listDocuments':'Document\x20List','getDocument':'Document\x20Get','agent':'Agent'};const LEGACY_KIND_TO_API={'ai_call':'sendAI','vector_call':'search'};export function toLogStepType(_0x2017c3){if(null==_0x2017c3||''===String(_0x2017c3)['trim']())return'Custom';const _0xa6aac6=String(_0x2017c3);if(LOG_TYPE_BY_API[_0xa6aac6])return LOG_TYPE_BY_API[_0xa6aac6];const _0x531198=_0xa6aac6['toLowerCase']();for(const [_0x3f4ce7,_0x2d4c7d]of Object['entries'](LOG_TYPE_BY_API))if(_0x3f4ce7['toLowerCase']()===_0x531198)return _0x2d4c7d;return _0xa6aac6;}export function resolveApiName(_0x5b095d){const _0x49eac6=null==_0x5b095d?void 0x0:_0x5b095d['kind'];if(null==_0x49eac6||''===String(_0x49eac6)['trim']())return null;const _0x1fd823=String(_0x49eac6);return LEGACY_KIND_TO_API[_0x1fd823]?LEGACY_KIND_TO_API[_0x1fd823]:'agent'===_0x1fd823||SDK_API_STEP_TYPES['includes'](_0x1fd823)||'semanticSearch'===_0x1fd823?_0x1fd823:null;}export function resolveStepType(_0x367ca6){if(null!=(null==_0x367ca6?void 0x0:_0x367ca6['type'])&&''!==String(_0x367ca6['type'])['trim']()){const _0x462554=String(_0x367ca6['type'])['trim']();return Object['values'](LOG_TYPE_BY_API)['includes'](_0x462554)?_0x462554:toLogStepType(_0x462554);}const _0x43ec31=resolveApiName(_0x367ca6);return _0x43ec31?toLogStepType(_0x43ec31):'Custom';}
@@ -1 +1 @@
1
- import{WorkflowError}from'./errors.js';function normalizeDescription(_0x195c4e){if(null==_0x195c4e||''===_0x195c4e)return;if('string'!=typeof _0x195c4e)throw new WorkflowError('Workflow\x20description\x20must\x20be\x20a\x20string');const _0x4fdddb=_0x195c4e['trim']();if(_0x4fdddb['length']>0x64)throw new WorkflowError('Workflow\x20description\x20must\x20be\x20at\x20most\x20100\x20characters');return _0x4fdddb['length']>0x0?_0x4fdddb:void 0x0;}export class Workflow{constructor({name:_0x1e300a,description:_0x5bc543,observability:_0x3376cc=!0x1,entry:_0x518794}){if(!_0x1e300a||'string'!=typeof _0x1e300a)throw new WorkflowError('Workflow\x20name\x20is\x20required');if('function'!=typeof _0x518794)throw new WorkflowError('Workflow\x20entry\x20must\x20be\x20a\x20function');this['name']=_0x1e300a['trim'](),this['description']=normalizeDescription(_0x5bc543),this['observability']=Boolean(_0x3376cc),this['entry']=_0x518794,this['_agents']=new Map(),this['_registeredWithObservability']=!0x1;}['registerAgent'](_0x219cf3,_0xf50dc0){if(!_0x219cf3||'string'!=typeof _0x219cf3)throw new WorkflowError('Agent\x20registration\x20name\x20is\x20required');if(!_0xf50dc0||'function'!=typeof _0xf50dc0['run'])throw new WorkflowError('Invalid\x20agent\x20for\x20\x22'+_0x219cf3+'\x22');return this['_agents']['set'](_0x219cf3,_0xf50dc0),this;}['registerAgents'](_0x5ad908){for(const [_0x2b1899,_0x173f26]of Object['entries'](_0x5ad908))this['registerAgent'](_0x2b1899,_0x173f26);return this;}['getAgent'](_0x3b4292){return this['_agents']['get'](_0x3b4292);}}
1
+ import{WorkflowError}from'./errors.js';function normalizeDescription(_0xbc5237){if(null==_0xbc5237||''===_0xbc5237)return;if('string'!=typeof _0xbc5237)throw new WorkflowError('Workflow\x20description\x20must\x20be\x20a\x20string');const _0x1baeec=_0xbc5237['trim']();if(_0x1baeec['length']>0x64)throw new WorkflowError('Workflow\x20description\x20must\x20be\x20at\x20most\x20100\x20characters');return _0x1baeec['length']>0x0?_0x1baeec:void 0x0;}export class Workflow{constructor({name:_0x54f467,description:_0x2b6ae6,observability:_0x4ea127=!0x1,entry:_0x46aaf3}){if(!_0x54f467||'string'!=typeof _0x54f467)throw new WorkflowError('Workflow\x20name\x20is\x20required');if('function'!=typeof _0x46aaf3)throw new WorkflowError('Workflow\x20entry\x20must\x20be\x20a\x20function');this['name']=_0x54f467['trim'](),this['description']=normalizeDescription(_0x2b6ae6),this['observability']=Boolean(_0x4ea127),this['entry']=_0x46aaf3,this['_agents']=new Map(),this['_registeredWithObservability']=!0x1;}['registerAgent'](_0x30f3ab,_0x4227ed){if(!_0x30f3ab||'string'!=typeof _0x30f3ab)throw new WorkflowError('Agent\x20registration\x20name\x20is\x20required');if(!_0x4227ed||'function'!=typeof _0x4227ed['run'])throw new WorkflowError('Invalid\x20agent\x20for\x20\x22'+_0x30f3ab+'\x22');return this['_agents']['set'](_0x30f3ab,_0x4227ed),this;}['registerAgents'](_0x505c28){for(const [_0x199157,_0x37b7f2]of Object['entries'](_0x505c28))this['registerAgent'](_0x199157,_0x37b7f2);return this;}['getAgent'](_0x560ab8){return this['_agents']['get'](_0x560ab8);}}
@@ -1 +1 @@
1
- {"version":3,"file":"workflowObservabilityClient.d.ts","sourceRoot":"","sources":["../../src/workflow/workflowObservabilityClient.js"],"names":[],"mappings":"AAUA;IAIE,+BAFW;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAKnD;IAFC,cAAkB;IAClB,qBAAkB;IAGpB,uCAGC;IAED,oCAGC;IAED,0CAaC;IAKD,0BAFW,MAAM;;OAahB;IAKD,yBAFW,MAAM;;;;;;;;;;;OAgBhB;IAMD,6BAHW,MAAM,SACN,MAAM;;;;;;;;;OAiBhB;IAMD,qBAHW,MAAM,QACN,MAAM;;OAiDhB;CACF;8BAxJ6B,+BAA+B"}
1
+ {"version":3,"file":"workflowObservabilityClient.d.ts","sourceRoot":"","sources":["../../src/workflow/workflowObservabilityClient.js"],"names":[],"mappings":"AAUA;IAIE,+BAFW;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAKnD;IAFC,cAAkB;IAClB,qBAAkB;IAGpB,uCAGC;IAED,oCAGC;IAED,0CAOC;IAKD,0BAFW,MAAM;;OAahB;IAKD,yBAFW,MAAM;;;;;;;;;;;OAgBhB;IAMD,6BAHW,MAAM,SACN,MAAM;;;;;;;;;OAiBhB;IAMD,qBAHW,MAAM,QACN,MAAM;;OAuChB;CACF;8BAxI6B,+BAA+B"}
@@ -1 +1 @@
1
- import{HttpTransport}from'../transport/httpTransport.js';import{DNotifierEndpoints}from'../config/endpoints.js';import{shortId}from'./ids.js';import{setJsonColumn}from'./jsonPayload.js';import{resolveStepType}from'./stepTypes.js';export class WorkflowObservabilityClient{constructor({appId:_0xbeb55c=null,token:_0x4ef9e1=null}={}){this['appId']=_0xbeb55c,this['token']=_0x4ef9e1;}['configure']({appId:_0x3b163d,token:_0x5235e3}={}){void 0x0!==_0x3b163d&&(this['appId']=_0x3b163d),void 0x0!==_0x5235e3&&(this['token']=_0x5235e3);}['_transport'](_0x8fc933){const _0x29fdfd=this['token']?{'authorization':''+this['token']}:{};return new HttpTransport({'url':_0x8fc933,'headers':_0x29fdfd});}async['_post'](_0x32efe3,_0x55513c){var _0x959fe2;if(this['token'])try{await this['_transport'](_0x32efe3)['send'](_0x55513c);}catch(_0x117341){console['log']('[WorkflowObservability]\x20API\x20failed\x20('+_0x32efe3+'):',null!==(_0x959fe2=null==_0x117341?void 0x0:_0x117341['message'])&&void 0x0!==_0x959fe2?_0x959fe2:_0x117341);}else console['warn']('[WorkflowObservability]\x20skip\x20API\x20call:\x20not\x20connected\x20(no\x20auth\x20token)');}async['registerWorkflow'](_0x435491){const _0x4e33a5={'appId':_0x435491['appId'],'workflowId':_0x435491['workflowId'],'name':_0x435491['name']};return null!=_0x435491['description']&&''!==_0x435491['description']&&(_0x4e33a5['description']=_0x435491['description']),await this['_post'](DNotifierEndpoints['workflowRegisterUrl'],_0x4e33a5),{'ok':!0x0};}async['createExecution'](_0x10a735){var _0xffc03c;const _0x21811d=null!==(_0xffc03c=_0x10a735['id'])&&void 0x0!==_0xffc03c?_0xffc03c:shortId('exec'),_0x58f2d6={'id':_0x21811d,'appId':_0x10a735['appId'],'workflowId':_0x10a735['workflowId'],'userId':_0x10a735['userId'],'status':'in_progress','stepCount':0x0,'startedAt':_0x10a735['startedAt']};return setJsonColumn(_0x58f2d6,'input',_0x10a735['input']),await this['_post'](DNotifierEndpoints['workflowExecutionsUrl'],_0x58f2d6),{'executionId':_0x21811d,'record':_0x58f2d6};}async['updateExecution'](_0x183940,_0x25586b){const _0x167e4f={'id':_0x183940,'status':_0x25586b['status'],'endedAt':_0x25586b['endedAt'],'durationMs':_0x25586b['durationMs'],'stepCount':_0x25586b['stepCount']};return setJsonColumn(_0x167e4f,'error',_0x25586b['error']),setJsonColumn(_0x167e4f,'result',_0x25586b['result']),await this['_post'](DNotifierEndpoints['workflowExecutionCompleteUrl'](_0x183940),_0x167e4f),{'ok':!0x0,'record':_0x167e4f};}async['addStep'](_0x32686d,_0x27e4ea){var _0x551e95,_0x46cb9a,_0x2f625f,_0x4ca9e5,_0x1511a4,_0x161765;const _0x253dba=resolveStepType(_0x27e4ea),_0x3bc968=null!==(_0x2f625f=null!==(_0x46cb9a=null!==(_0x551e95=_0x27e4ea['agentName'])&&void 0x0!==_0x551e95?_0x551e95:_0x27e4ea['kind'])&&void 0x0!==_0x46cb9a?_0x46cb9a:_0x27e4ea['apiName'])&&void 0x0!==_0x2f625f?_0x2f625f:null,_0x4c32d0={'id':_0x27e4ea['id'],'executionId':_0x32686d,'kind':_0x3bc968,'label':_0x27e4ea['label'],'type':_0x253dba,'step_type':_0x253dba,'status':_0x27e4ea['status'],'executedAt':_0x27e4ea['executedAt'],'latencyMs':null!==(_0x4ca9e5=_0x27e4ea['latencyMs'])&&void 0x0!==_0x4ca9e5?_0x4ca9e5:0x0,'tokensIn':null!==(_0x1511a4=_0x27e4ea['tokensIn'])&&void 0x0!==_0x1511a4?_0x1511a4:0x0,'tokensOut':null!==(_0x161765=_0x27e4ea['tokensOut'])&&void 0x0!==_0x161765?_0x161765:0x0};return null!=_0x27e4ea['apiName']&&''!==_0x27e4ea['apiName']&&(_0x4c32d0['apiName']=_0x27e4ea['apiName']),null!=_0x27e4ea['agentName']&&''!==_0x27e4ea['agentName']&&(_0x4c32d0['agentName']=_0x27e4ea['agentName']),console['log']('[WorkflowObservability]\x20step\x20kind:',{'kind':_0x4c32d0['kind'],'type':_0x4c32d0['type'],'agentName':_0x4c32d0['agentName'],'apiName':_0x4c32d0['apiName'],'stepKind':_0x27e4ea['kind'],'stepAgentName':_0x27e4ea['agentName'],'stepApiName':_0x27e4ea['apiName']}),null!=_0x27e4ea['model']&&''!==_0x27e4ea['model']&&(_0x4c32d0['model']='string'==typeof _0x27e4ea['model']?_0x27e4ea['model']:String(_0x27e4ea['model'])),setJsonColumn(_0x4c32d0,'input',_0x27e4ea['input']),setJsonColumn(_0x4c32d0,'output',_0x27e4ea['output']),setJsonColumn(_0x4c32d0,'error',_0x27e4ea['error']),await this['_post'](DNotifierEndpoints['workflowExecutionStepsUrl'](_0x32686d),_0x4c32d0),{'ok':!0x0};}}
1
+ import{HttpTransport}from'../transport/httpTransport.js';import{DNotifierEndpoints}from'../config/endpoints.js';import{shortId}from'./ids.js';import{setJsonColumn}from'./jsonPayload.js';import{resolveStepType}from'./stepTypes.js';export class WorkflowObservabilityClient{constructor({appId:_0x5d2d51=null,token:_0x152158=null}={}){this['appId']=_0x5d2d51,this['token']=_0x152158;}['configure']({appId:_0x4f356a,token:_0x138064}={}){void 0x0!==_0x4f356a&&(this['appId']=_0x4f356a),void 0x0!==_0x138064&&(this['token']=_0x138064);}['_transport'](_0x201787){const _0x3a78f8=this['token']?{'authorization':''+this['token']}:{};return new HttpTransport({'url':_0x201787,'headers':_0x3a78f8});}async['_post'](_0x39f102,_0x1981a2){if(this['token'])try{await this['_transport'](_0x39f102)['send'](_0x1981a2);}catch{}}async['registerWorkflow'](_0x51349e){const _0x101be0={'appId':_0x51349e['appId'],'workflowId':_0x51349e['workflowId'],'name':_0x51349e['name']};return null!=_0x51349e['description']&&''!==_0x51349e['description']&&(_0x101be0['description']=_0x51349e['description']),await this['_post'](DNotifierEndpoints['workflowRegisterUrl'],_0x101be0),{'ok':!0x0};}async['createExecution'](_0x3bbfd2){var _0x4c5016;const _0x990b40=null!==(_0x4c5016=_0x3bbfd2['id'])&&void 0x0!==_0x4c5016?_0x4c5016:shortId('exec'),_0x2c35a0={'id':_0x990b40,'appId':_0x3bbfd2['appId'],'workflowId':_0x3bbfd2['workflowId'],'userId':_0x3bbfd2['userId'],'status':'in_progress','stepCount':0x0,'startedAt':_0x3bbfd2['startedAt']};return setJsonColumn(_0x2c35a0,'input',_0x3bbfd2['input']),await this['_post'](DNotifierEndpoints['workflowExecutionsUrl'],_0x2c35a0),{'executionId':_0x990b40,'record':_0x2c35a0};}async['updateExecution'](_0x34ed87,_0x292f62){const _0x2fcdc={'id':_0x34ed87,'status':_0x292f62['status'],'endedAt':_0x292f62['endedAt'],'durationMs':_0x292f62['durationMs'],'stepCount':_0x292f62['stepCount']};return setJsonColumn(_0x2fcdc,'error',_0x292f62['error']),setJsonColumn(_0x2fcdc,'result',_0x292f62['result']),await this['_post'](DNotifierEndpoints['workflowExecutionCompleteUrl'](_0x34ed87),_0x2fcdc),{'ok':!0x0,'record':_0x2fcdc};}async['addStep'](_0x56a8fa,_0x471b85){var _0x7bdd,_0x3acd34,_0x28cd6d,_0x8445d1,_0x30b9ae,_0x56ac30;const _0x3e53a4=resolveStepType(_0x471b85),_0x214724=null!==(_0x28cd6d=null!==(_0x3acd34=null!==(_0x7bdd=_0x471b85['agentName'])&&void 0x0!==_0x7bdd?_0x7bdd:_0x471b85['kind'])&&void 0x0!==_0x3acd34?_0x3acd34:_0x471b85['apiName'])&&void 0x0!==_0x28cd6d?_0x28cd6d:null,_0x2fe115={'id':_0x471b85['id'],'executionId':_0x56a8fa,'kind':_0x214724,'label':_0x471b85['label'],'type':_0x3e53a4,'step_type':_0x3e53a4,'status':_0x471b85['status'],'executedAt':_0x471b85['executedAt'],'latencyMs':null!==(_0x8445d1=_0x471b85['latencyMs'])&&void 0x0!==_0x8445d1?_0x8445d1:0x0,'tokensIn':null!==(_0x30b9ae=_0x471b85['tokensIn'])&&void 0x0!==_0x30b9ae?_0x30b9ae:0x0,'tokensOut':null!==(_0x56ac30=_0x471b85['tokensOut'])&&void 0x0!==_0x56ac30?_0x56ac30:0x0};return null!=_0x471b85['apiName']&&''!==_0x471b85['apiName']&&(_0x2fe115['apiName']=_0x471b85['apiName']),null!=_0x471b85['agentName']&&''!==_0x471b85['agentName']&&(_0x2fe115['agentName']=_0x471b85['agentName']),null!=_0x471b85['model']&&''!==_0x471b85['model']&&(_0x2fe115['model']='string'==typeof _0x471b85['model']?_0x471b85['model']:String(_0x471b85['model'])),setJsonColumn(_0x2fe115,'input',_0x471b85['input']),setJsonColumn(_0x2fe115,'output',_0x471b85['output']),setJsonColumn(_0x2fe115,'error',_0x471b85['error']),await this['_post'](DNotifierEndpoints['workflowExecutionStepsUrl'](_0x56a8fa),_0x2fe115),{'ok':!0x0};}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnotifier-realtime/dnotifier",
3
- "version": "1.1.10",
3
+ "version": "1.1.15",
4
4
  "description": "Real-time communication & AI SDK",
5
5
  "main": "dist/dnotifier.js",
6
6
  "types": "dist/dnotifier.d.ts",