@or-sdk/content-request 0.1.0-beta.819.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.
- package/CHANGELOG.md +0 -0
- package/README.md +0 -0
- package/dist/cjs/ContentRequest.js +73 -0
- package/dist/cjs/ContentRequest.js.map +1 -0
- package/dist/cjs/index.js +21 -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/ContentRequest.js +35 -0
- package/dist/esm/ContentRequest.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/ContentRequest.d.ts +7 -0
- package/dist/types/ContentRequest.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types.d.ts +13 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +30 -0
- package/src/ContentRequest.ts +34 -0
- package/src/index.ts +2 -0
- package/src/types.ts +27 -0
- package/tsconfig.dev.json +8 -0
- package/tsconfig.esm.json +12 -0
- package/tsconfig.json +7 -0
- package/tsconfig.types.json +10 -0
package/CHANGELOG.md
ADDED
|
File without changes
|
package/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ContentRequest = void 0;
|
|
40
|
+
var providers_1 = require("@or-sdk/providers");
|
|
41
|
+
var ContentRequest = (function () {
|
|
42
|
+
function ContentRequest(params) {
|
|
43
|
+
var token = params.token, eventManagerUrl = params.eventManagerUrl, discoveryUrl = params.discoveryUrl, providersAccountId = params.providersAccountId;
|
|
44
|
+
this.providers = new providers_1.Providers({
|
|
45
|
+
token: token,
|
|
46
|
+
eventManagerUrl: eventManagerUrl,
|
|
47
|
+
discoveryUrl: discoveryUrl,
|
|
48
|
+
providersAccountId: providersAccountId,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
ContentRequest.prototype.postContentRequest = function (_a) {
|
|
52
|
+
var type = _a.type, usecase = _a.usecase, description = _a.description;
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
return __generator(this, function (_b) {
|
|
55
|
+
switch (_b.label) {
|
|
56
|
+
case 0: return [4, this.providers.makeRequest({
|
|
57
|
+
method: 'POST',
|
|
58
|
+
route: '/request-library-content',
|
|
59
|
+
data: {
|
|
60
|
+
type: type,
|
|
61
|
+
usecase: usecase,
|
|
62
|
+
description: description,
|
|
63
|
+
},
|
|
64
|
+
})];
|
|
65
|
+
case 1: return [2, _b.sent()];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
return ContentRequest;
|
|
71
|
+
}());
|
|
72
|
+
exports.ContentRequest = ContentRequest;
|
|
73
|
+
//# sourceMappingURL=ContentRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentRequest.js","sourceRoot":"","sources":["../../src/ContentRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8C;AAG9C;IAGE,wBAAY,MAA4B;QAEpC,IAAA,KAAK,GAIH,MAAM,MAJH,EACL,eAAe,GAGb,MAAM,gBAHO,EACf,YAAY,GAEV,MAAM,aAFI,EACZ,kBAAkB,GAChB,MAAM,mBADU,CACT;QAEX,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAS,CAAC;YAC7B,KAAK,OAAA;YACL,eAAe,iBAAA;YACf,YAAY,cAAA;YACZ,kBAAkB,oBAAA;SACnB,CAAC,CAAC;IACL,CAAC;IAEY,2CAAkB,GAA/B,UAAgC,EAAqD;YAAnD,IAAI,UAAA,EAAE,OAAO,aAAA,EAAE,WAAW,iBAAA;;;;4BACnD,WAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;4BACtC,MAAM,EAAE,MAAM;4BACd,KAAK,EAAE,0BAA0B;4BACjC,IAAI,EAAE;gCACJ,IAAI,MAAA;gCACJ,OAAO,SAAA;gCACP,WAAW,aAAA;6BACZ;yBACF,CAAC,EAAA;4BARF,WAAO,SAQL,EAAC;;;;KACJ;IACH,qBAAC;AAAD,CAAC,AA9BD,IA8BC;AA9BY,wCAAc"}
|
|
@@ -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.ContentRequest = void 0;
|
|
18
|
+
var ContentRequest_1 = require("./ContentRequest");
|
|
19
|
+
Object.defineProperty(exports, "ContentRequest", { enumerable: true, get: function () { return ContentRequest_1.ContentRequest; } });
|
|
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,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Providers } from '@or-sdk/providers';
|
|
11
|
+
export class ContentRequest {
|
|
12
|
+
constructor(params) {
|
|
13
|
+
const { token, eventManagerUrl, discoveryUrl, providersAccountId, } = params;
|
|
14
|
+
this.providers = new Providers({
|
|
15
|
+
token,
|
|
16
|
+
eventManagerUrl,
|
|
17
|
+
discoveryUrl,
|
|
18
|
+
providersAccountId,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
postContentRequest({ type, usecase, description }) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return yield this.providers.makeRequest({
|
|
24
|
+
method: 'POST',
|
|
25
|
+
route: '/request-library-content',
|
|
26
|
+
data: {
|
|
27
|
+
type,
|
|
28
|
+
usecase,
|
|
29
|
+
description,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=ContentRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentRequest.js","sourceRoot":"","sources":["../../src/ContentRequest.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,MAAM,OAAO,cAAc;IAGzB,YAAY,MAA4B;QACtC,MAAM,EACJ,KAAK,EACL,eAAe,EACf,YAAY,EACZ,kBAAkB,GACnB,GAAG,MAAM,CAAC;QAEX,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC;YAC7B,KAAK;YACL,eAAe;YACf,YAAY;YACZ,kBAAkB;SACnB,CAAC,CAAC;IACL,CAAC;IAEY,kBAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAyB;;YACnF,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,0BAA0B;gBACjC,IAAI,EAAE;oBACJ,IAAI;oBACJ,OAAO;oBACP,WAAW;iBACZ;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ContentRequestConfig, ContentRequestPayload } from './types';
|
|
2
|
+
export declare class ContentRequest {
|
|
3
|
+
private readonly providers;
|
|
4
|
+
constructor(params: ContentRequestConfig);
|
|
5
|
+
postContentRequest({ type, usecase, description }: ContentRequestPayload): Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=ContentRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentRequest.d.ts","sourceRoot":"","sources":["../../src/ContentRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEtE,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,MAAM,EAAE,oBAAoB;IAgB3B,kBAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,qBAAqB;CAWtF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Token } from '@or-sdk/base';
|
|
2
|
+
export type ContentRequestConfig = {
|
|
3
|
+
token: Token;
|
|
4
|
+
eventManagerUrl?: string;
|
|
5
|
+
providersAccountId?: string;
|
|
6
|
+
discoveryUrl?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ContentRequestPayload = {
|
|
9
|
+
type: string;
|
|
10
|
+
usecase: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
//# 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,MAAM,MAAM,oBAAoB,GAAG;IAIjC,KAAK,EAAE,KAAK,CAAC;IAKb,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAK5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@or-sdk/content-request",
|
|
3
|
+
"version": "0.1.0-beta.819.0",
|
|
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
|
+
"dependencies": {
|
|
20
|
+
"@or-sdk/base": "^0.27.0",
|
|
21
|
+
"@or-sdk/providers": "^0.2.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"concurrently": "^6.4.0",
|
|
25
|
+
"typescript": "^4.4.4"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Providers } from '@or-sdk/providers';
|
|
2
|
+
import { ContentRequestConfig, ContentRequestPayload } from './types';
|
|
3
|
+
|
|
4
|
+
export class ContentRequest {
|
|
5
|
+
private readonly providers: Providers;
|
|
6
|
+
|
|
7
|
+
constructor(params: ContentRequestConfig) {
|
|
8
|
+
const {
|
|
9
|
+
token,
|
|
10
|
+
eventManagerUrl,
|
|
11
|
+
discoveryUrl,
|
|
12
|
+
providersAccountId,
|
|
13
|
+
} = params;
|
|
14
|
+
|
|
15
|
+
this.providers = new Providers({
|
|
16
|
+
token,
|
|
17
|
+
eventManagerUrl,
|
|
18
|
+
discoveryUrl,
|
|
19
|
+
providersAccountId,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async postContentRequest({ type, usecase, description }: ContentRequestPayload) {
|
|
24
|
+
return await this.providers.makeRequest({
|
|
25
|
+
method: 'POST',
|
|
26
|
+
route: '/request-library-content',
|
|
27
|
+
data: {
|
|
28
|
+
type,
|
|
29
|
+
usecase,
|
|
30
|
+
description,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/index.ts
ADDED
package/src/types.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Token } from '@or-sdk/base';
|
|
2
|
+
|
|
3
|
+
export type ContentRequestConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* token
|
|
6
|
+
*/
|
|
7
|
+
token: Token;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Url of OneReach Event Manager api
|
|
11
|
+
*/
|
|
12
|
+
eventManagerUrl?: string;
|
|
13
|
+
|
|
14
|
+
providersAccountId?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Url of OneReach service discovery api
|
|
18
|
+
*/
|
|
19
|
+
discoveryUrl?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type ContentRequestPayload = {
|
|
23
|
+
type: string;
|
|
24
|
+
usecase: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
|
package/tsconfig.json
ADDED