@ossy/sdk-react 0.6.6 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{useWorkspace as r}from"./useWorkspace.js";var e=function(e){return r().workspace.resourceTemplates.find(function(r){return r.id===e})};export{e as useResourceTemplate};
1
+ import{useWorkspace as r}from"./useWorkspace.js";var e=function(e){var o;return null===(o=r().workspace.resourceTemplates)||void 0===o?void 0:o.find(function(r){return r.id===e})};export{e as useResourceTemplate};
@@ -1 +1 @@
1
- import{__spreadArray as n}from"../../node_modules/tslib/tslib.es6.js";import{useMemo as t,useCallback as e,useEffect as r}from"react";import{useCache as o}from"./Cache.js";import{removeBy as u}from"./removeBy.js";import{replaceBy as i}from"./replaceBy.js";import{AsyncStatus as c}from"./asyncStatus.js";import{useSdk as s}from"./useSdk.js";var a=function(a){var f=s(),d=t(function(){return["resources","status",a]},[a]),m=o(d,c.NotInitialized),l=m.data,v=m.set,p=o(["resources","data"],[]),h=p.data,y=p.set,j=t(function(){return h.filter(function(n){return n.location===a})},[h,a]),R=e(function(n){var t=h.find(function(t){return t.id===n});return t?Promise.resolve(t):f.resources.get({id:n}).then(function(n){return y(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[f,h,y]),g=e(function(){v(c.Loading),f.resources.list({location:a}).then(function(t){v(c.Success),y(function(e){void 0===e&&(e=[]);var r=t.map(function(n){return n.id}),o=e.filter(function(n){return!r.includes(n.id)});return n(n([],t,!0),o,!0)})}).catch(function(){v(c.Error)})},[f,a,v,y]),C=e(function(t){return f.resources.create({type:t.type,location:t.location,name:t.name,content:t.content}).then(function(t){return y(function(e){return void 0===e&&(e=[]),n(n([],e,!0),[t],!1)}),t})},[f,y]),D=e(function(t,e){return f.resources.upload({location:t,file:e}).then(function(t){return y(function(e){return void 0===e&&(e=[]),n(n([],e,!0),[t],!1)}),t})},[f,y]),S=e(function(t){var e=t.location,r=t.name;return f.resources.createDirectory({type:"directory",location:e,name:r}).then(function(t){return y(function(e){return void 0===e&&(e=[]),n(n([],e,!0),[t],!1)}),t})},[f,y]),b=e(function(n){return f.resources.remove({id:n}).then(function(){return y(function(t){return void 0===t&&(t=[]),u("id",n,t)})})},[f,y]),z=e(function(n,t){return f.resources.updateContent({id:n,content:t}).then(function(n){return y(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[f,y]),B=e(function(n,t){return f.resources.move({id:n,target:t}).then(function(n){return y(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[f,y]),I=e(function(n,t){return f.resources.rename({id:n,name:t}).then(function(n){return y(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[f,y]);return r(function(){a&&l===c.NotInitialized&&g()},[a,l]),{status:l,resources:j,removeResource:b,createDocument:C,createDirectory:S,loadResource:R,updateResourceContent:z,moveResource:B,renameResource:I,uploadFile:D}};export{a as useResources};
1
+ import{__spreadArray as n}from"../../node_modules/tslib/tslib.es6.js";import{useMemo as t,useCallback as e,useEffect as r}from"react";import{useCache as o}from"./Cache.js";import{removeBy as u}from"./removeBy.js";import{replaceBy as i}from"./replaceBy.js";import{AsyncStatus as c}from"./asyncStatus.js";import{useSdk as s}from"./useSdk.js";var a=function(a){var f=s(),d=t(function(){return["resources","status",a]},[a]),m=o(d,c.NotInitialized),l=m.data,v=m.set,p=o(["resources","data"],[]),h=p.data,y=p.set,j=t(function(){return h.filter(function(n){return n.location===a})},[h,a]),R=e(function(n){var t=null==h?void 0:h.find(function(t){return t.id===n});return t?Promise.resolve(t):f.resources.get({id:n}).then(function(n){return y(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[f,h,y]),g=e(function(){v(c.Loading),f.resources.list({location:a}).then(function(t){v(c.Success),y(function(e){void 0===e&&(e=[]);var r=t.map(function(n){return n.id}),o=e.filter(function(n){return!r.includes(n.id)});return n(n([],t,!0),o,!0)})}).catch(function(){v(c.Error)})},[f,a,v,y]),C=e(function(t){return f.resources.create({type:t.type,location:t.location,name:t.name,content:t.content}).then(function(t){return y(function(e){return void 0===e&&(e=[]),n(n([],e,!0),[t],!1)}),t})},[f,y]),D=e(function(t,e){return f.resources.upload({location:t,file:e}).then(function(t){return y(function(e){return void 0===e&&(e=[]),n(n([],e,!0),[t],!1)}),t})},[f,y]),S=e(function(t){var e=t.location,r=t.name;return f.resources.createDirectory({type:"directory",location:e,name:r}).then(function(t){return y(function(e){return void 0===e&&(e=[]),n(n([],e,!0),[t],!1)}),t})},[f,y]),b=e(function(n){return f.resources.remove({id:n}).then(function(){return y(function(t){return void 0===t&&(t=[]),u("id",n,t)})})},[f,y]),z=e(function(n,t){return f.resources.updateContent({id:n,content:t}).then(function(n){return y(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[f,y]),B=e(function(n,t){return f.resources.move({id:n,target:t}).then(function(n){return y(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[f,y]),I=e(function(n,t){return f.resources.rename({id:n,name:t}).then(function(n){return y(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[f,y]);return r(function(){a&&l===c.NotInitialized&&g()},[a,l]),{status:l,resources:j,removeResource:b,createDocument:C,createDirectory:S,loadResource:R,updateResourceContent:z,moveResource:B,renameResource:I,uploadFile:D}};export{a as useResources};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ossy/sdk-react",
3
3
  "description": "Sofware Development Kit React",
4
- "version": "0.6.6",
4
+ "version": "0.6.7",
5
5
  "url": "git://github.com/ossy-se/packages/sdk-react",
6
6
  "source": "src/public.index.ts",
7
7
  "module": "build/sdk-react/src/public.index.js",
@@ -56,5 +56,5 @@
56
56
  "/build",
57
57
  "README.md"
58
58
  ],
59
- "gitHead": "3694b1625d298c93c5bfbed5c54a56abb52e4619"
59
+ "gitHead": "3b5cde28a8fac3e27a4f22b52e9d8f8ce69a12c6"
60
60
  }