@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.
Files changed (125) hide show
  1. package/dist/api/abstract-api.d.ts +19 -0
  2. package/dist/api/abstract-api.js +33 -0
  3. package/dist/api/abstract-api.js.map +1 -0
  4. package/dist/api/author/index.d.ts +5 -0
  5. package/dist/api/author/index.js +15 -0
  6. package/dist/api/author/index.js.map +1 -0
  7. package/dist/api/author/types.js +2 -0
  8. package/dist/api/author/types.js.map +1 -0
  9. package/dist/api/draft/index.d.ts +5 -0
  10. package/dist/api/draft/index.js +15 -0
  11. package/dist/api/draft/index.js.map +1 -0
  12. package/dist/api/draft/types.js +3 -0
  13. package/dist/api/draft/types.js.map +1 -0
  14. package/dist/api/error.d.ts +10 -0
  15. package/dist/api/error.js +24 -0
  16. package/dist/api/error.js.map +1 -0
  17. package/dist/api/identity/index.d.ts +6 -0
  18. package/dist/api/identity/index.js +15 -0
  19. package/dist/api/identity/index.js.map +1 -0
  20. package/dist/api/identity/types.d.ts +58 -0
  21. package/dist/api/identity/types.js +3 -0
  22. package/dist/api/identity/types.js.map +1 -0
  23. package/dist/api/ifx/index.d.ts +18 -0
  24. package/dist/api/ifx/index.js +56 -0
  25. package/dist/api/ifx/index.js.map +1 -0
  26. package/dist/api/ifx/types.d.ts +24 -0
  27. package/dist/api/ifx/types.js +3 -0
  28. package/dist/api/ifx/types.js.map +1 -0
  29. package/dist/api/index.d.ts +22 -0
  30. package/dist/api/index.js +42 -0
  31. package/dist/api/index.js.map +1 -0
  32. package/dist/api/migration-center/index.d.ts +10 -0
  33. package/dist/api/migration-center/index.js +34 -0
  34. package/dist/api/migration-center/index.js.map +1 -0
  35. package/dist/api/migration-center/types.d.ts +166 -0
  36. package/dist/api/migration-center/types.js +40 -0
  37. package/dist/api/migration-center/types.js.map +1 -0
  38. package/dist/api/sales/index.d.ts +6 -0
  39. package/dist/api/sales/index.js +25 -0
  40. package/dist/api/sales/index.js.map +1 -0
  41. package/dist/api/sales/types.d.ts +68 -0
  42. package/dist/api/sales/types.js +3 -0
  43. package/dist/api/sales/types.js.map +1 -0
  44. package/dist/api/site/index.d.ts +7 -0
  45. package/dist/api/site/index.js +19 -0
  46. package/dist/api/site/index.js.map +1 -0
  47. package/dist/api/site/types.js +3 -0
  48. package/dist/api/site/types.js.map +1 -0
  49. package/dist/api/websked/index.d.ts +6 -0
  50. package/dist/api/websked/index.js +15 -0
  51. package/dist/api/websked/index.js.map +1 -0
  52. package/dist/api/websked/types.d.ts +7 -0
  53. package/dist/api/websked/types.js +3 -0
  54. package/dist/api/websked/types.js.map +1 -0
  55. package/dist/api/ws.client.d.ts +17 -0
  56. package/dist/api/ws.client.js +67 -0
  57. package/dist/api/ws.client.js.map +1 -0
  58. package/dist/content-elements/index.d.ts +137 -0
  59. package/dist/content-elements/index.js +112 -0
  60. package/dist/content-elements/index.js.map +1 -0
  61. package/{src/index.ts → dist/index.d.ts} +0 -2
  62. package/dist/index.js +43 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/tests/api/basic.test.d.ts +1 -0
  65. package/dist/tests/api/basic.test.js +15 -0
  66. package/dist/tests/api/basic.test.js.map +1 -0
  67. package/dist/types/author.d.ts +1511 -0
  68. package/dist/types/author.js +9 -0
  69. package/dist/types/author.js.map +1 -0
  70. package/dist/types/index.js +30 -0
  71. package/dist/types/index.js.map +1 -0
  72. package/dist/types/section.d.ts +80 -0
  73. package/dist/types/section.js +3 -0
  74. package/dist/types/section.js.map +1 -0
  75. package/dist/types/story.d.ts +1865 -0
  76. package/dist/types/story.js +9 -0
  77. package/dist/types/story.js.map +1 -0
  78. package/dist/utils/cache.d.ts +21 -0
  79. package/dist/utils/cache.js +63 -0
  80. package/dist/utils/cache.js.map +1 -0
  81. package/dist/utils/decorator.d.ts +2 -0
  82. package/dist/utils/decorator.js +21 -0
  83. package/dist/utils/decorator.js.map +1 -0
  84. package/dist/utils/duration.d.ts +7 -0
  85. package/dist/utils/duration.js +21 -0
  86. package/dist/utils/duration.js.map +1 -0
  87. package/dist/utils/index.d.ts +6 -0
  88. package/dist/utils/index.js +52 -0
  89. package/dist/utils/index.js.map +1 -0
  90. package/package.json +6 -2
  91. package/.eslintrc.js +0 -26
  92. package/.github/workflows/build-test-lint.yml +0 -41
  93. package/.prettierrc +0 -7
  94. package/src/api/abstract-api.ts +0 -42
  95. package/src/api/author/index.ts +0 -13
  96. package/src/api/draft/index.ts +0 -12
  97. package/src/api/error.ts +0 -30
  98. package/src/api/identity/index.ts +0 -14
  99. package/src/api/identity/types.ts +0 -61
  100. package/src/api/ifx/index.ts +0 -64
  101. package/src/api/ifx/types.ts +0 -27
  102. package/src/api/index.ts +0 -37
  103. package/src/api/migration-center/index.ts +0 -47
  104. package/src/api/migration-center/types.ts +0 -173
  105. package/src/api/sales/index.ts +0 -22
  106. package/src/api/sales/types.ts +0 -73
  107. package/src/api/site/index.ts +0 -20
  108. package/src/api/websked/index.ts +0 -13
  109. package/src/api/websked/types.ts +0 -7
  110. package/src/api/ws.client.ts +0 -73
  111. package/src/content-elements/index.ts +0 -113
  112. package/src/tests/api/basic.test.ts +0 -15
  113. package/src/types/author.ts +0 -1537
  114. package/src/types/section.ts +0 -55
  115. package/src/types/story.ts +0 -1905
  116. package/src/utils/cache.ts +0 -63
  117. package/src/utils/decorator.ts +0 -20
  118. package/src/utils/duration.ts +0 -17
  119. package/src/utils/index.ts +0 -51
  120. package/tsconfig.json +0 -72
  121. package/vite.config.ts +0 -10
  122. /package/{src/api/author/types.ts → dist/api/author/types.d.ts} +0 -0
  123. /package/{src/api/draft/types.ts → dist/api/draft/types.d.ts} +0 -0
  124. /package/{src/api/site/types.ts → dist/api/site/types.d.ts} +0 -0
  125. /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,IAAI,EAAE,mBAA4B;YAClC,GAAG;YACH,OAAO;SACR,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,CAAC,OAAe,EAAE,KAAa,EAAE,EAAE;QACzC,OAAO;YACL,IAAI,EAAE,QAAiB;YACvB,OAAO;YACP,KAAK;SACN,CAAC;IACJ,CAAC;IACD,QAAQ,EAAE,CAAC,OAAe,EAAE,EAAE;QAC5B,OAAO;YACL,IAAI,EAAE,UAAmB;YACzB,OAAO;SACR,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC,EAAU,EAAE,EAAE;QACtB,OAAO;YACL,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE;gBACR,IAAI,EAAE,SAAkB;gBACxB,EAAE;aACH;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE,CAAC,IAA6B,EAAE,KAAe,EAAE,EAAE;QACvD,OAAO;YACL,IAAI,EAAE,MAAe;YACrB,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,OAAO;oBACL,IAAI,EAAE,MAAe;oBACrB,OAAO;iBACR,CAAC;YACJ,CAAC,CAAC;SACH,CAAC;IACJ,CAAC;IACD,SAAS,EAAE,CAAC,KAAa,EAAE,KAAyC,EAAE,EAAE;QACtE,OAAO;YACL,IAAI,EAAE,WAAoB;YAC1B,KAAK;YACL,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;gBACpC,OAAO;oBACL,IAAI,EAAE,mBAA4B;oBAClC,OAAO;oBACP,GAAG;iBACJ,CAAC;YACJ,CAAC,CAAC;SACH,CAAC;IACJ,CAAC;IACD,KAAK,EAAE,CAAC,EAAU,EAAE,UAAmB,EAAE,EAAE;QACzC,OAAO;YACL,QAAQ,EAAE;gBACR,EAAE;gBACF,IAAI,EAAE,OAAgB;gBACtB,mBAAmB,EAAE;oBACnB,GAAG,UAAU;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"}