@code.store/arcxp-sdk-ts 2.0.1 → 2.0.2
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/api/abstract-api.d.ts +19 -0
- package/dist/api/abstract-api.js +33 -0
- package/dist/api/abstract-api.js.map +1 -0
- package/dist/api/author/index.d.ts +5 -0
- package/dist/api/author/index.js +15 -0
- package/dist/api/author/index.js.map +1 -0
- package/dist/api/author/types.js +2 -0
- package/dist/api/author/types.js.map +1 -0
- package/dist/api/draft/index.d.ts +5 -0
- package/dist/api/draft/index.js +15 -0
- package/dist/api/draft/index.js.map +1 -0
- package/dist/api/draft/types.js +3 -0
- package/dist/api/draft/types.js.map +1 -0
- package/dist/api/error.d.ts +10 -0
- package/dist/api/error.js +24 -0
- package/dist/api/error.js.map +1 -0
- package/dist/api/identity/index.d.ts +6 -0
- package/dist/api/identity/index.js +15 -0
- package/dist/api/identity/index.js.map +1 -0
- package/dist/api/identity/types.d.ts +58 -0
- package/dist/api/identity/types.js +3 -0
- package/dist/api/identity/types.js.map +1 -0
- package/dist/api/ifx/index.d.ts +18 -0
- package/dist/api/ifx/index.js +56 -0
- package/dist/api/ifx/index.js.map +1 -0
- package/dist/api/ifx/types.d.ts +24 -0
- package/dist/api/ifx/types.js +3 -0
- package/dist/api/ifx/types.js.map +1 -0
- package/dist/api/index.d.ts +22 -0
- package/dist/api/index.js +42 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/migration-center/index.d.ts +10 -0
- package/dist/api/migration-center/index.js +34 -0
- package/dist/api/migration-center/index.js.map +1 -0
- package/dist/api/migration-center/types.d.ts +166 -0
- package/dist/api/migration-center/types.js +40 -0
- package/dist/api/migration-center/types.js.map +1 -0
- package/dist/api/sales/index.d.ts +6 -0
- package/dist/api/sales/index.js +25 -0
- package/dist/api/sales/index.js.map +1 -0
- package/dist/api/sales/types.d.ts +68 -0
- package/dist/api/sales/types.js +3 -0
- package/dist/api/sales/types.js.map +1 -0
- package/dist/api/site/index.d.ts +7 -0
- package/dist/api/site/index.js +19 -0
- package/dist/api/site/index.js.map +1 -0
- package/dist/api/site/types.js +3 -0
- package/dist/api/site/types.js.map +1 -0
- package/dist/api/websked/index.d.ts +6 -0
- package/dist/api/websked/index.js +15 -0
- package/dist/api/websked/index.js.map +1 -0
- package/dist/api/websked/types.d.ts +7 -0
- package/dist/api/websked/types.js +3 -0
- package/dist/api/websked/types.js.map +1 -0
- package/dist/api/ws.client.d.ts +17 -0
- package/dist/api/ws.client.js +67 -0
- package/dist/api/ws.client.js.map +1 -0
- package/dist/content-elements/index.d.ts +137 -0
- package/dist/content-elements/index.js +112 -0
- package/dist/content-elements/index.js.map +1 -0
- package/{src/index.ts → dist/index.d.ts} +0 -2
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/tests/api/basic.test.d.ts +1 -0
- package/dist/tests/api/basic.test.js +15 -0
- package/dist/tests/api/basic.test.js.map +1 -0
- package/dist/types/author.d.ts +1511 -0
- package/dist/types/author.js +9 -0
- package/dist/types/author.js.map +1 -0
- package/dist/types/index.js +30 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/section.d.ts +80 -0
- package/dist/types/section.js +3 -0
- package/dist/types/section.js.map +1 -0
- package/dist/types/story.d.ts +1865 -0
- package/dist/types/story.js +9 -0
- package/dist/types/story.js.map +1 -0
- package/dist/utils/cache.d.ts +21 -0
- package/dist/utils/cache.js +63 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/decorator.d.ts +2 -0
- package/dist/utils/decorator.js +21 -0
- package/dist/utils/decorator.js.map +1 -0
- package/dist/utils/duration.d.ts +7 -0
- package/dist/utils/duration.js +21 -0
- package/dist/utils/duration.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +52 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +6 -2
- package/.eslintrc.js +0 -26
- package/.github/workflows/build-test-lint.yml +0 -41
- package/.prettierrc +0 -7
- package/src/api/abstract-api.ts +0 -42
- package/src/api/author/index.ts +0 -13
- package/src/api/draft/index.ts +0 -12
- package/src/api/error.ts +0 -30
- package/src/api/identity/index.ts +0 -14
- package/src/api/identity/types.ts +0 -61
- package/src/api/ifx/index.ts +0 -64
- package/src/api/ifx/types.ts +0 -27
- package/src/api/index.ts +0 -37
- package/src/api/migration-center/index.ts +0 -47
- package/src/api/migration-center/types.ts +0 -173
- package/src/api/sales/index.ts +0 -22
- package/src/api/sales/types.ts +0 -73
- package/src/api/site/index.ts +0 -20
- package/src/api/websked/index.ts +0 -13
- package/src/api/websked/types.ts +0 -7
- package/src/api/ws.client.ts +0 -73
- package/src/content-elements/index.ts +0 -113
- package/src/tests/api/basic.test.ts +0 -15
- package/src/types/author.ts +0 -1537
- package/src/types/section.ts +0 -55
- package/src/types/story.ts +0 -1905
- package/src/utils/cache.ts +0 -63
- package/src/utils/decorator.ts +0 -20
- package/src/utils/duration.ts +0 -17
- package/src/utils/index.ts +0 -51
- package/tsconfig.json +0 -72
- package/vite.config.ts +0 -10
- /package/{src/api/author/types.ts → dist/api/author/types.d.ts} +0 -0
- /package/{src/api/draft/types.ts → dist/api/draft/types.d.ts} +0 -0
- /package/{src/api/site/types.ts → dist/api/site/types.d.ts} +0 -0
- /package/{src/types/index.ts → dist/types/index.d.ts} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RateLimitedAxiosInstance } from 'axios-rate-limit';
|
|
2
|
+
export type ArcAbstractAPIOptions = {
|
|
3
|
+
credentials: {
|
|
4
|
+
organizationName: string;
|
|
5
|
+
accessToken: string;
|
|
6
|
+
};
|
|
7
|
+
apiPath: string;
|
|
8
|
+
maxRPS?: number;
|
|
9
|
+
};
|
|
10
|
+
export type ArcAPIOptions = Omit<ArcAbstractAPIOptions, 'apiPath'>;
|
|
11
|
+
export declare abstract class ArcAbstractAPI {
|
|
12
|
+
protected name: string;
|
|
13
|
+
protected client: RateLimitedAxiosInstance;
|
|
14
|
+
private token;
|
|
15
|
+
private host;
|
|
16
|
+
private headers;
|
|
17
|
+
constructor(options: ArcAbstractAPIOptions);
|
|
18
|
+
setMaxRPS(rps: number): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ArcAbstractAPI = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const axios_rate_limit_1 = __importDefault(require("axios-rate-limit"));
|
|
10
|
+
const error_1 = require("./error");
|
|
11
|
+
class ArcAbstractAPI {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.name = this.constructor.name;
|
|
14
|
+
this.token = '';
|
|
15
|
+
this.host = '';
|
|
16
|
+
this.headers = {
|
|
17
|
+
Authorization: '',
|
|
18
|
+
};
|
|
19
|
+
this.host = `api.${options.credentials.organizationName}.arcpublishing.com`;
|
|
20
|
+
this.token = `Bearer ${options.credentials.accessToken}`;
|
|
21
|
+
this.headers.Authorization = this.token;
|
|
22
|
+
this.client = (0, axios_rate_limit_1.default)(axios_1.default.create({
|
|
23
|
+
baseURL: `https://${this.host}/${options.apiPath}`,
|
|
24
|
+
headers: this.headers,
|
|
25
|
+
}), { maxRPS: options.maxRPS || 10 });
|
|
26
|
+
this.client.interceptors.response.use(...(0, utils_1.AxiosResponseErrorInterceptor)((e) => new error_1.ArcError(this.name, e)));
|
|
27
|
+
}
|
|
28
|
+
setMaxRPS(rps) {
|
|
29
|
+
this.client.setMaxRPS(rps);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ArcAbstractAPI = ArcAbstractAPI;
|
|
33
|
+
//# sourceMappingURL=abstract-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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ty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArcAuthor = void 0;
|
|
4
|
+
const abstract_api_1 = require("../abstract-api");
|
|
5
|
+
class ArcAuthor extends abstract_api_1.ArcAbstractAPI {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super({ ...options, apiPath: 'author' });
|
|
8
|
+
}
|
|
9
|
+
async delete(userId) {
|
|
10
|
+
const { data } = await this.client.delete(`/v2/author-service/${userId}`);
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ArcAuthor = ArcAuthor;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/author/index.ts"],"names":[],"mappings":";;;AAAA,kDAAgE;AAEhE,MAAa,SAAU,SAAQ,6BAAc;IAC3C,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc;QACzB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,MAAM,EAAE,CAAC,CAAC;QAE1E,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAVD,8BAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/author/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArcDraft = void 0;
|
|
4
|
+
const abstract_api_1 = require("../abstract-api");
|
|
5
|
+
class ArcDraft extends abstract_api_1.ArcAbstractAPI {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super({ ...options, apiPath: 'draft/v1' });
|
|
8
|
+
}
|
|
9
|
+
async generateId(id) {
|
|
10
|
+
const { data } = await this.client.get('/arcuuid', { params: { id } });
|
|
11
|
+
return data.id;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ArcDraft = ArcDraft;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/draft/index.ts"],"names":[],"mappings":";;;AAAA,kDAAgE;AAEhE,MAAa,QAAS,SAAQ,6BAAc;IAC1C,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAiB,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;CACF;AATD,4BASC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/draft/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AxiosError, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
export declare class ArcError extends Error {
|
|
3
|
+
responseData: unknown;
|
|
4
|
+
responseStatus?: number;
|
|
5
|
+
responseConfig?: InternalAxiosRequestConfig<any>;
|
|
6
|
+
ratelimitRemaining?: string;
|
|
7
|
+
ratelimitReset?: string;
|
|
8
|
+
service?: string;
|
|
9
|
+
constructor(service: string, e: AxiosError);
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArcError = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
class ArcError extends Error {
|
|
6
|
+
constructor(service, e) {
|
|
7
|
+
const ratelimitRemaining = e.response?.headers['arcpub-ratelimit-remaining'];
|
|
8
|
+
const ratelimitReset = e.response?.headers['arcpub-ratelimit-reset'];
|
|
9
|
+
const data = {
|
|
10
|
+
name: `${service}Error`,
|
|
11
|
+
responseData: e.response?.data,
|
|
12
|
+
responseStatus: e.response?.status,
|
|
13
|
+
responseConfig: e.response?.config,
|
|
14
|
+
ratelimitRemaining,
|
|
15
|
+
ratelimitReset,
|
|
16
|
+
service,
|
|
17
|
+
};
|
|
18
|
+
const message = (0, utils_1.safeJSONStringify)(data);
|
|
19
|
+
super(message);
|
|
20
|
+
Object.assign(this, data);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ArcError = ArcError;
|
|
24
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/api/error.ts"],"names":[],"mappings":";;;AACA,oCAA6C;AAE7C,MAAa,QAAS,SAAQ,KAAK;IAQjC,YAAY,OAAe,EAAE,CAAa;QACxC,MAAM,kBAAkB,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAC7E,MAAM,cAAc,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG;YACX,IAAI,EAAE,GAAG,OAAO,OAAO;YACvB,YAAY,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI;YAC9B,cAAc,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM;YAClC,cAAc,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM;YAClC,kBAAkB;YAClB,cAAc;YACd,OAAO;SACR,CAAC;QACF,MAAM,OAAO,GAAG,IAAA,yBAAiB,EAAC,IAAI,CAAC,CAAC;QAExC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF;AA1BD,4BA0BC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ArcAbstractAPI, ArcAPIOptions } from '../abstract-api';
|
|
2
|
+
import { MigrateBatchUsersPayload, MigrateBatchUsersResponse } from './types';
|
|
3
|
+
export declare class ArcIdentity extends ArcAbstractAPI {
|
|
4
|
+
constructor(options: ArcAPIOptions);
|
|
5
|
+
migrateBatch(payload: MigrateBatchUsersPayload): Promise<MigrateBatchUsersResponse>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArcIdentity = void 0;
|
|
4
|
+
const abstract_api_1 = require("../abstract-api");
|
|
5
|
+
class ArcIdentity extends abstract_api_1.ArcAbstractAPI {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super({ ...options, apiPath: 'identity/api/v1' });
|
|
8
|
+
}
|
|
9
|
+
async migrateBatch(payload) {
|
|
10
|
+
const { data } = await this.client.post('/migrate', payload);
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ArcIdentity = ArcIdentity;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/identity/index.ts"],"names":[],"mappings":";;;AAAA,kDAAgE;AAGhE,MAAa,WAAY,SAAQ,6BAAc;IAC7C,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAiC;QAClD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAA4B,UAAU,EAAE,OAAO,CAAC,CAAC;QAExF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAVD,kCAUC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type MigrateIdentityCustomAttributeType = {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
type: 'String' | 'Number' | 'Date' | 'Boolean';
|
|
5
|
+
};
|
|
6
|
+
export type MigrateUserPayload = {
|
|
7
|
+
identities: {
|
|
8
|
+
userName: string;
|
|
9
|
+
credentials: string;
|
|
10
|
+
grantType: 'password';
|
|
11
|
+
lastLoginDate?: string;
|
|
12
|
+
}[];
|
|
13
|
+
profile: {
|
|
14
|
+
firstName: string;
|
|
15
|
+
lastName: string;
|
|
16
|
+
secondLastName?: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
gender?: 'MALE' | 'FEMALE';
|
|
19
|
+
email: string;
|
|
20
|
+
birthYear: string;
|
|
21
|
+
birthMonth: string;
|
|
22
|
+
birthDay: string;
|
|
23
|
+
contacts: {
|
|
24
|
+
phone: string;
|
|
25
|
+
type: 'WORK' | 'HOME' | 'PRIMARY' | 'OTHER';
|
|
26
|
+
}[];
|
|
27
|
+
addresses: {
|
|
28
|
+
line1: string;
|
|
29
|
+
line2?: string;
|
|
30
|
+
locality: string;
|
|
31
|
+
region?: string;
|
|
32
|
+
postal: string;
|
|
33
|
+
country?: string;
|
|
34
|
+
type: 'WORK' | 'HOME' | 'PRIMARY' | 'OTHER';
|
|
35
|
+
}[];
|
|
36
|
+
attributes: MigrateIdentityCustomAttributeType[];
|
|
37
|
+
legacyId: string;
|
|
38
|
+
deletionRule?: 1;
|
|
39
|
+
emailVerified?: boolean;
|
|
40
|
+
createdOn: string;
|
|
41
|
+
};
|
|
42
|
+
uuid?: string;
|
|
43
|
+
};
|
|
44
|
+
export type MigrateBatchUsersPayload = {
|
|
45
|
+
records: MigrateUserPayload[];
|
|
46
|
+
};
|
|
47
|
+
export type MigrateBatchUsersResponse = {
|
|
48
|
+
records: {
|
|
49
|
+
email: string;
|
|
50
|
+
success: boolean;
|
|
51
|
+
errorMessage: string;
|
|
52
|
+
result: 'CREATE' | 'UPDATE';
|
|
53
|
+
uuid: string;
|
|
54
|
+
}[];
|
|
55
|
+
time: number;
|
|
56
|
+
errorCount: number;
|
|
57
|
+
successCount: number;
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/identity/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ArcAbstractAPI, ArcAPIOptions } from '../abstract-api';
|
|
2
|
+
import { AddSecretPayload, CreateIntegrationPayload, SubscribePayload, UpdateIntegrationPayload } from './types';
|
|
3
|
+
export declare class ArcIFX extends ArcAbstractAPI {
|
|
4
|
+
constructor(options: ArcAPIOptions);
|
|
5
|
+
createIntegration(payload: CreateIntegrationPayload): Promise<void>;
|
|
6
|
+
updateIntegration(payload: UpdateIntegrationPayload): Promise<void>;
|
|
7
|
+
getIntegrations(): Promise<any>;
|
|
8
|
+
getJobs(integrationName: string): Promise<any>;
|
|
9
|
+
getStatus(integrationName: string): Promise<any>;
|
|
10
|
+
initializeQuery(integrationName: string, query?: string): Promise<{
|
|
11
|
+
queryId: string;
|
|
12
|
+
}>;
|
|
13
|
+
getLogs(queryId: string): Promise<any>;
|
|
14
|
+
subscribe(payload: SubscribePayload): Promise<any>;
|
|
15
|
+
getSubscriptions(): Promise<any>;
|
|
16
|
+
addSecret(payload: AddSecretPayload): Promise<any>;
|
|
17
|
+
getSecrets(integrationName: string): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArcIFX = void 0;
|
|
4
|
+
const abstract_api_1 = require("../abstract-api");
|
|
5
|
+
class ArcIFX extends abstract_api_1.ArcAbstractAPI {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super({ ...options, apiPath: 'ifx/api/v1' });
|
|
8
|
+
}
|
|
9
|
+
async createIntegration(payload) {
|
|
10
|
+
await this.client.post('/admin/integration', payload);
|
|
11
|
+
}
|
|
12
|
+
async updateIntegration(payload) {
|
|
13
|
+
await this.client.put('/admin/integration', payload);
|
|
14
|
+
}
|
|
15
|
+
async getIntegrations() {
|
|
16
|
+
const { data } = await this.client.get('/admin/integrations');
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
async getJobs(integrationName) {
|
|
20
|
+
const { data } = await this.client.get(`/admin/jobs/status/${integrationName}`);
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
async getStatus(integrationName) {
|
|
24
|
+
const { data } = await this.client.get(`/admin/integration/${integrationName}/provisionStatus`);
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
async initializeQuery(integrationName, query) {
|
|
28
|
+
const { data } = await this.client.get(`/admin/logs/integration/${integrationName}?${query}`);
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
async getLogs(queryId) {
|
|
32
|
+
const { data } = await this.client.get(`/admin/logs/results?queryId=${queryId}`);
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
async subscribe(payload) {
|
|
36
|
+
const { data } = await this.client.post('/admin/events/subscriptions', payload);
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
async getSubscriptions() {
|
|
40
|
+
const { data } = await this.client.get('/admin/events/subscriptions');
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
async addSecret(payload) {
|
|
44
|
+
const { data } = await this.client.post(`/admin/secret?integrationName=${payload.integrationName}`, {
|
|
45
|
+
secretName: payload.secretName,
|
|
46
|
+
secretValue: payload.secretValue,
|
|
47
|
+
});
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
async getSecrets(integrationName) {
|
|
51
|
+
const { data } = await this.client.get(`/admin/secret?integrationName=${integrationName}`);
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.ArcIFX = ArcIFX;
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/ifx/index.ts"],"names":[],"mappings":";;;AAAA,kDAAgE;AAGhE,MAAa,MAAO,SAAQ,6BAAc;IACxC,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAiC;QACvD,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAiC;QACvD,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,eAAuB;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,eAAe,EAAE,CAAC,CAAC;QAChF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,eAAuB;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,eAAe,kBAAkB,CAAC,CAAC;QAChG,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,eAAuB,EAAE,KAAc;QAC3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rationName: string;
|
|
3
|
+
description: string;
|
|
4
|
+
email: string;
|
|
5
|
+
provisionPAT: boolean;
|
|
6
|
+
githubUsernames: string[];
|
|
7
|
+
runtime: 'node';
|
|
8
|
+
};
|
|
9
|
+
export type UpdateIntegrationPayload = {
|
|
10
|
+
integrationName: string;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
githubUsernames: string[];
|
|
13
|
+
githubUserAction: 'add' | 'replace';
|
|
14
|
+
};
|
|
15
|
+
export type SubscribePayload = {
|
|
16
|
+
eventName: string;
|
|
17
|
+
integrationName: string;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type AddSecretPayload = {
|
|
21
|
+
integrationName: string;
|
|
22
|
+
secretName: string;
|
|
23
|
+
secretValue: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/ifx/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ArcAPIOptions } from './abstract-api';
|
|
2
|
+
import { ArcAuthor } from './author';
|
|
3
|
+
import { ArcDraft } from './draft';
|
|
4
|
+
import { ArcIdentity } from './identity';
|
|
5
|
+
import { ArcIFX } from './ifx';
|
|
6
|
+
import { ArcMigrationCenter } from './migration-center';
|
|
7
|
+
import { ArcSales } from './sales';
|
|
8
|
+
import { ArcSite } from './site';
|
|
9
|
+
import { ArcWebsked } from './websked';
|
|
10
|
+
import WsClient from './ws.client';
|
|
11
|
+
export declare const ArcAPI: (options: ArcAPIOptions) => {
|
|
12
|
+
setMaxRPS: (rps: number) => void;
|
|
13
|
+
RetailEvents: (index?: '0' | '1' | 'string') => WsClient;
|
|
14
|
+
Author: ArcAuthor;
|
|
15
|
+
Draft: ArcDraft;
|
|
16
|
+
Identity: ArcIdentity;
|
|
17
|
+
IFX: ArcIFX;
|
|
18
|
+
MigrationCenter: ArcMigrationCenter;
|
|
19
|
+
Sales: ArcSales;
|
|
20
|
+
Site: ArcSite;
|
|
21
|
+
Websked: ArcWebsked;
|
|
22
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ArcAPI = void 0;
|
|
7
|
+
const author_1 = require("./author");
|
|
8
|
+
const draft_1 = require("./draft");
|
|
9
|
+
const identity_1 = require("./identity");
|
|
10
|
+
const ifx_1 = require("./ifx");
|
|
11
|
+
const migration_center_1 = require("./migration-center");
|
|
12
|
+
const sales_1 = require("./sales");
|
|
13
|
+
const site_1 = require("./site");
|
|
14
|
+
const websked_1 = require("./websked");
|
|
15
|
+
const ws_client_1 = __importDefault(require("./ws.client"));
|
|
16
|
+
const ArcAPI = (options) => {
|
|
17
|
+
const API = {
|
|
18
|
+
Author: new author_1.ArcAuthor(options),
|
|
19
|
+
Draft: new draft_1.ArcDraft(options),
|
|
20
|
+
Identity: new identity_1.ArcIdentity(options),
|
|
21
|
+
IFX: new ifx_1.ArcIFX(options),
|
|
22
|
+
MigrationCenter: new migration_center_1.ArcMigrationCenter(options),
|
|
23
|
+
Sales: new sales_1.ArcSales(options),
|
|
24
|
+
Site: new site_1.ArcSite(options),
|
|
25
|
+
Websked: new websked_1.ArcWebsked(options),
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
...API,
|
|
29
|
+
setMaxRPS: (rps) => {
|
|
30
|
+
Object.values(API).forEach((a) => a.setMaxRPS(rps));
|
|
31
|
+
},
|
|
32
|
+
RetailEvents: (index = '0') => {
|
|
33
|
+
const address = `wss://api.${options.credentials.organizationName}.arcpublishing.com/retail/api/v1/event/stream/${index}`;
|
|
34
|
+
const headers = {
|
|
35
|
+
Authorization: `Bearer ${options.credentials.accessToken}`,
|
|
36
|
+
};
|
|
37
|
+
return new ws_client_1.default(address, { headers });
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.ArcAPI = ArcAPI;
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;AACA,qCAAqC;AACrC,mCAAmC;AACnC,yCAAyC;AACzC,+BAA+B;AAC/B,yDAAwD;AACxD,mCAAmC;AACnC,iCAAiC;AACjC,uCAAuC;AACvC,4DAAmC;AAE5B,MAAM,MAAM,GAAG,CAAC,OAAsB,EAAE,EAAE;IAC/C,MAAM,GAAG,GAAG;QACV,MAAM,EAAE,IAAI,kBAAS,CAAC,OAAO,CAAC;QAC9B,KAAK,EAAE,IAAI,gBAAQ,CAAC,OAAO,CAAC;QAC5B,QAAQ,EAAE,IAAI,sBAAW,CAAC,OAAO,CAAC;QAClC,GAAG,EAAE,IAAI,YAAM,CAAC,OAAO,CAAC;QACxB,eAAe,EAAE,IAAI,qCAAkB,CAAC,OAAO,CAAC;QAChD,KAAK,EAAE,IAAI,gBAAQ,CAAC,OAAO,CAAC;QAC5B,IAAI,EAAE,IAAI,cAAO,CAAC,OAAO,CAAC;QAC1B,OAAO,EAAE,IAAI,oBAAU,CAAC,OAAO,CAAC;KACjC,CAAC;IAEF,OAAO;QACL,GAAG,GAAG;QACN,SAAS,EAAE,CAAC,GAAW,EAAE,EAAE;YACzB,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,YAAY,EAAE,CAAC,QAA8B,GAAG,EAAE,EAAE;YAClD,MAAM,OAAO,GAAG,aAAa,OAAO,CAAC,WAAW,CAAC,gBAAgB,iDAAiD,KAAK,EAAE,CAAC;YAC1H,MAAM,OAAO,GAAG;gBACd,aAAa,EAAE,UAAU,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE;aAC3D,CAAC;YACF,OAAO,IAAI,mBAAQ,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5C,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAzBW,QAAA,MAAM,UAyBjB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PostANSParams, PostANSPayload, GetANSParams, Summary, Count, DetailReportRequest, SummaryReportRequest, DetailReport } from './types';
|
|
2
|
+
import { ArcAbstractAPI, ArcAPIOptions } from '../abstract-api';
|
|
3
|
+
export declare class ArcMigrationCenter extends ArcAbstractAPI {
|
|
4
|
+
constructor(options: ArcAPIOptions);
|
|
5
|
+
summary(params?: SummaryReportRequest): Promise<Summary>;
|
|
6
|
+
detailed(params?: DetailReportRequest): Promise<DetailReport>;
|
|
7
|
+
count(): Promise<Count>;
|
|
8
|
+
postAns(params: PostANSParams, payload: PostANSPayload): Promise<any>;
|
|
9
|
+
getAns(params: GetANSParams): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArcMigrationCenter = void 0;
|
|
4
|
+
const abstract_api_1 = require("../abstract-api");
|
|
5
|
+
const querystring_1 = require("querystring");
|
|
6
|
+
class ArcMigrationCenter extends abstract_api_1.ArcAbstractAPI {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
super({ ...options, apiPath: 'migrations/v3' });
|
|
9
|
+
}
|
|
10
|
+
async summary(params) {
|
|
11
|
+
const { data } = await this.client.get(`/report/summary?${(0, querystring_1.stringify)(params)}`);
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
async detailed(params) {
|
|
15
|
+
const { data } = await this.client.get(`/report/detail?${(0, querystring_1.stringify)(params)}`);
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
async count() {
|
|
19
|
+
const { data } = await this.client.get('/report/status/count');
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
async postAns(params, payload) {
|
|
23
|
+
const search = new URLSearchParams(params).toString();
|
|
24
|
+
const { data } = await this.client.post(`/content/ans?${search}`, payload);
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
async getAns(params) {
|
|
28
|
+
const search = new URLSearchParams(params).toString();
|
|
29
|
+
const { data } = await this.client.get(`/content/ans?${search}`);
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ArcMigrationCenter = ArcMigrationCenter;
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/migration-center/index.ts"],"names":[],"mappings":";;;AAUA,kDAAgE;AAChE,6CAAwC;AAExC,MAAa,kBAAmB,SAAQ,6BAAc;IACpD,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAA6B;QACzC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAU,mBAAmB,IAAA,uBAAS,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAA4B;QACzC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,kBAAkB,IAAA,uBAAS,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5F,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAA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