@or-sdk/sdk-api 0.9.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/dist/cjs/SdkApi.js +39 -0
- package/dist/cjs/SdkApi.js.map +1 -0
- package/dist/cjs/constants.js +5 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/SdkApi.js +16 -0
- package/dist/esm/SdkApi.js.map +1 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/types/SdkApi.d.ts +6 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/types.d.ts +5 -0
- package/package.json +29 -0
- package/src/SdkApi.ts +32 -0
- package/src/constants.ts +1 -0
- package/src/index.ts +2 -0
- package/src/types.ts +12 -0
- package/tsconfig.esm.json +9 -0
- package/tsconfig.json +7 -0
- package/tsconfig.types.json +9 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SdkApi = void 0;
|
|
19
|
+
var base_1 = require("@or-sdk/base");
|
|
20
|
+
var constants_1 = require("./constants");
|
|
21
|
+
var SdkApi = (function (_super) {
|
|
22
|
+
__extends(SdkApi, _super);
|
|
23
|
+
function SdkApi(params) {
|
|
24
|
+
var _this = this;
|
|
25
|
+
var token = params.token, discoveryUrl = params.discoveryUrl;
|
|
26
|
+
_this = _super.call(this, {
|
|
27
|
+
token: token,
|
|
28
|
+
discoveryUrl: discoveryUrl,
|
|
29
|
+
serviceKey: constants_1.SERVICE_KEY,
|
|
30
|
+
}) || this;
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
SdkApi.prototype.makeRequest = function (params) {
|
|
34
|
+
return this.callApi(params);
|
|
35
|
+
};
|
|
36
|
+
return SdkApi;
|
|
37
|
+
}(base_1.Base));
|
|
38
|
+
exports.SdkApi = SdkApi;
|
|
39
|
+
//# sourceMappingURL=SdkApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SdkApi.js","sourceRoot":"","sources":["../../src/SdkApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qCAAkD;AAElD,yCAA0C;AAS1C;IAA4B,0BAAI;IAO9B,gBAAY,MAAoB;QAAhC,iBAQC;QAPS,IAAA,KAAK,GAAmB,MAAM,MAAzB,EAAE,YAAY,GAAK,MAAM,aAAX,CAAY;QAEvC,QAAA,kBAAM;YACJ,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,UAAU,EAAE,uBAAW;SACxB,CAAC,SAAC;;IACL,CAAC;IAEM,4BAAW,GAAlB,UAAsB,MAAoB;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IACH,aAAC;AAAD,CAAC,AApBD,CAA4B,WAAI,GAoB/B;AApBY,wBAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.SdkApi = void 0;
|
|
14
|
+
var SdkApi_1 = require("./SdkApi");
|
|
15
|
+
Object.defineProperty(exports, "SdkApi", { enumerable: true, get: function () { return SdkApi_1.SdkApi; } });
|
|
16
|
+
__exportStar(require("./types"), exports);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Base } from '@or-sdk/base';
|
|
2
|
+
import { SERVICE_KEY } from './constants';
|
|
3
|
+
export class SdkApi extends Base {
|
|
4
|
+
constructor(params) {
|
|
5
|
+
const { token, discoveryUrl } = params;
|
|
6
|
+
super({
|
|
7
|
+
token,
|
|
8
|
+
discoveryUrl,
|
|
9
|
+
serviceKey: SERVICE_KEY,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
makeRequest(params) {
|
|
13
|
+
return this.callApi(params);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=SdkApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SdkApi.js","sourceRoot":"","sources":["../../src/SdkApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1C,MAAM,OAAO,MAAO,SAAQ,IAAI;IAO9B,YAAY,MAAoB;QAC9B,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;QAEvC,KAAK,CAAC;YACJ,KAAK;YACL,YAAY;YACZ,UAAU,EAAE,WAAW;SACxB,CAAC,CAAC;IACL,CAAC;IAEM,WAAW,CAAI,MAAoB;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SERVICE_KEY = "sdk-api";
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.9.1",
|
|
3
|
+
"name": "@or-sdk/sdk-api",
|
|
4
|
+
"main": "dist/cjs/index.js",
|
|
5
|
+
"module": "dist/esm/index.js",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "npm run clean && concurrently \"npm run build:cjs\" \"npm run build:esm\" \"npm run build:types\"",
|
|
9
|
+
"build:watch": "concurrently -r --hide 1,2 \"npm run build:watch:cjs\" \"npm run build:watch:esm\" \"npm run build:watch:types\"",
|
|
10
|
+
"build:cjs": "tsc --project tsconfig.json",
|
|
11
|
+
"build:watch:cjs": "tsc --project tsconfig.json -w",
|
|
12
|
+
"build:esm": "tsc --project tsconfig.esm.json",
|
|
13
|
+
"build:watch:esm": "tsc --project tsconfig.esm.json -w",
|
|
14
|
+
"build:types": "tsc --project tsconfig.types.json",
|
|
15
|
+
"build:watch:types": "tsc --project tsconfig.types.json -w",
|
|
16
|
+
"clean": "rm -rf ./dist"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"concurrently": "^6.4.0",
|
|
20
|
+
"typescript": "^4.4.4"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@or-sdk/base": "^0.9.1"
|
|
27
|
+
},
|
|
28
|
+
"gitHead": "19c2221d6f95694979b32f51d729771a558ef189"
|
|
29
|
+
}
|
package/src/SdkApi.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Base, CalApiParams } from '@or-sdk/base';
|
|
2
|
+
import { SdkApiConfig } from './types';
|
|
3
|
+
import { SERVICE_KEY } from './constants';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* OneReach SdkApi service client
|
|
7
|
+
* ## Installation:
|
|
8
|
+
* ```
|
|
9
|
+
* $ npm i @or-sdk/sdk-api
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export class SdkApi extends Base {
|
|
13
|
+
/**
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { SdkApi } from '@or-sdk/sdk-api'
|
|
16
|
+
* const sdkApi = new SdkApi({token: 'my-account-token-string', discoveryUrl: 'http://example.tables/endpoint'});
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
constructor(params: SdkApiConfig) {
|
|
20
|
+
const { token, discoveryUrl } = params;
|
|
21
|
+
|
|
22
|
+
super({
|
|
23
|
+
token,
|
|
24
|
+
discoveryUrl,
|
|
25
|
+
serviceKey: SERVICE_KEY,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public makeRequest<T>(params: CalApiParams): Promise<T> {
|
|
30
|
+
return this.callApi(params);
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SERVICE_KEY = 'sdk-api';
|
package/src/index.ts
ADDED
package/src/types.ts
ADDED
package/tsconfig.json
ADDED