@code.store/arcxp-sdk-ts 2.0.0 → 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 +7 -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,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentElement = void 0;
|
|
4
|
+
const refType = 'reference';
|
|
5
|
+
exports.ContentElement = {
|
|
6
|
+
divider: () => {
|
|
7
|
+
return {
|
|
8
|
+
type: 'divider',
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
text: (content, alignment = 'left') => {
|
|
12
|
+
return {
|
|
13
|
+
type: 'text',
|
|
14
|
+
content,
|
|
15
|
+
alignment,
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
quote: (content) => {
|
|
19
|
+
return {
|
|
20
|
+
type: 'quote',
|
|
21
|
+
subtype: 'pullquote',
|
|
22
|
+
citation: {
|
|
23
|
+
type: 'text',
|
|
24
|
+
content: '',
|
|
25
|
+
},
|
|
26
|
+
content_elements: [
|
|
27
|
+
{
|
|
28
|
+
content,
|
|
29
|
+
type: 'text',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
interstitial_link: (url, content) => {
|
|
35
|
+
return {
|
|
36
|
+
type: 'interstitial_link',
|
|
37
|
+
url,
|
|
38
|
+
content,
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
header: (content, level) => {
|
|
42
|
+
return {
|
|
43
|
+
type: 'header',
|
|
44
|
+
content,
|
|
45
|
+
level,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
raw_html: (content) => {
|
|
49
|
+
return {
|
|
50
|
+
type: 'raw_html',
|
|
51
|
+
content,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
gallery: (id) => {
|
|
55
|
+
return {
|
|
56
|
+
type: refType,
|
|
57
|
+
referent: {
|
|
58
|
+
type: 'gallery',
|
|
59
|
+
id,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
list: (type, items) => {
|
|
64
|
+
return {
|
|
65
|
+
type: 'list',
|
|
66
|
+
list_type: type,
|
|
67
|
+
items: items.map((content) => {
|
|
68
|
+
return {
|
|
69
|
+
type: 'text',
|
|
70
|
+
content,
|
|
71
|
+
};
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
link_list: (title, links) => {
|
|
76
|
+
return {
|
|
77
|
+
type: 'link_list',
|
|
78
|
+
title,
|
|
79
|
+
items: links.map(({ content, url }) => {
|
|
80
|
+
return {
|
|
81
|
+
type: 'interstitial_link',
|
|
82
|
+
content,
|
|
83
|
+
url,
|
|
84
|
+
};
|
|
85
|
+
}),
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
image: (id, properties) => {
|
|
89
|
+
return {
|
|
90
|
+
referent: {
|
|
91
|
+
id,
|
|
92
|
+
type: 'image',
|
|
93
|
+
referent_properties: {
|
|
94
|
+
...properties,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
type: refType,
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
jwPlayer: (id) => {
|
|
101
|
+
return {
|
|
102
|
+
embed: {
|
|
103
|
+
config: {},
|
|
104
|
+
id,
|
|
105
|
+
url: 'https://cdn.jwplayer.com/players',
|
|
106
|
+
},
|
|
107
|
+
subtype: 'jw_player',
|
|
108
|
+
type: 'custom_embed',
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/content-elements/index.ts"],"names":[],"mappings":";;;AAIA,MAAM,OAAO,GAAG,WAAoB,CAAC;AAExB,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,GAAG,EAAE;QACZ,OAAO;YACL,IAAI,EAAE,SAAkB;SACzB,CAAC;IACJ,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,YAAuB,MAAM,EAAE,EAAE;QACvD,OAAO;YACL,IAAI,EAAE,MAAe;YACrB,OAAO;YACP,SAAS;SACV,CAAC;IACJ,CAAC;IACD,KAAK,EAAE,CAAC,OAAe,EAAE,EAAE;QACzB,OAAO;YACL,IAAI,EAAE,OAAgB;YACtB,OAAO,EAAE,WAAoB;YAC7B,QAAQ,EAAE;gBACR,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE,EAAE;aACZ;YACD,gBAAgB,EAAE;gBAChB;oBACE,OAAO;oBACP,IAAI,EAAE,MAAe;iBACtB;aACF;SACF,CAAC;IACJ,CAAC;IACD,iBAAiB,EAAE,CAAC,GAAW,EAAE,OAAe,EAAE,EAAE;QAClD,OAAO;YACL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;iBACd;aACF;YACD,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;IACD,QAAQ,EAAE,CAAC,EAAU,EAAE,EAAE;QACvB,OAAO;YACL,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE;gBACV,EAAE;gBACF,GAAG,EAAE,kCAAkC;aACxC;YACD,OAAO,EAAE,WAAoB;YAC7B,IAAI,EAAE,cAAuB;SAC9B,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ArcAPI } from './api';
|
|
2
2
|
import { ContentElement, ContentElementType } from './content-elements';
|
|
3
3
|
import * as ArcTypes from './types';
|
|
4
|
-
|
|
5
4
|
export * from './api/identity/types';
|
|
6
5
|
export * from './api/draft/types';
|
|
7
6
|
export * from './api/site/types';
|
|
@@ -9,5 +8,4 @@ export * from './api/ifx/types';
|
|
|
9
8
|
export * from './api/migration-center/types';
|
|
10
9
|
export * from './api/sales/types';
|
|
11
10
|
export * from './api/websked/types';
|
|
12
|
-
|
|
13
11
|
export { ArcAPI, ContentElement, ContentElementType, ArcTypes };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ArcTypes = exports.ContentElement = exports.ArcAPI = void 0;
|
|
30
|
+
const api_1 = require("./api");
|
|
31
|
+
Object.defineProperty(exports, "ArcAPI", { enumerable: true, get: function () { return api_1.ArcAPI; } });
|
|
32
|
+
const content_elements_1 = require("./content-elements");
|
|
33
|
+
Object.defineProperty(exports, "ContentElement", { enumerable: true, get: function () { return content_elements_1.ContentElement; } });
|
|
34
|
+
const ArcTypes = __importStar(require("./types"));
|
|
35
|
+
exports.ArcTypes = ArcTypes;
|
|
36
|
+
__exportStar(require("./api/identity/types"), exports);
|
|
37
|
+
__exportStar(require("./api/draft/types"), exports);
|
|
38
|
+
__exportStar(require("./api/site/types"), exports);
|
|
39
|
+
__exportStar(require("./api/ifx/types"), exports);
|
|
40
|
+
__exportStar(require("./api/migration-center/types"), exports);
|
|
41
|
+
__exportStar(require("./api/sales/types"), exports);
|
|
42
|
+
__exportStar(require("./api/websked/types"), exports);
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAYtB,uFAZA,YAAM,OAYA;AAXf,yDAAwE;AAWvD,+FAXR,iCAAc,OAWQ;AAV/B,kDAAoC;AAUiB,4BAAQ;AAR7D,uDAAqC;AACrC,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,+DAA6C;AAC7C,oDAAkC;AAClC,sDAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const api_1 = require("../../api");
|
|
5
|
+
(0, vitest_1.describe)('Arc API', () => {
|
|
6
|
+
(0, vitest_1.beforeEach)(() => {
|
|
7
|
+
vitest_1.vi.resetAllMocks();
|
|
8
|
+
vitest_1.vi.clearAllMocks();
|
|
9
|
+
});
|
|
10
|
+
(0, vitest_1.test)('Should throw authorization error (Invalid token)', async () => {
|
|
11
|
+
const API = (0, api_1.ArcAPI)({ credentials: { organizationName: 'codestore', accessToken: Date.now().toString() } });
|
|
12
|
+
await (0, vitest_1.expect)(API.Draft.generateId(Date.now().toString())).rejects.toThrowError(/401 Authorization Required/);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=basic.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic.test.js","sourceRoot":"","sources":["../../../src/tests/api/basic.test.ts"],"names":[],"mappings":";;AAAA,mCAAgE;AAChE,mCAAmC;AAEnC,IAAA,iBAAQ,EAAC,SAAS,EAAE,GAAG,EAAE;IACvB,IAAA,mBAAU,EAAC,GAAG,EAAE;QACd,WAAE,CAAC,aAAa,EAAE,CAAC;QACnB,WAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,IAAA,aAAI,EAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;QAClE,MAAM,GAAG,GAAG,IAAA,YAAM,EAAC,EAAE,WAAW,EAAE,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QAE3G,MAAM,IAAA,eAAM,EAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,4BAA4B,CAAC,CAAC;IAC/G,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|