@ossy/sdk 3.4.0 → 3.5.0
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 +3 -1
- package/build/public.index.js +1 -1
- package/build/types/sdk.d.ts +2 -0
- package/package.json +3 -3
package/build/public.index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ declare function resolveEventsUrl(apiUrl: string): string;
|
|
|
19
19
|
*/
|
|
20
20
|
declare function resolveHttpActionUrl(apiUrl: string, route: ActionRoute, payload?: Record<string, unknown>): string;
|
|
21
21
|
|
|
22
|
+
/** Detect filesystem-backend upload URLs; S3 URLs must not get session headers. */
|
|
23
|
+
declare function isLocalStorageUploadUrl(url: string): boolean;
|
|
22
24
|
declare class SDK {
|
|
23
25
|
workspaceId?: string;
|
|
24
26
|
authorization?: string;
|
|
@@ -208,5 +210,5 @@ declare const AuthSignOff: PlatformAction;
|
|
|
208
210
|
/** @deprecated Use `PlatformAction`. */
|
|
209
211
|
type RestAction<TPayload = Record<string, unknown>> = PlatformAction<TPayload>;
|
|
210
212
|
|
|
211
|
-
export { ApiTokenCreate, ApiTokenGetAll, ApiTokenInvalidate, AuthGetAuthenticatedUser, AuthGetAuthenticatedUserHistory, AuthGetUser, AuthSignIn, AuthSignOff, AuthSignUp, AuthVerifyInvitation, AuthVerifySignIn, ResourceUpdateAccess, ResourcesCreate, ResourcesCreateDirectory, ResourcesGet, ResourcesList, ResourcesMove, ResourcesRemove, ResourcesRename, ResourcesSearch, ResourcesUpdateContent, ResourcesUpload, ResourcesUploadNamedVersion, SDK, UserCurrentGet, UserCurrentGetHistory, UserCurrentUpdate, WorkspacesAddMember, WorkspacesCreate, WorkspacesCreateApiToken, WorkspacesDisableService, WorkspacesEnableService, WorkspacesGet, WorkspacesGetApiTokens, WorkspacesGetCurrent, WorkspacesGetSchemas, WorkspacesGetUsers, WorkspacesImportSchemas, WorkspacesInviteUser, WorkspacesList, WorkspacesRemoveMember, resolveActionId, resolveActionsUrl, resolveEventsUrl, resolveHttpActionUrl };
|
|
213
|
+
export { ApiTokenCreate, ApiTokenGetAll, ApiTokenInvalidate, AuthGetAuthenticatedUser, AuthGetAuthenticatedUserHistory, AuthGetUser, AuthSignIn, AuthSignOff, AuthSignUp, AuthVerifyInvitation, AuthVerifySignIn, ResourceUpdateAccess, ResourcesCreate, ResourcesCreateDirectory, ResourcesGet, ResourcesList, ResourcesMove, ResourcesRemove, ResourcesRename, ResourcesSearch, ResourcesUpdateContent, ResourcesUpload, ResourcesUploadNamedVersion, SDK, UserCurrentGet, UserCurrentGetHistory, UserCurrentUpdate, WorkspacesAddMember, WorkspacesCreate, WorkspacesCreateApiToken, WorkspacesDisableService, WorkspacesEnableService, WorkspacesGet, WorkspacesGetApiTokens, WorkspacesGetCurrent, WorkspacesGetSchemas, WorkspacesGetUsers, WorkspacesImportSchemas, WorkspacesInviteUser, WorkspacesList, WorkspacesRemoveMember, isLocalStorageUploadUrl, resolveActionId, resolveActionsUrl, resolveEventsUrl, resolveHttpActionUrl };
|
|
212
214
|
export type { ActionRef, PlatformAction, PushMessage, RestAction };
|
package/build/public.index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const s={VisualContentDescriptors:"@ossy/tasks/visual-content-descriptors",ResizeCommonWeb:"@ossy/tasks/resize-common-web"},e={Queued:"queued",InProgress:"in progress",Success:"success",Failed:"failed"},t={id:"@ossy/users/actions/get-api-tokens"},o={id:"@ossy/users/actions/create-api-token"},i={id:"@ossy/users/actions/invalidate-api-token"},n={id:"@ossy/workspaces/actions/list"},a={id:"@ossy/workspaces/actions/get"},r={id:"@ossy/workspaces/actions/get"},c={id:"@ossy/workspaces/actions/create"},
|
|
1
|
+
const s={VisualContentDescriptors:"@ossy/tasks/visual-content-descriptors",ResizeCommonWeb:"@ossy/tasks/resize-common-web"},e={Queued:"queued",InProgress:"in progress",Success:"success",Failed:"failed"},t={id:"@ossy/users/actions/get-api-tokens"},o={id:"@ossy/users/actions/create-api-token"},i={id:"@ossy/users/actions/invalidate-api-token"},n={id:"@ossy/workspaces/actions/list"},a={id:"@ossy/workspaces/actions/get"},r={id:"@ossy/workspaces/actions/get"},c={id:"@ossy/workspaces/actions/create"},u={id:"@ossy/workspaces/actions/import-schemas"},d={id:"@ossy/workspaces/actions/get-schemas"},h={id:"@ossy/workspaces/actions/create-api-token"},p={id:"@ossy/workspaces/actions/get-api-tokens"},l={id:"@ossy/workspaces/actions/invite-user"},y={id:"@ossy/workspaces/actions/enable-service"},k={id:"@ossy/workspaces/actions/disable-service"},g={id:"@ossy/workspaces/actions/get-users"},v={id:"@ossy/users/actions/join-workspace"},w={id:"@ossy/workspaces/actions/remove-member"},m={id:"@ossy/authentication/actions/get-current-user"},f={id:"@ossy/users/actions/get-current-user-history"},b={id:"@ossy/users/actions/update-details"},z={id:"@ossy/resources/actions/create",payload:{type:"directory"}},j={id:"@ossy/resources/actions/create"},$={id:"@ossy/resources/actions/create"},I={id:"@ossy/resources/actions/upload-named-version"},O={id:"@ossy/resources/actions/get"},R={id:"@ossy/resources/actions/list"},T={id:"@ossy/resources/actions/search"},U={id:"@ossy/resources/actions/update-access"},S={id:"@ossy/resources/actions/delete"},P={id:"@ossy/resources/actions/update-content"},C={id:"@ossy/resources/actions/update-location"},E={id:"@ossy/resources/actions/update-name"},A={id:"@ossy/authentication/actions/sign-up"},W={id:"@ossy/authentication/actions/request-sign-in"},G={id:"@ossy/authentication/actions/verify-sign-in"},H={id:"@ossy/workspaces/actions/accept-invitation"},N={id:"@ossy/authentication/actions/get-current-user"},q={id:"@ossy/users/actions/get-current-user-history"},D={id:"@ossy/authentication/actions/get-current-user"},J={id:"@ossy/authentication/actions/sign-out"};function L(s){const e="string"==typeof s?s:s.id;return e.includes(".")?e.replace(/\./g,"/"):e}function V(s){const e=(null!=s?s:"").replace(/\/$/,"");if(!e||"/@ossy"===e||e.endsWith("/@ossy"))return"/actions";const t=e.replace(/\/api\/v0\/?$/,"").replace(/\/$/,"");return t?`${t}/actions`:"/actions"}function x(s){const e=(null!=s?s:"").replace(/\/$/,"");if(!e||"/@ossy"===e||e.endsWith("/@ossy"))return"/events";const t=e.replace(/\/api\/v0\/?$/,"").replace(/\/$/,"");return t?`${t}/events`:"/events"}function F(s,e,t){var o,i;const n=e.path.startsWith("/")?e.path:`/${e.path}`,a=(null!=s?s:"").replace(/\/$/,"");let r;r=!a||"/@ossy"===a||a.endsWith("/@ossy")?`/@ossy${n.replace(/^\/api\/v0/,"")}`:a.includes("/api/v0")?`${a.replace(/\/api\/v0\/?$/,"")}${n}`:`${a}${n}`;const c=null!==(o=e.method)&&void 0!==o?o:"GET";if("GET"===c||"HEAD"===c){const s=new URLSearchParams;for(const o of null!==(i=e.query)&&void 0!==i?i:[]){const e=null==t?void 0:t[o];null!=e&&""!==e&&s.set(o,String(e))}const o=s.toString();o&&(r+=`${r.includes("?")?"&":"?"}${o}`)}return r}function M(s){if(!s||"string"!=typeof s)return!1;try{const e=new URL(s,"http://localhost");return"/local-storage"===e.pathname||e.pathname.endsWith("/local-storage")}catch(s){return!1}}class Q{static of(s){return new Q(s)}constructor(s){this.baseUrl="https://api.ossy.se/api/v0",this.actionRoutes={},this.invoke=(s,e)=>this.invokePlatformAction(L(s),e),this.invokePlatformAction=(s,e)=>{const t=this.actionRoutes[s];if(t)return this.invokeHttpRoute(t,e);const o={method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:s,payload:null!=e?e:{}})};this.workspaceId&&(o.headers=Object.assign(Object.assign({},o.headers),{workspaceId:this.workspaceId})),this.authorization&&(o.headers=Object.assign(Object.assign({},o.headers),{Authorization:this.authorization}));const i=V(this.baseUrl);return fetch(i,o).then(this.handleResponse)},this.invokeHttpRoute=(s,e)=>{var t;const o=null!==(t=s.method)&&void 0!==t?t:"GET",i=F(this.baseUrl,s,e),n={method:o,credentials:"include",headers:{}};return this.workspaceId&&(n.headers=Object.assign(Object.assign({},n.headers),{workspaceId:this.workspaceId})),this.authorization&&(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:this.authorization})),"GET"!==o&&"HEAD"!==o&&(n.headers=Object.assign(Object.assign({},n.headers),{"Content-Type":"application/json"}),n.body=JSON.stringify(null!=e?e:{})),fetch(i,n).then(this.handleResponse)},this.handleResponse=s=>{const e=s.headers.get("Content-Type")||"",t=s.status;return 400===t?s.json().then(s=>Promise.reject(s.error)):[200,204].includes(t)?e.includes("application/json")?s.json():s:Promise.reject(s)},this.subscribePush=s=>{if("undefined"==typeof EventSource)return()=>{};const e=x(this.baseUrl),t=new EventSource(e,{withCredentials:!0});return t.onmessage=e=>{try{const t=JSON.parse(e.data);s.onMessage(t)}catch(s){}},t.onerror=e=>{var t;null===(t=s.onError)||void 0===t||t.call(s,e)},()=>{t.close()}},this.updateConfig(s)}updateConfig(s){var e;this.baseUrl=s.apiUrl||this.baseUrl,this.workspaceId=s.workspaceId||this.workspaceId,this.authorization=s.authorization||this.authorization,this.actionRoutes=null!==(e=s.actionRoutes)&&void 0!==e?e:this.actionRoutes}get resources(){return{upload:({location:s="/",file:e})=>{const t={type:e.type,location:s,name:e.name,size:e.size};return this.invoke($,t).then(s=>{const t=s.content.uploadUrl,o={};e.type&&(o["Content-Type"]=e.type);const i={method:"PUT",headers:o,body:e};return M(t)&&(i.credentials="include",this.workspaceId&&(o.workspaceId=this.workspaceId),this.authorization&&(o.Authorization=this.authorization)),fetch(t,i).then(()=>s)})},list:s=>{const e=new URLSearchParams(Object.assign({},s)).toString();return this.invoke(R,{search:e})},uploadNamedVersion:({id:s,name:e,file:t})=>{const o={id:s,namedVersion:e,name:e,size:t.size,type:t.type};return this.invoke(I,o).then(s=>{const e=s.content.uploadUrl,o={};t.type&&(o["Content-Type"]=t.type);const i={method:"PUT",headers:o,body:t};return M(e)&&(i.credentials="include",this.workspaceId&&(o.workspaceId=this.workspaceId),this.authorization&&(o.Authorization=this.authorization)),fetch(e,i).then(()=>s)})}}}}export{o as ApiTokenCreate,t as ApiTokenGetAll,i as ApiTokenInvalidate,N as AuthGetAuthenticatedUser,q as AuthGetAuthenticatedUserHistory,D as AuthGetUser,W as AuthSignIn,J as AuthSignOff,A as AuthSignUp,H as AuthVerifyInvitation,G as AuthVerifySignIn,U as ResourceUpdateAccess,j as ResourcesCreate,z as ResourcesCreateDirectory,O as ResourcesGet,R as ResourcesList,C as ResourcesMove,S as ResourcesRemove,E as ResourcesRename,T as ResourcesSearch,P as ResourcesUpdateContent,$ as ResourcesUpload,I as ResourcesUploadNamedVersion,Q as SDK,e as TaskStatus,s as Tasks,m as UserCurrentGet,f as UserCurrentGetHistory,b as UserCurrentUpdate,v as WorkspacesAddMember,c as WorkspacesCreate,h as WorkspacesCreateApiToken,k as WorkspacesDisableService,y as WorkspacesEnableService,r as WorkspacesGet,p as WorkspacesGetApiTokens,a as WorkspacesGetCurrent,d as WorkspacesGetSchemas,g as WorkspacesGetUsers,u as WorkspacesImportSchemas,l as WorkspacesInviteUser,n as WorkspacesList,w as WorkspacesRemoveMember,M as isLocalStorageUploadUrl,L as resolveActionId,V as resolveActionsUrl,x as resolveEventsUrl,F as resolveHttpActionUrl};
|
package/build/types/sdk.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { resolveHttpActionUrl } from './resolve-http-action-url';
|
|
|
4
4
|
import type { ActionRoute } from '@ossy/types';
|
|
5
5
|
export { resolveActionId, resolveActionsUrl, resolveEventsUrl, resolveHttpActionUrl, type ActionRef };
|
|
6
6
|
export type { ActionRoute };
|
|
7
|
+
/** Detect filesystem-backend upload URLs; S3 URLs must not get session headers. */
|
|
8
|
+
export declare function isLocalStorageUploadUrl(url: string): boolean;
|
|
7
9
|
export declare class SDK {
|
|
8
10
|
workspaceId?: string;
|
|
9
11
|
authorization?: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/sdk",
|
|
3
3
|
"description": "Software Development Kit for interacting with our services",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.0",
|
|
5
5
|
"url": "git://github.com/ossy-se/packages/sdk",
|
|
6
6
|
"source": "src/public.index.ts",
|
|
7
7
|
"main": "build/public.index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@ossy/types": "^3.
|
|
24
|
+
"@ossy/types": "^3.5.0"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"start": "",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"/build",
|
|
37
37
|
"README.md"
|
|
38
38
|
],
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "23167600f991596f122765a53f2b9df08314e115"
|
|
40
40
|
}
|