@code.store/arcxp-sdk-ts 4.0.1 → 4.1.1

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,27 +1,33 @@
1
1
  # arcxp-sdk-ts
2
+
2
3
  <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
 
4
5
  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
 
6
7
  ## Installation
8
+
7
9
  Install the package with:
8
10
 
9
11
  ```
10
12
  npm i @code.store/arcxp-sdk-ts
11
13
  ```
14
+
12
15
  ## Features
16
+
13
17
  #### API
14
- * Draft
15
- * Site
16
- * Websked
17
- * Identity
18
- * Sales
19
- * Retail Events (WebSockets)
20
- * Author
21
- * IFX
22
- * Migration Center
18
+
19
+ - Draft
20
+ - Site
21
+ - Websked
22
+ - Identity
23
+ - Sales
24
+ - Retail Events (WebSockets)
25
+ - Author
26
+ - IFX
27
+ - Migration Center
23
28
 
24
29
  ##### Usage example
30
+
25
31
  ```ts
26
32
  import { ArcAPI } from '@code.store/arcxp-sdk-ts';
27
33
 
@@ -31,31 +37,33 @@ const api = ArcAPI({
31
37
  });
32
38
  const id = await api.Draft.generateId(Date.now().toString());
33
39
  ```
40
+
34
41
  #### 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
42
+
43
+ - text
44
+ - header
45
+ - image
46
+ - quote
47
+ - interstitial_link
48
+ - raw_html
49
+ - gallery
50
+ - list
51
+ - link_list
52
+ - jwPlayer
45
53
 
46
54
  ##### Usage example
55
+
47
56
  ```ts
48
57
  import { ContentElement } from '@code.store/arcxp-sdk-ts';
49
58
 
50
59
  const header = ContentElement.header('Header', 4);
51
60
  const text = ContentElement.text('text');
52
-
53
61
  ```
54
62
 
55
63
  ## Image migration example
64
+
56
65
  ```ts
57
66
  import { ArcTypes, ArcAPI } from '@code.store/arcxp-sdk-ts';
58
- import { ArcAPI } from '../../../arc';
59
67
 
60
68
  const api = ArcAPI({
61
69
  credentials: { organizationName: 'YOUR_ORG_NAME', accessToken: 'YOUR_ACCESS_TOKEN' },
@@ -98,7 +106,11 @@ await api.MigrationCenter.postAns(
98
106
  }
99
107
  );
100
108
  ```
109
+
110
+ ## Changeset
111
+
112
+ `npx changeset && npx changeset version`
113
+
101
114
  ## License
102
115
 
103
116
  [MIT](https://choosealicense.com/licenses/mit/)
104
-
@@ -0,0 +1,7 @@
1
+ import { GetStoryParams } from './types';
2
+ import { ArcAbstractAPI, ArcAPIOptions } from '../abstract-api';
3
+ import { AStory } from '../../types/story';
4
+ export declare class ArcContent extends ArcAbstractAPI {
5
+ constructor(options: ArcAPIOptions);
6
+ getStory(params: GetStoryParams): Promise<AStory>;
7
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArcContent = void 0;
4
+ const abstract_api_1 = require("../abstract-api");
5
+ class ArcContent extends abstract_api_1.ArcAbstractAPI {
6
+ constructor(options) {
7
+ super({ ...options, apiPath: 'content/v4' });
8
+ }
9
+ async getStory(params) {
10
+ const search = new URLSearchParams({ ...params, published: params.published.toString() }).toString();
11
+ const { data } = await this.client.get(`/stories?${search}`);
12
+ return data;
13
+ }
14
+ }
15
+ exports.ArcContent = ArcContent;
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/content/index.ts"],"names":[],"mappings":";;;AACA,kDAAgE;AAGhE,MAAa,UAAW,SAAQ,6BAAc;IAC5C,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAsB;QACnC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;QAErG,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,MAAM,EAAE,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAXD,gCAWC"}
@@ -0,0 +1,5 @@
1
+ export type GetStoryParams = {
2
+ _id: string;
3
+ published: boolean;
4
+ website: string;
5
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/content/types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,6 @@
1
1
  import { ArcAPIOptions } from './abstract-api';
2
2
  import { ArcAuthor } from './author';
3
+ import { ArcContent } from './content';
3
4
  import { ArcDraft } from './draft';
4
5
  import { ArcIdentity } from './identity';
5
6
  import { ArcIFX } from './ifx';
@@ -19,4 +20,5 @@ export declare const ArcAPI: (options: ArcAPIOptions) => {
19
20
  Sales: ArcSales;
20
21
  Site: ArcSite;
21
22
  Websked: ArcWebsked;
23
+ Content: ArcContent;
22
24
  };
package/dist/api/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ArcAPI = void 0;
4
4
  const author_1 = require("./author");
5
+ const content_1 = require("./content");
5
6
  const draft_1 = require("./draft");
6
7
  const identity_1 = require("./identity");
7
8
  const ifx_1 = require("./ifx");
@@ -20,6 +21,7 @@ const ArcAPI = (options) => {
20
21
  Sales: new sales_1.ArcSales(options),
21
22
  Site: new site_1.ArcSite(options),
22
23
  Websked: new websked_1.ArcWebsked(options),
24
+ Content: new content_1.ArcContent(options),
23
25
  };
24
26
  return {
25
27
  ...API,
@@ -1 +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,2CAAuC;AAEhC,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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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,oBAAQ,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5C,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,MAAM,UA0BjB"}
@@ -33,29 +33,29 @@ type AuthorANS = {
33
33
  linkedin: string;
34
34
  status: boolean;
35
35
  };
36
+ export type CirculationReference = {
37
+ document_id: string;
38
+ website_id: string;
39
+ website_url?: string;
40
+ primary_section?: SectionReference;
41
+ website_primary_section?: SectionReference;
42
+ website_sections: SectionReference[];
43
+ };
44
+ export type Operation = {
45
+ type: string;
46
+ story_id: string;
47
+ operation: string;
48
+ date: string;
49
+ organization_id: string;
50
+ endpoint: string;
51
+ };
36
52
  export type PostANSPayload = {
37
53
  sourceId: string;
38
54
  sourceType: string;
39
55
  ANS: AStory | AnImage | AuthorANS | TagANS;
40
56
  references?: unknown[];
41
- circulations?: [
42
- {
43
- document_id: string;
44
- website_id: string;
45
- website_url?: string;
46
- primary_section: SectionReference;
47
- website_primary_section: SectionReference;
48
- website_sections: SectionReference[];
49
- }
50
- ];
51
- operations?: {
52
- type: string;
53
- story_id: string;
54
- operation: string;
55
- date: string;
56
- organization_id: string;
57
- endpoint: string;
58
- }[];
57
+ circulations?: CirculationReference[];
58
+ operations?: Operation[];
59
59
  arcAdditionalProperties?: {
60
60
  importPriority?: string;
61
61
  story?: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/migration-center/types.ts"],"names":[],"mappings":";;;AAgFA,IAAY,OAQX;AARD,WAAY,OAAO;IACjB,0BAAe,CAAA;IACf,0BAAe,CAAA;IACf,sBAAW,CAAA;IACX,4BAAiB,CAAA;IACjB,8BAAmB,CAAA;IACnB,0BAAe,CAAA;IACf,gCAAqB,CAAA;AACvB,CAAC,EARW,OAAO,GAAP,eAAO,KAAP,eAAO,QAQlB;AAED,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;IACjB,4CAAyB,CAAA;IACzB,0CAAuB,CAAA;IACvB,0CAAuB,CAAA;IACvB,0CAAuB,CAAA;IACvB,0CAAuB,CAAA;IACvB,0CAAuB,CAAA;IACvB,8CAA2B,CAAA;IAC3B,4CAAyB,CAAA;IACzB,sCAAmB,CAAA;IACnB,wDAAqC,CAAA;AACvC,CAAC,EAbW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAa1B;AA4DD,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,0CAAyB,CAAA;IACzB,0CAAyB,CAAA;IACzB,0BAAS,CAAA;AACX,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,iCAAa,CAAA;AACf,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/migration-center/types.ts"],"names":[],"mappings":";;;AAkFA,IAAY,OAQX;AARD,WAAY,OAAO;IACjB,0BAAe,CAAA;IACf,0BAAe,CAAA;IACf,sBAAW,CAAA;IACX,4BAAiB,CAAA;IACjB,8BAAmB,CAAA;IACnB,0BAAe,CAAA;IACf,gCAAqB,CAAA;AACvB,CAAC,EARW,OAAO,GAAP,eAAO,KAAP,eAAO,QAQlB;AAED,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;IACjB,4CAAyB,CAAA;IACzB,0CAAuB,CAAA;IACvB,0CAAuB,CAAA;IACvB,0CAAuB,CAAA;IACvB,0CAAuB,CAAA;IACvB,0CAAuB,CAAA;IACvB,8CAA2B,CAAA;IAC3B,4CAAyB,CAAA;IACzB,sCAAmB,CAAA;IACnB,wDAAqC,CAAA;AACvC,CAAC,EAbW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAa1B;AA4DD,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,0CAAyB,CAAA;IACzB,0CAAyB,CAAA;IACzB,0BAAS,CAAA;AACX,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,iCAAa,CAAA;AACf,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B"}
package/dist/index.d.ts CHANGED
@@ -9,4 +9,5 @@ export * from './api/ifx/types';
9
9
  export * from './api/migration-center/types';
10
10
  export * from './api/sales/types';
11
11
  export * from './api/websked/types';
12
+ export * from './api/content/types';
12
13
  export { ArcAPI, WsClient, ContentElement, ContentElementType, ArcTypes };
package/dist/index.js CHANGED
@@ -42,4 +42,5 @@ __exportStar(require("./api/ifx/types"), exports);
42
42
  __exportStar(require("./api/migration-center/types"), exports);
43
43
  __exportStar(require("./api/sales/types"), exports);
44
44
  __exportStar(require("./api/websked/types"), exports);
45
+ __exportStar(require("./api/content/types"), exports);
45
46
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAatB,uFAbA,YAAM,OAaA;AAZf,yDAAwE;AAY7C,+FAZlB,iCAAc,OAYkB;AAXzC,+CAA2C;AAW1B,yFAXR,oBAAQ,OAWQ;AAVzB,kDAAoC;AAU2B,4BAAQ;AARvE,uDAAqC;AACrC,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,+DAA6C;AAC7C,oDAAkC;AAClC,sDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AActB,uFAdA,YAAM,OAcA;AAbf,yDAAwE;AAa7C,+FAblB,iCAAc,OAakB;AAZzC,+CAA2C;AAY1B,yFAZR,oBAAQ,OAYQ;AAXzB,kDAAoC;AAW2B,4BAAQ;AATvE,uDAAqC;AACrC,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,+DAA6C;AAC7C,oDAAkC;AAClC,sDAAoC;AACpC,sDAAoC"}
@@ -2,7 +2,7 @@
2
2
  export type CacheItem<Data> = {
3
3
  data: Data;
4
4
  ttl: number;
5
- timer?: NodeJS.Timer;
5
+ timer?: NodeJS.Timeout;
6
6
  };
7
7
  export default class Cache<Data = any> {
8
8
  private ttl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code.store/arcxp-sdk-ts",
3
- "version": "4.0.1",
3
+ "version": "4.1.1",
4
4
  "description": "",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,8 @@
15
15
  "scripts": {
16
16
  "build": "tsc",
17
17
  "lint": "tsc --noEmit && TIMING=1 eslint \"src/**/*.ts*\"",
18
- "test": "vitest"
18
+ "test": "vitest",
19
+ "cs": "npx changeset && npx changeset version"
19
20
  },
20
21
  "keywords": [
21
22
  "ArcXP",