@osaas/client-core
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -13,2 +13,3 @@ export type ContextConfig = { | ||
apiUrl: string; | ||
serviceType: 'instance' | 'job'; | ||
}; | ||
@@ -15,0 +16,0 @@ export type Subscriptions = { |
@@ -1,2 +0,3 @@ | ||
import { Context } from './context'; | ||
import { Context, Service } from './context'; | ||
export declare function getService(context: Context, serviceId: string): Promise<Service>; | ||
export declare function createInstance(context: Context, serviceId: string, token: string, body: any): Promise<any>; | ||
@@ -3,0 +4,0 @@ export declare function removeInstance(context: Context, serviceId: string, name: string, token: string): Promise<void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.listInstances = exports.getInstance = exports.removeInstance = exports.createInstance = void 0; | ||
exports.listInstances = exports.getInstance = exports.removeInstance = exports.createInstance = exports.getService = void 0; | ||
const fetch_1 = require("./fetch"); | ||
const log_1 = require("./log"); | ||
async function getService(context, serviceId) { | ||
@@ -20,2 +21,3 @@ const serviceUrl = new URL(`https://catalog.svc.${context.getEnvironment()}.osaas.io/mysubscriptions`); | ||
} | ||
exports.getService = getService; | ||
async function createInstance(context, serviceId, token, body) { | ||
@@ -50,9 +52,16 @@ const service = await getService(context, serviceId); | ||
const instanceUrl = new URL(service.apiUrl + '/' + name); | ||
return await (0, fetch_1.createFetch)(instanceUrl, { | ||
method: 'GET', | ||
headers: { | ||
'x-jwt': `Bearer ${token}`, | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
try { | ||
const instance = await (0, fetch_1.createFetch)(instanceUrl, { | ||
method: 'GET', | ||
headers: { | ||
'x-jwt': `Bearer ${token}`, | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
return instance; | ||
} | ||
catch (err) { | ||
(0, log_1.Log)().debug(err); | ||
} | ||
return undefined; | ||
} | ||
@@ -59,0 +68,0 @@ exports.getInstance = getInstance; |
@@ -5,2 +5,3 @@ export { Log } from './log'; | ||
export { createInstance, removeInstance, getInstance, listInstances } from './core'; | ||
export { createJob, removeJob, getJob, listJobs, waitForJobToComplete } from './job'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.listInstances = exports.getInstance = exports.removeInstance = exports.createInstance = exports.Context = exports.createFetch = exports.Log = void 0; | ||
exports.waitForJobToComplete = exports.listJobs = exports.getJob = exports.removeJob = exports.createJob = exports.listInstances = exports.getInstance = exports.removeInstance = exports.createInstance = exports.Context = exports.createFetch = exports.Log = void 0; | ||
var log_1 = require("./log"); | ||
@@ -15,2 +15,8 @@ Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return log_1.Log; } }); | ||
Object.defineProperty(exports, "listInstances", { enumerable: true, get: function () { return core_1.listInstances; } }); | ||
var job_1 = require("./job"); | ||
Object.defineProperty(exports, "createJob", { enumerable: true, get: function () { return job_1.createJob; } }); | ||
Object.defineProperty(exports, "removeJob", { enumerable: true, get: function () { return job_1.removeJob; } }); | ||
Object.defineProperty(exports, "getJob", { enumerable: true, get: function () { return job_1.getJob; } }); | ||
Object.defineProperty(exports, "listJobs", { enumerable: true, get: function () { return job_1.listJobs; } }); | ||
Object.defineProperty(exports, "waitForJobToComplete", { enumerable: true, get: function () { return job_1.waitForJobToComplete; } }); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@osaas/client-core", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Open Source Cloud Client SDK core library", | ||
@@ -28,2 +28,3 @@ "author": "Eyevinn Technology <work@eyevinn.se>", | ||
"dependencies": { | ||
"@osaas/client-core": "^0.4.0", | ||
"chalk": "4.1.2" | ||
@@ -34,3 +35,3 @@ }, | ||
}, | ||
"gitHead": "71d6b915ca0ff5bfdcc1a0886ed7c9f816343fa1" | ||
"gitHead": "d6ac76ccd8ee1463c3484a67757271131b3ac5f2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
33577
27
420
2
+ Added@osaas/client-core@^0.4.0
+ Added@osaas/client-core@0.4.0(transitive)