@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.
@@ -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,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SERVICE_KEY = void 0;
4
+ exports.SERVICE_KEY = 'sdk-api';
5
+ //# sourceMappingURL=constants.js.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -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,2 @@
1
+ export const SERVICE_KEY = 'sdk-api';
2
+ //# sourceMappingURL=constants.js.map
@@ -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,3 @@
1
+ export { SdkApi } from './SdkApi';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.js.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { Base, CalApiParams } from '@or-sdk/base';
2
+ import { SdkApiConfig } from './types';
3
+ export declare class SdkApi extends Base {
4
+ constructor(params: SdkApiConfig);
5
+ makeRequest<T>(params: CalApiParams): Promise<T>;
6
+ }
@@ -0,0 +1 @@
1
+ export declare const SERVICE_KEY = "sdk-api";
@@ -0,0 +1,2 @@
1
+ export { SdkApi } from './SdkApi';
2
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ import { Token } from '@or-sdk/base';
2
+ export declare type SdkApiConfig = {
3
+ token: Token;
4
+ discoveryUrl: string;
5
+ };
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
+ }
@@ -0,0 +1 @@
1
+ export const SERVICE_KEY = 'sdk-api';
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { SdkApi } from './SdkApi';
2
+ export * from './types';
package/src/types.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { Token } from '@or-sdk/base';
2
+
3
+ export type SdkApiConfig = {
4
+ /**
5
+ * token
6
+ */
7
+ token: Token;
8
+ /**
9
+ * function which return token
10
+ */
11
+ discoveryUrl: string;
12
+ };
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "ES6",
5
+ "target": "es6",
6
+ "outDir": "./dist/esm/",
7
+ "rootDir": "./src"
8
+ }
9
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/cjs/",
5
+ "rootDir": "./src"
6
+ }
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/types/",
5
+ "rootDir": "./src",
6
+ "declaration": true,
7
+ "emitDeclarationOnly": true
8
+ }
9
+ }