@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,166 @@
1
+ import { SectionReference } from '../../types/section';
2
+ import { AStory, AnImage, Tag } from '../../types/story';
3
+ type TagANS = Tag & {
4
+ name: string;
5
+ };
6
+ type AuthorANS = {
7
+ type: 'author';
8
+ _id: string;
9
+ firstName: string;
10
+ lastName: string;
11
+ byline: string;
12
+ email: string;
13
+ affiliations: string;
14
+ education: {
15
+ name: string;
16
+ }[];
17
+ awards: {
18
+ name: string;
19
+ }[];
20
+ bio_page: string;
21
+ bio: string;
22
+ longBio: string;
23
+ slug: string;
24
+ native_app_rendering: boolean;
25
+ fuzzy_match: boolean;
26
+ contributor: boolean;
27
+ location: string;
28
+ role: string;
29
+ expertise: string;
30
+ personal_website: string;
31
+ twitter: string;
32
+ facebook: string;
33
+ linkedin: string;
34
+ status: boolean;
35
+ };
36
+ export type PostANSPayload = {
37
+ sourceId: string;
38
+ sourceType: string;
39
+ ANS: AStory | AnImage | AuthorANS | TagANS;
40
+ 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
+ }[];
59
+ arcAdditionalProperties?: {
60
+ importPriority?: string;
61
+ story?: {
62
+ publish: boolean;
63
+ };
64
+ video?: {
65
+ transcoding: true;
66
+ useLastUpdated: true;
67
+ importPriority: string;
68
+ thumbnailTimeInSeconds: 0;
69
+ };
70
+ };
71
+ };
72
+ export type PostANSParams = {
73
+ website: string;
74
+ groupId: string;
75
+ priority: 'historical' | 'live';
76
+ };
77
+ export type GetANSParams = {
78
+ ansId: string;
79
+ ansType: string;
80
+ };
81
+ export declare enum ANSType {
82
+ Story = "story",
83
+ Video = "video",
84
+ Tag = "tag",
85
+ Author = "author",
86
+ Gallery = "gallery",
87
+ Image = "image",
88
+ Redirect = "redirect"
89
+ }
90
+ export declare enum MigrationStatus {
91
+ Success = "Success",
92
+ Queued = "Queued",
93
+ Circulated = "Circulated",
94
+ Published = "Published",
95
+ Scheduled = "Scheduled",
96
+ FailVideo = "FailVideo",
97
+ FailImage = "FailImage",
98
+ FailStory = "FailStory",
99
+ FailGallery = "FailGallery",
100
+ FailAuthor = "FailAuthor",
101
+ FailTag = "FailTag",
102
+ ValidationFailed = "ValidationFailed"
103
+ }
104
+ export type Summary = SummaryRecord[];
105
+ export type SummaryRecord = {
106
+ id: number;
107
+ sourceId: string;
108
+ sourceType: string;
109
+ sourceLocation: string;
110
+ sourceAdditionalProperties: string;
111
+ ansId: string;
112
+ ansType: string;
113
+ ansLocation: string;
114
+ status: MigrationStatus;
115
+ website: string;
116
+ operations: string;
117
+ circulationLocation: string;
118
+ createDate: string;
119
+ updateDate: string;
120
+ errorMessage?: string;
121
+ priority: string;
122
+ arcAdditionalProperties: string;
123
+ groupId: string;
124
+ tags?: null;
125
+ };
126
+ export type DetailReport = SummaryRecord & {
127
+ ansContent: AStory | AnImage | AuthorANS | TagANS;
128
+ };
129
+ export type Count = {
130
+ historical: {
131
+ total: number;
132
+ ansTypes: Partial<{
133
+ tag: ANSTypeCount;
134
+ story: ANSTypeCount;
135
+ author: ANSTypeCount;
136
+ image: ANSTypeCount;
137
+ }>;
138
+ };
139
+ };
140
+ type ANSTypeCount = Partial<Record<MigrationStatus, number>>;
141
+ export type DetailReportRequest = {
142
+ sourceId?: string;
143
+ sourceType?: string;
144
+ ansId?: string;
145
+ ansType?: string;
146
+ version?: string;
147
+ documentType?: string;
148
+ };
149
+ export type SummaryReportRequest = {
150
+ status?: MigrationStatus;
151
+ website: string;
152
+ groupId?: string;
153
+ fetchFromId?: string;
154
+ sort?: SummarySortBy;
155
+ sortOrder?: SummarySortOrder;
156
+ };
157
+ export declare enum SummarySortBy {
158
+ CreateDate = "createDate",
159
+ UpdateDate = "updateDate",
160
+ Id = "id"
161
+ }
162
+ export declare enum SummarySortOrder {
163
+ ASC = "ASC",
164
+ DESC = "DESC"
165
+ }
166
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SummarySortOrder = exports.SummarySortBy = exports.MigrationStatus = exports.ANSType = void 0;
4
+ var ANSType;
5
+ (function (ANSType) {
6
+ ANSType["Story"] = "story";
7
+ ANSType["Video"] = "video";
8
+ ANSType["Tag"] = "tag";
9
+ ANSType["Author"] = "author";
10
+ ANSType["Gallery"] = "gallery";
11
+ ANSType["Image"] = "image";
12
+ ANSType["Redirect"] = "redirect";
13
+ })(ANSType = exports.ANSType || (exports.ANSType = {}));
14
+ var MigrationStatus;
15
+ (function (MigrationStatus) {
16
+ MigrationStatus["Success"] = "Success";
17
+ MigrationStatus["Queued"] = "Queued";
18
+ MigrationStatus["Circulated"] = "Circulated";
19
+ MigrationStatus["Published"] = "Published";
20
+ MigrationStatus["Scheduled"] = "Scheduled";
21
+ MigrationStatus["FailVideo"] = "FailVideo";
22
+ MigrationStatus["FailImage"] = "FailImage";
23
+ MigrationStatus["FailStory"] = "FailStory";
24
+ MigrationStatus["FailGallery"] = "FailGallery";
25
+ MigrationStatus["FailAuthor"] = "FailAuthor";
26
+ MigrationStatus["FailTag"] = "FailTag";
27
+ MigrationStatus["ValidationFailed"] = "ValidationFailed";
28
+ })(MigrationStatus = exports.MigrationStatus || (exports.MigrationStatus = {}));
29
+ var SummarySortBy;
30
+ (function (SummarySortBy) {
31
+ SummarySortBy["CreateDate"] = "createDate";
32
+ SummarySortBy["UpdateDate"] = "updateDate";
33
+ SummarySortBy["Id"] = "id";
34
+ })(SummarySortBy = exports.SummarySortBy || (exports.SummarySortBy = {}));
35
+ var SummarySortOrder;
36
+ (function (SummarySortOrder) {
37
+ SummarySortOrder["ASC"] = "ASC";
38
+ SummarySortOrder["DESC"] = "DESC";
39
+ })(SummarySortOrder = exports.SummarySortOrder || (exports.SummarySortOrder = {}));
40
+ //# sourceMappingURL=types.js.map
@@ -0,0 +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"}
@@ -0,0 +1,6 @@
1
+ import { ArcAbstractAPI, ArcAPIOptions } from '../abstract-api';
2
+ import { MigrateBatchResponse } from './types';
3
+ export declare class ArcSales extends ArcAbstractAPI {
4
+ constructor(options: ArcAPIOptions);
5
+ migrate(filePath: string): Promise<MigrateBatchResponse>;
6
+ }
@@ -0,0 +1,25 @@
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.ArcSales = void 0;
7
+ const promises_1 = require("fs/promises");
8
+ const abstract_api_1 = require("../abstract-api");
9
+ const form_data_1 = __importDefault(require("form-data"));
10
+ class ArcSales extends abstract_api_1.ArcAbstractAPI {
11
+ constructor(options) {
12
+ super({ ...options, apiPath: 'sales/api/v1' });
13
+ }
14
+ async migrate(filePath) {
15
+ const form = new form_data_1.default();
16
+ const file = await (0, promises_1.readFile)(filePath);
17
+ form.append('file', file, { filename: 'subs.json' });
18
+ const { data } = await this.client.post('/migrate', form, {
19
+ headers: { ...form.getHeaders() },
20
+ });
21
+ return data;
22
+ }
23
+ }
24
+ exports.ArcSales = ArcSales;
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/sales/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAuC;AACvC,kDAAgE;AAChE,0DAAiC;AAGjC,MAAa,QAAS,SAAQ,6BAAc;IAC1C,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC5B,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;QAErD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAuB,UAAU,EAAE,IAAI,EAAE;YAC9E,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,EAAE;SAClC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAhBD,4BAgBC"}
@@ -0,0 +1,68 @@
1
+ export type BatchSubscriptionMigrate = {
2
+ subscriptions: (PaidSubscription | FreeSubscription)[];
3
+ payments: PaymentInfo[];
4
+ };
5
+ interface BaseSubscription {
6
+ type: string;
7
+ legacyID: string;
8
+ ownerClientID: string;
9
+ sku: string;
10
+ priceCode: string;
11
+ currentCycle: number;
12
+ nextEventDateUTC: string;
13
+ paymentMethod?: Record<string, any>;
14
+ }
15
+ export interface PaidSubscription extends BaseSubscription {
16
+ legacyID: string;
17
+ ownerClientID: string;
18
+ sku: string;
19
+ priceCode: string;
20
+ currentCycle: number;
21
+ nextEventDateUTC: string;
22
+ type: 'paid';
23
+ paymentMethod: {
24
+ providerID: number;
25
+ token: string;
26
+ };
27
+ billingAddress: {
28
+ line1?: string | null | undefined;
29
+ line2?: string | null | undefined;
30
+ locality?: string | null | undefined;
31
+ region?: string | null | undefined;
32
+ postal?: string | null | undefined;
33
+ country: string;
34
+ };
35
+ }
36
+ export interface FreeSubscription extends BaseSubscription {
37
+ type: 'free';
38
+ paymentMethod: {
39
+ providerID: number;
40
+ token: string;
41
+ };
42
+ }
43
+ export type PaymentInfo = {
44
+ legacySubscriptionID: string;
45
+ type: 'payment';
46
+ paymentDateUTC: string;
47
+ amount: number;
48
+ currency: string;
49
+ tax: number;
50
+ periodFromUTC?: string;
51
+ periodUntilUTC?: string;
52
+ refunds: null | Refund[];
53
+ };
54
+ export type Refund = {
55
+ /**
56
+ * 'YYYY-MM-DD HH24:mm – e.g. 2019-04-25 01:02 – refund date';
57
+ */
58
+ refundDateUTC: string;
59
+ amount: number;
60
+ currency: string;
61
+ tax: number;
62
+ providerReference?: string;
63
+ };
64
+ export type MigrateBatchResponse = {
65
+ subscriptionsInBatch?: number;
66
+ batchID?: string;
67
+ };
68
+ export {};
@@ -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/sales/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { Section, SetSection } from '../../types/section';
2
+ import { ArcAbstractAPI, ArcAPIOptions } from '../abstract-api';
3
+ export declare class ArcSite extends ArcAbstractAPI {
4
+ constructor(options: ArcAPIOptions);
5
+ getSection(id: string, website: string): Promise<Section>;
6
+ putSection(section: SetSection): Promise<any>;
7
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArcSite = void 0;
4
+ const abstract_api_1 = require("../abstract-api");
5
+ class ArcSite extends abstract_api_1.ArcAbstractAPI {
6
+ constructor(options) {
7
+ super({ ...options, apiPath: 'site/v3' });
8
+ }
9
+ async getSection(id, website) {
10
+ const { data } = await this.client.get(`/website/${website}/section?_id=${id}`);
11
+ return data;
12
+ }
13
+ async putSection(section) {
14
+ const { data } = await this.client.put(`/website/${section.website}/section?_id=${section._id}`, section);
15
+ return data;
16
+ }
17
+ }
18
+ exports.ArcSite = ArcSite;
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/site/index.ts"],"names":[],"mappings":";;;AACA,kDAAgE;AAEhE,MAAa,OAAQ,SAAQ,6BAAc;IACzC,YAAY,OAAsB;QAChC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,EAAE,OAAe;QAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAU,YAAY,OAAO,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAEzF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAmB;QAClC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,OAAO,CAAC,OAAO,gBAAgB,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAE1G,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAhBD,0BAgBC"}
@@ -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/site/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { ArcAbstractAPI, ArcAPIOptions } from '../abstract-api';
2
+ import { ReportStatusChangePayload } from './types';
3
+ export declare class ArcWebsked extends ArcAbstractAPI {
4
+ constructor(options: ArcAPIOptions);
5
+ reportStatusChange(payload: ReportStatusChangePayload): Promise<any>;
6
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArcWebsked = void 0;
4
+ const abstract_api_1 = require("../abstract-api");
5
+ class ArcWebsked extends abstract_api_1.ArcAbstractAPI {
6
+ constructor(options) {
7
+ super({ ...options, apiPath: 'websked' });
8
+ }
9
+ async reportStatusChange(payload) {
10
+ const { data } = await this.client.post('/tasks/workflowStatusChange', payload);
11
+ return data;
12
+ }
13
+ }
14
+ exports.ArcWebsked = ArcWebsked;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;QAChF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AATD,gCASC"}
@@ -0,0 +1,7 @@
1
+ export type ReportStatusChangePayload = {
2
+ storyId: string;
3
+ sourceId: string;
4
+ oldWorkflowStatus: number;
5
+ newWorkflowStatus: number;
6
+ note: string;
7
+ };
@@ -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/websked/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import ws from 'ws';
2
+ export type PromiseOr<T> = Promise<T> | T;
3
+ export type Callback<Args extends any[] = any[]> = (...args: Args) => PromiseOr<void>;
4
+ export default class WsClient {
5
+ private address;
6
+ private readonly options;
7
+ private socket?;
8
+ constructor(address: string, options: ws.ClientOptions);
9
+ onOpen?: Callback<[]>;
10
+ onMessage?: Callback<[any]>;
11
+ onClose?: Callback<[ws.CloseEvent | void]>;
12
+ connect(): Promise<void>;
13
+ private _closing;
14
+ close(event?: ws.CloseEvent): void;
15
+ send(data: string): Promise<void>;
16
+ private throwIfNotOpen;
17
+ }
@@ -0,0 +1,67 @@
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
+ const ws_1 = __importDefault(require("ws"));
7
+ class WsClient {
8
+ constructor(address, options) {
9
+ this.address = address;
10
+ this.options = options;
11
+ this._closing = false;
12
+ }
13
+ async connect() {
14
+ if (this.socket && this.socket.readyState === this.socket.OPEN)
15
+ return;
16
+ const socket = new ws_1.default.WebSocket(this.address, this.options);
17
+ this._closing = false;
18
+ socket.onclose = (event) => this.close(event);
19
+ await new Promise((resolve, reject) => {
20
+ socket.onerror = (error) => reject(error);
21
+ socket.onopen = () => resolve(true);
22
+ });
23
+ socket.onmessage = ({ data }) => {
24
+ let message;
25
+ try {
26
+ message = JSON.parse(data.toString());
27
+ }
28
+ catch (error) {
29
+ throw new Error('failed to parse message');
30
+ }
31
+ this.onMessage?.(message);
32
+ };
33
+ this.socket = socket;
34
+ this.onOpen?.();
35
+ }
36
+ close(event) {
37
+ if (this._closing)
38
+ return;
39
+ this._closing = true;
40
+ this.socket?.close();
41
+ this.onClose?.(event);
42
+ }
43
+ async send(data) {
44
+ this.throwIfNotOpen();
45
+ await new Promise((resolve, reject) => {
46
+ this.socket.send(data, (error) => {
47
+ error ? reject(error) : resolve(undefined);
48
+ });
49
+ });
50
+ }
51
+ throwIfNotOpen() {
52
+ if (!this.socket) {
53
+ throw new Error('Client is not connected');
54
+ }
55
+ const { readyState, OPEN } = this.socket;
56
+ if (readyState === OPEN)
57
+ return;
58
+ if (readyState < OPEN) {
59
+ throw new Error('socket is still connecting');
60
+ }
61
+ if (readyState > OPEN) {
62
+ throw new Error('socket was closed');
63
+ }
64
+ }
65
+ }
66
+ exports.default = WsClient;
67
+ //# sourceMappingURL=ws.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws.client.js","sourceRoot":"","sources":["../../src/api/ws.client.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AAKpB,MAAqB,QAAQ;IAG3B,YAAoB,OAAe,EAAmB,OAAyB;QAA3D,YAAO,GAAP,OAAO,CAAQ;QAAmB,YAAO,GAAP,OAAO,CAAkB;QAgCvE,aAAQ,GAAG,KAAK,CAAC;IAhCyD,CAAC;IAMnF,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI;YAAE,OAAO;QAEvE,MAAM,MAAM,GAAG,IAAI,YAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE9C,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC1C,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;YAC9B,IAAI,OAA4B,CAAC;YACjC,IAAI;gBACF,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;aACvC;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;aAC5C;YAED,IAAI,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IAClB,CAAC;IAGD,KAAK,CAAC,KAAqB;QACzB,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAY;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,IAAI,CAAC,MAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,cAAc;QACpB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;SAC5C;QAED,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QACzC,IAAI,UAAU,KAAK,IAAI;YAAE,OAAO;QAChC,IAAI,UAAU,GAAG,IAAI,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;SAC/C;QACD,IAAI,UAAU,GAAG,IAAI,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;SACtC;IACH,CAAC;CACF;AAnED,2BAmEC"}
@@ -0,0 +1,137 @@
1
+ import { Alignment, AnImage } from '../types/story';
2
+ export type ContentElementType<T extends keyof typeof ContentElement> = ReturnType<(typeof ContentElement)[T]>;
3
+ export declare const ContentElement: {
4
+ divider: () => {
5
+ type: "divider";
6
+ };
7
+ text: (content: string, alignment?: Alignment) => {
8
+ type: "text";
9
+ content: string;
10
+ alignment: Alignment;
11
+ };
12
+ quote: (content: string) => {
13
+ type: "quote";
14
+ subtype: "pullquote";
15
+ citation: {
16
+ type: "text";
17
+ content: string;
18
+ };
19
+ content_elements: {
20
+ content: string;
21
+ type: "text";
22
+ }[];
23
+ };
24
+ interstitial_link: (url: string, content: string) => {
25
+ type: "interstitial_link";
26
+ url: string;
27
+ content: string;
28
+ };
29
+ header: (content: string, level: number) => {
30
+ type: "header";
31
+ content: string;
32
+ level: number;
33
+ };
34
+ raw_html: (content: string) => {
35
+ type: "raw_html";
36
+ content: string;
37
+ };
38
+ gallery: (id: string) => {
39
+ type: "reference";
40
+ referent: {
41
+ type: "gallery";
42
+ id: string;
43
+ };
44
+ };
45
+ list: (type: 'ordered' | 'unordered', items: string[]) => {
46
+ type: "list";
47
+ list_type: "ordered" | "unordered";
48
+ items: {
49
+ type: "text";
50
+ content: string;
51
+ }[];
52
+ };
53
+ link_list: (title: string, links: {
54
+ content: string;
55
+ url: string;
56
+ }[]) => {
57
+ type: "link_list";
58
+ title: string;
59
+ items: {
60
+ type: "interstitial_link";
61
+ content: string;
62
+ url: string;
63
+ }[];
64
+ };
65
+ image: (id: string, properties: AnImage) => {
66
+ referent: {
67
+ id: string;
68
+ type: "image";
69
+ referent_properties: {
70
+ type: "image";
71
+ _id?: string | undefined;
72
+ version: "0.10.9";
73
+ subtype?: string | undefined;
74
+ channels?: import("../types/story").ChannelTrait | undefined;
75
+ alignment?: Alignment | undefined;
76
+ language?: string | undefined;
77
+ copyright?: string | undefined;
78
+ canonical_url?: string | undefined;
79
+ short_url?: string | undefined;
80
+ created_date?: string | undefined;
81
+ last_updated_date?: string | undefined;
82
+ publish_date?: string | undefined;
83
+ first_publish_date?: string | undefined;
84
+ display_date?: string | undefined;
85
+ location?: string | undefined;
86
+ geo?: import("../types/story").Geo | undefined;
87
+ address?: import("../types/story").Address | undefined;
88
+ editor_note?: string | undefined;
89
+ status?: string | undefined;
90
+ headlines?: import("../types/story").Headlines | undefined;
91
+ subheadlines?: import("../types/story").SubHeadlines | undefined;
92
+ description?: import("../types/story").Description | undefined;
93
+ credits?: import("../types/story").CreditTrait | undefined;
94
+ vanity_credits?: import("../types/story").VanityCreditsTrait | undefined;
95
+ taxonomy?: import("../types/story").Taxonomy | undefined;
96
+ promo_items?: import("../types/story").PromoItems | undefined;
97
+ related_content?: import("../types/story").Related_Content | undefined;
98
+ owner?: import("../types/story").OwnerInformation | undefined;
99
+ planning?: import("../types/story").SchedulingInformation | undefined;
100
+ workflow?: import("../types/story").WorkflowInformation | undefined;
101
+ pitches?: import("../types/story").Pitches | undefined;
102
+ revision?: import("../types/story").Revision | undefined;
103
+ syndication?: import("../types/story").Syndication | undefined;
104
+ source?: import("../types/story").Source | undefined;
105
+ distributor?: import("../types/story").Distributor | undefined;
106
+ tracking?: import("../types/story").Tracking | undefined;
107
+ comments?: import("../types/story").Comments | undefined;
108
+ label?: import("../types/story").Label | undefined;
109
+ slug?: string | undefined;
110
+ content_restrictions?: import("../types/story").ContentRestrictions | undefined;
111
+ image_type?: string | undefined;
112
+ alt_text?: string | undefined;
113
+ focal_point?: import("../types/story").FocalPoint | undefined;
114
+ auth?: import("../types/story").Auth | undefined;
115
+ seo_filename?: string | undefined;
116
+ additional_properties?: import("../types/story").HasAdditionalProperties | undefined;
117
+ subtitle?: string | undefined;
118
+ caption?: string | undefined;
119
+ url?: string | undefined;
120
+ width?: number | undefined;
121
+ height?: number | undefined;
122
+ licensable?: boolean | undefined;
123
+ contributors?: import("../types/story").Contributors | undefined;
124
+ };
125
+ };
126
+ type: "reference";
127
+ };
128
+ jwPlayer: (id: string) => {
129
+ embed: {
130
+ config: {};
131
+ id: string;
132
+ url: string;
133
+ };
134
+ subtype: "jw_player";
135
+ type: "custom_embed";
136
+ };
137
+ };