@or-sdk/adapters 0.1.1-beta.736.0

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,32 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Adapters = void 0;
15
+ var event_manager_1 = require("@or-sdk/event-manager");
16
+ var Adapters = (function () {
17
+ function Adapters(params) {
18
+ var token = params.token, discoveryUrl = params.discoveryUrl, eventManagerUrl = params.eventManagerUrl, accountId = params.accountId;
19
+ this.eventManager = new event_manager_1.EventManager({
20
+ token: token,
21
+ discoveryUrl: discoveryUrl,
22
+ eventManagerUrl: eventManagerUrl,
23
+ });
24
+ this.adaptersUrl = accountId ? "/http/".concat(accountId) : '';
25
+ }
26
+ Adapters.prototype.makeRequest = function (params) {
27
+ return this.eventManager.makeRequest(__assign(__assign({}, params), { route: "".concat(this.adaptersUrl, "/").concat(params.route) }));
28
+ };
29
+ return Adapters;
30
+ }());
31
+ exports.Adapters = Adapters;
32
+ //# sourceMappingURL=Adapters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Adapters.js","sourceRoot":"","sources":["../../src/Adapters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,uDAAqD;AAUrD;IAWE,kBAAY,MAAsB;QACxB,IAAA,KAAK,GAA+C,MAAM,MAArD,EAAE,YAAY,GAAiC,MAAM,aAAvC,EAAE,eAAe,GAAgB,MAAM,gBAAtB,EAAE,SAAS,GAAK,MAAM,UAAX,CAAY;QAEnE,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAY,CAAC;YACnC,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,eAAe,iBAAA;SAChB,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,gBAAS,SAAS,CAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,CAAC;IAEM,8BAAW,GAAlB,UAAsB,MAAoB;QACxC,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,uBAC/B,MAAM,KACT,KAAK,EAAE,UAAG,IAAI,CAAC,WAAW,cAAI,MAAM,CAAC,KAAK,CAAE,IAC5C,CAAC;IACL,CAAC;IACH,eAAC;AAAD,CAAC,AA7BD,IA6BC;AA7BY,4BAAQ"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SERVICE_KEY = void 0;
4
+ exports.SERVICE_KEY = 'event-manager';
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,eAAe,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Adapters = void 0;
18
+ var Adapters_1 = require("./Adapters");
19
+ Object.defineProperty(exports, "Adapters", { enumerable: true, get: function () { return Adapters_1.Adapters; } });
20
+ __exportStar(require("./types"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,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 { EventManager } from '@or-sdk/event-manager';
2
+ export class Adapters {
3
+ constructor(params) {
4
+ const { token, discoveryUrl, eventManagerUrl, accountId } = params;
5
+ this.eventManager = new EventManager({
6
+ token,
7
+ discoveryUrl,
8
+ eventManagerUrl,
9
+ });
10
+ this.adaptersUrl = accountId ? `/http/${accountId}` : '';
11
+ }
12
+ makeRequest(params) {
13
+ return this.eventManager.makeRequest(Object.assign(Object.assign({}, params), { route: `${this.adaptersUrl}/${params.route}` }));
14
+ }
15
+ }
16
+ //# sourceMappingURL=Adapters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Adapters.js","sourceRoot":"","sources":["../../src/Adapters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAUrD,MAAM,OAAO,QAAQ;IAWnB,YAAY,MAAsB;QAChC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAEnE,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,CAAC;YACnC,KAAK;YACL,YAAY;YACZ,eAAe;SAChB,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,CAAC;IAEM,WAAW,CAAI,MAAoB;QACxC,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,iCAC/B,MAAM,KACT,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,KAAK,EAAE,IAC5C,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export const SERVICE_KEY = 'event-manager';
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,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Adapters } from './Adapters';
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,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,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,9 @@
1
+ import { CalApiParams } from '@or-sdk/base';
2
+ import { AdaptersConfig } from './types';
3
+ export declare class Adapters {
4
+ private readonly adaptersUrl;
5
+ private readonly eventManager;
6
+ constructor(params: AdaptersConfig);
7
+ makeRequest<T>(params: CalApiParams): Promise<T>;
8
+ }
9
+ //# sourceMappingURL=Adapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Adapters.d.ts","sourceRoot":"","sources":["../../src/Adapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AASzC,qBAAa,QAAQ;IAQnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;gBAEhC,MAAM,EAAE,cAAc;IAY3B,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC;CAMxD"}
@@ -0,0 +1,2 @@
1
+ export declare const SERVICE_KEY = "event-manager";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Adapters } from './Adapters';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Token } from '@or-sdk/base';
2
+ export declare type AdaptersConfig = {
3
+ token: Token;
4
+ discoveryUrl?: string;
5
+ eventManagerUrl: string;
6
+ accountId: string;
7
+ };
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,oBAAY,cAAc,GAAG;IAI3B,KAAK,EAAE,KAAK,CAAC;IAIb,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,eAAe,EAAE,MAAM,CAAC;IAExB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "version": "0.1.1-beta.736.0",
3
+ "name": "@or-sdk/adapters",
4
+ "main": "dist/cjs/index.js",
5
+ "module": "dist/esm/index.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "scripts": {
8
+ "build": "pnpm clean && pnpm build:esm && pnpm build:cjs",
9
+ "build:cjs": "tsc --project tsconfig.json",
10
+ "build:esm": "tsc --project tsconfig.esm.json",
11
+ "build:types": "tsc --project tsconfig.types.json",
12
+ "build:watch": "concurrently -r --hide 1,2 \"pnpm build:watch:cjs\" \"pnpm build:watch:esm\" \"pnpm build:watch:types\"",
13
+ "build:watch:cjs": "tsc --project tsconfig.json -w",
14
+ "build:watch:esm": "tsc --project tsconfig.esm.json -w",
15
+ "build:watch:types": "tsc --project tsconfig.types.json -w",
16
+ "clean": "rm -rf ./dist",
17
+ "dev": "pnpm build:watch:esm"
18
+ },
19
+ "devDependencies": {
20
+ "concurrently": "^6.4.0",
21
+ "typescript": "^4.4.4"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@or-sdk/base": "^0.26.8",
28
+ "@or-sdk/event-manager": "^0.24.6"
29
+ }
30
+ }
@@ -0,0 +1,41 @@
1
+ import { CalApiParams } from '@or-sdk/base';
2
+ import { EventManager } from '@or-sdk/event-manager';
3
+ import { AdaptersConfig } from './types';
4
+
5
+ /**
6
+ * OneReach Adapters service client
7
+ * ## Installation:
8
+ * ```
9
+ * $ npm i @or-sdk/adapters
10
+ * ```
11
+ */
12
+ export class Adapters {
13
+ /**
14
+ * ```typescript
15
+ * import { Adapters } from '@or-sdk/adapters'
16
+ * const adapters = new Adapters({token: 'my-account-token-string', discoveryUrl: 'http://example.tables/endpoint'});
17
+ * ```
18
+ */
19
+
20
+ private readonly adaptersUrl: string;
21
+ private readonly eventManager: EventManager;
22
+
23
+ constructor(params: AdaptersConfig) {
24
+ const { token, discoveryUrl, eventManagerUrl, accountId } = params;
25
+
26
+ this.eventManager = new EventManager({
27
+ token,
28
+ discoveryUrl,
29
+ eventManagerUrl,
30
+ });
31
+
32
+ this.adaptersUrl = accountId ? `/http/${accountId}` : '';
33
+ }
34
+
35
+ public makeRequest<T>(params: CalApiParams): Promise<T> {
36
+ return this.eventManager.makeRequest({
37
+ ...params,
38
+ route: `${this.adaptersUrl}/${params.route}`,
39
+ });
40
+ }
41
+ }
@@ -0,0 +1,2 @@
1
+ export const SERVICE_KEY = 'event-manager';
2
+
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { Adapters } from './Adapters';
2
+ export * from './types';
package/src/types.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { Token } from '@or-sdk/base';
2
+
3
+ export type AdaptersConfig = {
4
+ /**
5
+ * token
6
+ */
7
+ token: Token;
8
+ /**
9
+ * Url of OneReach service discovery api
10
+ */
11
+ discoveryUrl?: string;
12
+ /**
13
+ * Url of OneReach Event Manager api
14
+ */
15
+ eventManagerUrl: string;
16
+
17
+ accountId: string;
18
+ };
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.esm.json",
3
+ "compilerOptions": {
4
+ "declarationDir": "./dist/types",
5
+ "rootDir": "./src",
6
+ "declaration": true
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/esm",
5
+ "declarationDir": "./dist/types",
6
+ "module": "ES6",
7
+ "target": "es6",
8
+ "rootDir": "./src",
9
+ "declaration": true,
10
+ "declarationMap": true
11
+ }
12
+ }
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,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/types/",
5
+ "rootDir": "./src",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "emitDeclarationOnly": true
9
+ }
10
+ }