@jointhedots/core 2.1.2 → 2.1.4
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/bundle.manifest.json +6 -2
- package/chunk.FZNTVWPG.js +1 -0
- package/{chunk.EUJGM6AI.js → chunk.I3IQPWRL.js} +1 -1
- package/{chunk.FUGADS64.js → chunk.IAUN77LU.js} +1 -1
- package/components.d.ts +0 -0
- package/export.commands.js +1 -1
- package/export.js +1 -1
- package/export.react.js +1 -1
- package/export.rest.js +1 -1
- package/export.storage.js +1 -1
- package/export.view.js +1 -1
- package/package.json +1 -1
- package/types.d.ts +46 -44
- package/chunk.JO4TTNUQ.js +0 -1
package/bundle.manifest.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "jointhedots.core",
|
|
2
|
+
"$id": "@jointhedots.core",
|
|
3
|
+
"type": "bundle",
|
|
3
4
|
"name": "@jointhedots/core",
|
|
5
|
+
"icon": "",
|
|
6
|
+
"title": "@jointhedots/core",
|
|
4
7
|
"data": {
|
|
5
|
-
"baseline": "jointhedots.core-v0",
|
|
8
|
+
"baseline": "@jointhedots.core-v0",
|
|
6
9
|
"components": [],
|
|
10
|
+
"namespaces": [],
|
|
7
11
|
"exports": {
|
|
8
12
|
"@jointhedots/core": "export.js",
|
|
9
13
|
"@jointhedots/core/commands": "export.commands.js",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{URI as U}from"vscode-uri";import{URI as ye,Utils as he}from"vscode-uri";var f=class t{constructor(e,n){this.resource=e;this.definition=n}get(e){return e.getResource(this.resource)?.get()}fetch(e){return e.fetchResource(this.resource)}spec(e){return e.acquireResource(this.resource)?.spec}subservice(e){return t.About(`${this.resource}.${e}`)}static About(e,n=null){return new t(e,n)}};var T=f.About("component"),xe=f.About("editor");var w={object:{async read(t){let e=await t.text();return JSON.parse(e)},async write(t){let e=JSON.stringify(t);return new Blob([e],{type:"application/json"})}},text:{async read(t){return t.text()},async write(t){return new Blob([t],{type:"text/plain"})}}};function B(t){let[e,n]=t.split(","),o=e.match(/data:([^;]+)/),r=o?o[1]:"application/octet-stream",s=atob(n),i=new Uint8Array(s.length);for(let a=0;a<s.length;a++)i[a]=s.charCodeAt(a);return new Blob([i],{type:r})}function F(t){let e=t.match(/data:([^;]+)/);return e?e[1]:"application/octet-stream"}async function A(t){return new Promise((e,n)=>{let o=new FileReader;o.onloadend=()=>e(o.result),o.onerror=n,o.readAsDataURL(t)})}import{URI as $}from"vscode-uri";function x(t){if(t.startsWith("./")){let e=$.parse(window.location.href),n=e.path.split("/");return n[n.length-1]=t.slice(2),e.with({path:n.join("/"),query:"",fragment:""})}else return t.startsWith("/")?$.parse(window.location.href).with({path:t,query:"",fragment:""}):$.parse(t)}async function Y(t){let e=t.apis?Object.keys(t.apis):[];if(t.type){let n=await l(t.type)?.fetch();if(n){for(let o in n?.apis)if(o.startsWith("component.")){let r=o.slice(10);e.includes(r)||e.push(r)}}else throw new Error("Cannot create publiction properly")}return e}async function I(t){let{$id:e}=t;return{id:e,type:t.type,icon:t.icon,title:t.title||e,description:t.description||"",keywords:t.keywords,tags:t.tags,services:await Y(t)}}function Ee(t){let e={query:t?.query||"",pattern:t?.pattern||null,tags:t?.tags||[],keywords:t?.keywords||[],services:t?.services||[],types:t?.types||[]};if(e.query.length>0)for(let n of e.query.split(/\s/))n.length>0&&!e.keywords.includes(n)&&e.keywords.push(n);return e.keywords.length>0&&(e.pattern=new RegExp(`(${e.keywords.join(").*(")})`)),e}function _(t,e){function n(s,i){return i?s?!i||i.test(s):!1:!0}function o(s,i){return!!(i.length===0||s&&i.includes(s))}function r(s,i){if(i.length===0)return!0;if(s){for(let a of s)if(i.includes(a))return!0}return!1}return!(!n(t.title||t.id,e.pattern)&&!n(t.description,e.pattern)||!r(t.services,e.services)||!r(t.keywords,e.keywords)||!r(t.tags,e.tags)||!o(t.type,e.types))}function N(t){if(typeof t=="string"){let[e,n]=t.split("#",2),o={type:"module",location:e};if(n){let[r,s]=n.split("?",2);if(o.identifier=r,s)for(let i of s.split("&")){let[a,m]=i.split("=");o[a]=m===void 0?!0:m}}return o}return t}var S=class{constructor(e){this.storage=e}modules_exports=new Map;baseUrl=Z(import.meta.url);async load_resource(e){if(this.modules_exports.has(e))return this.modules_exports.get(e);let n=x(e);switch(await this.storage.check_content(n)){case"application/json":case"text/json":return this.import_module_json(e,n);default:return this.import_module_esm(e,n)}}async import_module_json(e,n){let o=await this.storage.load_content(n);return w.object.read(o)}async import_module_esm(e,n){let o=n.toString();try{let r=await import(o);return this.modules_exports.set(e,r),r}catch(r){throw r.message=`Cannot import '${o}': ${r.message}`,r}}};function Z(t){let e=t.split("/");return e.pop(),e.join("/")}import{URI as ee}from"vscode-uri";var R=class{async check_url_content(e){let n=await fetch(e,{method:"HEAD"});if(n.ok){let o=n.headers.get("content-type");return o?o.split(";")[0].trim():"application/octet-stream"}return null}async load_url_content(e){let n=await fetch(e);if(n.ok)return n.blob();throw new Error(`Fetch failed ${n.statusText} ${n.status} '${e}'`)}async check_content(e){if(e.scheme==="local"){let n=e.toString(),o=localStorage.getItem(n);if(o)return F(o);throw new Error(`Unsupported local content uri: ${e}`)}else return this.check_url_content(e.toString())}async load_content(e){if(e.scheme==="local"){let n=e.toString();if(localStorage.getItem(n))return B(localStorage.getItem(n));throw new Error(`Unsupported local content uri: ${e}`)}else return this.load_url_content(e.toString())}async store_content(e,n){if(n.scheme==="local"){let o=n.toString(),r=await A(e);return localStorage.setItem(o,r),!0}return!1}};function qe(t,e,n){let o=n?`/${e}/${n}`:`/${e}`;return ee.from({scheme:"local",authority:t,path:o})}var C=class{pubs=new Map;constructor(e=[]){for(let n of e)this.pubs.set(n.id,n)}async get_component_publication(e){return this.pubs.get(e)}async search_component_publications(e){let n=[];for(let o of this.pubs.values())_(o,e)&&n.push(o);return n}},j=class extends C{manifests=new Map;async add_component(e){let n=await I(e);return this.manifests.set(n.id,e),this.pubs.set(n.id,n),n}async delete_component(e){return this.manifests.delete(e),this.pubs.delete(e),!0}async get_component_manifest(e){return this.manifests.get(e)}async set_component_manifest(e,n){return!1}};var E=class{constructor(e){this.content_provider=e}manifest=null;catalog=null;async get_provider_bundle(){return this.manifest||(this.manifest=await(await fetch("./bundle.manifest.json")).json()),this.manifest}async get_component_catalog(){if(!this.catalog){let e=await this.get_provider_bundle();this.catalog=new C(e.data?.components)}return this.catalog}async get_component_publication(e){return(await this.get_component_catalog()).get_component_publication(e)}async search_component_publications(e){return(await this.get_component_catalog()).search_component_publications(e)}async get_component_manifest(e){try{let o=(await this.get_provider_bundle()).data.components.find(r=>r.id===e);if(o){let r=x(o.ref?`./${o.ref}`:`./${e}.json`),s=await this.content_provider.load_content(r);if(s)return w.object.read(s)}}catch{}return null}async set_component_manifest(e,n){return!1}async add_component(e){return null}async delete_component(e){return!1}};var M=class{constructor(e=[]){this.providers=e}add_provider(e){this.providers.push(e)}async get_component_publication(e){for(let n of this.providers){let o=await n.get_component_publication(e);if(o)return o}return null}async search_component_publications(e){let n=[];for(let o of this.providers){let r=await o.search_component_publications(e);r&&n.push(...r)}return n}async get_component_manifest(e){for(let n of this.providers){let o=await n.get_component_manifest(e);if(o)return o}return null}async set_component_manifest(e,n){for(let o of this.providers)if(await o.set_component_manifest(e,n))return!0;return!1}async add_component(e){for(let n of this.providers){let o=await n.add_component(e);if(o)return o}return null}async delete_component(e){for(let n of this.providers)if(await n.delete_component(e))return!0;return!1}};var J=6,c={components:"components_v2",services:"components_services_v2",manifests:"components_manifests_v2"},te=["components","components_services","components_manifests"];function ne(t){t.createObjectStore(c.components,{keyPath:"id"}).createIndex("title","title",{unique:!1});let n=t.createObjectStore(c.services,{keyPath:["component_id","service"]});n.createIndex("component_id","component_id",{unique:!1}),n.createIndex("service","service",{unique:!1}),t.createObjectStore(c.manifests,{keyPath:"component_id"}).createIndex("component_id","component_id",{unique:!1})}function oe(t,e){if(te.some(o=>t.objectStoreNames.contains(o))){if(t.objectStoreNames.contains("components")){let o=e.objectStore("components"),r=e.objectStore(c.components),s=o.getAll();s.onsuccess=()=>{for(let i of s.result)"component_id"in i&&!("id"in i)&&(i.id=i.component_id,delete i.component_id),r.put(i);t.deleteObjectStore("components")}}if(t.objectStoreNames.contains("components_manifests")){let o=e.objectStore("components_manifests"),r=e.objectStore(c.manifests),s=o.getAll();s.onsuccess=()=>{for(let i of s.result)i.manifest&&"services"in i.manifest&&!("apis"in i.manifest)&&(i.manifest.apis=i.manifest.services,delete i.manifest.services),r.put(i);t.deleteObjectStore("components_manifests")}}if(t.objectStoreNames.contains("components_services")){let o=e.objectStore("components_services"),r=e.objectStore(c.services),s=o.getAll();s.onsuccess=()=>{for(let i of s.result)r.put(i);t.deleteObjectStore("components_services")}}}}function re(){return new Promise((t,e)=>{let n=window.indexedDB.open("LocalComponents",J);n.onerror=o=>{console.error("Database error:",o.target.error),e(o.target.error)},n.onupgradeneeded=o=>{let r=o.oldVersion;console.log("Upgrade LocalComponents from",r,"to",J);let s=n.result,i=n.transaction;s.objectStoreNames.contains(c.components)||(ne(s),oe(s,i))},n.onsuccess=()=>{let o=n.result;o.onerror=r=>{console.error("Database error:",r)},t(n.result)}})}function se(t,e){return new Promise((n,o)=>{let r=[],a=t.transaction([c.manifests],"readonly").objectStore(c.manifests).getAll(e);a.onsuccess=()=>{n(a.result?.[0]?.manifest)},a.onerror=m=>{o(m.target.error)}})}function ie(t,e){let o=t.transaction([c.components,c.services],"readonly").objectStore(c.components);return new Promise((r,s)=>{let i=o.get(e);i.onsuccess=()=>{r(i.result)},i.onerror=a=>{s(a.target.error)}})}function K(t,e){let o=t.transaction([c.components,c.services],"readonly").objectStore(c.components),r=[];for(let s of e)r.push(new Promise((i,a)=>{let m=o.get(s);m.onsuccess=()=>{i(m.result)},m.onerror=u=>{a(u.target.error)}}));return Promise.all(r)}function ce(t,e){return new Promise((n,o)=>{let i=t.transaction([c.components],"readonly").objectStore(c.components).openCursor(),a=[];i.onsuccess=()=>{let m=i.result;if(m){let u=m.value;e(u)&&a.push(m.value),m.continue()}else n(a)},i.onerror=()=>{o(i.error)}})}function ae(t,e,n){let s=t.transaction([c.services],"readonly").objectStore(c.services).index("service"),i=[];for(let a of e)i.push(new Promise((m,u)=>{let g=s.getAll(a);g.onsuccess=async()=>{for(let v of g.result)v.service===a&&n.add(v.component_id);m(void 0)},g.onerror=v=>{u(v.target.error)}}));return Promise.all(i)}async function pe(t,e){let{services:n}=e;if(n&&n.length>0){let o=[],r=new Set;await ae(t,n,r);for(let s of await K(t,Array.from(r)))_(s,e)&&o.push(s);return o}else return ce(t,o=>_(o,e))}function me(t,e){return new Promise(async(n,o)=>{let r=await I(e),s=t.transaction([c.components,c.services,c.manifests],"readwrite");s.objectStore(c.components).put(r);let a=s.objectStore(c.services);for(let u of r.services)a.put({component_id:r.id,service:u});s.objectStore(c.manifests).put({component_id:r.id,manifest:e}),s.onerror=u=>o(u.target.error),s.oncomplete=()=>n(r),s.commit()})}function ue(t,e){return new Promise(async(n,o)=>{let r=await ie(t,e);if(r){let s=t.transaction([c.components,c.services,c.manifests],"readwrite");s.objectStore(c.components).delete(e);let a=s.objectStore(c.services);for(let u of r.services)a.delete([e,u]);s.objectStore(c.manifests).delete(e),s.onerror=u=>o(u.target.error),s.oncomplete=()=>n(!0),s.commit()}else n(!1)})}var O=class{db=re();async get_component_publication(e){return(await K(await this.db,[e]))[0]}async search_component_publications(e){return pe(await this.db,e)}async get_component_manifest(e){return se(await this.db,e)}async set_component_manifest(e,n){return!1}async add_component(e){return me(await this.db,e)}async delete_component(e){return ue(await this.db,e)}};function V(){try{if(window)return new O}catch{}return new j}var b={...console},Ge=console.error=(...t)=>{b.error(...t.map(e=>typeof e=="string"?`\x1B[31m${e}\x1B[0m`:e))},He=console.warn=(...t)=>{b.warn(...t.map(e=>typeof e=="string"?`\x1B[35m${e}\x1B[0m`:e))},ze=console.info=(...t)=>{b.info(...t.map(e=>typeof e=="string"?`\x1B[36m${e}\x1B[0m`:e))},Xe=console.trace=(...t)=>{b.trace(...t.map(e=>typeof e=="string"?`\x1B[34m${e}\x1B[0m`:e))},Ye=console.debug=(...t)=>{b.debug(...t.map(e=>typeof e=="string"?`\x1B[32m${e}\x1B[0m`:e))},le=console;var q=class{notifyError(e,n){console.error(e),this.notifyObject(ge(e,n))}notifyObject(e){d.push(e),console.log(e)}},D=new Set,d=[],W=0,fe=new q;de(fe);function Q(){return W++,"id-"+Date.now().toString(36)+"-"+W.toString(2)}function de(t){D.add(t)}function tt(t){D.delete(t)}function nt(){return d.length}function G(t,e){let n=[];for(let o of d)if(e===void 0||e===o.component_id){if(n.length>=t)return{objects:n,hasMore:!0};n.push(o)}return{objects:n,hasMore:!1}}function H(t){return d.reduce((e,n)=>{if(t===void 0||t===n.component_id)switch(n.status){case"error":e.error_count++,e.warn_count++,e.notify_count++,e.info_count++;break;case"warn":e.warn_count++,e.notify_count++,e.info_count++;break;case"notify":e.notify_count++,e.info_count++;break;case"info":e.info_count++;break}return e},{action_expected_count:0,error_count:0,warn_count:0,notify_count:0,info_count:0})}var h={send(t){setTimeout(()=>{for(let e of D)e.notifyObject(t)},0)},error(t,e){setTimeout(()=>{for(let n of D)n.notifyError(t,e)},0)},event(t,e){let n=y(t),o=Q();h.send({...e,kind:"event",status:e.status||"error",message:e.message||`Issue with component: ${o}`,component_id:n.id,id:o})},openTicket(t,e,n){let o=y(t),r=`${o.id}/${e}`;h.send({...n,kind:"ticket",status:n.status||"error",message:n.message||`Issue with component: ${r}`,component_id:o.id,id:r})},closeTicket(t,e){let o=`${y(t).id}/${e}`,r=d.findIndex(s=>s.id===o);if(r>=0){let s=d[r];d.splice(r,1),h.event(t,{...s,kind:"event",status:"info",icon:"[success]bi:check-circle",message:`[closed] ${s.message}`,actions:void 0,doc_uri:void 0})}}};function ge(t,e){return{id:Q(),kind:"event",status:"error",component_id:y(e).id,message:t.message}}var P=class{constructor(e){this.id=e}__instance__=void 0;manifest=void 0;get title(){return this.id}get namespace(){let e=this.id.indexOf(":");switch(e){case-1:return"std";case 0:return"";default:return this.id.slice(0,e)}}get valid(){return this.manifest!==void 0&&this.manifest.type!=="<error>"}get loaded(){return this.manifest!==void 0}get installed(){return this.__instance__!==void 0}get instance(){return this.__instance__}set instance(e){if(this.__instance__=e,e instanceof Object)p.datamap.set(e,this);else if(e!==null)throw this.__instance__=null,new Error("Component instance shall be an object")}get(){if(this.manifest===void 0)throw new Error("Cannot get manifest of not loaded module");return this.manifest}set(e){return this.manifest=e,this}fetch(){let e=p.loadings.get(this);return e||(this.manifest===void 0?e=p.components_provider.get_component_manifest(this.id).then(async n=>{if(n)n.type&&await l(n.type).fetch(),this.manifest=n;else throw new Error(`Component '${this.id}' not found`);return this.manifest}).catch(n=>(h.error(n,this),this.set({$id:this.id,type:"<error>",message:n.message,stack:n.stack}),this.__instance__=new Error(n.message),this.manifest)):e=Promise.resolve(this.manifest),p.loadings.set(this,e),e)}async install(){let e=p.installings.get(this);return e||(this.instance===void 0?(this.instance=null,e=new Promise(async n=>{try{this.loaded===!1&&await this.fetch();let o=this.manifest?.type;if(o){let r=l(o);await(await T.fetch(r)).createComponent(this,this.manifest)}}catch(o){h.error(o,this)}n(this)})):e=Promise.resolve(this),p.installings.set(this,e),e)}acquireResource(e){let n=`${this.id}#${e}`,o=p.resources.get(n);return o||(o=new L(this,e),p.resources.set(n,o)),o}getResource(e){return this.hasResource(e)?this.acquireResource(e):null}hasResource(e){let{manifest:n}=this;if(n?.apis?.[e])return!0;if(n?.type){let o=l(n.type);if(o)return o?.hasResource(`component.${e}`)}return!1}async getResourceAsync(e){return this.manifest===void 0&&await this.fetch(),this.getResource(e)}async fetchResource(e){return this.manifest===void 0&&await this.fetch(),this.getResource(e)?.fetch()}getLogStats(){return H(this.id)}getLogs(e){return G(e,this.id)}},L=class{constructor(e,n){this.component=e;this.resource=n;e.fetch()}entry=void 0;identifier=void 0;get valid(){return this.identifier!==void 0&&this.component.valid}get loaded(){return this.identifier!==void 0}async fetch(){if(this.identifier===void 0){let e=p.loadings.get(this);return e||(e=new Promise(async n=>{let{component:o}=this;try{o.installed===!1&&await o.install();let{manifest:r}=o,s=N(r.apis?.[this.resource]),i=s?.type;if(i==="module")this.entry=await p.resources_loader.load_resource(s.location),this.identifier=s.identifier;else if(i==="api.rest")this.entry=z(s,o),this.identifier=null;else if(r.type){let u=l(r.type).getResource(`component.${this.resource}`);if(u){let g=await u.fetch();g?this.entry=await g(this.component):this.entry=null,this.identifier=null}else throw new Error(`Cannot provide resource '${this.resource}'`)}else throw new Error(`Cannot load resource '${this.resource}': ${JSON.stringify(s)}`);let a=this.get();a instanceof Object&&p.datamap.set(a,this)}catch(r){console.error(`Cannot install service api '${this.resource}' of '${o.id}':`,r),this.entry=null,this.identifier=null}n(this.get()),p.loadings.set(this,null)}),p.loadings.set(this,e),e)}else return this.get()}get(){if(this.entry)return this.identifier!==null?this.entry?.[this.identifier]:this.entry}set(e){this.entry=e,this.identifier=null}get spec(){let e=this.resource.split(".")[0];return this.component.manifest?.specs?.[e]}get url(){let e=this.component.manifest?.apis?.[this.resource];if(typeof e=="string"){let n=ye.parse(window.location.href).with({fragment:null});return he.joinPath(n,"..",e.split("#")[0]).toString()}return null}},k=class{components=new Map;resources=new Map;datamap=new WeakMap;loadings=new Map;installings=new Map;listeners=new Set;components_provider=new M([]);resources_loader=null;content_provider=null;constructor(){this.content_provider=new R,this.components_provider.add_provider(new E(this.content_provider)),this.components_provider.add_provider(V()),this.resources_loader=new S(this.content_provider)}listen(e){return this.listeners.add(e),e}unlisten(e){this.listeners.delete(e)}notifyError(e,n){}},p=new k;l("<error>").set({$id:"<error>",icon:"bi:house",title:"Define invalid component"});function _e(){return l("log:application")}function y(t,e){if(t instanceof Object){let n=p.datamap.get(t)||t;if(n instanceof P)return n;if(n instanceof L)return n.component;if(!e&&t.getComponent instanceof Function)return y(t.getComponent(),!0)}return _e()}function l(t){let e=p.components.get(t);return!e&&typeof t=="string"&&(e=new P(t),p.components.set(t,e)),e}function gt(t){let e=t.$id,n=p.components.get(e);return!n&&typeof e=="string"&&(n=new P(e),n.manifest=t,n.instance=null,p.components.set(e,n)),n}function yt(t){let e=t.split("#");return e.length===2?l(e[0])?.acquireResource(e[1]):null}function ht(t,e){return e&&t.startsWith("/")?l(`${e?.id}${t}`):null}async function _t(t){let e=l(t.$id);return p.loadings.delete(e),e.manifest=t,Ce(e)}async function Ce(t){console.log("[Update Component]",t.id);let e=await t.fetch();if(await p.components_provider.add_component(e),t.loaded&&e.type&&t.installed){let o=await T.fetch(l(e.type));o&&(t.instance?await o.updateComponent(t,e):(t.__instance__=void 0,await o.createComponent(t,e))),t.instance instanceof Object&&p.datamap.set(t.instance,t),p.listeners.forEach(r=>r(t))}return t}async function Ct(t){console.log("deleteComponent",t),await p.components_provider.delete_component(t)&&be(t)}function be(t){let e=p.components.get(t);e&&(e.set({$id:e.id,type:"<error>",message:"Component deleted"}),p.listeners.forEach(n=>n(e)),p.components.delete(t))}async function bt(t){return p.components_provider.search_component_publications(t)}async function Pt(t){let e=[];for(let n of t){let o=await p.components_provider.get_component_publication(n);o?e.push(o):e.push(Pe(n))}return e}function Pe(t,e){return{id:t,title:e||"! Not found: "+t}}var X=f.About("api.rest");function z(t,e){let n=t.endpoint+(t.path||"");return{invoke(o,r){return globalThis.fetch(n+o,r)},getUrl(o){return n+o}}}var Rt={async fetch(t,e){if(typeof t=="string"&&(t=U.parse(t)),t.scheme==="jtd"){let n=l(t.authority),o=await X.fetch(n);if(o){let r=t.query?`${t.path}?${t.query}`:t.path;return o.invoke(r,e)}else return Response.error()}else return fetch(t.toString(),e)},async getUri(t){if(typeof t=="string"&&(t=U.parse(t)),t.scheme==="jtd"){let e=l(t.authority),n=await X.fetch(e);if(n){let o=t.query?`${t.path}?${t.query}`:t.path;t=U.parse(n.getUrl(o))}else throw new Error(`Unknown component '${t.authority}'`)}return t}};export{f as a,T as b,xe as c,x as d,Y as e,I as f,Ee as g,_ as h,N as i,S as j,R as k,qe as l,C as m,j as n,E as o,M as p,V as q,X as r,z as s,Rt as t,P as u,L as v,k as w,p as x,_e as y,y as z,l as A,gt as B,yt as C,ht as D,_t as E,Ce as F,Ct as G,be as H,bt as I,Pt as J,Pe as K,le as L,de as M,tt as N,nt as O,G as P,H as Q,h as R,ge as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as d,R as p,x as u}from"./chunk.
|
|
1
|
+
import{A as d,R as p,x as u}from"./chunk.FZNTVWPG.js";var y=(i=>(i[i.Default=0]="Default",i[i.Reset=1]="Reset",i[i.Temporary=2]="Temporary",i))(y||{}),l=class{constructor(e){this.name=e;this.key=`settings://${this.name}`;try{let t=localStorage.getItem(this.key);this.restore(JSON.parse(t).stores)}catch{}try{window.addEventListener("storage",t=>{let{key:i,newValue:s}=t;if(i===this.key)try{this.restore(JSON.parse(s).stores)}catch{}})}catch(t){console.error(t.message)}}key=null;stores=S();temporaries=S();settings=S();get(e,t){let i=this.settings[e][t];if(!i){let s=this.temporaries[e][t]||this.stores[e][t];s&&(i=JSON.parse(s),this.settings[e][t]=i)}return i}set(e,t,i,s=0){let n=JSON.stringify(i);return this.write(e,t,n,s)?(this.settings[e][t]=i,m(this,e,t),!0):!1}list(e){return Object.keys(this.temporaries[e]).length>0?Object.keys(Object.assign({},this.stores[e],this.temporaries[e])):Object.keys(this.stores[e])}read(e){return this.stores[e]}write(e,t,i,s){if(s!==1&&this.temporaries[e][t]!==void 0&&(s=2),s===2){if(this.temporaries[e][t]!==i)return this.temporaries[e][t]=i,this.settings[e][t]=null,!0}else if(this.stores[e][t]!==i)return this.stores[e][t]=i,this.settings[e][t]=null,s===0&&localStorage.setItem(this.key,JSON.stringify({stores:this.stores})),!0;return!1}restore(e){for(let t in e)for(let i in e[t])this.write(t,i,e[t][i],1)&&m(this,t,i)}},h=new Set,P=new l("default");function c(){return P}function I(r){return h.add(r),r}function b(r){h.delete(r)}function m(r,e,t){if(r===P&&r.settings[e][t]!==void 0)for(let i of h)i(e,t)}function S(){return{service_points:{},components:{},shareds:{}}}var a=new Map,g=new Set,v=class{constructor(e){this.descriptor=e;let[t,i]=e.id.split("/");this.service=t,this.name=i}service="";name="";services=[];loading=null;ready=!1;failure=null;get id(){return this.descriptor.id}get multiple(){return this.descriptor?.properties?.multiple||!1}async fetch(){return this.ready?this.services:(this.loading||(this.loading=new Promise(async e=>{let{descriptor:t}=this,{providers:i}=this.descriptor,s=await x(i,this.service,this.id,this);t===this.descriptor?(this.services=s,this.ready=!0,this.loading=null,e(this.services)):e(this.fetch())})),this.loading)}async reset(e){return this.descriptor!==e&&(this.descriptor=e,(this.loading||this.ready||this.failure)&&(this.failure=null,this.loading=null,this.ready=!1,g.forEach(t=>t(this)),await this.fetch()),g.forEach(t=>t(this))),this}override(e){let t=c(),i=t.get("service_points",this.id);t.set("service_points",this.id,{...i,providers:e},2)}notifyError(e){this.failure=e,p.error(e)}notifyObject(e){p.send(e)}};function G(r){return g.add(r),r}function H(r){g.delete(r)}u.listen(r=>{for(let e of a.values())e.descriptor.providers?.includes(r.id)&&g.forEach(t=>t(e))});async function x(r,e,t,i){let s=[];if(Array.isArray(r)&&r.length>0)for(let n of r){let o=d(n);if(await o.fetch()){let f=await o.acquireResource(e).fetch();f?s.push(f):i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not implement service '${e}'`))}else i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not found`))}return s}function C(r){let t=c().get("service_points",r);return t||(t={id:r,providers:[],properties:{}}),t}function w(r,e){let t=c(),i=t.get("service_points",r);if(i){let s=!1;for(let n in e){let o=e[n];o!==void 0&&i[n]!=o&&(i[n]=o,s=!0)}s&&t.set("service_points",r,i)}else i={id:r,providers:[],properties:e},t.set("service_points",r,i);return i}I((r,e)=>{if(r==="service_points"){let t=a.get(e);if(t){let i=c().get("service_points",e);t.reset(i),console.log("[Update Service Point]",e)}}});function L(r){return a.get(r)}function D(r){let e=a.get(r);return e||(e=new v(C(r)),a.set(e.id,e)),e}function j(r,e,t){let i=r.resource+"/"+e;return w(i,t),D(i)}export{y as a,l as b,c,I as d,b as e,a as f,v as g,G as h,H as i,C as j,w as k,L as l,D as m,j as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as h,C as V,a as w}from"./chunk.
|
|
1
|
+
import{A as h,C as V,a as w}from"./chunk.FZNTVWPG.js";var S={stringify(n,r){let e=new URLSearchParams;for(let[t,o]of Object.entries(n||{}))if(!(r?.skipNull&&o===null)&&!(r?.skipEmptyString&&o===""))if(Array.isArray(o))for(let s of o)e.append(t,String(s));else e.set(t,String(o));return e.toString()},parse(n,r){let e={},t=new URLSearchParams(n);for(let[o,s]of t.entries())e[o]=s;return e}},I=w.About("view");function g(n){if(!n)return"";if(n instanceof Object){let r=[];for(;n;){let e=S.stringify(n.params,{skipNull:!1,skipEmptyString:!1});e?r.push(`${n.name}?${e}`):r.push(n.name),n=n.nested}return r.join("/")}return n.startsWith("#")?n.slice(1):n}function a(n,r){if(!n)return null;if(n instanceof Object)return n;let e=null,t=null;n=n.startsWith("#")?n.slice(1):n;for(let o of n.split("/"))if(o){let[s,u]=o.split("?"),c={};u&&(c=S.parse(u,{parseNumbers:!1,parseBooleans:!1}));let f={name:s,params:c};t?t.nested=f:e=f,t=f}return t&&(t.content=r),e}function R(n,r){if(n==="safe")return null;if(n){let e=typeof n=="string"?n:n?.rule,t=V(e).get();if(t)try{return t.check(r,n instanceof Object?n:null)}catch(o){return o}else return new Error("Data security guard not found")}else return new Error("Data cannot be securised")}function k(n,r,e){if(r!==void 0){if(e!==!0){let t=R(n?.security,r);if(t)throw t}return r}else return n.default}function d(n,r,e,t){let o={},s=I.spec(n),u=t==="safe",c=s?.properties;if(c instanceof Object){let{content:f}=e,l=e.params||{},y=s.aliases;if(y){let i={};for(let p in l){let m=y?.[p]||p;i[m]=l[p]}l=i}for(let i in c){let p=c[i],m=l[i];f!==void 0&&p?.binding?.source==="content"&&(m=f);try{o[i]=k(p,m,u)}catch(b){throw new Error(`Invalid param '${i}' : ${b.message}`)}}}return o}async function N(n,r){typeof n=="string"&&(n=a(n));let e=h(n.name),t=await e.fetch();if(e.valid){let o=d(e,t,n,r||"unknown");return{component:e,properties:o}}else throw new Error(`Component '${e.id}' is invalid`)}function O(n,r){let{origin:e,pathname:t}=window.location;typeof n=="string"&&(n=a(n)),r&&(typeof r=="string"&&(r=a(e)),n={...r,nested:n});let o="#"+g(n);return`${e}${t}${o}`}function $(n,r){let{origin:e}=window.location;typeof n=="string"&&(n=a(n)),r&&(typeof r=="string"&&(r=a(e)),n={...r,nested:n});let t="#"+g(n);window.location.assign(t)}function C(n){typeof n=="string"&&(n=a(n));let r=a(window.location.hash),e="#"+g({...n,params:{...r.params,...n.params}});window.location.replace(e)}export{I as a,g as b,a as c,N as d,O as e,$ as f,C as g};
|
package/components.d.ts
ADDED
|
File without changes
|
package/export.commands.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as
|
|
1
|
+
import{A as r,R as o}from"./chunk.FZNTVWPG.js";import{URI as n}from"vscode-uri";async function s(t){console.log("executeCommand:",t.target);let a=n.parse(t.target),i=r(a.authority);if(a.scheme==="command")try{let e=await i.fetchResource("commands");if(e?.execute instanceof Function)e.execute(a.path,t.payload);else throw new Error("Invalid commands service")}catch(e){o.error(e)}}export{s as executeCommand};
|
package/export.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Ae,b as Ee,c as we,d as $e,e as Ce,f as Re,g as Fe,h as _e,i as De,j as Ke,k as qe,l as Ie,m as Me,n as Be}from"./chunk.LFHCE3KB.js";import{a as Ge,b as He,c as Ze,d as Ve,e as Qe,f as Ue,g as We,h as Xe,i as Ye,j as et,k as tt,l as rt,m as nt,n as ot}from"./chunk.
|
|
1
|
+
import{a as Ae,b as Ee,c as we,d as $e,e as Ce,f as Re,g as Fe,h as _e,i as De,j as Ke,k as qe,l as Ie,m as Me,n as Be}from"./chunk.LFHCE3KB.js";import{a as Ge,b as He,c as Ze,d as Ve,e as Qe,f as Ue,g as We,h as Xe,i as Ye,j as et,k as tt,l as rt,m as nt,n as ot}from"./chunk.I3IQPWRL.js";import{A as ye,B as he,C as fe,D as Se,E as ge,F as de,G as be,H as xe,I as ve,J as Oe,K as Ne,L as N,M as Te,N as Je,O as ze,P as Pe,Q as je,R as Le,S as ke,a as B,b as G,c as H,d as Z,e as V,f as Q,g as U,h as W,i as X,j as Y,k as ee,l as te,m as re,n as ne,o as oe,p as ie,q as se,u as ae,v as le,w as pe,x as ce,y as ue,z as me}from"./chunk.FZNTVWPG.js";function it(n,t){for(let r in n)if(n[r]!==t[r])return!1;for(let r in t)if(n[r]!==t[r])return!1;return!0}function*st(n){if(Array.isArray(n))for(let t of n)yield t;else n&&(yield n)}var T=Symbol("__observable__"),J=Symbol("__status__");var f=class{observers;state;image;constructor(){this.observers=null,this.state={},this.image=new Proxy(this.state,this)}subscribe(t,r){this.observers===null&&(this.observers=[]),this.observers.push(t,r)}unsubscribe(t){}notify(t){if(this.observers)for(let r=0;r<this.observers.length;r+=2){let o=this.observers[r];o(this.image,t)}}async use(t){return this.image}get(t,r){return r===T?this:Reflect.get(this.state,r)}set(t,r,o){return this.state[r]!==o&&(this.state[r]=o,this.notify(r)),!0}ownKeys(t){return Reflect.ownKeys(this.state)}has(t,r){return Reflect.has(this.state,r)}};var c=null,S=class{".events";".listeners";addEventListener(){let t=this[".listeners"];if(t?c===t&&(this[".listeners"]=t=t.slice()):this[".listeners"]=t=[],arguments.length===1)return arguments[0]?(t.push(arguments[0]),t.push(null),!0):!1;if(arguments.length===2)return arguments[1]?(t.push(arguments[1]),t.push(arguments[0]),!0):!1}removeEventListener(){let t=this[".listeners"];if(t)c===t&&(this[".listeners"]=t=t.slice());else return!1;if(arguments.length===1){let r=arguments[0],o=0;for(;;)if(o=t.indexOf(r,o),o>=0)t.splice(o,2),o++;else return!0}else if(arguments.length===2){let r=arguments[0],o=arguments[1],i=0;for(;;)if(i=t.indexOf(o,i),i>=0){if(t[i+1]===r)return t.splice(i,2),!0;i++}else return console.warn(`removeEventListener(${r}) failed on:`,this),!1}return!1}synchronizeStateInContext(t,r,o,i){return this}addStateListener(t,r){return this.addEventListener("change",t)}removeStateListener(t){return this.removeEventListener("change",t)}setState(){if(arguments.length===0)this[".events"]?this[".events"][0]||(this[".events"][0]={}):(this[".events"]=[{}],setTimeout(b.bind(this)));else if(arguments.length===1)for(let t in arguments[0])z.call(this,t,arguments[0][t]);else arguments.length===2&&z.call(this,arguments[0],arguments[1])}dispatchEvent(t,r){this[".events"]||(this[".events"]=[null],setTimeout(b.bind(this))),t==="change"?this[".events"][0]=Object.assign(this[".events"][0]||{},r):(this[".events"].push(t),this[".events"].push(r))}executeEvent(t,r){let o=this[".listeners"],i=o?o.length:0;if(!i)return;c===null?c=o:o=o.slice();let a=[];for(let p=1;p<i;p+=2)try{let l,m=o[p];m?m===t&&(l=o[p-1](r,this)):l=o[p-1](t,r,this),l instanceof Promise&&a.push(l)}catch(l){console.error(l)}return c===o&&(c=null),Promise.all(a)}static setState(){}};S.setState=S.prototype.setState;function z(n,t){if(this[n]!==t){this[".events"]||(this[".events"]=[null],setTimeout(b.bind(this)));let r=this[".events"][0];r?r.hasOwnProperty(n)||(r[n]=this[n]):this[".events"][0]={[n]:t},this[n]=t}}function b(){let n=this[".listeners"],t=this[".events"],r=n?n.length:0;if(this[".events"]=null,!r)return;c===null?c=n:n=n.slice();let o=t[0];if(o)for(let i=1;i<r;i+=2)try{let a=n[i];if(!a)n[i-1]("change",this,o);else if(a==="change")n[i-1](this,o);else if(Array.isArray(a)){for(let p of a)if(o.hasOwnProperty(p)){n[i-1](this,o);break}}}catch(a){console.error(a)}for(let i=2;i<t.length;i+=2){let a=t[i-1],p=t[i];for(let l=1;l<r;l+=2)try{let m=n[l];m?m===a&&n[l-1](p,this):n[l-1](a,p,this)}catch(m){console.error(m)}}c===n&&(c=null)}var P=class extends f{constructor(r){super();this.url=r}loaded=!1;query=null;status=0;async use(){return this.loaded===!1?(this.query===null&&(this.query=fetch(this.url).then(async r=>{let o=await r.json();return Object.assign(this.state,o),this.status=r.status,this.query=null,this.loaded=!0,this.notify(),this.image},r=>(N.error(r),this.loaded=!0,this.image))),this.query):this.image}get(r,o){if(typeof o=="string"){if(this.loaded===!1)return this.use().then(()=>this.state[o])}else if(o===J)return this.status;return super.get(r,o)}set(r,o,i){return this.loaded===!1?(console.error(`Resource '${this.url}' not ready for assignement`),!0):super.set(this.state,o,i)}};var u={boolean:{type:"boolean"},string:{type:"string"},number:{type:"number"},object:{type:"object"},view:{type:"view"},display:{type:"display"},function:{type:"function"},null:{type:"null"},unknown:{type:"null"},any:{}},vt={enums(n,...t){return{...n,enum:t}},array(n){return{type:"array",items:n}},record(n){return{type:"object",properties:n}},collection(n){return{type:"object",additionalProperties:n}},event_fn(n){return{type:"function",args:[n||u.any]}}},y={invalid:{$error:"Cannot determine the type"}};function j(n,t){if(!t)return y.invalid;let r=t.properties?.[n];if(r)return r;let{patternProperties:o}=t;for(let i in o)if(n.match(i))return o[i];return t.$error?y.invalid:t.additionalProperties||u.any}function L(n,t){return t?Array.isArray(t.items)?t.items?.[n]||y.invalid:t.items?t.items:t.type==="element"?t:t.$error?y.invalid:t.additionalProperties||u.any:y.invalid}function x(n){switch(typeof n){case"undefined":return u.null;case"boolean":return u.boolean;case"symbol":case"string":return u.string;case"bigint":case"number":return u.number;case"function":return u.function;case"object":{if(Array.isArray(n))return{type:"array",items:n.map(x)};if(n!==null){let t={};for(let r in t)t[r]=x(t[r]);return{type:"array",properties:t}}return u.null}default:return y.invalid}}function k(n,t){let{type:r}=n;return Array.isArray(r)?r.includes(t):r===t}function A(n){return Array.isArray(n)?n.join(","):n}function g(n){if(n.type==="object"){let t=[];for(let r in n.properties)t.push(`${r}: ${g(n.properties[r])}`);for(let r in n.additionalProperties)t.push(`${r}?: ${g(n.additionalProperties[r])}`);for(let r in n.patternProperties)t.push(`[${r}: ${g(n.patternProperties[r])}]`);return t.join(`
|
|
2
2
|
`)}else if(n.type)return n.type;return"any"}var Ot={getPropertyTyping:j,getItemTyping:L,getValueTyping:x,isType:k,typeAsString:A,generateTypescript:g};import{z as e}from"zod";var E=e.enum(["string","number","integer","boolean","object","array","null"]),w=e.enum(["module","function","service"]),d=e.union([e.string(),e.number(),e.boolean(),e.null(),e.record(e.string(),e.any()),e.array(e.any())]),$=e.object({title:e.string().optional(),properties:e.array(e.string()).optional(),secondaryProperties:e.array(e.string()).optional(),patternProperties:e.array(e.string()).optional(),additionalProperties:e.boolean().optional()}),C=e.object({description:e.string().optional(),chapters:e.array($).optional(),additionalChapter:e.boolean().optional()}),R=e.object({source:e.string()}),F=e.object({type:e.string()}).passthrough(),s=e.lazy(()=>h),_=e.object({title:e.string().optional(),icon:e.string().optional(),description:e.string().optional(),args:e.array(s).optional(),content:F}),D=e.object({view:e.string(),properties:e.record(e.string(),s).optional()}),Jt=e.object({check:e.any()}),K=e.union([e.literal("safe"),e.string(),e.object({rule:e.string()}).passthrough()]),q=e.string(),I=e.union([q,e.object({type:e.string(),data:e.any().optional()})]),v=e.object({$id:e.string().optional(),$ref:e.string().optional(),$schema:e.string().optional(),$comment:e.string().optional(),$defs:e.record(e.string(),e.lazy(()=>s)).optional(),type:e.union([E,w]).optional(),enum:e.array(d).optional(),const:d.optional(),multipleOf:e.number().optional(),maximum:e.number().optional(),exclusiveMaximum:e.number().optional(),minimum:e.number().optional(),exclusiveMinimum:e.number().optional(),maxLength:e.number().optional(),minLength:e.number().optional(),pattern:e.string().optional(),items:e.union([e.lazy(()=>s),e.array(e.lazy(()=>s))]).optional(),additionalItems:e.lazy(()=>s).optional(),maxItems:e.number().optional(),minItems:e.number().optional(),uniqueItems:e.boolean().optional(),contains:e.lazy(()=>s).optional(),maxProperties:e.number().optional(),minProperties:e.number().optional(),required:e.array(e.string()).optional(),properties:e.record(e.string(),e.lazy(()=>s)).optional(),patternProperties:e.record(e.string(),e.lazy(()=>s)).optional(),additionalProperties:e.lazy(()=>s).optional(),dependencies:e.record(e.string(),e.union([e.lazy(()=>s),e.array(e.string())])).optional(),propertyNames:e.lazy(()=>s).optional(),if:e.lazy(()=>s).optional(),then:e.lazy(()=>s).optional(),else:e.lazy(()=>s).optional(),allOf:e.array(e.lazy(()=>s)).optional(),anyOf:e.array(e.lazy(()=>s)).optional(),oneOf:e.array(e.lazy(()=>s)).optional(),not:e.lazy(()=>s).optional(),format:e.string().optional(),contentMediaType:e.string().optional(),contentEncoding:e.string().optional(),definitions:e.record(e.string(),e.lazy(()=>s)).optional(),title:e.string().optional(),description:e.string().optional(),default:d.optional(),readOnly:e.boolean().optional(),writeOnly:e.boolean().optional(),examples:d.optional()}),O=e.object({title:e.string().optional(),icon:e.string().optional(),doc:C.optional(),$error:e.union([e.string(),e.instanceof(Error)]).optional(),args:e.array(e.lazy(()=>h)).optional(),placeholder:e.boolean().optional(),resources:e.record(e.string(),I).optional(),security:K.optional(),"allow-origin":e.string().optional(),docking:D.optional(),templates:e.array(_).optional(),binding:R.optional(),aliases:e.record(e.string(),e.string()).optional()}),M=v.merge(O).extend({type:e.literal("service"),$spec:e.string(),version:e.string().optional()}),zt=v.merge(O).extend({type:e.literal("function"),input:e.union([e.lazy(()=>h),e.array(e.lazy(()=>h))]).optional(),output:e.union([e.lazy(()=>h),e.array(e.lazy(()=>h))]).optional()}),h=e.lazy(()=>e.union([v.merge(O),M]));export{He as AccountSettings,R as BindingSchema,$ as ChapterSchema,ie as CombinedComponentProvider,vt as CommonMakers,Y as CommonResourceProvider,u as CommonTypes,G as ComponentControllerKey,ae as ComponentEntry,le as ComponentResource,pe as ComponentsManifold,ce as ComponentsRegistry,D as DockingSchema,C as DocumentationSchema,H as EditorKey,y as ErrorTypes,F as ExpressionSchema,zt as FunctionSchemaSchema,J as HttpStatusAttribute,ne as InMemComponentProvider,re as InMemComponentPublisher,s as JSONSchema7DefinitionSchema,w as JSONSchema7TypeNameCustomSchema,E as JSONSchema7TypeNameSchema,d as JSONSchema7TypeSchema,O as JSONSchemaCustomSchema,h as JSONSchemaSchema,v as JSONSchemaStandardSchema,S as Listenable,Le as Log,f as Observable,T as ObservableAttribute,I as ResourceEntrySchema,q as ResourceLinkSchema,P as RestResource,Ot as Schema,K as SecurityGuardSchema,Jt as SecurityRuleSchema,B as ServiceAccessor,We as ServicePoint,Ue as ServicePoints,M as ServiceSchemaSchema,oe as StaticComponentProvider,ee as StaticContentProvider,_ as TemplateSchema,Ge as WriteMode,Ee as ZodService,ye as acquireComponent,he as acquireFutureComponent,fe as acquireResource,nt as acquireServicePoint,et as acquireServicePointDescriptor,it as areSimilarObjects,De as checkVersionCompatibility,te as contentLocalURI,U as createComponentFilter,Q as createComponentPublication,se as createLocalComponentProvider,ke as createLogFromError,ot as createServicePoint,Ke as defineServiceSpec,be as deleteComponent,Ne as failedComponentPublication,Oe as fetchComponentsPublications,_e as generateTypeScript,me as getComponentFromData,V as getComponentServicesList,ue as getDefaultComponent,rt as getServicePoint,Ie as getServiceSchema,Me as getServiceSchemaFromSpec,qe as getServiceZod,Ze as getSettings,Ce as jsonSchemaToZod,st as listOneOrMany,Xe as listenServicePoints,Ve as listenSettings,W as matchComponentFilter,Be as matchesSpecification,Z as parseComponentURI,X as parseResourceEntry,N as print,ze as queryLogCount,je as queryLogInfos,Pe as queryLogObjects,Te as registerLogCollector,Se as resolveRelativeComponent,de as saveComponent,ge as saveComponentManifest,ve as searchComponentsPublications,Ye as unlistenServicePoints,Qe as unlistenSettings,xe as unregisterComponent,Je as unregisterLogCollector,tt as updateServicePointDescriptor,Re as validate,Fe as validateOrThrow,Ae as z,we as zService,$e as zodToJSONSchema};
|
package/export.react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as y,i as U,m as L}from"./chunk.
|
|
1
|
+
import{h as y,i as U,m as L}from"./chunk.I3IQPWRL.js";import{a as v,c as w,d as q}from"./chunk.IAUN77LU.js";import"./chunk.FZNTVWPG.js";import{z as a}from"zod";function Ve(t){let e=t||a.record(a.string(),a.any());return{$spec:"spec://jointhedots.org/view.react",version:"0.0",properties:a.object({props:e,requirements:a.object({servicePoints:a.record(a.string(),a.object({service:a.string().optional(),cardinality:a.number().optional()})).optional()}).optional()}),isAssignable(r){return r.$spec=this.$spec}}}var N=v.subservice("react"),ke=v.subservice("webc");import{useEffect as K,useState as z}from"react";function qe(t,e,r){let[o,i]=z(e);return K(()=>{t().then(i,console.error)},r),o}import T from"react";import{jsx as f}from"react/jsx-runtime";var x=class{constructor(e,r){this.value=e;this.updateTimeout=r}promise=null;dispatch=null;updateTimer=null;shallUpdate=!0;updater;deps;use(e,r){if(this.updater=e,r!==this.deps){let o=this.deps;if(this.deps=r,r?.length===o?.length){if(r){for(let i=0;i<r.length;i++)if(r[i]!==o[i])return this.update()}}else return this.update()}}initiate(e){this.dispatch=e,this.dispatch(this.value)}cancelAutoUpdate(){this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}scheduleAutoUpdate(){this.cancelAutoUpdate(),this.shallUpdate?this.update():this.updateTimeout>0&&(this.updateTimer=setTimeout(()=>{this.updateTimer=null,this.update()},this.updateTimeout))}get isWaiting(){return this.promise!==null}get hasState(){return this.value!==void 0}get autoUpdate(){return this.updateTimeout}set autoUpdate(e){this.updateTimeout=e,this.cancelAutoUpdate(),this.update()}set(e){this.value!==e&&(this.value=e,this.dispatch&&this.dispatch(e))}get(){return this.value}update(){try{if(this.promise)this.shallUpdate=!0,this.cancelAutoUpdate();else{let e=this.updater();this.shallUpdate=!1,e instanceof Promise?(this.promise=e,e.then(r=>{this.promise=null,this.set(r),this.scheduleAutoUpdate()},r=>{this.promise=null,this.scheduleAutoUpdate(),console.log(r)})):this.scheduleAutoUpdate()}}catch(e){this.scheduleAutoUpdate(),console.log(e)}}cancel(){this.dispatch=null,this.promise=null,this.updateTimeout=0,this.cancelAutoUpdate()}waiting(e){return this.isWaiting==!0?f(m,{}):e(this.value)}using(e){return this.hasState==!1?f(m,{}):e(this.value)}};function Me(t,e,r,o){let[i]=T.useState(()=>new x(r,o)),[s,n]=T.useState(r);return i.use(t,e),T.useEffect(()=>(i.initiate(n),()=>i.cancel()),null),i}function Ae(t,...e){for(let r of e)if(r.isWaiting==!0)return f(m,{});return t()}function _e(t,...e){for(let r of e)if(r.hasState==!1)return f(m,{});return t()}function m(){return f("div",{children:"..."})}import D,{useContext as ie,useEffect as A,useMemo as oe,useState as ne}from"react";import G,{createContext as X,useContext as Y,useMemo as ee}from"react";var Q=`.JDT-ErrorBoundary {
|
|
2
2
|
background-color: rgb(216, 59, 59);
|
|
3
3
|
padding: 5px;
|
|
4
4
|
overflow: hidden;
|
package/export.rest.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,s as b,t as c}from"./chunk.
|
|
1
|
+
import{r as a,s as b,t as c}from"./chunk.FZNTVWPG.js";export{c as REST,a as RESTServiceKey,b as __import_RESTService};
|
package/export.storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.LFHCE3KB.js";import"./chunk.
|
|
1
|
+
import"./chunk.LFHCE3KB.js";import"./chunk.I3IQPWRL.js";import{a as e}from"./chunk.FZNTVWPG.js";var r=e.About("storage");export{r as StorageServiceKey};
|
package/export.view.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"./chunk.
|
|
1
|
+
import{a,b,c,d,e,f,g}from"./chunk.IAUN77LU.js";import"./chunk.FZNTVWPG.js";export{a as ViewServiceKey,d as evaluateViewInfos,c as getViewInfosFrom,b as getViewReferenceFrom,e as getViewURL,f as gotoURLView,g as updateURLView};
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -26,9 +26,9 @@ declare module '@jointhedots/core:src/common/types' {
|
|
|
26
26
|
|
|
27
27
|
declare module '@jointhedots/core:src/components/components' {
|
|
28
28
|
import { URI } from '@jointhedots/core:src/components/vscode-uri';
|
|
29
|
-
import type { DocumentationSchema, JSONSchema, ResourceEntry } from '@jointhedots/core:src/schema/schema
|
|
30
|
-
import type { ComponentEntry } from '@jointhedots/core:src/components/manifold
|
|
31
|
-
import { ServiceAccessor, type ServiceType } from '@jointhedots/core:src/services/service-accessor
|
|
29
|
+
import type { DocumentationSchema, JSONSchema, ResourceEntry } from '@jointhedots/core:src/schema/schema';
|
|
30
|
+
import type { ComponentEntry } from '@jointhedots/core:src/components/manifold';
|
|
31
|
+
import { ServiceAccessor, type ServiceType } from '@jointhedots/core:src/services/service-accessor';
|
|
32
32
|
import React from '@jointhedots/core:src/components/react';
|
|
33
33
|
export type ComponentID = string;
|
|
34
34
|
export interface ComponentPublication {
|
|
@@ -148,8 +148,8 @@ declare module '@jointhedots/core:src/components/components' {
|
|
|
148
148
|
|
|
149
149
|
declare module '@jointhedots/core:src/components/helpers' {
|
|
150
150
|
import { URI } from '@jointhedots/core:src/components/vscode-uri';
|
|
151
|
-
import { type ComponentFilter, type ComponentManifest, type ComponentPublication } from '@jointhedots/core:src/components/components
|
|
152
|
-
import type { ResourceEntry, ResourceImport } from '@jointhedots/core:src/schema/schema
|
|
151
|
+
import { type ComponentFilter, type ComponentManifest, type ComponentPublication } from '@jointhedots/core:src/components/components';
|
|
152
|
+
import type { ResourceEntry, ResourceImport } from '@jointhedots/core:src/schema/schema';
|
|
153
153
|
export function parseComponentURI(ref: string): URI;
|
|
154
154
|
export function getComponentServicesList(manif: ComponentManifest): Promise<string[]>;
|
|
155
155
|
export function createComponentPublication(manif: ComponentManifest): Promise<ComponentPublication>;
|
|
@@ -158,16 +158,16 @@ declare module '@jointhedots/core:src/components/helpers' {
|
|
|
158
158
|
export function parseResourceEntry(entry: ResourceEntry): ResourceImport;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
declare module '@jointhedots/core:src/components
|
|
161
|
+
declare module '@jointhedots/core:src/components' {
|
|
162
162
|
export * from '@jointhedots/core:src/components/components';
|
|
163
163
|
export * from '@jointhedots/core:src/components/manifold';
|
|
164
164
|
export * from '@jointhedots/core:src/components/helpers';
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
declare module '@jointhedots/core:src/components/manifold' {
|
|
168
|
-
import { type ComponentFilter, type ComponentManifest, type ComponentPublication, type IContentProvider, type IResourceLoader } from '@jointhedots/core:src/components/components
|
|
169
|
-
import { CombinedComponentProvider } from '@jointhedots/core:src/providers/components/CombinedComponentProvider
|
|
170
|
-
import { type QueryLogResult } from '@jointhedots/core:src/logging
|
|
168
|
+
import { type ComponentFilter, type ComponentManifest, type ComponentPublication, type IContentProvider, type IResourceLoader } from '@jointhedots/core:src/components/components';
|
|
169
|
+
import { CombinedComponentProvider } from '@jointhedots/core:src/providers/components/CombinedComponentProvider';
|
|
170
|
+
import { type QueryLogResult } from '@jointhedots/core:src/logging';
|
|
171
171
|
export type ComponentErrorManifest = ComponentManifest & {
|
|
172
172
|
type: "<error>";
|
|
173
173
|
message: string;
|
|
@@ -195,7 +195,7 @@ declare module '@jointhedots/core:src/components/manifold' {
|
|
|
195
195
|
hasResource(identifier: string): boolean;
|
|
196
196
|
getResourceAsync(identifier: string): Promise<ComponentResource>;
|
|
197
197
|
fetchResource<T = any>(identifier: string): Promise<T>;
|
|
198
|
-
getLogStats(): import( '@jointhedots/core:src
|
|
198
|
+
getLogStats(): import( '@jointhedots/core:src').LogInfos;
|
|
199
199
|
getLogs(count: number): QueryLogResult;
|
|
200
200
|
}
|
|
201
201
|
export class ComponentResource {
|
|
@@ -244,7 +244,7 @@ declare module '@jointhedots/core:src/components/manifold' {
|
|
|
244
244
|
export function failedComponentPublication(id: string, title?: string): ComponentPublication;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
declare module '@jointhedots/core:src
|
|
247
|
+
declare module '@jointhedots/core:src' {
|
|
248
248
|
export * from '@jointhedots/core:src/common/types';
|
|
249
249
|
export * from '@jointhedots/core:src/logging';
|
|
250
250
|
export * from '@jointhedots/core:src/observable';
|
|
@@ -260,7 +260,9 @@ declare module '@jointhedots/core:src/index' {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
declare module '@jointhedots/core:src/interfaces/commands/interface' {
|
|
263
|
-
|
|
263
|
+
export type Serializable = string | number | boolean | null | Serializable[] | {
|
|
264
|
+
[key: string]: Serializable;
|
|
265
|
+
};
|
|
264
266
|
export type Cmdlet<CmdPayload extends Serializable = Serializable, CmdResult extends Serializable = Serializable> = {
|
|
265
267
|
payload: CmdPayload;
|
|
266
268
|
result: CmdResult;
|
|
@@ -329,7 +331,7 @@ declare module '@jointhedots/core:src/interfaces/react/ErrorBoundary' {
|
|
|
329
331
|
export {};
|
|
330
332
|
}
|
|
331
333
|
|
|
332
|
-
declare module '@jointhedots/core:src/interfaces/react
|
|
334
|
+
declare module '@jointhedots/core:src/interfaces/react' {
|
|
333
335
|
export * from '@jointhedots/core:src/interfaces/react/interface';
|
|
334
336
|
export * from '@jointhedots/core:src/interfaces/react/useAsyncMemo';
|
|
335
337
|
export * from '@jointhedots/core:src/interfaces/react/useAsyncState';
|
|
@@ -612,8 +614,8 @@ declare module '@jointhedots/core:src/interfaces/rest/decorators' {
|
|
|
612
614
|
|
|
613
615
|
declare module '@jointhedots/core:src/interfaces/rest/interface' {
|
|
614
616
|
import { URI } from '@jointhedots/core:src/components/vscode-uri';
|
|
615
|
-
import { ComponentEntry } from '@jointhedots/core:src/components/manifold
|
|
616
|
-
import { ServiceAccessor } from '@jointhedots/core:src/services/service-accessor
|
|
617
|
+
import { ComponentEntry } from '@jointhedots/core:src/components/manifold';
|
|
618
|
+
import { ServiceAccessor } from '@jointhedots/core:src/services/service-accessor';
|
|
617
619
|
export interface RESTService {
|
|
618
620
|
getUrl(path: string): string;
|
|
619
621
|
invoke(path: string, init?: RequestInit): Promise<Response>;
|
|
@@ -698,8 +700,8 @@ declare module '@jointhedots/core:src/interfaces/storage/interface' {
|
|
|
698
700
|
}
|
|
699
701
|
|
|
700
702
|
declare module '@jointhedots/core:src/interfaces/view/interface' {
|
|
701
|
-
import { ComponentEntry } from '@jointhedots/core:src/components/manifold
|
|
702
|
-
import { ServiceAccessor } from '@jointhedots/core:src/services/service-accessor
|
|
703
|
+
import { ComponentEntry } from '@jointhedots/core:src/components/manifold';
|
|
704
|
+
import { ServiceAccessor } from '@jointhedots/core:src/services/service-accessor';
|
|
703
705
|
export const ViewServiceKey: ServiceAccessor<any, any>;
|
|
704
706
|
export type ViewInfos = {
|
|
705
707
|
name: string;
|
|
@@ -720,9 +722,9 @@ declare module '@jointhedots/core:src/interfaces/view/interface' {
|
|
|
720
722
|
export function updateURLView(view: string | ViewInfos): void;
|
|
721
723
|
}
|
|
722
724
|
|
|
723
|
-
declare module '@jointhedots/core:src/logging
|
|
724
|
-
import type { Command } from '@jointhedots/core:src/interfaces/commands/interface
|
|
725
|
-
export { print } from '@jointhedots/core:src/logging/trace
|
|
725
|
+
declare module '@jointhedots/core:src/logging' {
|
|
726
|
+
import type { Command } from '@jointhedots/core:src/interfaces/commands/interface';
|
|
727
|
+
export { print } from '@jointhedots/core:src/logging/trace';
|
|
726
728
|
export type LogObjectID = string;
|
|
727
729
|
export type LogStatus = "error" | "warn" | "notify" | "info";
|
|
728
730
|
export type LogKind = "event" | "ticket";
|
|
@@ -812,7 +814,7 @@ declare module '@jointhedots/core:src/observable/attributes' {
|
|
|
812
814
|
export const HttpStatusAttribute: unique symbol;
|
|
813
815
|
}
|
|
814
816
|
|
|
815
|
-
declare module '@jointhedots/core:src/observable
|
|
817
|
+
declare module '@jointhedots/core:src/observable' {
|
|
816
818
|
export * from '@jointhedots/core:src/observable/attributes';
|
|
817
819
|
export * from '@jointhedots/core:src/observable/observable';
|
|
818
820
|
export * from '@jointhedots/core:src/observable/listenable';
|
|
@@ -885,7 +887,7 @@ declare module '@jointhedots/core:src/observable/RestResource' {
|
|
|
885
887
|
}
|
|
886
888
|
|
|
887
889
|
declare module '@jointhedots/core:src/providers/components/CombinedComponentProvider' {
|
|
888
|
-
import { type ComponentFilter, type ComponentManifest, type ComponentPublication, type IComponentProvider } from '@jointhedots/core:src/components/components
|
|
890
|
+
import { type ComponentFilter, type ComponentManifest, type ComponentPublication, type IComponentProvider } from '@jointhedots/core:src/components/components';
|
|
889
891
|
export class CombinedComponentProvider implements IComponentProvider {
|
|
890
892
|
readonly providers: IComponentProvider[];
|
|
891
893
|
constructor(providers?: IComponentProvider[]);
|
|
@@ -900,7 +902,7 @@ declare module '@jointhedots/core:src/providers/components/CombinedComponentProv
|
|
|
900
902
|
}
|
|
901
903
|
|
|
902
904
|
declare module '@jointhedots/core:src/providers/components/InMemComponentProvider' {
|
|
903
|
-
import { type ComponentFilter, type ComponentManifest, type ComponentPublication, type IComponentProvider, type IComponentPublisher } from '@jointhedots/core:src/components/components
|
|
905
|
+
import { type ComponentFilter, type ComponentManifest, type ComponentPublication, type IComponentProvider, type IComponentPublisher } from '@jointhedots/core:src/components/components';
|
|
904
906
|
export class InMemComponentPublisher implements IComponentPublisher {
|
|
905
907
|
pubs: Map<string, ComponentPublication>;
|
|
906
908
|
constructor(catalog?: ComponentPublication[]);
|
|
@@ -917,13 +919,13 @@ declare module '@jointhedots/core:src/providers/components/InMemComponentProvide
|
|
|
917
919
|
}
|
|
918
920
|
|
|
919
921
|
declare module '@jointhedots/core:src/providers/components/LocalComponentProvider' {
|
|
920
|
-
import { type IComponentProvider } from '@jointhedots/core:src/components/components
|
|
922
|
+
import { type IComponentProvider } from '@jointhedots/core:src/components/components';
|
|
921
923
|
export function createLocalComponentProvider(): IComponentProvider;
|
|
922
924
|
}
|
|
923
925
|
|
|
924
926
|
declare module '@jointhedots/core:src/providers/components/StaticComponentProvider' {
|
|
925
|
-
import { type BundleManifest, type ComponentFilter, type ComponentManifest, type ComponentPublication, type IComponentProvider, type IContentProvider } from '@jointhedots/core:src/components/components
|
|
926
|
-
import { InMemComponentPublisher } from '@jointhedots/core:src/providers/components/InMemComponentProvider
|
|
927
|
+
import { type BundleManifest, type ComponentFilter, type ComponentManifest, type ComponentPublication, type IComponentProvider, type IContentProvider } from '@jointhedots/core:src/components/components';
|
|
928
|
+
import { InMemComponentPublisher } from '@jointhedots/core:src/providers/components/InMemComponentProvider';
|
|
927
929
|
export class StaticComponentProvider implements IComponentProvider {
|
|
928
930
|
readonly content_provider: IContentProvider;
|
|
929
931
|
manifest: BundleManifest;
|
|
@@ -942,7 +944,7 @@ declare module '@jointhedots/core:src/providers/components/StaticComponentProvid
|
|
|
942
944
|
|
|
943
945
|
declare module '@jointhedots/core:src/providers/resources/CommonResourceProvider' {
|
|
944
946
|
import { URI } from '@jointhedots/core:src/components/vscode-uri';
|
|
945
|
-
import { type IContentProvider, type IResourceLoader } from '@jointhedots/core:src/components/components
|
|
947
|
+
import { type IContentProvider, type IResourceLoader } from '@jointhedots/core:src/components/components';
|
|
946
948
|
export class CommonResourceProvider implements IResourceLoader {
|
|
947
949
|
readonly storage: IContentProvider;
|
|
948
950
|
modules_exports: Map<string, any>;
|
|
@@ -956,7 +958,7 @@ declare module '@jointhedots/core:src/providers/resources/CommonResourceProvider
|
|
|
956
958
|
|
|
957
959
|
declare module '@jointhedots/core:src/providers/resources/StaticContentProvider' {
|
|
958
960
|
import { URI } from '@jointhedots/core:src/components/vscode-uri';
|
|
959
|
-
import type { IContentProvider } from '@jointhedots/core:src/components/components
|
|
961
|
+
import type { IContentProvider } from '@jointhedots/core:src/components/components';
|
|
960
962
|
export class StaticContentProvider implements IContentProvider {
|
|
961
963
|
check_url_content(ref: string): Promise<string>;
|
|
962
964
|
load_url_content(ref: string): Promise<Blob>;
|
|
@@ -968,7 +970,7 @@ declare module '@jointhedots/core:src/providers/resources/StaticContentProvider'
|
|
|
968
970
|
}
|
|
969
971
|
|
|
970
972
|
declare module '@jointhedots/core:src/schema/helpers' {
|
|
971
|
-
import { type JSONSchema } from '@jointhedots/core:src/schema/schema
|
|
973
|
+
import { type JSONSchema } from '@jointhedots/core:src/schema/schema';
|
|
972
974
|
export const CommonTypes: {
|
|
973
975
|
boolean: any;
|
|
974
976
|
string: any;
|
|
@@ -1000,10 +1002,10 @@ declare module '@jointhedots/core:src/schema/helpers' {
|
|
|
1000
1002
|
export {};
|
|
1001
1003
|
}
|
|
1002
1004
|
|
|
1003
|
-
declare module '@jointhedots/core:src/schema
|
|
1004
|
-
export * from '@jointhedots/core:src/schema/helpers
|
|
1005
|
-
export * from '@jointhedots/core:src/schema/schema
|
|
1006
|
-
export * from '@jointhedots/core:src/schema/zod
|
|
1005
|
+
declare module '@jointhedots/core:src/schema' {
|
|
1006
|
+
export * from '@jointhedots/core:src/schema/helpers';
|
|
1007
|
+
export * from '@jointhedots/core:src/schema/schema';
|
|
1008
|
+
export * from '@jointhedots/core:src/schema/zod';
|
|
1007
1009
|
}
|
|
1008
1010
|
|
|
1009
1011
|
declare module '@jointhedots/core:src/schema/schema' {
|
|
@@ -1387,7 +1389,7 @@ declare module '@jointhedots/core:src/schema/schema' {
|
|
|
1387
1389
|
|
|
1388
1390
|
declare module '@jointhedots/core:src/schema/zod' {
|
|
1389
1391
|
import { z, type ZodType } from '@jointhedots/core:src/interfaces/react/zod';
|
|
1390
|
-
import { type JSONSchema, type ServiceSchema } from '@jointhedots/core:src/schema/schema
|
|
1392
|
+
import { type JSONSchema, type ServiceSchema } from '@jointhedots/core:src/schema/schema';
|
|
1391
1393
|
export class ZodService<T = unknown> {
|
|
1392
1394
|
readonly $spec: string;
|
|
1393
1395
|
readonly version?: string;
|
|
@@ -1432,7 +1434,7 @@ declare module '@jointhedots/core:src/schema/zod' {
|
|
|
1432
1434
|
export { z };
|
|
1433
1435
|
}
|
|
1434
1436
|
|
|
1435
|
-
declare module '@jointhedots/core:src/services
|
|
1437
|
+
declare module '@jointhedots/core:src/services' {
|
|
1436
1438
|
export * from '@jointhedots/core:src/services/service-definitions';
|
|
1437
1439
|
export * from '@jointhedots/core:src/services/service-points';
|
|
1438
1440
|
export * from '@jointhedots/core:src/services/service-specification';
|
|
@@ -1461,10 +1463,10 @@ declare module '@jointhedots/core:src/services/service-accessor' {
|
|
|
1461
1463
|
}
|
|
1462
1464
|
|
|
1463
1465
|
declare module '@jointhedots/core:src/services/service-definitions' {
|
|
1464
|
-
import type { ServiceSchema } from '@jointhedots/core:src/schema/schema
|
|
1465
|
-
import { ZodService } from '@jointhedots/core:src/schema/zod
|
|
1466
|
+
import type { ServiceSchema } from '@jointhedots/core:src/schema/schema';
|
|
1467
|
+
import { ZodService } from '@jointhedots/core:src/schema/zod';
|
|
1466
1468
|
import type { ZodType } from '@jointhedots/core:src/interfaces/react/zod';
|
|
1467
|
-
import { type ServiceSpecification, type ServiceCompatibility } from '@jointhedots/core:src/services/service-specification
|
|
1469
|
+
import { type ServiceSpecification, type ServiceCompatibility } from '@jointhedots/core:src/services/service-specification';
|
|
1468
1470
|
/**
|
|
1469
1471
|
* ServiceDefinition is a concrete definition linking a specification to implementation.
|
|
1470
1472
|
*
|
|
@@ -1501,9 +1503,9 @@ declare module '@jointhedots/core:src/services/service-definitions' {
|
|
|
1501
1503
|
}
|
|
1502
1504
|
|
|
1503
1505
|
declare module '@jointhedots/core:src/services/service-points' {
|
|
1504
|
-
import { type ComponentID } from '@jointhedots/core:src/components/components
|
|
1505
|
-
import { type ILogDispatcher, type LogObject } from '@jointhedots/core:src/logging
|
|
1506
|
-
import { ServiceAccessor, type ServiceType } from '@jointhedots/core:src/services/service-accessor
|
|
1506
|
+
import { type ComponentID } from '@jointhedots/core:src/components/components';
|
|
1507
|
+
import { type ILogDispatcher, type LogObject } from '@jointhedots/core:src/logging';
|
|
1508
|
+
import { ServiceAccessor, type ServiceType } from '@jointhedots/core:src/services/service-accessor';
|
|
1507
1509
|
export const ServicePoints: Map<string, ServicePoint>;
|
|
1508
1510
|
export type ServicePointID = string;
|
|
1509
1511
|
export type ServicePointProperties = {
|
|
@@ -1544,7 +1546,7 @@ declare module '@jointhedots/core:src/services/service-points' {
|
|
|
1544
1546
|
}
|
|
1545
1547
|
|
|
1546
1548
|
declare module '@jointhedots/core:src/services/service-specification' {
|
|
1547
|
-
import type { JSONSchema } from '@jointhedots/core:src/schema/schema
|
|
1549
|
+
import type { JSONSchema } from '@jointhedots/core:src/schema/schema';
|
|
1548
1550
|
import type { ZodType } from '@jointhedots/core:src/interfaces/react/zod';
|
|
1549
1551
|
/**
|
|
1550
1552
|
* ServiceSpecification defines the metadata and schema for a service interface.
|
|
@@ -1631,7 +1633,7 @@ declare module '@jointhedots/core:src/services/settings' {
|
|
|
1631
1633
|
}
|
|
1632
1634
|
|
|
1633
1635
|
declare module '@jointhedots/core' {
|
|
1634
|
-
export * from '@jointhedots/core:src
|
|
1636
|
+
export * from '@jointhedots/core:src';
|
|
1635
1637
|
}
|
|
1636
1638
|
|
|
1637
1639
|
declare module '@jointhedots/core/commands' {
|
|
@@ -1647,7 +1649,7 @@ declare module '@jointhedots/core/view' {
|
|
|
1647
1649
|
}
|
|
1648
1650
|
|
|
1649
1651
|
declare module '@jointhedots/core/react' {
|
|
1650
|
-
export * from '@jointhedots/core:src/interfaces/react
|
|
1652
|
+
export * from '@jointhedots/core:src/interfaces/react';
|
|
1651
1653
|
}
|
|
1652
1654
|
|
|
1653
1655
|
declare module '@jointhedots/core/rest' {
|
package/chunk.JO4TTNUQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{URI as O}from"vscode-uri";import{URI as de,Utils as ge}from"vscode-uri";var l=class t{constructor(e,n){this.resource=e;this.definition=n}get(e){return e.getResource(this.resource)?.get()}fetch(e){return e.fetchResource(this.resource)}spec(e){return e.acquireResource(this.resource)?.spec}subservice(e){return t.About(`${this.resource}.${e}`)}static About(e,n=null){return new t(e,n)}};var L=l.About("component"),ve=l.About("editor");var v={object:{async read(t){let e=await t.text();return JSON.parse(e)},async write(t){let e=JSON.stringify(t);return new Blob([e],{type:"application/json"})}},text:{async read(t){return t.text()},async write(t){return new Blob([t],{type:"text/plain"})}}};function U(t){let[e,n]=t.split(","),o=e.match(/data:([^;]+)/),r=o?o[1]:"application/octet-stream",s=atob(n),i=new Uint8Array(s.length);for(let c=0;c<s.length;c++)i[c]=s.charCodeAt(c);return new Blob([i],{type:r})}function B(t){let e=t.match(/data:([^;]+)/);return e?e[1]:"application/octet-stream"}async function F(t){return new Promise((e,n)=>{let o=new FileReader;o.onloadend=()=>e(o.result),o.onerror=n,o.readAsDataURL(t)})}import{URI as T}from"vscode-uri";function w(t){if(t.startsWith("./")){let e=T.parse(window.location.href),n=e.path.split("/");return n[n.length-1]=t.slice(2),e.with({path:n.join("/"),query:"",fragment:""})}else return t.startsWith("/")?T.parse(window.location.href).with({path:t,query:"",fragment:""}):T.parse(t)}async function Y(t){let e=t.apis?Object.keys(t.apis):[];if(t.type){let n=await u(t.type)?.fetch();if(n){for(let o in n?.apis)if(o.startsWith("component.")){let r=o.slice(10);e.includes(r)||e.push(r)}}else throw new Error("Cannot create publiction properly")}return e}async function x(t){let{$id:e}=t;return{id:e,type:t.type,icon:t.icon,title:t.title||e,description:t.description||"",keywords:t.keywords,tags:t.tags,services:await Y(t)}}function Re(t){let e={query:t?.query||"",pattern:t?.pattern||null,tags:t?.tags||[],keywords:t?.keywords||[],services:t?.services||[],types:t?.types||[]};if(e.query.length>0)for(let n of e.query.split(/\s/))n.length>0&&!e.keywords.includes(n)&&e.keywords.push(n);return e.keywords.length>0&&(e.pattern=new RegExp(`(${e.keywords.join(").*(")})`)),e}function h(t,e){function n(s,i){return i?s?!i||i.test(s):!1:!0}function o(s,i){return!!(i.length===0||s&&i.includes(s))}function r(s,i){if(i.length===0)return!0;if(s){for(let c of s)if(i.includes(c))return!0}return!1}return!(!n(t.title||t.id,e.pattern)&&!n(t.description,e.pattern)||!r(t.services,e.services)||!r(t.keywords,e.keywords)||!r(t.tags,e.tags)||!o(t.type,e.types))}function A(t){if(typeof t=="string"){let[e,n]=t.split("#",2),o={type:"module",location:e};if(n){let[r,s]=n.split("?",2);if(o.identifier=r,s)for(let i of s.split("&")){let[c,p]=i.split("=");o[c]=p===void 0?!0:p}}return o}return t}var I=class{constructor(e){this.storage=e}modules_exports=new Map;baseUrl=Z(import.meta.url);async load_resource(e){if(this.modules_exports.has(e))return this.modules_exports.get(e);let n=w(e);switch(await this.storage.check_content(n)){case"application/json":case"text/json":return this.import_module_json(e,n);default:return this.import_module_esm(e,n)}}async import_module_json(e,n){let o=await this.storage.load_content(n);return v.object.read(o)}async import_module_esm(e,n){let o=n.toString();try{let r=await import(o);return this.modules_exports.set(e,r),r}catch(r){throw r.message=`Cannot import '${o}': ${r.message}`,r}}};function Z(t){let e=t.split("/");return e.pop(),e.join("/")}import{URI as ee}from"vscode-uri";var S=class{async check_url_content(e){let n=await fetch(e,{method:"HEAD"});if(n.ok){let o=n.headers.get("content-type");return o?o.split(";")[0].trim():"application/octet-stream"}return null}async load_url_content(e){let n=await fetch(e);if(n.ok)return n.blob();throw new Error(`Fetch failed ${n.statusText} ${n.status} '${e}'`)}async check_content(e){if(e.scheme==="local"){let n=e.toString(),o=localStorage.getItem(n);if(o)return B(o);throw new Error(`Unsupported local content uri: ${e}`)}else return this.check_url_content(e.toString())}async load_content(e){if(e.scheme==="local"){let n=e.toString();if(localStorage.getItem(n))return U(localStorage.getItem(n));throw new Error(`Unsupported local content uri: ${e}`)}else return this.load_url_content(e.toString())}async store_content(e,n){if(n.scheme==="local"){let o=n.toString(),r=await F(e);return localStorage.setItem(o,r),!0}return!1}};function $e(t,e,n){let o=n?`/${e}/${n}`:`/${e}`;return ee.from({scheme:"local",authority:t,path:o})}var _=class{pubs=new Map;constructor(e=[]){for(let n of e)this.pubs.set(n.id,n)}async get_component_publication(e){return this.pubs.get(e)}async search_component_publications(e){let n=[];for(let o of this.pubs.values())h(o,e)&&n.push(o);return n}},R=class extends _{manifests=new Map;async add_component(e){let n=await x(e);return this.manifests.set(n.id,e),this.pubs.set(n.id,n),n}async delete_component(e){return this.manifests.delete(e),this.pubs.delete(e),!0}async get_component_manifest(e){return this.manifests.get(e)}async set_component_manifest(e,n){return!1}};var j=class{constructor(e){this.content_provider=e}manifest=null;catalog=null;async get_provider_bundle(){return this.manifest||(this.manifest=await(await fetch("./bundle.manifest.json")).json()),this.manifest}async get_component_catalog(){if(!this.catalog){let e=await this.get_provider_bundle();this.catalog=new _(e.data?.components)}return this.catalog}async get_component_publication(e){return(await this.get_component_catalog()).get_component_publication(e)}async search_component_publications(e){return(await this.get_component_catalog()).search_component_publications(e)}async get_component_manifest(e){try{let o=(await this.get_provider_bundle()).data.components.find(r=>r.id===e);if(o){let r=w(o.ref?`./${o.ref}`:`./${e}.json`),s=await this.content_provider.load_content(r);if(s)return v.object.read(s)}}catch{}return null}async set_component_manifest(e,n){return!1}async add_component(e){return null}async delete_component(e){return!1}};var M=class{constructor(e=[]){this.providers=e}add_provider(e){this.providers.push(e)}async get_component_publication(e){for(let n of this.providers){let o=await n.get_component_publication(e);if(o)return o}return null}async search_component_publications(e){let n=[];for(let o of this.providers){let r=await o.search_component_publications(e);r&&n.push(...r)}return n}async get_component_manifest(e){for(let n of this.providers){let o=await n.get_component_manifest(e);if(o)return o}return null}async set_component_manifest(e,n){for(let o of this.providers)if(await o.set_component_manifest(e,n))return!0;return!1}async add_component(e){for(let n of this.providers){let o=await n.add_component(e);if(o)return o}return null}async delete_component(e){for(let n of this.providers)if(await n.delete_component(e))return!0;return!1}};var N=5;function J(t){t.createObjectStore("components",{keyPath:"id"}).createIndex("title","title",{unique:!1});let n=t.createObjectStore("components_services",{keyPath:["component_id","service"]});n.createIndex("component_id","component_id",{unique:!1}),n.createIndex("service","service",{unique:!1}),t.createObjectStore("components_manifests",{keyPath:"component_id"}).createIndex("component_id","component_id",{unique:!1})}function te(t,e){if(t.objectStoreNames.contains("components")){let o=e.objectStore("components").getAll();o.onsuccess=()=>{let r=o.result;t.deleteObjectStore("components");let s=t.createObjectStore("components",{keyPath:"id"});s.createIndex("title","title",{unique:!1});for(let i of r)"component_id"in i&&!("id"in i)&&(i.id=i.component_id,delete i.component_id),s.put(i)}}else t.createObjectStore("components",{keyPath:"id"}).createIndex("title","title",{unique:!1});if(t.objectStoreNames.contains("components_manifests")){let n=e.objectStore("components_manifests"),o=n.getAll();o.onsuccess=()=>{for(let r of o.result)r.manifest&&"services"in r.manifest&&!("apis"in r.manifest)&&(r.manifest.apis=r.manifest.services,delete r.manifest.services,n.put(r))}}else t.createObjectStore("components_manifests",{keyPath:"component_id"}).createIndex("component_id","component_id",{unique:!1});if(!t.objectStoreNames.contains("components_services")){let n=t.createObjectStore("components_services",{keyPath:["component_id","service"]});n.createIndex("component_id","component_id",{unique:!1}),n.createIndex("service","service",{unique:!1})}}function ne(){return new Promise((t,e)=>{let n=window.indexedDB.open("LocalComponents",N);n.onerror=o=>{console.error("Database error:",o.target.error),e(o.target.error)},n.onupgradeneeded=o=>{let r=o.oldVersion;console.log("Upgrade LocalComponents from",r,"to",N);let s=n.result,i=n.transaction;if(r===0){J(s);return}if(r<3){te(s,i);return}s.objectStoreNames.contains("components_manifests")&&s.deleteObjectStore("components_manifests"),s.objectStoreNames.contains("components_services")&&s.deleteObjectStore("components_services"),s.objectStoreNames.contains("components")&&s.deleteObjectStore("components"),J(s)},n.onsuccess=()=>{let o=n.result;o.onerror=r=>{console.error("Database error:",r)},t(n.result)}})}function oe(t,e){return new Promise((n,o)=>{let r=[],c=t.transaction(["components_manifests"],"readonly").objectStore("components_manifests").getAll(e);c.onsuccess=()=>{n(c.result?.[0]?.manifest)},c.onerror=p=>{o(p.target.error)}})}function re(t,e){let o=t.transaction(["components","components_services"],"readonly").objectStore("components");return new Promise((r,s)=>{let i=o.get(e);i.onsuccess=()=>{r(i.result)},i.onerror=c=>{s(c.target.error)}})}function K(t,e){let o=t.transaction(["components","components_services"],"readonly").objectStore("components"),r=[];for(let s of e)r.push(new Promise((i,c)=>{let p=o.get(s);p.onsuccess=()=>{i(p.result)},p.onerror=m=>{c(m.target.error)}}));return Promise.all(r)}function se(t,e){return new Promise((n,o)=>{let i=t.transaction(["components"],"readonly").objectStore("components").openCursor(),c=[];i.onsuccess=()=>{let p=i.result;if(p){let m=p.value;e(m)&&c.push(p.value),p.continue()}else n(c)},i.onerror=()=>{o(i.error)}})}function ie(t,e,n){let s=t.transaction(["components_services"],"readonly").objectStore("components_services").index("service"),i=[];for(let c of e)i.push(new Promise((p,m)=>{let d=s.getAll(c);d.onsuccess=async()=>{for(let P of d.result)P.service===c&&n.add(P.component_id);p(void 0)},d.onerror=P=>{m(P.target.error)}}));return Promise.all(i)}async function ce(t,e){let{services:n}=e;if(n&&n.length>0){let o=[],r=new Set;await ie(t,n,r);for(let s of await K(t,Array.from(r)))h(s,e)&&o.push(s);return o}else return se(t,o=>h(o,e))}function ae(t,e){return new Promise(async(n,o)=>{let r=await x(e),s=t.transaction(["components","components_services","components_manifests"],"readwrite");s.objectStore("components").put(r);let c=s.objectStore("components_services");for(let m of r.services)c.put({component_id:r.id,service:m});s.objectStore("components_manifests").put({component_id:r.id,manifest:e}),s.onerror=m=>o(m.target.error),s.oncomplete=()=>n(r),s.commit()})}function pe(t,e){return new Promise(async(n,o)=>{let r=await re(t,e);if(r){let s=t.transaction(["components","components_services","components_manifests"],"readwrite");s.objectStore("components").delete(e);let c=s.objectStore("components_services");for(let m of r.services)c.delete([e,m]);s.objectStore("components_manifests").delete(e),s.onerror=m=>o(m.target.error),s.oncomplete=()=>n(!0),s.commit()}else n(!1)})}var $=class{db=ne();async get_component_publication(e){return(await K(await this.db,[e]))[0]}async search_component_publications(e){return ce(await this.db,e)}async get_component_manifest(e){return oe(await this.db,e)}async set_component_manifest(e,n){return!1}async add_component(e){return ae(await this.db,e)}async delete_component(e){return pe(await this.db,e)}};function W(){try{if(window)return new $}catch{}return new R}var C={...console},Ve=console.error=(...t)=>{C.error(...t.map(e=>typeof e=="string"?`\x1B[31m${e}\x1B[0m`:e))},Qe=console.warn=(...t)=>{C.warn(...t.map(e=>typeof e=="string"?`\x1B[35m${e}\x1B[0m`:e))},Ge=console.info=(...t)=>{C.info(...t.map(e=>typeof e=="string"?`\x1B[36m${e}\x1B[0m`:e))},He=console.trace=(...t)=>{C.trace(...t.map(e=>typeof e=="string"?`\x1B[34m${e}\x1B[0m`:e))},ze=console.debug=(...t)=>{C.debug(...t.map(e=>typeof e=="string"?`\x1B[32m${e}\x1B[0m`:e))},me=console;var q=class{notifyError(e,n){console.error(e),this.notifyObject(fe(e,n))}notifyObject(e){f.push(e),console.log(e)}},E=new Set,f=[],V=0,ue=new q;le(ue);function Q(){return V++,"id-"+Date.now().toString(36)+"-"+V.toString(2)}function le(t){E.add(t)}function Ze(t){E.delete(t)}function et(){return f.length}function G(t,e){let n=[];for(let o of f)if(e===void 0||e===o.component_id){if(n.length>=t)return{objects:n,hasMore:!0};n.push(o)}return{objects:n,hasMore:!1}}function H(t){return f.reduce((e,n)=>{if(t===void 0||t===n.component_id)switch(n.status){case"error":e.error_count++,e.warn_count++,e.notify_count++,e.info_count++;break;case"warn":e.warn_count++,e.notify_count++,e.info_count++;break;case"notify":e.notify_count++,e.info_count++;break;case"info":e.info_count++;break}return e},{action_expected_count:0,error_count:0,warn_count:0,notify_count:0,info_count:0})}var y={send(t){setTimeout(()=>{for(let e of E)e.notifyObject(t)},0)},error(t,e){setTimeout(()=>{for(let n of E)n.notifyError(t,e)},0)},event(t,e){let n=g(t),o=Q();y.send({...e,kind:"event",status:e.status||"error",message:e.message||`Issue with component: ${o}`,component_id:n.id,id:o})},openTicket(t,e,n){let o=g(t),r=`${o.id}/${e}`;y.send({...n,kind:"ticket",status:n.status||"error",message:n.message||`Issue with component: ${r}`,component_id:o.id,id:r})},closeTicket(t,e){let o=`${g(t).id}/${e}`,r=f.findIndex(s=>s.id===o);if(r>=0){let s=f[r];f.splice(r,1),y.event(t,{...s,kind:"event",status:"info",icon:"[success]bi:check-circle",message:`[closed] ${s.message}`,actions:void 0,doc_uri:void 0})}}};function fe(t,e){return{id:Q(),kind:"event",status:"error",component_id:g(e).id,message:t.message}}var b=class{constructor(e){this.id=e}__instance__=void 0;manifest=void 0;get title(){return this.id}get namespace(){let e=this.id.indexOf(":");switch(e){case-1:return"std";case 0:return"";default:return this.id.slice(0,e)}}get valid(){return this.manifest!==void 0&&this.manifest.type!=="<error>"}get loaded(){return this.manifest!==void 0}get installed(){return this.__instance__!==void 0}get instance(){return this.__instance__}set instance(e){if(this.__instance__=e,e instanceof Object)a.datamap.set(e,this);else if(e!==null)throw this.__instance__=null,new Error("Component instance shall be an object")}get(){if(this.manifest===void 0)throw new Error("Cannot get manifest of not loaded module");return this.manifest}set(e){return this.manifest=e,this}fetch(){let e=a.loadings.get(this);return e||(this.manifest===void 0?e=a.components_provider.get_component_manifest(this.id).then(async n=>{if(n)n.type&&await u(n.type).fetch(),this.manifest=n;else throw new Error(`Component '${this.id}' not found`);return this.manifest}).catch(n=>(y.error(n,this),this.set({$id:this.id,type:"<error>",message:n.message,stack:n.stack}),this.__instance__=new Error(n.message),this.manifest)):e=Promise.resolve(this.manifest),a.loadings.set(this,e),e)}async install(){let e=a.installings.get(this);return e||(this.instance===void 0?(this.instance=null,e=new Promise(async n=>{try{this.loaded===!1&&await this.fetch();let o=this.manifest?.type;if(o){let r=u(o);await(await L.fetch(r)).createComponent(this,this.manifest)}}catch(o){y.error(o,this)}n(this)})):e=Promise.resolve(this),a.installings.set(this,e),e)}acquireResource(e){let n=`${this.id}#${e}`,o=a.resources.get(n);return o||(o=new D(this,e),a.resources.set(n,o)),o}getResource(e){return this.hasResource(e)?this.acquireResource(e):null}hasResource(e){let{manifest:n}=this;if(n?.apis?.[e])return!0;if(n?.type){let o=u(n.type);if(o)return o?.hasResource(`component.${e}`)}return!1}async getResourceAsync(e){return this.manifest===void 0&&await this.fetch(),this.getResource(e)}async fetchResource(e){return this.manifest===void 0&&await this.fetch(),this.getResource(e)?.fetch()}getLogStats(){return H(this.id)}getLogs(e){return G(e,this.id)}},D=class{constructor(e,n){this.component=e;this.resource=n;e.fetch()}entry=void 0;identifier=void 0;get valid(){return this.identifier!==void 0&&this.component.valid}get loaded(){return this.identifier!==void 0}async fetch(){if(this.identifier===void 0){let e=a.loadings.get(this);return e||(e=new Promise(async n=>{let{component:o}=this;try{o.installed===!1&&await o.install();let{manifest:r}=o,s=A(r.apis?.[this.resource]),i=s?.type;if(i==="module")this.entry=await a.resources_loader.load_resource(s.location),this.identifier=s.identifier;else if(i==="api.rest")this.entry=z(s,o),this.identifier=null;else if(r.type){let m=u(r.type).getResource(`component.${this.resource}`);if(m){let d=await m.fetch();d?this.entry=await d(this.component):this.entry=null,this.identifier=null}else throw new Error(`Cannot provide resource '${this.resource}'`)}else throw new Error(`Cannot load resource '${this.resource}': ${JSON.stringify(s)}`);let c=this.get();c instanceof Object&&a.datamap.set(c,this)}catch(r){console.error(`Cannot install service api '${this.resource}' of '${o.id}':`,r),this.entry=null,this.identifier=null}n(this.get()),a.loadings.set(this,null)}),a.loadings.set(this,e),e)}else return this.get()}get(){if(this.entry)return this.identifier!==null?this.entry?.[this.identifier]:this.entry}set(e){this.entry=e,this.identifier=null}get spec(){let e=this.resource.split(".")[0];return this.component.manifest?.specs?.[e]}get url(){let e=this.component.manifest?.apis?.[this.resource];if(typeof e=="string"){let n=de.parse(window.location.href).with({fragment:null});return ge.joinPath(n,"..",e.split("#")[0]).toString()}return null}},k=class{components=new Map;resources=new Map;datamap=new WeakMap;loadings=new Map;installings=new Map;listeners=new Set;components_provider=new M([]);resources_loader=null;content_provider=null;constructor(){this.content_provider=new S,this.components_provider.add_provider(new j(this.content_provider)),this.components_provider.add_provider(W()),this.resources_loader=new I(this.content_provider)}listen(e){return this.listeners.add(e),e}unlisten(e){this.listeners.delete(e)}notifyError(e,n){}},a=new k;u("<error>").set({$id:"<error>",icon:"bi:house",title:"Define invalid component"});function ye(){return u("log:application")}function g(t,e){if(t instanceof Object){let n=a.datamap.get(t)||t;if(n instanceof b)return n;if(n instanceof D)return n.component;if(!e&&t.getComponent instanceof Function)return g(t.getComponent(),!0)}return ye()}function u(t){let e=a.components.get(t);return!e&&typeof t=="string"&&(e=new b(t),a.components.set(t,e)),e}function ft(t){let e=t.$id,n=a.components.get(e);return!n&&typeof e=="string"&&(n=new b(e),n.manifest=t,n.instance=null,a.components.set(e,n)),n}function dt(t){let e=t.split("#");return e.length===2?u(e[0])?.acquireResource(e[1]):null}function gt(t,e){return e&&t.startsWith("/")?u(`${e?.id}${t}`):null}async function yt(t){let e=u(t.$id);return a.loadings.delete(e),e.manifest=t,he(e)}async function he(t){console.log("[Update Component]",t.id);let e=await t.fetch();if(await a.components_provider.add_component(e),t.loaded&&e.type&&t.installed){let o=await L.fetch(u(e.type));o&&(t.instance?await o.updateComponent(t,e):(t.__instance__=void 0,await o.createComponent(t,e))),t.instance instanceof Object&&a.datamap.set(t.instance,t),a.listeners.forEach(r=>r(t))}return t}async function ht(t){console.log("deleteComponent",t),await a.components_provider.delete_component(t)&&_e(t)}function _e(t){let e=a.components.get(t);e&&(e.set({$id:e.id,type:"<error>",message:"Component deleted"}),a.listeners.forEach(n=>n(e)),a.components.delete(t))}async function _t(t){return a.components_provider.search_component_publications(t)}async function Ct(t){let e=[];for(let n of t){let o=await a.components_provider.get_component_publication(n);o?e.push(o):e.push(Ce(n))}return e}function Ce(t,e){return{id:t,title:e||"! Not found: "+t}}var X=l.About("api.rest");function z(t,e){let n=t.endpoint+(t.path||"");return{invoke(o,r){return globalThis.fetch(n+o,r)},getUrl(o){return n+o}}}var It={async fetch(t,e){if(typeof t=="string"&&(t=O.parse(t)),t.scheme==="jtd"){let n=u(t.authority),o=await X.fetch(n);if(o){let r=t.query?`${t.path}?${t.query}`:t.path;return o.invoke(r,e)}else return Response.error()}else return fetch(t.toString(),e)},async getUri(t){if(typeof t=="string"&&(t=O.parse(t)),t.scheme==="jtd"){let e=u(t.authority),n=await X.fetch(e);if(n){let o=t.query?`${t.path}?${t.query}`:t.path;t=O.parse(n.getUrl(o))}else throw new Error(`Unknown component '${t.authority}'`)}return t}};export{l as a,L as b,ve as c,w as d,Y as e,x as f,Re as g,h,A as i,I as j,S as k,$e as l,_ as m,R as n,j as o,M as p,W as q,X as r,z as s,It as t,b as u,D as v,k as w,a as x,ye as y,g as z,u as A,ft as B,dt as C,gt as D,yt as E,he as F,ht as G,_e as H,_t as I,Ct as J,Ce as K,me as L,le as M,Ze as N,et as O,G as P,H as Q,y as R,fe as S};
|