@code.store/arcxp-sdk-ts 4.35.0 → 4.36.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/dist/api/content/types.d.ts +1 -0
- package/dist/content-elements/content-elements.d.ts +212 -0
- package/dist/content-elements/content-elements.js +202 -0
- package/dist/content-elements/content-elements.js.map +1 -0
- package/dist/content-elements/html/html.constants.d.ts +1 -0
- package/dist/content-elements/html/html.constants.js +40 -0
- package/dist/content-elements/html/html.constants.js.map +1 -0
- package/dist/content-elements/html/html.processor.d.ts +106 -0
- package/dist/content-elements/html/html.processor.js +359 -0
- package/dist/content-elements/html/html.processor.js.map +1 -0
- package/dist/content-elements/html/html.utils.d.ts +15 -0
- package/dist/content-elements/html/html.utils.js +69 -0
- package/dist/content-elements/html/html.utils.js.map +1 -0
- package/dist/content-elements/html/index.d.ts +3 -0
- package/dist/content-elements/html/index.js +31 -0
- package/dist/content-elements/html/index.js.map +1 -0
- package/dist/content-elements/index.d.ts +2 -213
- package/dist/content-elements/index.js +29 -199
- package/dist/content-elements/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/mapper/doc.d.ts +2 -2
- package/dist/tests/content-elements/html.processor.test.d.ts +1 -0
- package/dist/tests/content-elements/html.processor.test.js +35 -0
- package/dist/tests/content-elements/html.processor.test.js.map +1 -0
- package/dist/types/content-elements.d.ts +4 -0
- package/dist/types/content-elements.js +3 -0
- package/dist/types/content-elements.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +2 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/arc/content.d.ts +2 -1
- package/dist/utils/arc/content.js +3 -1
- package/dist/utils/arc/content.js.map +1 -1
- package/package.json +10 -12
|
@@ -1,213 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export type ContentElementType<T extends keyof typeof ContentElement> = ReturnType<(typeof ContentElement)[T]>;
|
|
4
|
-
export declare const ContentElement: {
|
|
5
|
-
divider: () => {
|
|
6
|
-
type: "divider";
|
|
7
|
-
};
|
|
8
|
-
text: (content: string, alignment?: Alignment) => {
|
|
9
|
-
type: "text";
|
|
10
|
-
content: string;
|
|
11
|
-
alignment: Alignment;
|
|
12
|
-
};
|
|
13
|
-
quote: (items: CElement[], citation?: string, subtype?: 'blockquote' | 'pullquote') => {
|
|
14
|
-
type: "quote";
|
|
15
|
-
subtype: "blockquote" | "pullquote";
|
|
16
|
-
citation: {
|
|
17
|
-
type: "text";
|
|
18
|
-
content: string;
|
|
19
|
-
};
|
|
20
|
-
content_elements: AnElementThatCanBeListedAsPartOfContentElements[];
|
|
21
|
-
};
|
|
22
|
-
interstitial_link: (url: string, content: string) => {
|
|
23
|
-
type: "interstitial_link";
|
|
24
|
-
url: string;
|
|
25
|
-
content: string;
|
|
26
|
-
};
|
|
27
|
-
header: (content: string, level: number) => {
|
|
28
|
-
type: "header";
|
|
29
|
-
content: string;
|
|
30
|
-
level: number;
|
|
31
|
-
};
|
|
32
|
-
raw_html: (content: string) => {
|
|
33
|
-
type: "raw_html";
|
|
34
|
-
content: string;
|
|
35
|
-
};
|
|
36
|
-
gallery: (id: string) => {
|
|
37
|
-
type: "reference";
|
|
38
|
-
referent: {
|
|
39
|
-
type: "gallery";
|
|
40
|
-
id: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
list: (type: 'ordered' | 'unordered', items: CElement[]) => {
|
|
44
|
-
type: "list";
|
|
45
|
-
list_type: "ordered" | "unordered";
|
|
46
|
-
items: AnElementThatCanBeListedAsPartOfContentElements[];
|
|
47
|
-
};
|
|
48
|
-
link_list: (title: string, links: {
|
|
49
|
-
content: string;
|
|
50
|
-
url: string;
|
|
51
|
-
}[]) => {
|
|
52
|
-
type: "link_list";
|
|
53
|
-
title: string;
|
|
54
|
-
items: {
|
|
55
|
-
type: "interstitial_link";
|
|
56
|
-
content: string;
|
|
57
|
-
url: string;
|
|
58
|
-
}[];
|
|
59
|
-
};
|
|
60
|
-
image: (id: string, properties?: AnImage) => {
|
|
61
|
-
referent: {
|
|
62
|
-
id: string;
|
|
63
|
-
type: "image";
|
|
64
|
-
referent_properties: {
|
|
65
|
-
type: "image";
|
|
66
|
-
_id: string;
|
|
67
|
-
version?: "0.10.10" | undefined;
|
|
68
|
-
subtype?: string | undefined;
|
|
69
|
-
channels?: import("../types/story").ChannelTrait | undefined;
|
|
70
|
-
alignment?: Alignment | undefined;
|
|
71
|
-
language?: string | undefined;
|
|
72
|
-
copyright?: string | undefined;
|
|
73
|
-
canonical_url?: string | undefined;
|
|
74
|
-
short_url?: string | undefined;
|
|
75
|
-
created_date?: string | undefined;
|
|
76
|
-
last_updated_date?: string | undefined;
|
|
77
|
-
publish_date?: string | undefined;
|
|
78
|
-
first_publish_date?: string | undefined;
|
|
79
|
-
display_date?: string | undefined;
|
|
80
|
-
location?: string | undefined;
|
|
81
|
-
geo?: import("../types/story").Geo | undefined;
|
|
82
|
-
address?: import("../types/story").Address | undefined;
|
|
83
|
-
editor_note?: string | undefined;
|
|
84
|
-
status?: string | undefined;
|
|
85
|
-
headlines?: import("../types/story").Headlines | undefined;
|
|
86
|
-
subheadlines?: import("../types/story").SubHeadlines | undefined;
|
|
87
|
-
description?: import("../types/story").Description | undefined;
|
|
88
|
-
credits?: import("../types/story").CreditTrait | undefined;
|
|
89
|
-
vanity_credits?: import("../types/story").VanityCreditsTrait | undefined;
|
|
90
|
-
taxonomy?: import("../types/story").Taxonomy | undefined;
|
|
91
|
-
promo_items?: import("../types/story").PromoItems | undefined;
|
|
92
|
-
related_content?: import("../types/story").Related_Content | undefined;
|
|
93
|
-
owner?: import("../types/story").OwnerInformation | undefined;
|
|
94
|
-
planning?: import("../types/story").SchedulingInformation | undefined;
|
|
95
|
-
workflow?: import("../types/story").WorkflowInformation | undefined;
|
|
96
|
-
pitches?: import("../types/story").Pitches | undefined;
|
|
97
|
-
revision?: import("../types/story").Revision | undefined;
|
|
98
|
-
syndication?: import("../types/story").Syndication | undefined;
|
|
99
|
-
source?: import("../types/story").Source | undefined;
|
|
100
|
-
distributor?: import("../types/story").Distributor | undefined;
|
|
101
|
-
tracking?: import("../types/story").Tracking | undefined;
|
|
102
|
-
comments?: import("../types/story").Comments | undefined;
|
|
103
|
-
label?: import("../types/story").Label | undefined;
|
|
104
|
-
slug?: string | undefined;
|
|
105
|
-
content_restrictions?: import("../types/story").ContentRestrictions | undefined;
|
|
106
|
-
image_type?: string | undefined;
|
|
107
|
-
alt_text?: string | undefined;
|
|
108
|
-
focal_point?: import("../types/story").FocalPoint | undefined;
|
|
109
|
-
auth?: import("../types/story").Auth | undefined;
|
|
110
|
-
seo_filename?: string | undefined;
|
|
111
|
-
additional_properties?: import("../types/story").HasAdditionalProperties | undefined;
|
|
112
|
-
subtitle?: string | undefined;
|
|
113
|
-
caption?: string | undefined;
|
|
114
|
-
url?: string | undefined;
|
|
115
|
-
width?: number | undefined;
|
|
116
|
-
height?: number | undefined;
|
|
117
|
-
licensable?: boolean | undefined;
|
|
118
|
-
contributors?: import("../types/story").Contributors | undefined;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
type: "reference";
|
|
122
|
-
};
|
|
123
|
-
jwPlayer: (id: string) => {
|
|
124
|
-
embed: {
|
|
125
|
-
config: {};
|
|
126
|
-
id: string;
|
|
127
|
-
url: string;
|
|
128
|
-
};
|
|
129
|
-
subtype: "jw_player";
|
|
130
|
-
type: "custom_embed";
|
|
131
|
-
};
|
|
132
|
-
twitter: (id: string, provider?: string) => {
|
|
133
|
-
referent: {
|
|
134
|
-
id: string;
|
|
135
|
-
provider: string;
|
|
136
|
-
service: "oembed";
|
|
137
|
-
type: "twitter";
|
|
138
|
-
};
|
|
139
|
-
type: "reference";
|
|
140
|
-
};
|
|
141
|
-
youtube: (id: string, provider?: string) => {
|
|
142
|
-
referent: {
|
|
143
|
-
id: string;
|
|
144
|
-
provider: string;
|
|
145
|
-
service: string;
|
|
146
|
-
type: string;
|
|
147
|
-
};
|
|
148
|
-
type: "reference";
|
|
149
|
-
};
|
|
150
|
-
facebook_video: (id: string, provider?: string) => {
|
|
151
|
-
referent: {
|
|
152
|
-
id: string;
|
|
153
|
-
provider: string;
|
|
154
|
-
service: string;
|
|
155
|
-
type: string;
|
|
156
|
-
};
|
|
157
|
-
type: "reference";
|
|
158
|
-
};
|
|
159
|
-
facebook_post: (id: string, provider?: string) => {
|
|
160
|
-
referent: {
|
|
161
|
-
id: string;
|
|
162
|
-
provider: string;
|
|
163
|
-
service: string;
|
|
164
|
-
type: string;
|
|
165
|
-
};
|
|
166
|
-
type: "reference";
|
|
167
|
-
};
|
|
168
|
-
soundcloud: (id: string, provider?: string) => {
|
|
169
|
-
referent: {
|
|
170
|
-
id: string;
|
|
171
|
-
provider: string;
|
|
172
|
-
service: string;
|
|
173
|
-
type: string;
|
|
174
|
-
};
|
|
175
|
-
type: "reference";
|
|
176
|
-
};
|
|
177
|
-
vimeo: (id: string, provider?: string) => {
|
|
178
|
-
referent: {
|
|
179
|
-
id: string;
|
|
180
|
-
provider: string;
|
|
181
|
-
service: string;
|
|
182
|
-
type: string;
|
|
183
|
-
};
|
|
184
|
-
type: "reference";
|
|
185
|
-
};
|
|
186
|
-
instagram: (id: string, provider?: string) => {
|
|
187
|
-
referent: {
|
|
188
|
-
id: string;
|
|
189
|
-
provider: string;
|
|
190
|
-
service: string;
|
|
191
|
-
type: string;
|
|
192
|
-
};
|
|
193
|
-
type: "reference";
|
|
194
|
-
};
|
|
195
|
-
dailymotion: (id: string, provider?: string) => {
|
|
196
|
-
referent: {
|
|
197
|
-
id: string;
|
|
198
|
-
provider: string;
|
|
199
|
-
service: string;
|
|
200
|
-
type: string;
|
|
201
|
-
};
|
|
202
|
-
type: "reference";
|
|
203
|
-
};
|
|
204
|
-
tiktok: (id: string, provider?: string) => {
|
|
205
|
-
referent: {
|
|
206
|
-
id: string;
|
|
207
|
-
provider: string;
|
|
208
|
-
service: string;
|
|
209
|
-
type: string;
|
|
210
|
-
};
|
|
211
|
-
type: "reference";
|
|
212
|
-
};
|
|
213
|
-
};
|
|
1
|
+
export * from './content-elements';
|
|
2
|
+
export * as HTML from './html';
|
|
@@ -1,202 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
interstitial_link: (url, content) => {
|
|
29
|
-
return {
|
|
30
|
-
type: 'interstitial_link',
|
|
31
|
-
url,
|
|
32
|
-
content,
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
header: (content, level) => {
|
|
36
|
-
return {
|
|
37
|
-
type: 'header',
|
|
38
|
-
content,
|
|
39
|
-
level,
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
raw_html: (content) => {
|
|
43
|
-
return {
|
|
44
|
-
type: 'raw_html',
|
|
45
|
-
content,
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
gallery: (id) => {
|
|
49
|
-
return {
|
|
50
|
-
type: 'reference',
|
|
51
|
-
referent: {
|
|
52
|
-
type: 'gallery',
|
|
53
|
-
id,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
list: (type, items) => {
|
|
58
|
-
return {
|
|
59
|
-
type: 'list',
|
|
60
|
-
list_type: type,
|
|
61
|
-
items,
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
link_list: (title, links) => {
|
|
65
|
-
return {
|
|
66
|
-
type: 'link_list',
|
|
67
|
-
title,
|
|
68
|
-
items: links.map(({ content, url }) => {
|
|
69
|
-
return {
|
|
70
|
-
type: 'interstitial_link',
|
|
71
|
-
content,
|
|
72
|
-
url,
|
|
73
|
-
};
|
|
74
|
-
}),
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
image: (id, properties) => {
|
|
78
|
-
return {
|
|
79
|
-
referent: {
|
|
80
|
-
id,
|
|
81
|
-
type: 'image',
|
|
82
|
-
referent_properties: {
|
|
83
|
-
_id: id,
|
|
84
|
-
type: 'image',
|
|
85
|
-
...properties,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
type: 'reference',
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
jwPlayer: (id) => {
|
|
92
|
-
return {
|
|
93
|
-
embed: {
|
|
94
|
-
config: {},
|
|
95
|
-
id,
|
|
96
|
-
url: 'https://cdn.jwplayer.com/players',
|
|
97
|
-
},
|
|
98
|
-
subtype: 'jw_player',
|
|
99
|
-
type: 'custom_embed',
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
twitter: (id, provider = 'https://publish.twitter.com/oembed?url=') => {
|
|
103
|
-
return {
|
|
104
|
-
referent: {
|
|
105
|
-
id,
|
|
106
|
-
provider,
|
|
107
|
-
service: 'oembed',
|
|
108
|
-
type: 'twitter',
|
|
109
|
-
},
|
|
110
|
-
type: 'reference',
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
youtube: (id, provider = 'https://www.youtube.com/oembed?url=') => {
|
|
114
|
-
return {
|
|
115
|
-
referent: {
|
|
116
|
-
id,
|
|
117
|
-
provider,
|
|
118
|
-
service: 'oembed',
|
|
119
|
-
type: 'youtube',
|
|
120
|
-
},
|
|
121
|
-
type: 'reference',
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
facebook_video: (id, provider = 'https://www.facebook.com/plugins/post/oembed.json/?url=') => {
|
|
125
|
-
return {
|
|
126
|
-
referent: {
|
|
127
|
-
id,
|
|
128
|
-
provider,
|
|
129
|
-
service: 'oembed',
|
|
130
|
-
type: 'facebook-video',
|
|
131
|
-
},
|
|
132
|
-
type: 'reference',
|
|
133
|
-
};
|
|
134
|
-
},
|
|
135
|
-
facebook_post: (id, provider = 'https://www.facebook.com/plugins/post/oembed.json/?url=') => {
|
|
136
|
-
return {
|
|
137
|
-
referent: {
|
|
138
|
-
id,
|
|
139
|
-
provider,
|
|
140
|
-
service: 'oembed',
|
|
141
|
-
type: 'facebook-post',
|
|
142
|
-
},
|
|
143
|
-
type: 'reference',
|
|
144
|
-
};
|
|
145
|
-
},
|
|
146
|
-
soundcloud: (id, provider = 'https://soundcloud.com/oembed.json/?url=') => {
|
|
147
|
-
return {
|
|
148
|
-
referent: {
|
|
149
|
-
id,
|
|
150
|
-
provider,
|
|
151
|
-
service: 'oembed',
|
|
152
|
-
type: 'soundcloud',
|
|
153
|
-
},
|
|
154
|
-
type: 'reference',
|
|
155
|
-
};
|
|
156
|
-
},
|
|
157
|
-
vimeo: (id, provider = 'https://vimeo.com/api/oembed.json?url=') => {
|
|
158
|
-
return {
|
|
159
|
-
referent: {
|
|
160
|
-
id,
|
|
161
|
-
provider,
|
|
162
|
-
service: 'oembed',
|
|
163
|
-
type: 'vimeo',
|
|
164
|
-
},
|
|
165
|
-
type: 'reference',
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
instagram: (id, provider = 'https://api.instagram.com/oembed?url=') => {
|
|
169
|
-
return {
|
|
170
|
-
referent: {
|
|
171
|
-
id,
|
|
172
|
-
provider,
|
|
173
|
-
service: 'oembed',
|
|
174
|
-
type: 'instagram',
|
|
175
|
-
},
|
|
176
|
-
type: 'reference',
|
|
177
|
-
};
|
|
178
|
-
},
|
|
179
|
-
dailymotion: (id, provider = 'https://www.dailymotion.com/services/oembed?url=') => {
|
|
180
|
-
return {
|
|
181
|
-
referent: {
|
|
182
|
-
id,
|
|
183
|
-
provider,
|
|
184
|
-
service: 'oembed',
|
|
185
|
-
type: 'dailymotion',
|
|
186
|
-
},
|
|
187
|
-
type: 'reference',
|
|
188
|
-
};
|
|
189
|
-
},
|
|
190
|
-
tiktok: (id, provider = 'https://www.tiktok.com/oembed?url=') => {
|
|
191
|
-
return {
|
|
192
|
-
referent: {
|
|
193
|
-
id,
|
|
194
|
-
provider,
|
|
195
|
-
service: 'oembed',
|
|
196
|
-
type: 'tiktok',
|
|
197
|
-
},
|
|
198
|
-
type: 'reference',
|
|
199
|
-
};
|
|
200
|
-
},
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
201
27
|
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.HTML = void 0;
|
|
30
|
+
__exportStar(require("./content-elements"), exports);
|
|
31
|
+
exports.HTML = __importStar(require("./html"));
|
|
202
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/content-elements/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/content-elements/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,+CAA+B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export { ArcAPI, ArcAPIType } from './api';
|
|
|
16
16
|
export { ArcUtils } from './utils/arc';
|
|
17
17
|
export { ArcError } from './api/error';
|
|
18
18
|
export { WsClient } from './api/ws.client';
|
|
19
|
-
export { ContentElement, ContentElementType } from './content-elements';
|
|
20
19
|
export * as AnsMapper from './mapper';
|
|
20
|
+
export * as ContentElements from './content-elements';
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.ContentElements = exports.AnsMapper = exports.WsClient = exports.ArcError = exports.ArcUtils = exports.ArcAPI = exports.ArcTypes = void 0;
|
|
30
30
|
exports.ArcTypes = __importStar(require("./types"));
|
|
31
31
|
__exportStar(require("./api/identity/types"), exports);
|
|
32
32
|
__exportStar(require("./api/draft/types"), exports);
|
|
@@ -49,7 +49,6 @@ var error_1 = require("./api/error");
|
|
|
49
49
|
Object.defineProperty(exports, "ArcError", { enumerable: true, get: function () { return error_1.ArcError; } });
|
|
50
50
|
var ws_client_1 = require("./api/ws.client");
|
|
51
51
|
Object.defineProperty(exports, "WsClient", { enumerable: true, get: function () { return ws_client_1.WsClient; } });
|
|
52
|
-
var content_elements_1 = require("./content-elements");
|
|
53
|
-
Object.defineProperty(exports, "ContentElement", { enumerable: true, get: function () { return content_elements_1.ContentElement; } });
|
|
54
52
|
exports.AnsMapper = __importStar(require("./mapper"));
|
|
53
|
+
exports.ContentElements = __importStar(require("./content-elements"));
|
|
55
54
|
//# 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,oDAAoC;AACpC,uDAAqC;AACrC,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,uDAAqC;AACrC,+DAA6C;AAC7C,oDAAkC;AAClC,sDAAoC;AACpC,sDAAoC;AACpC,2DAAyC;AACzC,8DAA4C;AAC5C,mDAAiC;AACjC,0DAAwC;AAExC,6BAA2C;AAAlC,6FAAA,MAAM,OAAA;AACf,mCAAuC;AAA9B,+FAAA,QAAQ,OAAA;AACjB,qCAAuC;AAA9B,iGAAA,QAAQ,OAAA;AACjB,6CAA2C;AAAlC,qGAAA,QAAQ,OAAA;AACjB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAoC;AACpC,uDAAqC;AACrC,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,uDAAqC;AACrC,+DAA6C;AAC7C,oDAAkC;AAClC,sDAAoC;AACpC,sDAAoC;AACpC,2DAAyC;AACzC,8DAA4C;AAC5C,mDAAiC;AACjC,0DAAwC;AAExC,6BAA2C;AAAlC,6FAAA,MAAM,OAAA;AACf,mCAAuC;AAA9B,+FAAA,QAAQ,OAAA;AACjB,qCAAuC;AAA9B,iGAAA,QAAQ,OAAA;AACjB,6CAA2C;AAAlC,qGAAA,QAAQ,OAAA;AACjB,sDAAsC;AACtC,sEAAsD"}
|
package/dist/mapper/doc.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { ArcTypes } from '..';
|
|
1
2
|
import type { ANSContent, CirculationReference, PostANSParams, PostANSPayload } from '../api/migration-center/types';
|
|
2
|
-
import type { ArcTypes, ContentElementType } from '..';
|
|
3
3
|
import type { MaybePromise, Optional } from '../types/utils';
|
|
4
4
|
/**
|
|
5
5
|
* Base class for all arc entities, it provides common methods and properties
|
|
@@ -40,7 +40,7 @@ export declare abstract class Document<ANS extends ANSContent> {
|
|
|
40
40
|
protected getDescription(): Optional<ArcTypes.Story.Description>;
|
|
41
41
|
protected formatDate(date?: Date): string | undefined;
|
|
42
42
|
protected getDisplayDate(): Optional<Date>;
|
|
43
|
-
protected getContentElements(): Promise<ContentElementType<any>[]>;
|
|
43
|
+
protected getContentElements(): Promise<ArcTypes.ContentElements.ContentElementType<any>[]>;
|
|
44
44
|
protected getPublicationDate(): Optional<Date>;
|
|
45
45
|
protected getHeadlines(): Optional<ArcTypes.Story.Headlines>;
|
|
46
46
|
protected getTags(): MaybePromise<Optional<ArcTypes.Story.Tag[]>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
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 node_fs_1 = require("node:fs");
|
|
7
|
+
const promises_1 = require("node:fs/promises");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const vitest_1 = require("vitest");
|
|
10
|
+
const html_1 = require("../../content-elements/html");
|
|
11
|
+
const suitesDir = node_path_1.default.join(__dirname, '../__fixtures__/html-processor');
|
|
12
|
+
const suites = (0, node_fs_1.readdirSync)(suitesDir)
|
|
13
|
+
.filter((f) => f.endsWith('.json'))
|
|
14
|
+
.map((f) => f.replace('.json', ''));
|
|
15
|
+
(0, vitest_1.describe)('HTMLProcessor', () => {
|
|
16
|
+
for (const suite of suites) {
|
|
17
|
+
(0, vitest_1.test)(`suite: ${suite}`, async () => {
|
|
18
|
+
const { output, expected } = await getSuite(suite);
|
|
19
|
+
(0, vitest_1.expect)(output).toBeDefined();
|
|
20
|
+
(0, vitest_1.expect)(output).toMatchObject(expected);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
async function getSuite(suite) {
|
|
25
|
+
const body = await (0, promises_1.readFile)(node_path_1.default.join(suitesDir, `${suite}.html`), 'utf-8');
|
|
26
|
+
const expected = await (0, promises_1.readFile)(node_path_1.default.join(suitesDir, `${suite}.json`), 'utf-8');
|
|
27
|
+
const processor = new html_1.HTMLProcessor();
|
|
28
|
+
processor.init();
|
|
29
|
+
const output = await processor.parse(body);
|
|
30
|
+
return {
|
|
31
|
+
output,
|
|
32
|
+
expected: JSON.parse(expected),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=html.processor.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.processor.test.js","sourceRoot":"","sources":["../../../src/tests/content-elements/html.processor.test.ts"],"names":[],"mappings":";;;;;AAAA,qCAAsC;AACtC,+CAA4C;AAC5C,0DAA6B;AAC7B,mCAAgD;AAChD,sDAA4D;AAE5D,MAAM,SAAS,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gCAAgC,CAAC,CAAC;AACzE,MAAM,MAAM,GAAG,IAAA,qBAAW,EAAC,SAAS,CAAC;KAClC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;KAClC,GAAG,C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../types/story';
|
|
3
|
+
export type CElement = AnElementThatCanBeListedAsPartOfContentElements;
|
|
4
|
+
export type ContentElementType<T extends keyof typeof ContentElement> = ReturnType<(typeof ContentElement)[T]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-elements.js","sourceRoot":"","sources":["../../src/types/content-elements.ts"],"names":[],"mappings":""}
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -23,11 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Utils = exports.Video = exports.Gallery = exports.Section = exports.Story = exports.Author = void 0;
|
|
26
|
+
exports.ContentElements = exports.Utils = exports.Video = exports.Gallery = exports.Section = exports.Story = exports.Author = void 0;
|
|
27
27
|
exports.Author = __importStar(require("./author"));
|
|
28
28
|
exports.Story = __importStar(require("./story"));
|
|
29
29
|
exports.Section = __importStar(require("./section"));
|
|
30
30
|
exports.Gallery = __importStar(require("./gallery"));
|
|
31
31
|
exports.Video = __importStar(require("./video"));
|
|
32
32
|
exports.Utils = __importStar(require("./utils"));
|
|
33
|
+
exports.ContentElements = __importStar(require("./content-elements"));
|
|
33
34
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAmC;AACnC,iDAAiC;AACjC,qDAAqC;AACrC,qDAAqC;AACrC,iDAAiC;AACjC,iDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAmC;AACnC,iDAAiC;AACjC,qDAAqC;AACrC,qDAAqC;AACrC,iDAAiC;AACjC,iDAAiC;AACjC,sEAAsD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ContentElementType } from '../../types/content-elements';
|
|
2
2
|
export declare function youtubeURLParser(url?: string | null): string | undefined;
|
|
3
3
|
export declare function twitterURLParser(url: string): string | undefined;
|
|
4
4
|
export declare function instagramURLParser(url: string): string | undefined;
|
|
@@ -6,3 +6,4 @@ export declare function tiktokURLParser(url: string): string | undefined;
|
|
|
6
6
|
export declare function facebookVideoURLParser(url: string): string | undefined;
|
|
7
7
|
export declare function facebookPostURLParser(url: string): string | undefined;
|
|
8
8
|
export declare function createSocial(url?: string): ContentElementType<'instagram' | 'tiktok' | 'youtube' | 'twitter'>[];
|
|
9
|
+
export declare const randomId: () => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSocial = exports.facebookPostURLParser = exports.facebookVideoURLParser = exports.tiktokURLParser = exports.instagramURLParser = exports.twitterURLParser = exports.youtubeURLParser = void 0;
|
|
3
|
+
exports.randomId = exports.createSocial = exports.facebookPostURLParser = exports.facebookVideoURLParser = exports.tiktokURLParser = exports.instagramURLParser = exports.twitterURLParser = exports.youtubeURLParser = void 0;
|
|
4
4
|
const content_elements_1 = require("../../content-elements");
|
|
5
5
|
const socialRegExps = {
|
|
6
6
|
instagram: /(?:https?:\/\/)?(?:www.)?instagram.com\/?([a-zA-Z0-9\.\_\-]+)?\/([p]+)?([reel]+)?([tv]+)?([stories]+)?\/([a-zA-Z0-9\-\_\.]+)\/?([0-9]+)?/,
|
|
@@ -74,4 +74,6 @@ function createSocial(url = '') {
|
|
|
74
74
|
return embeds;
|
|
75
75
|
}
|
|
76
76
|
exports.createSocial = createSocial;
|
|
77
|
+
const randomId = () => `${new Date().toISOString()}-${Math.random()}`;
|
|
78
|
+
exports.randomId = randomId;
|
|
77
79
|
//# sourceMappingURL=content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/utils/arc/content.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/utils/arc/content.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAGxD,MAAM,aAAa,GAAG;IACpB,SAAS,EACP,0IAA0I;IAC5I,OAAO,EAAE,gEAAgE;IACzE,MAAM,EACJ,kHAAkH;IACpH,YAAY,EACV,sHAAsH;IACxH,aAAa,EAAE,kEAAkE;CAClF,CAAC;AAEF,SAAS,KAAK,CAAC,GAAW,EAAE,KAAa;IACvC,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,SAAgB,gBAAgB,CAAC,MAAqB,EAAE;IACtD,MAAM,MAAM,GACV,sHAAsH,CAAC;IACzH,MAAM,EAAE,GAAG,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnC,IAAI,EAAE,EAAE,CAAC;QACP,OAAO,oBAAoB,EAAE,EAAE,CAAC;IAClC,CAAC;IAED,MAAM,YAAY,GAAG,GAAG,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACtD,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtB,OAAO,kDAAkD,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/E,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAdD,4CAcC;AAED,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,OAAO,KAAK,CAAC,GAAG,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC;AAFD,4CAEC;AAED,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,KAAK,CAAC,GAAG,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;AAC7C,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