@ossy/sdk-react 0.8.3 → 0.8.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/build/public.index.d.ts +2 -0
- package/build/sdk-react/src/useAuthentication.js +1 -1
- package/build/sdk-react/src/useQuery.js +1 -1
- package/build/sdk-react/src/useResource.js +1 -1
- package/build/sdk-react/src/useResources.js +1 -1
- package/build/types/useQuery.d.ts +1 -0
- package/build/types/useResources.d.ts +1 -0
- package/package.json +2 -2
package/build/public.index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ declare const useWorkspaces: () => {
|
|
|
57
57
|
declare const useQuery: (incomingQuery: any) => {
|
|
58
58
|
status: any;
|
|
59
59
|
resources: any;
|
|
60
|
+
loadResources: (query: any) => void;
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
declare const useResource: (id: string) => {
|
|
@@ -76,6 +77,7 @@ declare const useResourceTemplate: (id: string) => any;
|
|
|
76
77
|
declare const useResources: (location?: string) => {
|
|
77
78
|
status: any;
|
|
78
79
|
resources: any;
|
|
80
|
+
loadResources: () => void;
|
|
79
81
|
removeResource: (id: string) => Promise<void>;
|
|
80
82
|
createDocument: (document: any) => Promise<any>;
|
|
81
83
|
createDirectory: ({ location, name }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as t,useEffect as n}from"react";import{useCache as i}from"./Cache.js";import{useSdk as e}from"./useSdk.js";var r={AuthenticationError:"AuthenticationError",NotInitialized:"NotInitialized",NotAuthenticated:"NotAuthenticated",Verifying:"Verifying",Authenticated:"Authenticated",VerifySignIn:"VerifySignIn"},u=["auth","status"],o=function(){var o=e(),c=i(u),f=c.data,a=void 0===f?r.NotInitialized:f,h=c.set,s=t(function(t){return h(function(){return r.Verifying}),o.auth.signUp({email:t}).then(function(){return h(r.VerifySignIn)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),g=t(function(t){return h(function(){return r.Verifying}),o.auth.signIn({email:t}).then(function(){return h(r.VerifySignIn)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),d=t(function(t){return h(function(){return r.Verifying}),o.auth.verifySignIn({token:t}).then(function(){return h(r.Authenticated)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),A=t(function(t,n){return h(function(){return r.Verifying}),o.auth.verifyInvitation({workspaceId:t,token:n}).then(function(){return h(r.Authenticated)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),y=t(function(){return o.auth.signOff().then(function(){return h(r.NotAuthenticated)})},[o])
|
|
1
|
+
import{useCallback as t,useEffect as n}from"react";import{useCache as i}from"./Cache.js";import{useSdk as e}from"./useSdk.js";var r={AuthenticationError:"AuthenticationError",NotInitialized:"NotInitialized",NotAuthenticated:"NotAuthenticated",Verifying:"Verifying",Authenticated:"Authenticated",VerifySignIn:"VerifySignIn"},u=["auth","status"],o=function(){var o=e(),c=i(u),f=c.data,a=void 0===f?r.NotInitialized:f,h=c.set,s=t(function(t){return h(function(){return r.Verifying}),o.auth.signUp({email:t}).then(function(){return h(r.VerifySignIn)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),g=t(function(t){return h(function(){return r.Verifying}),o.auth.signIn({email:t}).then(function(){return h(r.VerifySignIn)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),d=t(function(t){return h(function(){return r.Verifying}),o.auth.verifySignIn({token:t}).then(function(){return h(r.Authenticated)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),A=t(function(t,n){return h(function(){return r.Verifying}),o.auth.verifyInvitation({workspaceId:t,token:n}).then(function(){return h(r.Authenticated)}).catch(function(t){return h(r.AuthenticationError),Promise.reject(t)})},[o]),y=t(function(){return o.auth.signOff().then(function(){return h(r.NotAuthenticated)})},[o]),I=t(function(){h(function(){return r.Verifying}),o.auth.getAuthenticatedUser().then(function(t){if(!t)return Promise.reject();h(function(){return r.Authenticated})}).catch(function(){h(function(){return r.NotAuthenticated})})},[o]);return n(function(){a===r.NotInitialized&&I()},[a,I]),{status:a,signUp:s,signIn:g,signOff:y,verifySignIn:d,verifyInvitation:A}};export{r as AuthenticationStatus,o as useAuthentication};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemo as t,useCallback as r,useEffect as e}from"react";import{useCache as
|
|
1
|
+
import{useMemo as t,useCallback as r,useEffect as e}from"react";import{useCache as o}from"./Cache.js";import{AsyncStatus as n}from"./asyncStatus.js";import{useSdk as s}from"./useSdk.js";var a=function(a){var i=s(),u=new URLSearchParams(a).toString(),c=t(function(){return["queries",u,"status"]},[u]),f=t(function(){return["queries",u,"data"]},[u]),m=o(c,n.NotInitialized),d=m.data,p=m.set,S=o(f,[]),h=S.data,g=S.set,j=r(function(t){p(n.Loading),i.resources.get(t).then(function(t){p(n.Success),g(t)}).catch(function(){p(n.Error)})},[i]);return e(function(){a&&d===n.NotInitialized&&j(a)},[a,d,j]),{status:d,resources:h,loadResources:j}};export{a as useQuery};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemo as e,useCallback as t,useEffect as r}from"react";import{useCache as n}from"./Cache.js";import{AsyncStatus as o}from"./asyncStatus.js";import{useResources as u}from"./useResources.js";import{useSdk as c}from"./useSdk.js";var s=function(s){c();var i=e(function(){return["resource",s,"status"]},[s]),a=e(function(){return["resource",s,"data"]},[s]),f=n(i),d=f.data,m=void 0===d?o.NotInitialized:d,R=f.set,p=n(a),h=p.data,v=void 0===h?{}:h,l=p.set,j=u(),z=j.loadResource,C=j.removeResource,I=j.updateResourceContent,N=j.renameResource,S=j.access,g=t(function(){R(o.Loading),l({}),z(s).then(function(e){R(o.Success),l(e)}).catch(function(){R(o.Error),l({})})},[s,z]),k=t(function(){return C(s).then(function(){R(o.NotInitialized),l({})})},[s,C]),x=t(function(e){return I(s,e).then(function(e){return l(e)})},[s,I]),y=t(function(e){return N(s,e).then(function(e){return l(e)})},[s,N]),E=t(function(e){var t=e.access;return S({id:s,access:t}).then(function(e){return l(e),e})},[s]);return r(function(){s&&m===o.NotInitialized&&g()},[s,g]),{status:m,resource:v,loadResource:g,removeResource:k,updateResourceContent:x,renameResource:y,access:E}};export{s as useResource};
|
|
1
|
+
import{useMemo as e,useCallback as t,useEffect as r}from"react";import{useCache as n}from"./Cache.js";import{AsyncStatus as o}from"./asyncStatus.js";import{useResources as u}from"./useResources.js";import{useSdk as c}from"./useSdk.js";var s=function(s){c();var i=e(function(){return["resource",s,"status"]},[s]),a=e(function(){return["resource",s,"data"]},[s]),f=n(i),d=f.data,m=void 0===d?o.NotInitialized:d,R=f.set,p=n(a),h=p.data,v=void 0===h?{}:h,l=p.set,j=u(),z=j.loadResource,C=j.removeResource,I=j.updateResourceContent,N=j.renameResource,S=j.access,g=t(function(){R(o.Loading),l({}),z(s).then(function(e){R(o.Success),l(e)}).catch(function(){R(o.Error),l({})})},[s,z]),k=t(function(){return C(s).then(function(){R(o.NotInitialized),l({})})},[s,C]),x=t(function(e){return I(s,e).then(function(e){return l(e)})},[s,I]),y=t(function(e){return N(s,e).then(function(e){return l(e)})},[s,N]),E=t(function(e){var t=e.access;return S({id:s,access:t}).then(function(e){return l(e),e})},[s,S]);return r(function(){s&&m===o.NotInitialized&&g()},[s,g]),{status:m,resource:v,loadResource:g,removeResource:k,updateResourceContent:x,renameResource:y,access:E}};export{s as useResource};
|
|
@@ -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";function a(n){if(null==n||""===n)return"/";var t=n.replace(/^\/+|\/+$/g,"");return t?"/".concat(t,"/"):"/"}var f=function(f){var d=s(),l=t(function(){return a(f)},[f]),m=t(function(){return["resources","status",l]},[l]),v=t(function(){return["resources","data",l]},[l]),p=o(m,c.NotInitialized),h=p.data,y=p.set,j=o(v,[]),R=j.data,g=j.set,C=e(function(n){var t=null==R?void 0:R.find(function(t){return t.id===n});return t?Promise.resolve(t):d.resources.get({id:n}).then(function(n){return g(function(t){return void 0===t&&(t=[]),a(n.location)===l?i("id",n,t):t}),n})},[d,R,g,l]),D=e(function(){y(c.Loading),d.resources.list({location:l}).then(function(n){y(c.Success),g(n)}).catch(function(){y(c.Error)})},[d,l,y,g]),S=e(function(t){return d.resources.create({type:t.type,location:a(t.location),name:t.name,content:t.content}).then(function(t){return g(function(e){return void 0===e&&(e=[]),a(t.location)===l?n(n([],e,!0),[t],!1):e}),t})},[d,g,l]),b=e(function(t,e){return d.resources.upload({location:a(t),file:e}).then(function(t){return g(function(e){return void 0===e&&(e=[]),a(t.location)===l?n(n([],e,!0),[t],!1):e}),t})},[d,g,l]),z=e(function(t){var e=t.location,r=t.name;return d.resources.createDirectory({type:"directory",location:a(e),name:r}).then(function(t){return g(function(e){return void 0===e&&(e=[]),a(t.location)===l?n(n([],e,!0),[t],!1):e}),t})},[d,g,l]),B=e(function(n){return d.resources.remove({id:n}).then(function(){g(function(t){return void 0===t&&(t=[]),u("id",n,t)})})},[d,g]),I=e(function(n,t){return d.resources.updateContent({id:n,content:t}).then(function(n){return g(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[d,g]),N=e(function(n,t){return d.resources.move({id:n,target:t}).then(function(t){return g(function(e){return void 0===e&&(e=[]),a(t.location)===l?i("id",t,e):u("id",n,e)}),t})},[d,g,l]),k=e(function(n,t){return d.resources.rename({id:n,name:t}).then(function(n){return g(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[d,g]),x=e(function(n){return d.resources.access(n).then(function(n){return g(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[g]);return r(function(){h===c.NotInitialized&&D()},[l,h]),{status:h,resources:R,removeResource:B,createDocument:S,createDirectory:z,loadResource:C,updateResourceContent:I,moveResource:N,renameResource:k,uploadFile:b,access:x}};export{f 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";function a(n){if(null==n||""===n)return"/";var t=n.replace(/^\/+|\/+$/g,"");return t?"/".concat(t,"/"):"/"}var f=function(f){var d=s(),l=t(function(){return a(f)},[f]),m=t(function(){return["resources","status",l]},[l]),v=t(function(){return["resources","data",l]},[l]),p=o(m,c.NotInitialized),h=p.data,y=p.set,j=o(v,[]),R=j.data,g=j.set,C=e(function(n){var t=null==R?void 0:R.find(function(t){return t.id===n});return t?Promise.resolve(t):d.resources.get({id:n}).then(function(n){return g(function(t){return void 0===t&&(t=[]),a(n.location)===l?i("id",n,t):t}),n})},[d,R,g,l]),D=e(function(){y(c.Loading),d.resources.list({location:l}).then(function(n){y(c.Success),g(n)}).catch(function(){y(c.Error)})},[d,l,y,g]),S=e(function(t){return d.resources.create({type:t.type,location:a(t.location),name:t.name,content:t.content}).then(function(t){return g(function(e){return void 0===e&&(e=[]),a(t.location)===l?n(n([],e,!0),[t],!1):e}),t})},[d,g,l]),b=e(function(t,e){return d.resources.upload({location:a(t),file:e}).then(function(t){return g(function(e){return void 0===e&&(e=[]),a(t.location)===l?n(n([],e,!0),[t],!1):e}),t})},[d,g,l]),z=e(function(t){var e=t.location,r=t.name;return d.resources.createDirectory({type:"directory",location:a(e),name:r}).then(function(t){return g(function(e){return void 0===e&&(e=[]),a(t.location)===l?n(n([],e,!0),[t],!1):e}),t})},[d,g,l]),B=e(function(n){return d.resources.remove({id:n}).then(function(){g(function(t){return void 0===t&&(t=[]),u("id",n,t)})})},[d,g]),I=e(function(n,t){return d.resources.updateContent({id:n,content:t}).then(function(n){return g(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[d,g]),N=e(function(n,t){return d.resources.move({id:n,target:t}).then(function(t){return g(function(e){return void 0===e&&(e=[]),a(t.location)===l?i("id",t,e):u("id",n,e)}),t})},[d,g,l]),k=e(function(n,t){return d.resources.rename({id:n,name:t}).then(function(n){return g(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[d,g]),x=e(function(n){return d.resources.access(n).then(function(n){return g(function(t){return void 0===t&&(t=[]),i("id",n,t)}),n})},[g]);return r(function(){h===c.NotInitialized&&D()},[l,h,D]),{status:h,resources:R,loadResources:D,removeResource:B,createDocument:S,createDirectory:z,loadResource:C,updateResourceContent:I,moveResource:N,renameResource:k,uploadFile:b,access:x}};export{f as useResources};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/sdk-react",
|
|
3
3
|
"description": "Software Development Kit React",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.4",
|
|
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": "
|
|
59
|
+
"gitHead": "9aeb9a551d216c046aca2004d2718bb60ea59154"
|
|
60
60
|
}
|