@ossy/sdk 0.15.13 → 1.0.1
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
|
@@ -88,6 +88,9 @@ declare class SDK {
|
|
|
88
88
|
} | undefined>) => Promise<any>;
|
|
89
89
|
history: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
90
90
|
};
|
|
91
|
+
get registry(): {
|
|
92
|
+
ecrPushCredentials: (_payload?: Required<{} | undefined>) => Promise<any>;
|
|
93
|
+
};
|
|
91
94
|
get resources(): {
|
|
92
95
|
createDirectory: (_payload?: Required<{
|
|
93
96
|
type?: "directory";
|
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:n}){if(!Object.values(e).includes(i))throw new Error(`Job type ${i} does not exist`);if(!n)throw new Error("Resource ID is required");return this.resources.create({type:i,location:s.location,name:`[${t.Queued}] ${n}`,content:{resourceId:n,status:t.Queued,result:void 0}})}}s.location="/@ossy/jobs/";const i={id:"api-tokens.get-all",endpoint:"/users/me/tokens",method:"GET"},n={id:"api-tokens.create",endpoint:"/users/me/tokens",method:"POST"},o={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"},P={id:"resources.get",endpoint:"/resources/:id",method:"GET"},E={id:"resources.list",endpoint:"/resources?:search",method:"GET"},O={id:"resources.search",endpoint:"/resources/search",method:"POST"},U={id:"resources.update-access",endpoint:"/resources/:id/access",method:"PUT"},S={id:"resources.remove",endpoint:"/resources/:id",method:"DELETE"},j={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:"registry.ecr-push-credentials",endpoint:"/registry/ecr/push-credentials",method:"POST"},$={id:"auth.sign-up",endpoint:"/users/sign-up",method:"POST"},C={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"},D={id:"auth.verify-invitation",endpoint:"/workspaces/:workspaceId/invitations?token=:token",method:"GET"},A={id:"auth.get-authenticated-user",endpoint:"/users/me",method:"GET"},J={id:"auth.get-authenticated-user-history",endpoint:"/users/me/history",method:"GET"},L={id:"auth.get-user",endpoint:"/users/:id",method:"GET"},Q={id:"auth.sign-off",endpoint:"/users/sign-off",method:"GET"};class N{static of(e){return new N(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,n="workspaceId"in s?s.workspaceId:this.workspaceId,o="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 n&&(a.headers=Object.assign(Object.assign({},a.headers),{workspaceId:n})),o&&(a.headers=Object.assign(Object.assign({},a.headers),{Authorization:o})),"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(n).bind(this),invalidate:this.makeRequest(o).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 registry(){return{ecrPushCredentials:this.makeRequest(z).bind(this)}}get resources(){return{createDirectory:this.makeRequest(y).bind(this),create:this.makeRequest(w).bind(this),access:this.makeRequest(U).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(P).bind(this),list:e=>{const t=new URLSearchParams(Object.assign({},e)).toString();return this.makeRequest(E)({search:t})},search:this.makeRequest(O).bind(this),remove:this.makeRequest(S).bind(this),updateContent:this.makeRequest(j).bind(this),move:this.makeRequest(G).bind(this),rename:this.makeRequest(I).bind(this)}}get auth(){return{signUp:this.makeRequest($).bind(this),signIn:this.makeRequest(C).bind(this),verifySignIn:this.makeRequest(x).bind(this),verifyInvitation:this.makeRequest(D).bind(this),getAuthenticatedUser:this.makeRequest(A).bind(this),getAuthenticatedUserHistory:this.makeRequest(J).bind(this),getUser:this.makeRequest(L).bind(this),signOff:this.makeRequest(Q).bind(this)}}get jobs(){return s.of({resources:this.resources})}}export{t as JobStatus,e as Jobs,N as SDK};
|
package/build/types/Actions.d.ts
CHANGED
|
@@ -88,6 +88,8 @@ 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;
|
|
91
93
|
export declare const AuthSignUp: Action<{
|
|
92
94
|
email: string;
|
|
93
95
|
firstName: string;
|
package/build/types/sdk.d.ts
CHANGED
|
@@ -56,6 +56,9 @@ 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
|
+
};
|
|
59
62
|
get resources(): {
|
|
60
63
|
createDirectory: (_payload?: Required<{
|
|
61
64
|
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": "0.
|
|
4
|
+
"version": "1.0.1",
|
|
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": "^0.
|
|
24
|
+
"@ossy/types": "^1.0.1"
|
|
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": "e5276fdb5dedf68b966d851077461b188c613241"
|
|
40
40
|
}
|