@ossy/sdk 1.17.8 → 1.17.9
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
CHANGED
|
@@ -121,8 +121,6 @@ declare const ResourcesRename: Action<{
|
|
|
121
121
|
id: string;
|
|
122
122
|
name: string;
|
|
123
123
|
}>;
|
|
124
|
-
/** Short-lived ECR registry password for `docker login` (same AWS account as the API credentials). */
|
|
125
|
-
declare const RegistryEcrPushCredentials: Action;
|
|
126
124
|
declare const AuthSignUp: Action<{
|
|
127
125
|
email: string;
|
|
128
126
|
firstName: string;
|
|
@@ -200,9 +198,6 @@ declare class SDK {
|
|
|
200
198
|
} | undefined>) => Promise<any>;
|
|
201
199
|
history: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
202
200
|
};
|
|
203
|
-
get registry(): {
|
|
204
|
-
ecrPushCredentials: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
205
|
-
};
|
|
206
201
|
get resources(): {
|
|
207
202
|
createDirectory: (_payload?: Required<{
|
|
208
203
|
type?: "directory";
|
|
@@ -278,4 +273,4 @@ declare class SDK {
|
|
|
278
273
|
makeRequest: <T extends Action>(action: T) => (_payload?: Required<T["payload"]>) => Promise<any>;
|
|
279
274
|
}
|
|
280
275
|
|
|
281
|
-
export { ApiTokenCreate, ApiTokenGetAll, ApiTokenInvalidate, AuthGetAuthenticatedUser, AuthGetAuthenticatedUserHistory, AuthGetUser, AuthSignIn, AuthSignOff, AuthSignUp, AuthVerifyInvitation, AuthVerifySignIn,
|
|
276
|
+
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, WorkspacesCreate, WorkspacesCreateApiToken, WorkspacesDisableService, WorkspacesEnableService, WorkspacesGet, WorkspacesGetApiTokens, WorkspacesGetCurrent, WorkspacesGetResourceTemplates, WorkspacesGetUsers, WorkspacesImportResourceTemplates, WorkspacesInviteUser, WorkspacesList };
|
package/build/public.index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={VisualContentDescriptors:"@ossy/jobs/visual-content-descriptors",ResizeCommonWeb:"@ossy/jobs/resize-common-web"},t={Queued:"queued",InProgress:"in progress",Success:"success",Failed:"failed"};class s{static of(e){return new s(e)}constructor(e){this.http=null==e?void 0:e.http,this.resources=e.resources}get(e={}){const t="string"==typeof e?{id:e}:e;return t.location=s.location,this.resources.search({query:t})}getUnprocessed(){return this.resources.search({$and:[{$or:[{"content.nextReevaluation":{$exists:!1}},{"content.nextReevaluation":null},{"content.nextReevaluation":{$lt:Date.now()}}]},{"content.status":{$in:["queued","failed"]}},{location:"/@ossy/jobs/"},{type:{$regex:"^@ossy/jobs"}}]})}create({type:i,resourceId:
|
|
1
|
+
const e={VisualContentDescriptors:"@ossy/jobs/visual-content-descriptors",ResizeCommonWeb:"@ossy/jobs/resize-common-web"},t={Queued:"queued",InProgress:"in progress",Success:"success",Failed:"failed"};class s{static of(e){return new s(e)}constructor(e){this.http=null==e?void 0:e.http,this.resources=e.resources}get(e={}){const t="string"==typeof e?{id:e}:e;return t.location=s.location,this.resources.search({query:t})}getUnprocessed(){return this.resources.search({$and:[{$or:[{"content.nextReevaluation":{$exists:!1}},{"content.nextReevaluation":null},{"content.nextReevaluation":{$lt:Date.now()}}]},{"content.status":{$in:["queued","failed"]}},{location:"/@ossy/jobs/"},{type:{$regex:"^@ossy/jobs"}}]})}create({type:i,resourceId:o}){if(!Object.values(e).includes(i))throw new Error(`Job type ${i} does not exist`);if(!o)throw new Error("Resource ID is required");return this.resources.create({type:i,location:s.location,name:`[${t.Queued}] ${o}`,content:{resourceId:o,status:t.Queued,result:void 0}})}}s.location="/@ossy/jobs/";const i={id:"api-tokens.get-all",endpoint:"/users/me/tokens",method:"GET"},o={id:"api-tokens.create",endpoint:"/users/me/tokens",method:"POST"},n={id:"api-tokens.invalidate",endpoint:"/users/me/tokens/:id",method:"DELETE"},r={id:"workspaces.get-all",endpoint:"/workspaces",method:"GET"},d={id:"workspaces.get-current",endpoint:"/workspaces/current",method:"GET"},a={id:"workspaces.get",endpoint:"/workspaces/:id",method:"GET"},u={id:"workspaces.create",endpoint:"/workspaces",method:"POST"},h={id:"workspaces.import-resource-templates",endpoint:"/resource-templates",method:"POST"},c={id:"workspaces.get-resource-templates",endpoint:"/resource-templates",method:"GET"},p={id:"workspaces.create-api-token",endpoint:"/tokens",method:"POST"},m={id:"workspaces.get-api-tokens",endpoint:"/tokens",method:"GET"},k={id:"workspaces.invite-user",endpoint:"/invitations",method:"POST"},l={id:"workspaces.enable-service",endpoint:"/services/enable",method:"POST"},b={id:"workspaces.disable-service",endpoint:"/services/disable",method:"POST"},g={id:"workspaces.get-users",endpoint:"/users",method:"GET"},T={id:"user.get",endpoint:"/users/me",method:"GET"},R={id:"user.get-history",endpoint:"/users/me/history",method:"GET"},q={id:"user.update",endpoint:"/users/me",method:"PUT"},y={id:"resources.create-directory",endpoint:"/resources",method:"POST",payload:{type:"directory"}},w={id:"resources.create",endpoint:"/resources",method:"POST"},v={id:"resources.upload",endpoint:"/resources",method:"POST"},f={id:"resources.upload-named-version",endpoint:"/resources/:id/:name",method:"PUT"},E={id:"resources.get",endpoint:"/resources/:id",method:"GET"},P={id:"resources.list",endpoint:"/resources?:search",method:"GET"},U={id:"resources.search",endpoint:"/resources/search",method:"POST"},O={id:"resources.update-access",endpoint:"/resources/:id/access",method:"PUT"},j={id:"resources.remove",endpoint:"/resources/:id",method:"DELETE"},S={id:"resources.update-content",endpoint:"/resources/:id/content",method:"PUT"},G={id:"resources.move",endpoint:"/resources/:id/location",method:"PUT"},I={id:"resources.rename",endpoint:"/resources/:id/name",method:"PUT"},z={id:"auth.sign-up",endpoint:"/users/sign-up",method:"POST"},$={id:"auth.sign-in",endpoint:"/users/sign-in",method:"POST"},x={id:"auth.verify-sign-in",endpoint:"/users/verify-sign-in?token=:token",method:"GET"},C={id:"auth.verify-invitation",endpoint:"/workspaces/:workspaceId/invitations?token=:token",method:"GET"},D={id:"auth.get-authenticated-user",endpoint:"/users/me",method:"GET"},A={id:"auth.get-authenticated-user-history",endpoint:"/users/me/history",method:"GET"},J={id:"auth.get-user",endpoint:"/users/:id",method:"GET"},L={id:"auth.sign-off",endpoint:"/users/sign-off",method:"GET"};class Q{static of(e){return new Q(e)}constructor(e){this.baseUrl="https://api.ossy.se/api/v0",this.makeRequest=e=>t=>{let s={};(t||e.payload)&&(s=Object.assign(Object.assign({},e.payload||{}),t||{}));let i="apiUrl"in s?null==s?void 0:s.apiUrl:this.baseUrl,o="workspaceId"in s?s.workspaceId:this.workspaceId,n="authorization"in s?s.authorization:this.authorization,r=e.endpoint;if(s){const t=Object.keys(s);r=e.endpoint,r=t.reduce((e,t)=>e.replace(`:${t}`,`${s[t]}`),e.endpoint)}const d=`${i}${r}`,a={method:e.method,credentials:"include",headers:{"Content-Type":"application/json"}};return o&&(a.headers=Object.assign(Object.assign({},a.headers),{workspaceId:o})),n&&(a.headers=Object.assign(Object.assign({},a.headers),{Authorization:n})),"GET"!==a.method&&s&&(a.body=JSON.stringify(s)),fetch(d,a).then(e=>{const t=e.headers.get("Content-Type")||"",s=e.status;return 400===s?e.json().then(e=>Promise.reject(e.error)):[200,204].includes(s)?t.includes("application/json")?e.json():e:Promise.reject(e)})},this.updateConfig(e)}updateConfig(e){this.baseUrl=e.apiUrl||this.baseUrl,this.workspaceId=e.workspaceId||this.workspaceId,this.authorization=e.authorization||this.authorization}get apiTokens(){return{list:this.makeRequest(i).bind(this),create:this.makeRequest(o).bind(this),invalidate:this.makeRequest(n).bind(this)}}get workspaces(){return{current:this.makeRequest(d).bind(this),list:this.makeRequest(r).bind(this),get:this.makeRequest(a).bind(this),create:this.makeRequest(u).bind(this),importResourceTemplates:this.makeRequest(h).bind(this),getResourceTemplates:this.makeRequest(c).bind(this),createApiToken:this.makeRequest(p).bind(this),getApiTokens:this.makeRequest(m).bind(this),inviteUser:this.makeRequest(k).bind(this),enableService:this.makeRequest(l).bind(this),disableService:this.makeRequest(b).bind(this)}}get users(){return{list:this.makeRequest(g).bind(this)}}get currentUser(){return{get:this.makeRequest(T).bind(this),update:this.makeRequest(q).bind(this),history:this.makeRequest(R).bind(this)}}get resources(){return{createDirectory:this.makeRequest(y).bind(this),create:this.makeRequest(w).bind(this),access:this.makeRequest(O).bind(this),upload:({location:e="/",file:t})=>{const s={type:t.type,location:e,name:t.name,size:t.size};return this.makeRequest(v)(s).then(e=>fetch(e.content.uploadUrl,{method:"PUT",body:t}).then(()=>e))},uploadNamedVersion:({id:e,name:t,file:s})=>{const i={id:e,name:t,size:s.size};this.makeRequest(f)(i).then(e=>fetch(e.content.uploadUrl,{method:"PUT",body:s}).then(()=>e))},get:this.makeRequest(E).bind(this),list:e=>{const t=new URLSearchParams(Object.assign({},e)).toString();return this.makeRequest(P)({search:t})},search:this.makeRequest(U).bind(this),remove:this.makeRequest(j).bind(this),updateContent:this.makeRequest(S).bind(this),move:this.makeRequest(G).bind(this),rename:this.makeRequest(I).bind(this)}}get auth(){return{signUp:this.makeRequest(z).bind(this),signIn:this.makeRequest($).bind(this),verifySignIn:this.makeRequest(x).bind(this),verifyInvitation:this.makeRequest(C).bind(this),getAuthenticatedUser:this.makeRequest(D).bind(this),getAuthenticatedUserHistory:this.makeRequest(A).bind(this),getUser:this.makeRequest(J).bind(this),signOff:this.makeRequest(L).bind(this)}}get jobs(){return s.of({resources:this.resources})}}export{o as ApiTokenCreate,i as ApiTokenGetAll,n as ApiTokenInvalidate,D as AuthGetAuthenticatedUser,A as AuthGetAuthenticatedUserHistory,J as AuthGetUser,$ as AuthSignIn,L as AuthSignOff,z as AuthSignUp,C as AuthVerifyInvitation,x as AuthVerifySignIn,t as JobStatus,e as Jobs,O as ResourceUpdateAccess,w as ResourcesCreate,y as ResourcesCreateDirectory,E as ResourcesGet,P as ResourcesList,G as ResourcesMove,j as ResourcesRemove,I as ResourcesRename,U as ResourcesSearch,S as ResourcesUpdateContent,v as ResourcesUpload,f as ResourcesUploadNamedVersion,Q as SDK,T as UserCurrentGet,R as UserCurrentGetHistory,q as UserCurrentUpdate,u as WorkspacesCreate,p as WorkspacesCreateApiToken,b as WorkspacesDisableService,l as WorkspacesEnableService,a as WorkspacesGet,m as WorkspacesGetApiTokens,d as WorkspacesGetCurrent,c as WorkspacesGetResourceTemplates,g as WorkspacesGetUsers,h as WorkspacesImportResourceTemplates,k as WorkspacesInviteUser,r as WorkspacesList};
|
package/build/types/Actions.d.ts
CHANGED
|
@@ -88,8 +88,6 @@ export declare const ResourcesRename: Action<{
|
|
|
88
88
|
id: string;
|
|
89
89
|
name: string;
|
|
90
90
|
}>;
|
|
91
|
-
/** Short-lived ECR registry password for `docker login` (same AWS account as the API credentials). */
|
|
92
|
-
export declare const RegistryEcrPushCredentials: Action;
|
|
93
91
|
export declare const AuthSignUp: Action<{
|
|
94
92
|
email: string;
|
|
95
93
|
firstName: string;
|
package/build/types/sdk.d.ts
CHANGED
|
@@ -56,9 +56,6 @@ export declare class SDK {
|
|
|
56
56
|
} | undefined>) => Promise<any>;
|
|
57
57
|
history: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
58
58
|
};
|
|
59
|
-
get registry(): {
|
|
60
|
-
ecrPushCredentials: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
61
|
-
};
|
|
62
59
|
get resources(): {
|
|
63
60
|
createDirectory: (_payload?: Required<{
|
|
64
61
|
type?: "directory";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/sdk",
|
|
3
3
|
"description": "Sofware Development Kit for interacting with our services",
|
|
4
|
-
"version": "1.17.
|
|
4
|
+
"version": "1.17.9",
|
|
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": "^1.17.
|
|
24
|
+
"@ossy/types": "^1.17.9"
|
|
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": "295c9447b738f39dc81a9f250f06acc97efa76b9"
|
|
40
40
|
}
|