@code.store/arcxp-sdk-ts 3.0.0 → 3.2.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/README.md
CHANGED
|
@@ -1,2 +1,104 @@
|
|
|
1
1
|
# arcxp-sdk-ts
|
|
2
|
-
|
|
2
|
+
<p align="left"> <a href="https://www.typescriptlang.org/" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/typescript/typescript-original.svg" alt="typescript" width="40" height="40"/> </a> </p>
|
|
3
|
+
|
|
4
|
+
A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
Install the package with:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm i @code.store/arcxp-sdk-ts
|
|
11
|
+
```
|
|
12
|
+
## Features
|
|
13
|
+
#### API
|
|
14
|
+
* Draft
|
|
15
|
+
* Site
|
|
16
|
+
* Websked
|
|
17
|
+
* Identity
|
|
18
|
+
* Sales
|
|
19
|
+
* Retail Events (WebSockets)
|
|
20
|
+
* Author
|
|
21
|
+
* IFX
|
|
22
|
+
* Migration Center
|
|
23
|
+
|
|
24
|
+
##### Usage example
|
|
25
|
+
```ts
|
|
26
|
+
import { ArcAPI } from '@code.store/arcxp-sdk-ts';
|
|
27
|
+
|
|
28
|
+
const api = ArcAPI({
|
|
29
|
+
credentials: { organizationName: 'YOUR_ORG_NAME', accessToken: 'YOUR_ACCESS_TOKEN' },
|
|
30
|
+
maxRPS: 10,
|
|
31
|
+
});
|
|
32
|
+
const id = await api.Draft.generateId(Date.now().toString());
|
|
33
|
+
```
|
|
34
|
+
#### Content Elements
|
|
35
|
+
* text
|
|
36
|
+
* header
|
|
37
|
+
* image
|
|
38
|
+
* quote
|
|
39
|
+
* interstitial_link
|
|
40
|
+
* raw_html
|
|
41
|
+
* gallery
|
|
42
|
+
* list
|
|
43
|
+
* link_list
|
|
44
|
+
* jwPlayer
|
|
45
|
+
|
|
46
|
+
##### Usage example
|
|
47
|
+
```ts
|
|
48
|
+
import { ContentElement } from '@code.store/arcxp-sdk-ts';
|
|
49
|
+
|
|
50
|
+
const header = ContentElement.header('Header', 4);
|
|
51
|
+
const text = ContentElement.text('text');
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Image migration example
|
|
56
|
+
```ts
|
|
57
|
+
import { ArcTypes, ArcAPI } from '@code.store/arcxp-sdk-ts';
|
|
58
|
+
import { ArcAPI } from '../../../arc';
|
|
59
|
+
|
|
60
|
+
const api = ArcAPI({
|
|
61
|
+
credentials: { organizationName: 'YOUR_ORG_NAME', accessToken: 'YOUR_ACCESS_TOKEN' },
|
|
62
|
+
maxRPS: 10,
|
|
63
|
+
});
|
|
64
|
+
const sourceImageId = 'sourceImageId';
|
|
65
|
+
const id = await api.Draft.generateId(sourceImageId);
|
|
66
|
+
const ans: ArcTypes.Story.AnImage = {
|
|
67
|
+
_id: id,
|
|
68
|
+
description: { basic: 'Description' },
|
|
69
|
+
caption: 'Caption',
|
|
70
|
+
subtitle: 'Subtitle',
|
|
71
|
+
alt_text: 'Alt',
|
|
72
|
+
type: 'image',
|
|
73
|
+
version: '0.10.9',
|
|
74
|
+
image_type: 'photograph',
|
|
75
|
+
source: {
|
|
76
|
+
name: 'codestore-arcxp-sdk-ts',
|
|
77
|
+
system: 'codestore-arcxp-sdk-ts',
|
|
78
|
+
source_id: sourceImageId,
|
|
79
|
+
},
|
|
80
|
+
additional_properties: {
|
|
81
|
+
originalName: 'originalName',
|
|
82
|
+
version: 0,
|
|
83
|
+
originalUrl: 'https://picsum.photos/200',
|
|
84
|
+
published: true,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
await api.MigrationCenter.postAns(
|
|
89
|
+
{
|
|
90
|
+
website: 'YOUR_WEBSITE',
|
|
91
|
+
groupId: 'images',
|
|
92
|
+
priority: 'historical',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
sourceId: sourceImageId,
|
|
96
|
+
sourceType: 'image',
|
|
97
|
+
ANS: ans,
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
```
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
104
|
+
|
|
@@ -76,7 +76,7 @@ export type PostANSParams = {
|
|
|
76
76
|
};
|
|
77
77
|
export type GetANSParams = {
|
|
78
78
|
ansId: string;
|
|
79
|
-
ansType:
|
|
79
|
+
ansType: ANSType;
|
|
80
80
|
};
|
|
81
81
|
export declare enum ANSType {
|
|
82
82
|
Story = "story",
|
|
@@ -109,7 +109,7 @@ export type SummaryRecord = {
|
|
|
109
109
|
sourceLocation: string;
|
|
110
110
|
sourceAdditionalProperties: string;
|
|
111
111
|
ansId: string;
|
|
112
|
-
ansType:
|
|
112
|
+
ansType: ANSType;
|
|
113
113
|
ansLocation: string;
|
|
114
114
|
status: MigrationStatus;
|
|
115
115
|
website: string;
|
|
@@ -142,7 +142,7 @@ export type DetailReportRequest = {
|
|
|
142
142
|
sourceId?: string;
|
|
143
143
|
sourceType?: string;
|
|
144
144
|
ansId?: string;
|
|
145
|
-
ansType?:
|
|
145
|
+
ansType?: ANSType;
|
|
146
146
|
version?: string;
|
|
147
147
|
documentType?: string;
|
|
148
148
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ArcAbstractAPI, ArcAPIOptions } from '../abstract-api';
|
|
2
|
-
import { ReportStatusChangePayload } from './types';
|
|
2
|
+
import { CreateTaskPayload, CreateTaskResponse, ReportStatusChangePayload } from './types';
|
|
3
3
|
export declare class ArcWebsked extends ArcAbstractAPI {
|
|
4
4
|
constructor(options: ArcAPIOptions);
|
|
5
|
-
reportStatusChange(payload: ReportStatusChangePayload): Promise<
|
|
5
|
+
reportStatusChange(payload: ReportStatusChangePayload): Promise<void>;
|
|
6
|
+
createTask(payload: CreateTaskPayload): Promise<CreateTaskResponse>;
|
|
6
7
|
}
|
|
@@ -10,6 +10,10 @@ class ArcWebsked extends abstract_api_1.ArcAbstractAPI {
|
|
|
10
10
|
const { data } = await this.client.post('/tasks/workflowStatusChange', payload);
|
|
11
11
|
return data;
|
|
12
12
|
}
|
|
13
|
+
async createTask(payload) {
|
|
14
|
+
const { data } = await this.client.post('/tasks', payload);
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
13
17
|
}
|
|
14
18
|
exports.ArcWebsked = ArcWebsked;
|
|
15
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/websked/index.ts"],"names":[],"mappings":";;;AAAA,kDAAgE;AAGhE,MAAa,UAAW,SAAQ,6BAAc;IAC5C,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,OAAkC;QACzD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/websked/index.ts"],"names":[],"mappings":";;;AAAA,kDAAgE;AAGhE,MAAa,UAAW,SAAQ,6BAAc;IAC5C,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,OAAkC;QACzD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAO,6BAA6B,EAAE,OAAO,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAA0B;QACzC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAdD,gCAcC"}
|
|
@@ -5,3 +5,56 @@ export type ReportStatusChangePayload = {
|
|
|
5
5
|
newWorkflowStatus: number;
|
|
6
6
|
note: string;
|
|
7
7
|
};
|
|
8
|
+
export type WebskedEvent = {
|
|
9
|
+
priority: number;
|
|
10
|
+
startDate?: number;
|
|
11
|
+
deadline?: number;
|
|
12
|
+
assignedGroup?: string;
|
|
13
|
+
assignedUser?: string;
|
|
14
|
+
datetime: number;
|
|
15
|
+
user: object;
|
|
16
|
+
note: string;
|
|
17
|
+
status: number;
|
|
18
|
+
customFields: Record<string, {
|
|
19
|
+
value: string;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
export type CreateTaskResponse = {
|
|
23
|
+
id: string;
|
|
24
|
+
storyID: string;
|
|
25
|
+
type: number;
|
|
26
|
+
createdDate: number;
|
|
27
|
+
events: WebskedEvent[];
|
|
28
|
+
latestEvent: WebskedEvent;
|
|
29
|
+
creationEvent: WebskedEvent;
|
|
30
|
+
taskTemplateId: string | null;
|
|
31
|
+
website: string;
|
|
32
|
+
authoringApp: string;
|
|
33
|
+
startDate: number;
|
|
34
|
+
content: {
|
|
35
|
+
type: 'ans';
|
|
36
|
+
contentId: string;
|
|
37
|
+
versionId: null;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export type CreateTaskPayload = {
|
|
41
|
+
priority: number;
|
|
42
|
+
startDate?: number;
|
|
43
|
+
deadline?: number;
|
|
44
|
+
assignedGroup: string;
|
|
45
|
+
note: string;
|
|
46
|
+
status: number;
|
|
47
|
+
customFields: {
|
|
48
|
+
sourceId: {
|
|
49
|
+
value: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
type: number;
|
|
53
|
+
storyID: string;
|
|
54
|
+
content: {
|
|
55
|
+
type: 'ans';
|
|
56
|
+
contentId: string;
|
|
57
|
+
};
|
|
58
|
+
website: string;
|
|
59
|
+
authoringApp: string;
|
|
60
|
+
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code.store/arcxp-sdk-ts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/code-store-platform/arcxp-sdk-ts"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/code-store-platform/arcxp-sdk-ts",
|
|
8
12
|
"files": [
|
|
9
13
|
"dist"
|
|
10
14
|
],
|
|
@@ -13,10 +17,16 @@
|
|
|
13
17
|
"lint": "tsc --noEmit && TIMING=1 eslint \"src/**/*.ts*\"",
|
|
14
18
|
"test": "vitest"
|
|
15
19
|
},
|
|
16
|
-
"keywords": [
|
|
20
|
+
"keywords": [
|
|
21
|
+
"ArcXP",
|
|
22
|
+
"SDK",
|
|
23
|
+
"Code.Store"
|
|
24
|
+
],
|
|
17
25
|
"author": "code.store",
|
|
18
26
|
"license": "MIT",
|
|
19
27
|
"dependencies": {
|
|
28
|
+
"@changesets/changelog-github": "^0.4.8",
|
|
29
|
+
"@changesets/cli": "^2.26.2",
|
|
20
30
|
"axios": "^1.4.0",
|
|
21
31
|
"axios-rate-limit": "^1.3.0",
|
|
22
32
|
"form-data": "^4.0.0",
|