@asaidimu/hestia 1.10.2 → 1.10.3

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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@asaidimu/network-client"),t=require("@asaidimu/utils-error"),n=require("@asaidimu/utils-sync"),r=require("@asaidimu/utils-store"),i=require("@asaidimu/query");async function a(e){try{return(await e.clone().json())?.error??null}catch{return null}}function o(e,n){if(n)return new t.SystemError({code:n.code??`UNKNOWN`,message:n.message??`Unknown error`,issues:n.details?.issues});let r=e.error?.message;if(typeof r==`object`&&r){let e=r;return new t.SystemError({code:e.code??`UNKNOWN`,message:e.message??`Unknown error`})}return new t.SystemError({code:`UNKNOWN`,message:r??`Unknown error`})}function s(e){return t.Errors.notFound(e)}function c(e){return t.Errors.permissionDenied(e)}function l(e){return t.Errors.internalError(e)}const u={"system:apikeys:key:create":{method:`POST`,route:`/system/apikeys/key/create`,arguments:[]},"system:apikeys:key:delete":{method:`DELETE`,route:`/system/apikeys/key/delete/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:get":{method:`GET`,route:`/system/apikeys/key/get/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:list":{method:`GET`,route:`/system/apikeys/key/list`,arguments:[]},"system:apikeys:key:rotate":{method:`POST`,route:`/system/apikeys/key/rotate/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:update":{method:`PATCH`,route:`/system/apikeys/key/update/{key_id}`,arguments:[`key_id`]},"system:audit:log:export":{method:`PATCH`,route:`/system/audit/log/export`,arguments:[]},"system:audit:log:stream":{method:`GET`,route:`/system/audit/log/stream`,arguments:[]},"system:auth:bootstrap:password:set":{method:`PATCH`,route:`/system/auth/bootstrap/password/set`,arguments:[]},"system:auth:password:confirm":{method:`PATCH`,route:`/system/auth/password/confirm`,arguments:[]},"system:auth:password:reset":{method:`POST`,route:`/system/auth/password/reset`,arguments:[]},"system:auth:session:create":{method:`POST`,route:`/system/auth/session/create`,arguments:[]},"system:auth:session:delete":{method:`DELETE`,route:`/system/auth/session/delete`,arguments:[]},"system:auth:token:elevate":{method:`POST`,route:`/system/auth/token/elevate`,arguments:[]},"system:blobs:blob:abort":{method:`POST`,route:`/system/blobs/blob/abort/{ns}`,arguments:[`ns`]},"system:blobs:blob:begin":{method:`POST`,route:`/system/blobs/blob/begin/{ns}`,arguments:[`ns`]},"system:blobs:blob:chunk":{method:`POST`,route:`/system/blobs/blob/chunk/{ns}`,arguments:[`ns`]},"system:blobs:blob:complete":{method:`POST`,route:`/system/blobs/blob/complete/{ns}`,arguments:[`ns`]},"system:blobs:blob:delete":{method:`DELETE`,route:`/system/blobs/blob/delete/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:download":{method:`GET`,route:`/system/blobs/blob/download/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:head":{method:`POST`,route:`/system/blobs/blob/head/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:list":{method:`POST`,route:`/system/blobs/blob/list/{ns}`,arguments:[`ns`]},"system:blobs:blob:progress":{method:`POST`,route:`/system/blobs/blob/progress/{ns}`,arguments:[`ns`]},"system:blobs:blob:rename":{method:`PATCH`,route:`/system/blobs/blob/rename/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:update":{method:`PATCH`,route:`/system/blobs/blob/update/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:upload":{method:`POST`,route:`/system/blobs/blob/upload/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:namespace:compact":{method:`POST`,route:`/system/blobs/namespace/compact/{ns}`,arguments:[`ns`]},"system:blobs:namespace:create":{method:`POST`,route:`/system/blobs/namespace/create/{ns}`,arguments:[`ns`]},"system:blobs:namespace:delete":{method:`DELETE`,route:`/system/blobs/namespace/delete/{ns}`,arguments:[`ns`]},"system:blobs:namespace:list":{method:`POST`,route:`/system/blobs/namespace/list`,arguments:[]},"system:blobs:namespace:stats":{method:`POST`,route:`/system/blobs/namespace/stats/{ns}`,arguments:[`ns`]},"system:blobs:namespace:verify":{method:`POST`,route:`/system/blobs/namespace/verify/{ns}`,arguments:[`ns`]},"system:collections:audit_log:query":{method:`POST`,route:`/system/collections/audit_log/query`,arguments:[]},"system:collections:collection:create":{method:`POST`,route:`/system/collections/collection/create`,arguments:[]},"system:collections:collection:delete":{method:`DELETE`,route:`/system/collections/collection/delete/{name}`,arguments:[`name`]},"system:collections:collection:get":{method:`GET`,route:`/system/collections/collection/get/{name}`,arguments:[`name`]},"system:collections:collection:list":{method:`GET`,route:`/system/collections/collection/list`,arguments:[]},"system:collections:document:create":{method:`POST`,route:`/system/collections/document/create/{name}`,arguments:[`name`]},"system:collections:document:delete":{method:`DELETE`,route:`/system/collections/document/delete/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:document:get":{method:`GET`,route:`/system/collections/document/get/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:document:query":{method:`POST`,route:`/system/collections/document/query/{name}`,arguments:[`name`]},"system:collections:document:update":{method:`PATCH`,route:`/system/collections/document/update/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:user:query":{method:`POST`,route:`/system/collections/user/query`,arguments:[]},"system:core:capability:list":{method:`GET`,route:`/system/core/capability/list`,arguments:[]},"system:core:capability:set":{method:`PATCH`,route:`/system/core/capability/set/{name}`,arguments:[`name`]},"system:core:docs:list":{method:`GET`,route:`/system/core/docs/list`,arguments:[]},"system:core:health:check":{method:`GET`,route:`/system/core/health/check`,arguments:[]},"system:core:heartbeat":{method:`GET`,route:`/system/core/heartbeat`,arguments:[]},"system:core:reset":{method:`GET`,route:`/system/core/reset`,arguments:[]},"system:logs:list":{method:`POST`,route:`/system/logs/list`,arguments:[]},"system:logs:stream":{method:`GET`,route:`/system/logs/stream`,arguments:[]},"system:notifications:notification:create":{method:`POST`,route:`/system/notifications/notification/create`,arguments:[]},"system:notifications:notification:list":{method:`GET`,route:`/system/notifications/notification/list`,arguments:[]},"system:notifications:notification:read":{method:`PATCH`,route:`/system/notifications/notification/read/{notification_id}`,arguments:[`notification_id`]},"system:notifications:notification:stream":{method:`GET`,route:`/system/notifications/notification/stream`,arguments:[]},"system:notifications:read:all":{method:`PATCH`,route:`/system/notifications/read/all`,arguments:[]},"system:notifications:unread:count":{method:`GET`,route:`/system/notifications/unread/count`,arguments:[]},"system:policies:binding:get":{method:`GET`,route:`/system/policies/binding/get/{name}`,arguments:[`name`]},"system:policies:binding:list":{method:`GET`,route:`/system/policies/binding/list`,arguments:[]},"system:policies:policy:create":{method:`POST`,route:`/system/policies/policy/create/{name}`,arguments:[`name`]},"system:policies:policy:list":{method:`GET`,route:`/system/policies/policy/list`,arguments:[]},"system:policies:policy:update":{method:`PATCH`,route:`/system/policies/policy/update/{name}`,arguments:[`name`]},"system:policies:reload":{method:`GET`,route:`/system/policies/reload`,arguments:[]},"system:policies:rule:create":{method:`POST`,route:`/system/policies/rule/create/{name}`,arguments:[`name`]},"system:policies:rule:delete":{method:`DELETE`,route:`/system/policies/rule/delete/{name}`,arguments:[`name`]},"system:policies:rule:get":{method:`GET`,route:`/system/policies/rule/get/{name}`,arguments:[`name`]},"system:policies:rule:list":{method:`GET`,route:`/system/policies/rule/list`,arguments:[]},"system:policies:rule:update":{method:`PATCH`,route:`/system/policies/rule/update/{name}`,arguments:[`name`]},"system:policies:rule:validate":{method:`POST`,route:`/system/policies/rule/validate`,arguments:[]},"system:scheduler:job:list":{method:`GET`,route:`/system/scheduler/job/list`,arguments:[]},"system:schedules:schedule:create":{method:`POST`,route:`/system/schedules/schedule/create`,arguments:[]},"system:schedules:schedule:delete":{method:`DELETE`,route:`/system/schedules/schedule/delete/{id}`,arguments:[`id`]},"system:schedules:schedule:get":{method:`GET`,route:`/system/schedules/schedule/get/{id}`,arguments:[`id`]},"system:schedules:schedule:list":{method:`GET`,route:`/system/schedules/schedule/list`,arguments:[]},"system:schedules:schedule:update":{method:`PATCH`,route:`/system/schedules/schedule/update/{id}`,arguments:[`id`]},"system:settings:delete":{method:`DELETE`,route:`/system/settings/delete/{key}`,arguments:[`key`]},"system:settings:get":{method:`GET`,route:`/system/settings/get/{key}`,arguments:[`key`]},"system:settings:list":{method:`GET`,route:`/system/settings/list`,arguments:[]},"system:settings:set":{method:`POST`,route:`/system/settings/set/{key}`,arguments:[`key`]},"system:updates:changelog:get":{method:`GET`,route:`/system/updates/changelog/get`,arguments:[]},"system:updates:check:create":{method:`POST`,route:`/system/updates/check/create`,arguments:[]},"system:updates:check:get":{method:`GET`,route:`/system/updates/check/get`,arguments:[]},"system:updates:stage:create":{method:`POST`,route:`/system/updates/stage/create`,arguments:[]},"system:updates:status:get":{method:`GET`,route:`/system/updates/status/get`,arguments:[]},"system:updates:update:apply":{method:`POST`,route:`/system/updates/update/apply`,arguments:[]},"system:updates:update:discard":{method:`DELETE`,route:`/system/updates/update/discard`,arguments:[]},"system:users:password:change":{method:`PATCH`,route:`/system/users/password/change/{user_id}`,arguments:[`user_id`]},"system:users:user:create":{method:`POST`,route:`/system/users/user/create`,arguments:[]},"system:users:user:delete":{method:`DELETE`,route:`/system/users/user/delete/{user_id}`,arguments:[`user_id`]},"system:users:user:get":{method:`GET`,route:`/system/users/user/get/{user_id}`,arguments:[`user_id`]},"system:users:user:update":{method:`PATCH`,route:`/system/users/user/update/{user_id}`,arguments:[`user_id`]},"system:workflows:definition:compile":{method:`POST`,route:`/system/workflows/definition/compile`,arguments:[]},"system:workflows:definition:create":{method:`POST`,route:`/system/workflows/definition/create`,arguments:[]},"system:workflows:definition:delete":{method:`DELETE`,route:`/system/workflows/definition/delete/{id}`,arguments:[`id`]},"system:workflows:definition:get":{method:`GET`,route:`/system/workflows/definition/get/{id}`,arguments:[`id`]},"system:workflows:definition:list":{method:`GET`,route:`/system/workflows/definition/list`,arguments:[]},"system:workflows:definition:update":{method:`PATCH`,route:`/system/workflows/definition/update/{id}`,arguments:[`id`]},"system:workflows:registry:get":{method:`GET`,route:`/system/workflows/registry/get/{kind}`,arguments:[`kind`]},"system:workflows:registry:handles":{method:`GET`,route:`/system/workflows/registry/handles`,arguments:[]},"system:workflows:registry:list":{method:`GET`,route:`/system/workflows/registry/list`,arguments:[]},"system:workflows:run:events":{method:`GET`,route:`/system/workflows/run/events/{run_id}`,arguments:[`run_id`]},"system:workflows:run:get":{method:`GET`,route:`/system/workflows/run/get/{run_id}`,arguments:[`run_id`]},"system:workflows:run:list":{method:`GET`,route:`/system/workflows/run/list`,arguments:[]},"system:workflows:run:outcome":{method:`GET`,route:`/system/workflows/run/outcome/{run_id}`,arguments:[`run_id`]},"system:workflows:run:store":{method:`GET`,route:`/system/workflows/run/store/{run_id}`,arguments:[`run_id`]},"system:workflows:run:stream":{method:`GET`,route:`/system/workflows/run/stream/{run_id}`,arguments:[`run_id`]},"system:workflows:runtime:abort":{method:`DELETE`,route:`/system/workflows/runtime/abort/{run_id}`,arguments:[`run_id`]},"system:workflows:runtime:events":{method:`POST`,route:`/system/workflows/runtime/events`,arguments:[]},"system:workflows:runtime:has":{method:`GET`,route:`/system/workflows/runtime/has/{id}`,arguments:[`id`]},"system:workflows:runtime:invoke":{method:`POST`,route:`/system/workflows/runtime/invoke`,arguments:[]},"system:workflows:runtime:list":{method:`GET`,route:`/system/workflows/runtime/list`,arguments:[]},"system:workflows:runtime:resume":{method:`POST`,route:`/system/workflows/runtime/resume`,arguments:[]},"system:workflows:runtime:run":{method:`POST`,route:`/system/workflows/runtime/run`,arguments:[]}};var d=class{data;status;constructor(e,t){this.data=e,this.status=t}},f=class{baseUrl;apiPrefix;onAuthStateChanged;raw;constructor(t,n,r){this.baseUrl=t,this.apiPrefix=n,this.onAuthStateChanged=r,this.raw=(0,e.createNetworkClient)({baseUrl:t,defaultResponseType:`json`,defaultBodyType:`json`})}substituteArgs(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]?encodeURIComponent(t[n]):`{${n}}`)}async dispatch(e,n){let r=u[e];if(!r)throw new t.SystemError({code:`ROUTE_NOT_FOUND`,message:`No registered route for handler: ${e}`});let i=this.substituteArgs(r.route,n?.arguments??{}),a=r.method,o={},s=n?.notifyAuthStateChange??!0;if(n?.headers&&(o.headers=n.headers),n?.responseType&&(o.responseType=n.responseType),n?.bodyType&&(o.bodyType=n.bodyType),n?.signal&&(o.signal=n.signal),n?.modifiers){let e=Object.entries(n.modifiers).flatMap(([e,t])=>(Array.isArray(t)?t:[t]).map(t=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join(`&`);if(e){let t=i.includes(`?`)?`&`:`?`;return this.request(a,`${i}${t}${e}`,n?.payload,o,s)}}return this.request(a,i,n?.payload,o,s)}routeUrl(e,n){let r=u[e];if(!r)throw new t.SystemError({code:`ROUTE_NOT_FOUND`,message:`No registered route for handler: ${e}`});return`${this.baseUrl.replace(/\/+$/,``)}/${this.canonicalPath(this.substituteArgs(r.route,n??{}))}`}base(){return this.baseUrl}prefix(){return this.apiPrefix}async ready(){}canonicalPath(e){let t=e.replace(/^\/+/,``);if(this.apiPrefix){let e=this.apiPrefix.replace(/^\/+/,``),n=RegExp(`^${e}/?`);return t=t.replace(n,``),`${e}/${t}`}return t}async request(e,t,n,r,i=!1){let s=this.canonicalPath(t),c={};r?.headers&&(c.headers={...r.headers}),r?.responseType&&(c.responseType=r.responseType),r?.bodyType&&(c.bodyType=r.bodyType),r?.signal&&(c.signal=r.signal),c.headers||={};let l;if(e===`GET`)l=await this.raw.get(s,c);else{let t=r?.bodyType?{type:r.bodyType}:void 0;l=await this.raw[e.toLowerCase()](s,n,c,t)}if(l.success||l.status===204)return new d(l.data,l.status);l.status===401&&i&&this.onAuthStateChanged?.();let u=l.raw?await a(l.raw):null;throw o(l,u)}async check(e,t,n){return this.request(`POST`,`${e}/check`,t,n)}async get(e,t){return this.request(`GET`,e,void 0,t)}async post(e,t,n){return this.request(`POST`,e,t,n)}async patch(e,t,n){return this.request(`PATCH`,e,t,n)}async put(e,t,n){return this.request(`PUT`,e,t,n)}async delete(e,t,n){return this.request(`DELETE`,e,t,n)}async openStream(e,t,n){let r={Accept:`text/event-stream`,...n?.headers??{}},i=`${this.baseUrl.replace(/\/+$/,``)}/${this.canonicalPath(e)}`,a;try{a=await fetch(i,{method:`GET`,headers:r,signal:n?.signal})}catch(e){if(e instanceof Error&&e.name===`AbortError`){t.onClose?.();return}t.onError?.(e instanceof Error?e:Error(String(e)));return}if(!a.ok||!a.body){t.onError?.(Error(`Stream request failed with status ${a.status}`));return}t.onOpen?.();let o=a.body.getReader(),s=new TextDecoder,c=``;try{for(;;){let{done:e,value:n}=await o.read();if(e)break;c+=s.decode(n,{stream:!0});let r=c.indexOf(`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@asaidimu/network-client"),t=require("@asaidimu/utils-error"),n=require("@asaidimu/utils-sync"),r=require("@asaidimu/utils-store"),i=require("@asaidimu/query");async function a(e){try{return(await e.clone().json())?.error??null}catch{return null}}function o(e,n){if(n)return new t.SystemError({code:n.code??`UNKNOWN`,message:n.message??`Unknown error`,issues:n.details?.issues});let r=e.error?.message;if(typeof r==`object`&&r){let e=r;return new t.SystemError({code:e.code??`UNKNOWN`,message:e.message??`Unknown error`})}return new t.SystemError({code:`UNKNOWN`,message:r??`Unknown error`})}function s(e){return t.Errors.notFound(e)}function c(e){return t.Errors.permissionDenied(e)}function l(e){return t.Errors.internalError(e)}const u={"system:apikeys:key:create":{method:`POST`,route:`/system/apikeys/key/create`,arguments:[]},"system:apikeys:key:delete":{method:`DELETE`,route:`/system/apikeys/key/delete/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:get":{method:`GET`,route:`/system/apikeys/key/get/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:list":{method:`GET`,route:`/system/apikeys/key/list`,arguments:[]},"system:apikeys:key:rotate":{method:`POST`,route:`/system/apikeys/key/rotate/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:update":{method:`PATCH`,route:`/system/apikeys/key/update/{key_id}`,arguments:[`key_id`]},"system:audit:log:export":{method:`PATCH`,route:`/system/audit/log/export`,arguments:[]},"system:audit:log:stream":{method:`GET`,route:`/system/audit/log/stream`,arguments:[]},"system:auth:bootstrap:password:set":{method:`PATCH`,route:`/system/auth/bootstrap/password/set`,arguments:[]},"system:auth:password:confirm":{method:`PATCH`,route:`/system/auth/password/confirm`,arguments:[]},"system:auth:password:reset":{method:`POST`,route:`/system/auth/password/reset`,arguments:[]},"system:auth:session:create":{method:`POST`,route:`/system/auth/session/create`,arguments:[]},"system:auth:session:delete":{method:`DELETE`,route:`/system/auth/session/delete`,arguments:[]},"system:auth:token:elevate":{method:`POST`,route:`/system/auth/token/elevate`,arguments:[]},"system:blobs:blob:abort":{method:`POST`,route:`/system/blobs/blob/abort/{ns}`,arguments:[`ns`]},"system:blobs:blob:begin":{method:`POST`,route:`/system/blobs/blob/begin/{ns}`,arguments:[`ns`]},"system:blobs:blob:chunk":{method:`POST`,route:`/system/blobs/blob/chunk/{ns}`,arguments:[`ns`]},"system:blobs:blob:complete":{method:`POST`,route:`/system/blobs/blob/complete/{ns}`,arguments:[`ns`]},"system:blobs:blob:delete":{method:`DELETE`,route:`/system/blobs/blob/delete/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:download":{method:`GET`,route:`/system/blobs/blob/download/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:head":{method:`POST`,route:`/system/blobs/blob/head/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:list":{method:`POST`,route:`/system/blobs/blob/list/{ns}`,arguments:[`ns`]},"system:blobs:blob:progress":{method:`POST`,route:`/system/blobs/blob/progress/{ns}`,arguments:[`ns`]},"system:blobs:blob:rename":{method:`PATCH`,route:`/system/blobs/blob/rename/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:update":{method:`PATCH`,route:`/system/blobs/blob/update/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:upload":{method:`POST`,route:`/system/blobs/blob/upload/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:namespace:compact":{method:`POST`,route:`/system/blobs/namespace/compact/{ns}`,arguments:[`ns`]},"system:blobs:namespace:create":{method:`POST`,route:`/system/blobs/namespace/create/{ns}`,arguments:[`ns`]},"system:blobs:namespace:delete":{method:`DELETE`,route:`/system/blobs/namespace/delete/{ns}`,arguments:[`ns`]},"system:blobs:namespace:list":{method:`POST`,route:`/system/blobs/namespace/list`,arguments:[]},"system:blobs:namespace:stats":{method:`POST`,route:`/system/blobs/namespace/stats/{ns}`,arguments:[`ns`]},"system:blobs:namespace:verify":{method:`POST`,route:`/system/blobs/namespace/verify/{ns}`,arguments:[`ns`]},"system:collections:audit_log:query":{method:`POST`,route:`/system/collections/audit_log/query`,arguments:[]},"system:collections:collection:create":{method:`POST`,route:`/system/collections/collection/create`,arguments:[]},"system:collections:collection:delete":{method:`DELETE`,route:`/system/collections/collection/delete/{name}`,arguments:[`name`]},"system:collections:collection:get":{method:`GET`,route:`/system/collections/collection/get/{name}`,arguments:[`name`]},"system:collections:collection:list":{method:`GET`,route:`/system/collections/collection/list`,arguments:[]},"system:collections:document:create":{method:`POST`,route:`/system/collections/document/create/{name}`,arguments:[`name`]},"system:collections:document:delete":{method:`DELETE`,route:`/system/collections/document/delete/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:document:get":{method:`GET`,route:`/system/collections/document/get/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:document:query":{method:`POST`,route:`/system/collections/document/query/{name}`,arguments:[`name`]},"system:collections:document:update":{method:`PATCH`,route:`/system/collections/document/update/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:user:query":{method:`POST`,route:`/system/collections/user/query`,arguments:[]},"system:core:capability:list":{method:`GET`,route:`/system/core/capability/list`,arguments:[]},"system:core:capability:set":{method:`PATCH`,route:`/system/core/capability/set/{name}`,arguments:[`name`]},"system:core:docs:list":{method:`GET`,route:`/system/core/docs/list`,arguments:[]},"system:core:health:check":{method:`GET`,route:`/system/core/health/check`,arguments:[]},"system:core:heartbeat":{method:`GET`,route:`/system/core/heartbeat`,arguments:[]},"system:core:reset":{method:`DELETE`,route:`/system/core/reset`,arguments:[]},"system:logs:list":{method:`POST`,route:`/system/logs/list`,arguments:[]},"system:logs:stream":{method:`GET`,route:`/system/logs/stream`,arguments:[]},"system:notifications:notification:create":{method:`POST`,route:`/system/notifications/notification/create`,arguments:[]},"system:notifications:notification:list":{method:`GET`,route:`/system/notifications/notification/list`,arguments:[]},"system:notifications:notification:read":{method:`PATCH`,route:`/system/notifications/notification/read/{notification_id}`,arguments:[`notification_id`]},"system:notifications:notification:stream":{method:`GET`,route:`/system/notifications/notification/stream`,arguments:[]},"system:notifications:read:all":{method:`PATCH`,route:`/system/notifications/read/all`,arguments:[]},"system:notifications:unread:count":{method:`GET`,route:`/system/notifications/unread/count`,arguments:[]},"system:policies:binding:get":{method:`GET`,route:`/system/policies/binding/get/{name}`,arguments:[`name`]},"system:policies:binding:list":{method:`GET`,route:`/system/policies/binding/list`,arguments:[]},"system:policies:policy:create":{method:`POST`,route:`/system/policies/policy/create/{name}`,arguments:[`name`]},"system:policies:policy:list":{method:`GET`,route:`/system/policies/policy/list`,arguments:[]},"system:policies:policy:update":{method:`PATCH`,route:`/system/policies/policy/update/{name}`,arguments:[`name`]},"system:policies:reload":{method:`GET`,route:`/system/policies/reload`,arguments:[]},"system:policies:rule:create":{method:`POST`,route:`/system/policies/rule/create/{name}`,arguments:[`name`]},"system:policies:rule:delete":{method:`DELETE`,route:`/system/policies/rule/delete/{name}`,arguments:[`name`]},"system:policies:rule:get":{method:`GET`,route:`/system/policies/rule/get/{name}`,arguments:[`name`]},"system:policies:rule:list":{method:`GET`,route:`/system/policies/rule/list`,arguments:[]},"system:policies:rule:update":{method:`PATCH`,route:`/system/policies/rule/update/{name}`,arguments:[`name`]},"system:policies:rule:validate":{method:`POST`,route:`/system/policies/rule/validate`,arguments:[]},"system:scheduler:job:list":{method:`GET`,route:`/system/scheduler/job/list`,arguments:[]},"system:schedules:schedule:create":{method:`POST`,route:`/system/schedules/schedule/create`,arguments:[]},"system:schedules:schedule:delete":{method:`DELETE`,route:`/system/schedules/schedule/delete/{id}`,arguments:[`id`]},"system:schedules:schedule:get":{method:`GET`,route:`/system/schedules/schedule/get/{id}`,arguments:[`id`]},"system:schedules:schedule:list":{method:`GET`,route:`/system/schedules/schedule/list`,arguments:[]},"system:schedules:schedule:update":{method:`PATCH`,route:`/system/schedules/schedule/update/{id}`,arguments:[`id`]},"system:settings:delete":{method:`DELETE`,route:`/system/settings/delete/{key}`,arguments:[`key`]},"system:settings:get":{method:`GET`,route:`/system/settings/get/{key}`,arguments:[`key`]},"system:settings:list":{method:`GET`,route:`/system/settings/list`,arguments:[]},"system:settings:set":{method:`POST`,route:`/system/settings/set/{key}`,arguments:[`key`]},"system:updates:changelog:get":{method:`GET`,route:`/system/updates/changelog/get`,arguments:[]},"system:updates:check:create":{method:`POST`,route:`/system/updates/check/create`,arguments:[]},"system:updates:check:get":{method:`GET`,route:`/system/updates/check/get`,arguments:[]},"system:updates:stage:create":{method:`POST`,route:`/system/updates/stage/create`,arguments:[]},"system:updates:status:get":{method:`GET`,route:`/system/updates/status/get`,arguments:[]},"system:updates:update:apply":{method:`POST`,route:`/system/updates/update/apply`,arguments:[]},"system:updates:update:discard":{method:`DELETE`,route:`/system/updates/update/discard`,arguments:[]},"system:users:password:change":{method:`PATCH`,route:`/system/users/password/change/{user_id}`,arguments:[`user_id`]},"system:users:user:create":{method:`POST`,route:`/system/users/user/create`,arguments:[]},"system:users:user:delete":{method:`DELETE`,route:`/system/users/user/delete/{user_id}`,arguments:[`user_id`]},"system:users:user:get":{method:`GET`,route:`/system/users/user/get/{user_id}`,arguments:[`user_id`]},"system:users:user:update":{method:`PATCH`,route:`/system/users/user/update/{user_id}`,arguments:[`user_id`]},"system:workflows:definition:compile":{method:`POST`,route:`/system/workflows/definition/compile`,arguments:[]},"system:workflows:definition:create":{method:`POST`,route:`/system/workflows/definition/create`,arguments:[]},"system:workflows:definition:delete":{method:`DELETE`,route:`/system/workflows/definition/delete/{id}`,arguments:[`id`]},"system:workflows:definition:get":{method:`GET`,route:`/system/workflows/definition/get/{id}`,arguments:[`id`]},"system:workflows:definition:list":{method:`GET`,route:`/system/workflows/definition/list`,arguments:[]},"system:workflows:definition:update":{method:`PATCH`,route:`/system/workflows/definition/update/{id}`,arguments:[`id`]},"system:workflows:registry:get":{method:`GET`,route:`/system/workflows/registry/get/{kind}`,arguments:[`kind`]},"system:workflows:registry:handles":{method:`GET`,route:`/system/workflows/registry/handles`,arguments:[]},"system:workflows:registry:list":{method:`GET`,route:`/system/workflows/registry/list`,arguments:[]},"system:workflows:run:events":{method:`GET`,route:`/system/workflows/run/events/{run_id}`,arguments:[`run_id`]},"system:workflows:run:get":{method:`GET`,route:`/system/workflows/run/get/{run_id}`,arguments:[`run_id`]},"system:workflows:run:list":{method:`GET`,route:`/system/workflows/run/list`,arguments:[]},"system:workflows:run:outcome":{method:`GET`,route:`/system/workflows/run/outcome/{run_id}`,arguments:[`run_id`]},"system:workflows:run:store":{method:`GET`,route:`/system/workflows/run/store/{run_id}`,arguments:[`run_id`]},"system:workflows:run:stream":{method:`GET`,route:`/system/workflows/run/stream/{run_id}`,arguments:[`run_id`]},"system:workflows:runtime:abort":{method:`DELETE`,route:`/system/workflows/runtime/abort/{run_id}`,arguments:[`run_id`]},"system:workflows:runtime:events":{method:`POST`,route:`/system/workflows/runtime/events`,arguments:[]},"system:workflows:runtime:has":{method:`GET`,route:`/system/workflows/runtime/has/{id}`,arguments:[`id`]},"system:workflows:runtime:invoke":{method:`POST`,route:`/system/workflows/runtime/invoke`,arguments:[]},"system:workflows:runtime:list":{method:`GET`,route:`/system/workflows/runtime/list`,arguments:[]},"system:workflows:runtime:resume":{method:`POST`,route:`/system/workflows/runtime/resume`,arguments:[]},"system:workflows:runtime:run":{method:`POST`,route:`/system/workflows/runtime/run`,arguments:[]}};var d=class{data;status;constructor(e,t){this.data=e,this.status=t}},f=class{baseUrl;apiPrefix;onAuthStateChanged;raw;constructor(t,n,r){this.baseUrl=t,this.apiPrefix=n,this.onAuthStateChanged=r,this.raw=(0,e.createNetworkClient)({baseUrl:t,defaultResponseType:`json`,defaultBodyType:`json`})}substituteArgs(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]?encodeURIComponent(t[n]):`{${n}}`)}async dispatch(e,n){let r=u[e];if(!r)throw new t.SystemError({code:`ROUTE_NOT_FOUND`,message:`No registered route for handler: ${e}`});let i=this.substituteArgs(r.route,n?.arguments??{}),a=r.method,o={},s=n?.notifyAuthStateChange??!0;if(n?.headers&&(o.headers=n.headers),n?.responseType&&(o.responseType=n.responseType),n?.bodyType&&(o.bodyType=n.bodyType),n?.signal&&(o.signal=n.signal),n?.modifiers){let e=Object.entries(n.modifiers).flatMap(([e,t])=>(Array.isArray(t)?t:[t]).map(t=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join(`&`);if(e){let t=i.includes(`?`)?`&`:`?`;return this.request(a,`${i}${t}${e}`,n?.payload,o,s)}}return this.request(a,i,n?.payload,o,s)}routeUrl(e,n){let r=u[e];if(!r)throw new t.SystemError({code:`ROUTE_NOT_FOUND`,message:`No registered route for handler: ${e}`});return`${this.baseUrl.replace(/\/+$/,``)}/${this.canonicalPath(this.substituteArgs(r.route,n??{}))}`}base(){return this.baseUrl}prefix(){return this.apiPrefix}async ready(){}canonicalPath(e){let t=e.replace(/^\/+/,``);if(this.apiPrefix){let e=this.apiPrefix.replace(/^\/+/,``),n=RegExp(`^${e}/?`);return t=t.replace(n,``),`${e}/${t}`}return t}async request(e,t,n,r,i=!1){let s=this.canonicalPath(t),c={};r?.headers&&(c.headers={...r.headers}),r?.responseType&&(c.responseType=r.responseType),r?.bodyType&&(c.bodyType=r.bodyType),r?.signal&&(c.signal=r.signal),c.headers||={};let l;if(e===`GET`)l=await this.raw.get(s,c);else{let t=r?.bodyType?{type:r.bodyType}:void 0;l=await this.raw[e.toLowerCase()](s,n,c,t)}if(l.success||l.status===204)return new d(l.data,l.status);l.status===401&&i&&this.onAuthStateChanged?.();let u=l.raw?await a(l.raw):null;throw o(l,u)}async check(e,t,n){return this.request(`POST`,`${e}/check`,t,n)}async get(e,t){return this.request(`GET`,e,void 0,t)}async post(e,t,n){return this.request(`POST`,e,t,n)}async patch(e,t,n){return this.request(`PATCH`,e,t,n)}async put(e,t,n){return this.request(`PUT`,e,t,n)}async delete(e,t,n){return this.request(`DELETE`,e,t,n)}async openStream(e,t,n){let r={Accept:`text/event-stream`,...n?.headers??{}},i=`${this.baseUrl.replace(/\/+$/,``)}/${this.canonicalPath(e)}`,a;try{a=await fetch(i,{method:`GET`,headers:r,signal:n?.signal})}catch(e){if(e instanceof Error&&e.name===`AbortError`){t.onClose?.();return}t.onError?.(e instanceof Error?e:Error(String(e)));return}if(!a.ok||!a.body){t.onError?.(Error(`Stream request failed with status ${a.status}`));return}t.onOpen?.();let o=a.body.getReader(),s=new TextDecoder,c=``;try{for(;;){let{done:e,value:n}=await o.read();if(e)break;c+=s.decode(n,{stream:!0});let r=c.indexOf(`
2
2
 
3
3
  `);for(;r!==-1;){let e=c.slice(0,r);c=c.slice(r+2);let n=e.split(`
4
4
  `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trim());n.length>0&&t.onMessage(n.join(`
package/index.d.cts CHANGED
@@ -505,7 +505,7 @@ declare const ROUTE_TABLE$1: {
505
505
  readonly arguments: readonly [];
506
506
  };
507
507
  readonly "system:core:reset": {
508
- readonly method: "GET";
508
+ readonly method: "DELETE";
509
509
  readonly route: "/system/core/reset";
510
510
  readonly arguments: readonly [];
511
511
  };
@@ -2797,7 +2797,7 @@ declare const ROUTE_TABLE: {
2797
2797
  readonly arguments: readonly [];
2798
2798
  };
2799
2799
  readonly "system:core:reset": {
2800
- readonly method: "GET";
2800
+ readonly method: "DELETE";
2801
2801
  readonly route: "/system/core/reset";
2802
2802
  readonly arguments: readonly [];
2803
2803
  };
package/index.d.mts CHANGED
@@ -505,7 +505,7 @@ declare const ROUTE_TABLE: {
505
505
  readonly arguments: readonly [];
506
506
  };
507
507
  readonly "system:core:reset": {
508
- readonly method: "GET";
508
+ readonly method: "DELETE";
509
509
  readonly route: "/system/core/reset";
510
510
  readonly arguments: readonly [];
511
511
  };
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{createNetworkClient as e}from"@asaidimu/network-client";import{Errors as t,SystemError as n}from"@asaidimu/utils-error";import{Debouncer as r,Once as i}from"@asaidimu/utils-sync";import{DELETE_SYMBOL as a,ReactiveDataStore as o}from"@asaidimu/utils-store";import{createMatcher as s,createSorter as c}from"@asaidimu/query";async function l(e){try{return(await e.clone().json())?.error??null}catch{return null}}function u(e,t){if(t)return new n({code:t.code??`UNKNOWN`,message:t.message??`Unknown error`,issues:t.details?.issues});let r=e.error?.message;if(typeof r==`object`&&r){let e=r;return new n({code:e.code??`UNKNOWN`,message:e.message??`Unknown error`})}return new n({code:`UNKNOWN`,message:r??`Unknown error`})}function d(e){return t.notFound(e)}function f(e){return t.permissionDenied(e)}function p(e){return t.internalError(e)}const m={"system:apikeys:key:create":{method:`POST`,route:`/system/apikeys/key/create`,arguments:[]},"system:apikeys:key:delete":{method:`DELETE`,route:`/system/apikeys/key/delete/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:get":{method:`GET`,route:`/system/apikeys/key/get/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:list":{method:`GET`,route:`/system/apikeys/key/list`,arguments:[]},"system:apikeys:key:rotate":{method:`POST`,route:`/system/apikeys/key/rotate/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:update":{method:`PATCH`,route:`/system/apikeys/key/update/{key_id}`,arguments:[`key_id`]},"system:audit:log:export":{method:`PATCH`,route:`/system/audit/log/export`,arguments:[]},"system:audit:log:stream":{method:`GET`,route:`/system/audit/log/stream`,arguments:[]},"system:auth:bootstrap:password:set":{method:`PATCH`,route:`/system/auth/bootstrap/password/set`,arguments:[]},"system:auth:password:confirm":{method:`PATCH`,route:`/system/auth/password/confirm`,arguments:[]},"system:auth:password:reset":{method:`POST`,route:`/system/auth/password/reset`,arguments:[]},"system:auth:session:create":{method:`POST`,route:`/system/auth/session/create`,arguments:[]},"system:auth:session:delete":{method:`DELETE`,route:`/system/auth/session/delete`,arguments:[]},"system:auth:token:elevate":{method:`POST`,route:`/system/auth/token/elevate`,arguments:[]},"system:blobs:blob:abort":{method:`POST`,route:`/system/blobs/blob/abort/{ns}`,arguments:[`ns`]},"system:blobs:blob:begin":{method:`POST`,route:`/system/blobs/blob/begin/{ns}`,arguments:[`ns`]},"system:blobs:blob:chunk":{method:`POST`,route:`/system/blobs/blob/chunk/{ns}`,arguments:[`ns`]},"system:blobs:blob:complete":{method:`POST`,route:`/system/blobs/blob/complete/{ns}`,arguments:[`ns`]},"system:blobs:blob:delete":{method:`DELETE`,route:`/system/blobs/blob/delete/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:download":{method:`GET`,route:`/system/blobs/blob/download/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:head":{method:`POST`,route:`/system/blobs/blob/head/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:list":{method:`POST`,route:`/system/blobs/blob/list/{ns}`,arguments:[`ns`]},"system:blobs:blob:progress":{method:`POST`,route:`/system/blobs/blob/progress/{ns}`,arguments:[`ns`]},"system:blobs:blob:rename":{method:`PATCH`,route:`/system/blobs/blob/rename/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:update":{method:`PATCH`,route:`/system/blobs/blob/update/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:upload":{method:`POST`,route:`/system/blobs/blob/upload/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:namespace:compact":{method:`POST`,route:`/system/blobs/namespace/compact/{ns}`,arguments:[`ns`]},"system:blobs:namespace:create":{method:`POST`,route:`/system/blobs/namespace/create/{ns}`,arguments:[`ns`]},"system:blobs:namespace:delete":{method:`DELETE`,route:`/system/blobs/namespace/delete/{ns}`,arguments:[`ns`]},"system:blobs:namespace:list":{method:`POST`,route:`/system/blobs/namespace/list`,arguments:[]},"system:blobs:namespace:stats":{method:`POST`,route:`/system/blobs/namespace/stats/{ns}`,arguments:[`ns`]},"system:blobs:namespace:verify":{method:`POST`,route:`/system/blobs/namespace/verify/{ns}`,arguments:[`ns`]},"system:collections:audit_log:query":{method:`POST`,route:`/system/collections/audit_log/query`,arguments:[]},"system:collections:collection:create":{method:`POST`,route:`/system/collections/collection/create`,arguments:[]},"system:collections:collection:delete":{method:`DELETE`,route:`/system/collections/collection/delete/{name}`,arguments:[`name`]},"system:collections:collection:get":{method:`GET`,route:`/system/collections/collection/get/{name}`,arguments:[`name`]},"system:collections:collection:list":{method:`GET`,route:`/system/collections/collection/list`,arguments:[]},"system:collections:document:create":{method:`POST`,route:`/system/collections/document/create/{name}`,arguments:[`name`]},"system:collections:document:delete":{method:`DELETE`,route:`/system/collections/document/delete/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:document:get":{method:`GET`,route:`/system/collections/document/get/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:document:query":{method:`POST`,route:`/system/collections/document/query/{name}`,arguments:[`name`]},"system:collections:document:update":{method:`PATCH`,route:`/system/collections/document/update/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:user:query":{method:`POST`,route:`/system/collections/user/query`,arguments:[]},"system:core:capability:list":{method:`GET`,route:`/system/core/capability/list`,arguments:[]},"system:core:capability:set":{method:`PATCH`,route:`/system/core/capability/set/{name}`,arguments:[`name`]},"system:core:docs:list":{method:`GET`,route:`/system/core/docs/list`,arguments:[]},"system:core:health:check":{method:`GET`,route:`/system/core/health/check`,arguments:[]},"system:core:heartbeat":{method:`GET`,route:`/system/core/heartbeat`,arguments:[]},"system:core:reset":{method:`GET`,route:`/system/core/reset`,arguments:[]},"system:logs:list":{method:`POST`,route:`/system/logs/list`,arguments:[]},"system:logs:stream":{method:`GET`,route:`/system/logs/stream`,arguments:[]},"system:notifications:notification:create":{method:`POST`,route:`/system/notifications/notification/create`,arguments:[]},"system:notifications:notification:list":{method:`GET`,route:`/system/notifications/notification/list`,arguments:[]},"system:notifications:notification:read":{method:`PATCH`,route:`/system/notifications/notification/read/{notification_id}`,arguments:[`notification_id`]},"system:notifications:notification:stream":{method:`GET`,route:`/system/notifications/notification/stream`,arguments:[]},"system:notifications:read:all":{method:`PATCH`,route:`/system/notifications/read/all`,arguments:[]},"system:notifications:unread:count":{method:`GET`,route:`/system/notifications/unread/count`,arguments:[]},"system:policies:binding:get":{method:`GET`,route:`/system/policies/binding/get/{name}`,arguments:[`name`]},"system:policies:binding:list":{method:`GET`,route:`/system/policies/binding/list`,arguments:[]},"system:policies:policy:create":{method:`POST`,route:`/system/policies/policy/create/{name}`,arguments:[`name`]},"system:policies:policy:list":{method:`GET`,route:`/system/policies/policy/list`,arguments:[]},"system:policies:policy:update":{method:`PATCH`,route:`/system/policies/policy/update/{name}`,arguments:[`name`]},"system:policies:reload":{method:`GET`,route:`/system/policies/reload`,arguments:[]},"system:policies:rule:create":{method:`POST`,route:`/system/policies/rule/create/{name}`,arguments:[`name`]},"system:policies:rule:delete":{method:`DELETE`,route:`/system/policies/rule/delete/{name}`,arguments:[`name`]},"system:policies:rule:get":{method:`GET`,route:`/system/policies/rule/get/{name}`,arguments:[`name`]},"system:policies:rule:list":{method:`GET`,route:`/system/policies/rule/list`,arguments:[]},"system:policies:rule:update":{method:`PATCH`,route:`/system/policies/rule/update/{name}`,arguments:[`name`]},"system:policies:rule:validate":{method:`POST`,route:`/system/policies/rule/validate`,arguments:[]},"system:scheduler:job:list":{method:`GET`,route:`/system/scheduler/job/list`,arguments:[]},"system:schedules:schedule:create":{method:`POST`,route:`/system/schedules/schedule/create`,arguments:[]},"system:schedules:schedule:delete":{method:`DELETE`,route:`/system/schedules/schedule/delete/{id}`,arguments:[`id`]},"system:schedules:schedule:get":{method:`GET`,route:`/system/schedules/schedule/get/{id}`,arguments:[`id`]},"system:schedules:schedule:list":{method:`GET`,route:`/system/schedules/schedule/list`,arguments:[]},"system:schedules:schedule:update":{method:`PATCH`,route:`/system/schedules/schedule/update/{id}`,arguments:[`id`]},"system:settings:delete":{method:`DELETE`,route:`/system/settings/delete/{key}`,arguments:[`key`]},"system:settings:get":{method:`GET`,route:`/system/settings/get/{key}`,arguments:[`key`]},"system:settings:list":{method:`GET`,route:`/system/settings/list`,arguments:[]},"system:settings:set":{method:`POST`,route:`/system/settings/set/{key}`,arguments:[`key`]},"system:updates:changelog:get":{method:`GET`,route:`/system/updates/changelog/get`,arguments:[]},"system:updates:check:create":{method:`POST`,route:`/system/updates/check/create`,arguments:[]},"system:updates:check:get":{method:`GET`,route:`/system/updates/check/get`,arguments:[]},"system:updates:stage:create":{method:`POST`,route:`/system/updates/stage/create`,arguments:[]},"system:updates:status:get":{method:`GET`,route:`/system/updates/status/get`,arguments:[]},"system:updates:update:apply":{method:`POST`,route:`/system/updates/update/apply`,arguments:[]},"system:updates:update:discard":{method:`DELETE`,route:`/system/updates/update/discard`,arguments:[]},"system:users:password:change":{method:`PATCH`,route:`/system/users/password/change/{user_id}`,arguments:[`user_id`]},"system:users:user:create":{method:`POST`,route:`/system/users/user/create`,arguments:[]},"system:users:user:delete":{method:`DELETE`,route:`/system/users/user/delete/{user_id}`,arguments:[`user_id`]},"system:users:user:get":{method:`GET`,route:`/system/users/user/get/{user_id}`,arguments:[`user_id`]},"system:users:user:update":{method:`PATCH`,route:`/system/users/user/update/{user_id}`,arguments:[`user_id`]},"system:workflows:definition:compile":{method:`POST`,route:`/system/workflows/definition/compile`,arguments:[]},"system:workflows:definition:create":{method:`POST`,route:`/system/workflows/definition/create`,arguments:[]},"system:workflows:definition:delete":{method:`DELETE`,route:`/system/workflows/definition/delete/{id}`,arguments:[`id`]},"system:workflows:definition:get":{method:`GET`,route:`/system/workflows/definition/get/{id}`,arguments:[`id`]},"system:workflows:definition:list":{method:`GET`,route:`/system/workflows/definition/list`,arguments:[]},"system:workflows:definition:update":{method:`PATCH`,route:`/system/workflows/definition/update/{id}`,arguments:[`id`]},"system:workflows:registry:get":{method:`GET`,route:`/system/workflows/registry/get/{kind}`,arguments:[`kind`]},"system:workflows:registry:handles":{method:`GET`,route:`/system/workflows/registry/handles`,arguments:[]},"system:workflows:registry:list":{method:`GET`,route:`/system/workflows/registry/list`,arguments:[]},"system:workflows:run:events":{method:`GET`,route:`/system/workflows/run/events/{run_id}`,arguments:[`run_id`]},"system:workflows:run:get":{method:`GET`,route:`/system/workflows/run/get/{run_id}`,arguments:[`run_id`]},"system:workflows:run:list":{method:`GET`,route:`/system/workflows/run/list`,arguments:[]},"system:workflows:run:outcome":{method:`GET`,route:`/system/workflows/run/outcome/{run_id}`,arguments:[`run_id`]},"system:workflows:run:store":{method:`GET`,route:`/system/workflows/run/store/{run_id}`,arguments:[`run_id`]},"system:workflows:run:stream":{method:`GET`,route:`/system/workflows/run/stream/{run_id}`,arguments:[`run_id`]},"system:workflows:runtime:abort":{method:`DELETE`,route:`/system/workflows/runtime/abort/{run_id}`,arguments:[`run_id`]},"system:workflows:runtime:events":{method:`POST`,route:`/system/workflows/runtime/events`,arguments:[]},"system:workflows:runtime:has":{method:`GET`,route:`/system/workflows/runtime/has/{id}`,arguments:[`id`]},"system:workflows:runtime:invoke":{method:`POST`,route:`/system/workflows/runtime/invoke`,arguments:[]},"system:workflows:runtime:list":{method:`GET`,route:`/system/workflows/runtime/list`,arguments:[]},"system:workflows:runtime:resume":{method:`POST`,route:`/system/workflows/runtime/resume`,arguments:[]},"system:workflows:runtime:run":{method:`POST`,route:`/system/workflows/runtime/run`,arguments:[]}};var h=class{data;status;constructor(e,t){this.data=e,this.status=t}},g=class{baseUrl;apiPrefix;onAuthStateChanged;raw;constructor(t,n,r){this.baseUrl=t,this.apiPrefix=n,this.onAuthStateChanged=r,this.raw=e({baseUrl:t,defaultResponseType:`json`,defaultBodyType:`json`})}substituteArgs(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]?encodeURIComponent(t[n]):`{${n}}`)}async dispatch(e,t){let r=m[e];if(!r)throw new n({code:`ROUTE_NOT_FOUND`,message:`No registered route for handler: ${e}`});let i=this.substituteArgs(r.route,t?.arguments??{}),a=r.method,o={},s=t?.notifyAuthStateChange??!0;if(t?.headers&&(o.headers=t.headers),t?.responseType&&(o.responseType=t.responseType),t?.bodyType&&(o.bodyType=t.bodyType),t?.signal&&(o.signal=t.signal),t?.modifiers){let e=Object.entries(t.modifiers).flatMap(([e,t])=>(Array.isArray(t)?t:[t]).map(t=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join(`&`);if(e){let n=i.includes(`?`)?`&`:`?`;return this.request(a,`${i}${n}${e}`,t?.payload,o,s)}}return this.request(a,i,t?.payload,o,s)}routeUrl(e,t){let r=m[e];if(!r)throw new n({code:`ROUTE_NOT_FOUND`,message:`No registered route for handler: ${e}`});return`${this.baseUrl.replace(/\/+$/,``)}/${this.canonicalPath(this.substituteArgs(r.route,t??{}))}`}base(){return this.baseUrl}prefix(){return this.apiPrefix}async ready(){}canonicalPath(e){let t=e.replace(/^\/+/,``);if(this.apiPrefix){let e=this.apiPrefix.replace(/^\/+/,``),n=RegExp(`^${e}/?`);return t=t.replace(n,``),`${e}/${t}`}return t}async request(e,t,n,r,i=!1){let a=this.canonicalPath(t),o={};r?.headers&&(o.headers={...r.headers}),r?.responseType&&(o.responseType=r.responseType),r?.bodyType&&(o.bodyType=r.bodyType),r?.signal&&(o.signal=r.signal),o.headers||={};let s;if(e===`GET`)s=await this.raw.get(a,o);else{let t=r?.bodyType?{type:r.bodyType}:void 0;s=await this.raw[e.toLowerCase()](a,n,o,t)}if(s.success||s.status===204)return new h(s.data,s.status);s.status===401&&i&&this.onAuthStateChanged?.();let c=s.raw?await l(s.raw):null;throw u(s,c)}async check(e,t,n){return this.request(`POST`,`${e}/check`,t,n)}async get(e,t){return this.request(`GET`,e,void 0,t)}async post(e,t,n){return this.request(`POST`,e,t,n)}async patch(e,t,n){return this.request(`PATCH`,e,t,n)}async put(e,t,n){return this.request(`PUT`,e,t,n)}async delete(e,t,n){return this.request(`DELETE`,e,t,n)}async openStream(e,t,n){let r={Accept:`text/event-stream`,...n?.headers??{}},i=`${this.baseUrl.replace(/\/+$/,``)}/${this.canonicalPath(e)}`,a;try{a=await fetch(i,{method:`GET`,headers:r,signal:n?.signal})}catch(e){if(e instanceof Error&&e.name===`AbortError`){t.onClose?.();return}t.onError?.(e instanceof Error?e:Error(String(e)));return}if(!a.ok||!a.body){t.onError?.(Error(`Stream request failed with status ${a.status}`));return}t.onOpen?.();let o=a.body.getReader(),s=new TextDecoder,c=``;try{for(;;){let{done:e,value:n}=await o.read();if(e)break;c+=s.decode(n,{stream:!0});let r=c.indexOf(`
1
+ import{createNetworkClient as e}from"@asaidimu/network-client";import{Errors as t,SystemError as n}from"@asaidimu/utils-error";import{Debouncer as r,Once as i}from"@asaidimu/utils-sync";import{DELETE_SYMBOL as a,ReactiveDataStore as o}from"@asaidimu/utils-store";import{createMatcher as s,createSorter as c}from"@asaidimu/query";async function l(e){try{return(await e.clone().json())?.error??null}catch{return null}}function u(e,t){if(t)return new n({code:t.code??`UNKNOWN`,message:t.message??`Unknown error`,issues:t.details?.issues});let r=e.error?.message;if(typeof r==`object`&&r){let e=r;return new n({code:e.code??`UNKNOWN`,message:e.message??`Unknown error`})}return new n({code:`UNKNOWN`,message:r??`Unknown error`})}function d(e){return t.notFound(e)}function f(e){return t.permissionDenied(e)}function p(e){return t.internalError(e)}const m={"system:apikeys:key:create":{method:`POST`,route:`/system/apikeys/key/create`,arguments:[]},"system:apikeys:key:delete":{method:`DELETE`,route:`/system/apikeys/key/delete/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:get":{method:`GET`,route:`/system/apikeys/key/get/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:list":{method:`GET`,route:`/system/apikeys/key/list`,arguments:[]},"system:apikeys:key:rotate":{method:`POST`,route:`/system/apikeys/key/rotate/{key_id}`,arguments:[`key_id`]},"system:apikeys:key:update":{method:`PATCH`,route:`/system/apikeys/key/update/{key_id}`,arguments:[`key_id`]},"system:audit:log:export":{method:`PATCH`,route:`/system/audit/log/export`,arguments:[]},"system:audit:log:stream":{method:`GET`,route:`/system/audit/log/stream`,arguments:[]},"system:auth:bootstrap:password:set":{method:`PATCH`,route:`/system/auth/bootstrap/password/set`,arguments:[]},"system:auth:password:confirm":{method:`PATCH`,route:`/system/auth/password/confirm`,arguments:[]},"system:auth:password:reset":{method:`POST`,route:`/system/auth/password/reset`,arguments:[]},"system:auth:session:create":{method:`POST`,route:`/system/auth/session/create`,arguments:[]},"system:auth:session:delete":{method:`DELETE`,route:`/system/auth/session/delete`,arguments:[]},"system:auth:token:elevate":{method:`POST`,route:`/system/auth/token/elevate`,arguments:[]},"system:blobs:blob:abort":{method:`POST`,route:`/system/blobs/blob/abort/{ns}`,arguments:[`ns`]},"system:blobs:blob:begin":{method:`POST`,route:`/system/blobs/blob/begin/{ns}`,arguments:[`ns`]},"system:blobs:blob:chunk":{method:`POST`,route:`/system/blobs/blob/chunk/{ns}`,arguments:[`ns`]},"system:blobs:blob:complete":{method:`POST`,route:`/system/blobs/blob/complete/{ns}`,arguments:[`ns`]},"system:blobs:blob:delete":{method:`DELETE`,route:`/system/blobs/blob/delete/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:download":{method:`GET`,route:`/system/blobs/blob/download/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:head":{method:`POST`,route:`/system/blobs/blob/head/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:list":{method:`POST`,route:`/system/blobs/blob/list/{ns}`,arguments:[`ns`]},"system:blobs:blob:progress":{method:`POST`,route:`/system/blobs/blob/progress/{ns}`,arguments:[`ns`]},"system:blobs:blob:rename":{method:`PATCH`,route:`/system/blobs/blob/rename/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:update":{method:`PATCH`,route:`/system/blobs/blob/update/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:blob:upload":{method:`POST`,route:`/system/blobs/blob/upload/{ns}/{key}`,arguments:[`ns`,`key`]},"system:blobs:namespace:compact":{method:`POST`,route:`/system/blobs/namespace/compact/{ns}`,arguments:[`ns`]},"system:blobs:namespace:create":{method:`POST`,route:`/system/blobs/namespace/create/{ns}`,arguments:[`ns`]},"system:blobs:namespace:delete":{method:`DELETE`,route:`/system/blobs/namespace/delete/{ns}`,arguments:[`ns`]},"system:blobs:namespace:list":{method:`POST`,route:`/system/blobs/namespace/list`,arguments:[]},"system:blobs:namespace:stats":{method:`POST`,route:`/system/blobs/namespace/stats/{ns}`,arguments:[`ns`]},"system:blobs:namespace:verify":{method:`POST`,route:`/system/blobs/namespace/verify/{ns}`,arguments:[`ns`]},"system:collections:audit_log:query":{method:`POST`,route:`/system/collections/audit_log/query`,arguments:[]},"system:collections:collection:create":{method:`POST`,route:`/system/collections/collection/create`,arguments:[]},"system:collections:collection:delete":{method:`DELETE`,route:`/system/collections/collection/delete/{name}`,arguments:[`name`]},"system:collections:collection:get":{method:`GET`,route:`/system/collections/collection/get/{name}`,arguments:[`name`]},"system:collections:collection:list":{method:`GET`,route:`/system/collections/collection/list`,arguments:[]},"system:collections:document:create":{method:`POST`,route:`/system/collections/document/create/{name}`,arguments:[`name`]},"system:collections:document:delete":{method:`DELETE`,route:`/system/collections/document/delete/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:document:get":{method:`GET`,route:`/system/collections/document/get/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:document:query":{method:`POST`,route:`/system/collections/document/query/{name}`,arguments:[`name`]},"system:collections:document:update":{method:`PATCH`,route:`/system/collections/document/update/{name}/{doc_id}`,arguments:[`name`,`doc_id`]},"system:collections:user:query":{method:`POST`,route:`/system/collections/user/query`,arguments:[]},"system:core:capability:list":{method:`GET`,route:`/system/core/capability/list`,arguments:[]},"system:core:capability:set":{method:`PATCH`,route:`/system/core/capability/set/{name}`,arguments:[`name`]},"system:core:docs:list":{method:`GET`,route:`/system/core/docs/list`,arguments:[]},"system:core:health:check":{method:`GET`,route:`/system/core/health/check`,arguments:[]},"system:core:heartbeat":{method:`GET`,route:`/system/core/heartbeat`,arguments:[]},"system:core:reset":{method:`DELETE`,route:`/system/core/reset`,arguments:[]},"system:logs:list":{method:`POST`,route:`/system/logs/list`,arguments:[]},"system:logs:stream":{method:`GET`,route:`/system/logs/stream`,arguments:[]},"system:notifications:notification:create":{method:`POST`,route:`/system/notifications/notification/create`,arguments:[]},"system:notifications:notification:list":{method:`GET`,route:`/system/notifications/notification/list`,arguments:[]},"system:notifications:notification:read":{method:`PATCH`,route:`/system/notifications/notification/read/{notification_id}`,arguments:[`notification_id`]},"system:notifications:notification:stream":{method:`GET`,route:`/system/notifications/notification/stream`,arguments:[]},"system:notifications:read:all":{method:`PATCH`,route:`/system/notifications/read/all`,arguments:[]},"system:notifications:unread:count":{method:`GET`,route:`/system/notifications/unread/count`,arguments:[]},"system:policies:binding:get":{method:`GET`,route:`/system/policies/binding/get/{name}`,arguments:[`name`]},"system:policies:binding:list":{method:`GET`,route:`/system/policies/binding/list`,arguments:[]},"system:policies:policy:create":{method:`POST`,route:`/system/policies/policy/create/{name}`,arguments:[`name`]},"system:policies:policy:list":{method:`GET`,route:`/system/policies/policy/list`,arguments:[]},"system:policies:policy:update":{method:`PATCH`,route:`/system/policies/policy/update/{name}`,arguments:[`name`]},"system:policies:reload":{method:`GET`,route:`/system/policies/reload`,arguments:[]},"system:policies:rule:create":{method:`POST`,route:`/system/policies/rule/create/{name}`,arguments:[`name`]},"system:policies:rule:delete":{method:`DELETE`,route:`/system/policies/rule/delete/{name}`,arguments:[`name`]},"system:policies:rule:get":{method:`GET`,route:`/system/policies/rule/get/{name}`,arguments:[`name`]},"system:policies:rule:list":{method:`GET`,route:`/system/policies/rule/list`,arguments:[]},"system:policies:rule:update":{method:`PATCH`,route:`/system/policies/rule/update/{name}`,arguments:[`name`]},"system:policies:rule:validate":{method:`POST`,route:`/system/policies/rule/validate`,arguments:[]},"system:scheduler:job:list":{method:`GET`,route:`/system/scheduler/job/list`,arguments:[]},"system:schedules:schedule:create":{method:`POST`,route:`/system/schedules/schedule/create`,arguments:[]},"system:schedules:schedule:delete":{method:`DELETE`,route:`/system/schedules/schedule/delete/{id}`,arguments:[`id`]},"system:schedules:schedule:get":{method:`GET`,route:`/system/schedules/schedule/get/{id}`,arguments:[`id`]},"system:schedules:schedule:list":{method:`GET`,route:`/system/schedules/schedule/list`,arguments:[]},"system:schedules:schedule:update":{method:`PATCH`,route:`/system/schedules/schedule/update/{id}`,arguments:[`id`]},"system:settings:delete":{method:`DELETE`,route:`/system/settings/delete/{key}`,arguments:[`key`]},"system:settings:get":{method:`GET`,route:`/system/settings/get/{key}`,arguments:[`key`]},"system:settings:list":{method:`GET`,route:`/system/settings/list`,arguments:[]},"system:settings:set":{method:`POST`,route:`/system/settings/set/{key}`,arguments:[`key`]},"system:updates:changelog:get":{method:`GET`,route:`/system/updates/changelog/get`,arguments:[]},"system:updates:check:create":{method:`POST`,route:`/system/updates/check/create`,arguments:[]},"system:updates:check:get":{method:`GET`,route:`/system/updates/check/get`,arguments:[]},"system:updates:stage:create":{method:`POST`,route:`/system/updates/stage/create`,arguments:[]},"system:updates:status:get":{method:`GET`,route:`/system/updates/status/get`,arguments:[]},"system:updates:update:apply":{method:`POST`,route:`/system/updates/update/apply`,arguments:[]},"system:updates:update:discard":{method:`DELETE`,route:`/system/updates/update/discard`,arguments:[]},"system:users:password:change":{method:`PATCH`,route:`/system/users/password/change/{user_id}`,arguments:[`user_id`]},"system:users:user:create":{method:`POST`,route:`/system/users/user/create`,arguments:[]},"system:users:user:delete":{method:`DELETE`,route:`/system/users/user/delete/{user_id}`,arguments:[`user_id`]},"system:users:user:get":{method:`GET`,route:`/system/users/user/get/{user_id}`,arguments:[`user_id`]},"system:users:user:update":{method:`PATCH`,route:`/system/users/user/update/{user_id}`,arguments:[`user_id`]},"system:workflows:definition:compile":{method:`POST`,route:`/system/workflows/definition/compile`,arguments:[]},"system:workflows:definition:create":{method:`POST`,route:`/system/workflows/definition/create`,arguments:[]},"system:workflows:definition:delete":{method:`DELETE`,route:`/system/workflows/definition/delete/{id}`,arguments:[`id`]},"system:workflows:definition:get":{method:`GET`,route:`/system/workflows/definition/get/{id}`,arguments:[`id`]},"system:workflows:definition:list":{method:`GET`,route:`/system/workflows/definition/list`,arguments:[]},"system:workflows:definition:update":{method:`PATCH`,route:`/system/workflows/definition/update/{id}`,arguments:[`id`]},"system:workflows:registry:get":{method:`GET`,route:`/system/workflows/registry/get/{kind}`,arguments:[`kind`]},"system:workflows:registry:handles":{method:`GET`,route:`/system/workflows/registry/handles`,arguments:[]},"system:workflows:registry:list":{method:`GET`,route:`/system/workflows/registry/list`,arguments:[]},"system:workflows:run:events":{method:`GET`,route:`/system/workflows/run/events/{run_id}`,arguments:[`run_id`]},"system:workflows:run:get":{method:`GET`,route:`/system/workflows/run/get/{run_id}`,arguments:[`run_id`]},"system:workflows:run:list":{method:`GET`,route:`/system/workflows/run/list`,arguments:[]},"system:workflows:run:outcome":{method:`GET`,route:`/system/workflows/run/outcome/{run_id}`,arguments:[`run_id`]},"system:workflows:run:store":{method:`GET`,route:`/system/workflows/run/store/{run_id}`,arguments:[`run_id`]},"system:workflows:run:stream":{method:`GET`,route:`/system/workflows/run/stream/{run_id}`,arguments:[`run_id`]},"system:workflows:runtime:abort":{method:`DELETE`,route:`/system/workflows/runtime/abort/{run_id}`,arguments:[`run_id`]},"system:workflows:runtime:events":{method:`POST`,route:`/system/workflows/runtime/events`,arguments:[]},"system:workflows:runtime:has":{method:`GET`,route:`/system/workflows/runtime/has/{id}`,arguments:[`id`]},"system:workflows:runtime:invoke":{method:`POST`,route:`/system/workflows/runtime/invoke`,arguments:[]},"system:workflows:runtime:list":{method:`GET`,route:`/system/workflows/runtime/list`,arguments:[]},"system:workflows:runtime:resume":{method:`POST`,route:`/system/workflows/runtime/resume`,arguments:[]},"system:workflows:runtime:run":{method:`POST`,route:`/system/workflows/runtime/run`,arguments:[]}};var h=class{data;status;constructor(e,t){this.data=e,this.status=t}},g=class{baseUrl;apiPrefix;onAuthStateChanged;raw;constructor(t,n,r){this.baseUrl=t,this.apiPrefix=n,this.onAuthStateChanged=r,this.raw=e({baseUrl:t,defaultResponseType:`json`,defaultBodyType:`json`})}substituteArgs(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]?encodeURIComponent(t[n]):`{${n}}`)}async dispatch(e,t){let r=m[e];if(!r)throw new n({code:`ROUTE_NOT_FOUND`,message:`No registered route for handler: ${e}`});let i=this.substituteArgs(r.route,t?.arguments??{}),a=r.method,o={},s=t?.notifyAuthStateChange??!0;if(t?.headers&&(o.headers=t.headers),t?.responseType&&(o.responseType=t.responseType),t?.bodyType&&(o.bodyType=t.bodyType),t?.signal&&(o.signal=t.signal),t?.modifiers){let e=Object.entries(t.modifiers).flatMap(([e,t])=>(Array.isArray(t)?t:[t]).map(t=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join(`&`);if(e){let n=i.includes(`?`)?`&`:`?`;return this.request(a,`${i}${n}${e}`,t?.payload,o,s)}}return this.request(a,i,t?.payload,o,s)}routeUrl(e,t){let r=m[e];if(!r)throw new n({code:`ROUTE_NOT_FOUND`,message:`No registered route for handler: ${e}`});return`${this.baseUrl.replace(/\/+$/,``)}/${this.canonicalPath(this.substituteArgs(r.route,t??{}))}`}base(){return this.baseUrl}prefix(){return this.apiPrefix}async ready(){}canonicalPath(e){let t=e.replace(/^\/+/,``);if(this.apiPrefix){let e=this.apiPrefix.replace(/^\/+/,``),n=RegExp(`^${e}/?`);return t=t.replace(n,``),`${e}/${t}`}return t}async request(e,t,n,r,i=!1){let a=this.canonicalPath(t),o={};r?.headers&&(o.headers={...r.headers}),r?.responseType&&(o.responseType=r.responseType),r?.bodyType&&(o.bodyType=r.bodyType),r?.signal&&(o.signal=r.signal),o.headers||={};let s;if(e===`GET`)s=await this.raw.get(a,o);else{let t=r?.bodyType?{type:r.bodyType}:void 0;s=await this.raw[e.toLowerCase()](a,n,o,t)}if(s.success||s.status===204)return new h(s.data,s.status);s.status===401&&i&&this.onAuthStateChanged?.();let c=s.raw?await l(s.raw):null;throw u(s,c)}async check(e,t,n){return this.request(`POST`,`${e}/check`,t,n)}async get(e,t){return this.request(`GET`,e,void 0,t)}async post(e,t,n){return this.request(`POST`,e,t,n)}async patch(e,t,n){return this.request(`PATCH`,e,t,n)}async put(e,t,n){return this.request(`PUT`,e,t,n)}async delete(e,t,n){return this.request(`DELETE`,e,t,n)}async openStream(e,t,n){let r={Accept:`text/event-stream`,...n?.headers??{}},i=`${this.baseUrl.replace(/\/+$/,``)}/${this.canonicalPath(e)}`,a;try{a=await fetch(i,{method:`GET`,headers:r,signal:n?.signal})}catch(e){if(e instanceof Error&&e.name===`AbortError`){t.onClose?.();return}t.onError?.(e instanceof Error?e:Error(String(e)));return}if(!a.ok||!a.body){t.onError?.(Error(`Stream request failed with status ${a.status}`));return}t.onOpen?.();let o=a.body.getReader(),s=new TextDecoder,c=``;try{for(;;){let{done:e,value:n}=await o.read();if(e)break;c+=s.decode(n,{stream:!0});let r=c.indexOf(`
2
2
 
3
3
  `);for(;r!==-1;){let e=c.slice(0,r);c=c.slice(r+2);let n=e.split(`
4
4
  `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trim());n.length>0&&t.onMessage(n.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asaidimu/hestia",
3
- "version": "1.10.2",
3
+ "version": "1.10.3",
4
4
  "description": "TypeScript client SDK for the Hestia platform — auth, collections, API keys, policies, audit logs, blobs, and capabilities",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",