@xylabs/sdk-meta 4.13.20 → 4.13.21
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 +607 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,13 +12,617 @@
|
|
|
12
12
|
[![snyk-badge][]][snyk-link]
|
|
13
13
|
[![socket-badge][]][socket-link]
|
|
14
14
|
|
|
15
|
-
Version: 4.13.19
|
|
16
15
|
|
|
17
16
|
Base functionality used throughout XYO TypeScript/JavaScript libraries
|
|
18
17
|
|
|
19
|
-
## Documentation
|
|
18
|
+
## API Documentation
|
|
19
|
+
|
|
20
|
+
**@xylabs/sdk-meta**
|
|
21
|
+
|
|
22
|
+
***
|
|
23
|
+
|
|
24
|
+
## Interfaces
|
|
25
|
+
|
|
26
|
+
- [Meta](#interfaces/Meta)
|
|
27
|
+
- [OpenGraphMeta](#interfaces/OpenGraphMeta)
|
|
28
|
+
- [OpenGraphStructured](#interfaces/OpenGraphStructured)
|
|
29
|
+
- [TwitterMeta](#interfaces/TwitterMeta)
|
|
30
|
+
- [TwitterApp](#interfaces/TwitterApp)
|
|
31
|
+
- [TwitterPlayer](#interfaces/TwitterPlayer)
|
|
32
|
+
|
|
33
|
+
## Type Aliases
|
|
34
|
+
|
|
35
|
+
- [StringIndexable](#type-aliases/StringIndexable)
|
|
36
|
+
- [OpenGraphStructuredProperty](#type-aliases/OpenGraphStructuredProperty)
|
|
37
|
+
|
|
38
|
+
## Functions
|
|
39
|
+
|
|
40
|
+
- [mergeDocumentHead](#functions/mergeDocumentHead)
|
|
41
|
+
- [getMetaAsDict](#functions/getMetaAsDict)
|
|
42
|
+
- [metaBuilder](#functions/metaBuilder)
|
|
43
|
+
|
|
44
|
+
### functions
|
|
45
|
+
|
|
46
|
+
### <a id="getMetaAsDict"></a>getMetaAsDict
|
|
47
|
+
|
|
48
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
49
|
+
|
|
50
|
+
***
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
function getMetaAsDict(obj, parentKey?): Record<string, string>;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Parameters
|
|
57
|
+
|
|
58
|
+
### obj
|
|
59
|
+
|
|
60
|
+
[`StringIndexable`](#../type-aliases/StringIndexable)
|
|
61
|
+
|
|
62
|
+
### parentKey?
|
|
63
|
+
|
|
64
|
+
`string`
|
|
65
|
+
|
|
66
|
+
## Returns
|
|
67
|
+
|
|
68
|
+
`Record`\<`string`, `string`\>
|
|
69
|
+
|
|
70
|
+
### <a id="mergeDocumentHead"></a>mergeDocumentHead
|
|
71
|
+
|
|
72
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
73
|
+
|
|
74
|
+
***
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
function mergeDocumentHead(destination, source): string;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Parameters
|
|
81
|
+
|
|
82
|
+
### destination
|
|
83
|
+
|
|
84
|
+
`string`
|
|
85
|
+
|
|
86
|
+
### source
|
|
87
|
+
|
|
88
|
+
`string`
|
|
89
|
+
|
|
90
|
+
## Returns
|
|
91
|
+
|
|
92
|
+
`string`
|
|
93
|
+
|
|
94
|
+
### <a id="metaBuilder"></a>metaBuilder
|
|
95
|
+
|
|
96
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
97
|
+
|
|
98
|
+
***
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
function metaBuilder(
|
|
102
|
+
html,
|
|
103
|
+
meta,
|
|
104
|
+
handler?): string;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Parameters
|
|
108
|
+
|
|
109
|
+
### html
|
|
110
|
+
|
|
111
|
+
`string`
|
|
112
|
+
|
|
113
|
+
### meta
|
|
114
|
+
|
|
115
|
+
[`Meta`](#../interfaces/Meta)
|
|
116
|
+
|
|
117
|
+
### handler?
|
|
118
|
+
|
|
119
|
+
`string`
|
|
120
|
+
|
|
121
|
+
## Returns
|
|
122
|
+
|
|
123
|
+
`string`
|
|
124
|
+
|
|
125
|
+
### interfaces
|
|
126
|
+
|
|
127
|
+
### <a id="Meta"></a>Meta
|
|
128
|
+
|
|
129
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
130
|
+
|
|
131
|
+
***
|
|
132
|
+
|
|
133
|
+
## Properties
|
|
134
|
+
|
|
135
|
+
### description?
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
optional description: string;
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
***
|
|
142
|
+
|
|
143
|
+
### og?
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
optional og: OpenGraphMeta;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
***
|
|
150
|
+
|
|
151
|
+
### title?
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
optional title: string;
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
***
|
|
158
|
+
|
|
159
|
+
### twitter?
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
optional twitter: TwitterMeta;
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### <a id="OpenGraphMeta"></a>OpenGraphMeta
|
|
166
|
+
|
|
167
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
168
|
+
|
|
169
|
+
***
|
|
170
|
+
|
|
171
|
+
## Properties
|
|
172
|
+
|
|
173
|
+
### audio?
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
optional audio: OpenGraphStructuredProperty;
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
***
|
|
180
|
+
|
|
181
|
+
### description?
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
optional description: string;
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
***
|
|
188
|
+
|
|
189
|
+
### determiner?
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
optional determiner: string;
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
***
|
|
196
|
+
|
|
197
|
+
### image?
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
optional image: OpenGraphStructuredProperty;
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
***
|
|
204
|
+
|
|
205
|
+
### locale?
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
optional locale: string | string[];
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
***
|
|
212
|
+
|
|
213
|
+
### site\_name?
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
optional site_name: string;
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
***
|
|
220
|
+
|
|
221
|
+
### title?
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
optional title: string;
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
***
|
|
228
|
+
|
|
229
|
+
### type?
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
optional type: string;
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
***
|
|
236
|
+
|
|
237
|
+
### url?
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
optional url: string;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
***
|
|
244
|
+
|
|
245
|
+
### video?
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
optional video: OpenGraphStructuredProperty;
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### <a id="OpenGraphStructured"></a>OpenGraphStructured
|
|
252
|
+
|
|
253
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
254
|
+
|
|
255
|
+
***
|
|
256
|
+
|
|
257
|
+
## Properties
|
|
258
|
+
|
|
259
|
+
### ?
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
optional : string;
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
***
|
|
266
|
+
|
|
267
|
+
### alt?
|
|
268
|
+
|
|
269
|
+
```ts
|
|
270
|
+
optional alt: string;
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
***
|
|
274
|
+
|
|
275
|
+
### height?
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
optional height: number;
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
***
|
|
282
|
+
|
|
283
|
+
### secure\_url?
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
optional secure_url: string;
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
***
|
|
290
|
+
|
|
291
|
+
### type?
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
optional type: string;
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
***
|
|
298
|
+
|
|
299
|
+
### url?
|
|
300
|
+
|
|
301
|
+
```ts
|
|
302
|
+
optional url: string;
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
***
|
|
306
|
+
|
|
307
|
+
### width?
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
optional width: number;
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### <a id="TwitterApp"></a>TwitterApp
|
|
314
|
+
|
|
315
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
316
|
+
|
|
317
|
+
***
|
|
318
|
+
|
|
319
|
+
## Properties
|
|
320
|
+
|
|
321
|
+
### id?
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
optional id: object;
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### googleplay?
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
optional googleplay: string;
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### ipad?
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
optional ipad: string;
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### iphone?
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
optional iphone: string;
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
***
|
|
346
|
+
|
|
347
|
+
### name?
|
|
348
|
+
|
|
349
|
+
```ts
|
|
350
|
+
optional name: object;
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### googleplay?
|
|
354
|
+
|
|
355
|
+
```ts
|
|
356
|
+
optional googleplay: string;
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### ipad?
|
|
360
|
+
|
|
361
|
+
```ts
|
|
362
|
+
optional ipad: string;
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### iphone?
|
|
366
|
+
|
|
367
|
+
```ts
|
|
368
|
+
optional iphone: string;
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
***
|
|
372
|
+
|
|
373
|
+
### url?
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
optional url: object;
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### googleplay?
|
|
380
|
+
|
|
381
|
+
```ts
|
|
382
|
+
optional googleplay: string;
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### ipad?
|
|
386
|
+
|
|
387
|
+
```ts
|
|
388
|
+
optional ipad: string;
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### iphone?
|
|
392
|
+
|
|
393
|
+
```ts
|
|
394
|
+
optional iphone: string;
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### <a id="TwitterMeta"></a>TwitterMeta
|
|
398
|
+
|
|
399
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
400
|
+
|
|
401
|
+
***
|
|
402
|
+
|
|
403
|
+
https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup
|
|
404
|
+
|
|
405
|
+
## Properties
|
|
406
|
+
|
|
407
|
+
### app?
|
|
408
|
+
|
|
409
|
+
```ts
|
|
410
|
+
optional app: TwitterApp;
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
***
|
|
414
|
+
|
|
415
|
+
### card?
|
|
416
|
+
|
|
417
|
+
```ts
|
|
418
|
+
optional card: "summary" | "summary_large_image" | "app" | "player";
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
The card type. Used with all cards. Fallback: og:type.
|
|
422
|
+
If an og:type, og:title and og:description exist in the markup but
|
|
423
|
+
twitter:card is absent, then a summary card may be rendered.
|
|
424
|
+
|
|
425
|
+
***
|
|
426
|
+
|
|
427
|
+
### creator?
|
|
428
|
+
|
|
429
|
+
```ts
|
|
430
|
+
optional creator: object;
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### ?
|
|
434
|
+
|
|
435
|
+
```ts
|
|
436
|
+
optional : string;
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
The
|
|
440
|
+
|
|
441
|
+
#### Username
|
|
442
|
+
|
|
443
|
+
of content creator. Used with summary_large_image cards
|
|
444
|
+
|
|
445
|
+
### id?
|
|
446
|
+
|
|
447
|
+
```ts
|
|
448
|
+
optional id: string;
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Twitter user ID of content creator. Used with summary,
|
|
452
|
+
summary_large_image cards
|
|
453
|
+
|
|
454
|
+
***
|
|
455
|
+
|
|
456
|
+
### description?
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
optional description: string;
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Description of content (maximum 200 characters). Used with summary,
|
|
463
|
+
summary_large_image, player cards. Fallback: og:description.
|
|
464
|
+
|
|
465
|
+
***
|
|
466
|
+
|
|
467
|
+
### image?
|
|
468
|
+
|
|
469
|
+
```ts
|
|
470
|
+
optional image: object;
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### ?
|
|
474
|
+
|
|
475
|
+
```ts
|
|
476
|
+
optional : string;
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
URL of image to use in the card. Images must be less than 5MB in size.
|
|
480
|
+
JPG, PNG, WEBP and GIF formats are supported. Only the first frame of
|
|
481
|
+
an animated GIF will be used. SVG is not supported. Used with summary,
|
|
482
|
+
summary_large_image, player cards. Fallback: og:image
|
|
483
|
+
|
|
484
|
+
### alt?
|
|
485
|
+
|
|
486
|
+
```ts
|
|
487
|
+
optional alt: string;
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
A text description of the image conveying the essential nature of
|
|
491
|
+
an image to users who are visually impaired. Maximum 420
|
|
492
|
+
characters. Used with summary, summary_large_image, player cards
|
|
493
|
+
|
|
494
|
+
***
|
|
495
|
+
|
|
496
|
+
### player?
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
optional player: TwitterPlayer;
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
***
|
|
503
|
+
|
|
504
|
+
### site?
|
|
505
|
+
|
|
506
|
+
```ts
|
|
507
|
+
optional site: object;
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
The
|
|
511
|
+
|
|
512
|
+
### ?
|
|
513
|
+
|
|
514
|
+
```ts
|
|
515
|
+
optional : string;
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### id?
|
|
519
|
+
|
|
520
|
+
```ts
|
|
521
|
+
optional id: string;
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
Same as twitter:site, but the user’s Twitter ID. Either
|
|
525
|
+
twitter:site or twitter:site:id is required. Used with
|
|
526
|
+
summary, summary_large_image, player cards
|
|
527
|
+
|
|
528
|
+
### Username
|
|
529
|
+
|
|
530
|
+
of website. Either twitter:site or twitter:site:id is
|
|
531
|
+
required. Used with summary, summary_large_image, app, player
|
|
532
|
+
cards
|
|
533
|
+
|
|
534
|
+
***
|
|
535
|
+
|
|
536
|
+
### title?
|
|
537
|
+
|
|
538
|
+
```ts
|
|
539
|
+
optional title: string;
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
Title of content (max 70 characters). Used with summary,
|
|
543
|
+
summary_large_image, player cards. Fallback: og:title.
|
|
544
|
+
|
|
545
|
+
### <a id="TwitterPlayer"></a>TwitterPlayer
|
|
546
|
+
|
|
547
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
548
|
+
|
|
549
|
+
***
|
|
550
|
+
|
|
551
|
+
https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/player-card
|
|
552
|
+
|
|
553
|
+
## Properties
|
|
554
|
+
|
|
555
|
+
###
|
|
556
|
+
|
|
557
|
+
```ts
|
|
558
|
+
: string;
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
HTTPS URL to iFrame player. This must be a HTTPS URL which does not
|
|
562
|
+
generate active mixed content warnings in a web browser. The audio or
|
|
563
|
+
video player must not require plugins such as Adobe Flash.
|
|
564
|
+
|
|
565
|
+
***
|
|
566
|
+
|
|
567
|
+
### height?
|
|
568
|
+
|
|
569
|
+
```ts
|
|
570
|
+
optional height: number;
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
Height of iframe in pixels. Used with player card
|
|
574
|
+
|
|
575
|
+
***
|
|
576
|
+
|
|
577
|
+
### stream?
|
|
578
|
+
|
|
579
|
+
```ts
|
|
580
|
+
optional stream: string;
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
URL to raw video or audio stream. Used with player card
|
|
584
|
+
|
|
585
|
+
***
|
|
586
|
+
|
|
587
|
+
### width?
|
|
588
|
+
|
|
589
|
+
```ts
|
|
590
|
+
optional width: number;
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
Width of iframe in pixels. Used with player card
|
|
594
|
+
|
|
595
|
+
### type-aliases
|
|
596
|
+
|
|
597
|
+
### <a id="OpenGraphStructuredProperty"></a>OpenGraphStructuredProperty
|
|
598
|
+
|
|
599
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
600
|
+
|
|
601
|
+
***
|
|
602
|
+
|
|
603
|
+
```ts
|
|
604
|
+
type OpenGraphStructuredProperty =
|
|
605
|
+
| string
|
|
606
|
+
| OpenGraphStructured
|
|
607
|
+
| (string | OpenGraphStructured)[];
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### <a id="StringIndexable"></a>StringIndexable
|
|
611
|
+
|
|
612
|
+
[**@xylabs/sdk-meta**](#../README)
|
|
613
|
+
|
|
614
|
+
***
|
|
615
|
+
|
|
616
|
+
```ts
|
|
617
|
+
type StringIndexable = object;
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
## Index Signature
|
|
621
|
+
|
|
622
|
+
```ts
|
|
623
|
+
[key: string]: any
|
|
624
|
+
```
|
|
20
625
|
|
|
21
|
-
Coming Soon!
|
|
22
626
|
|
|
23
627
|
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
24
628
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/sdk-meta",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.21",
|
|
4
4
|
"description": "Base functionality used throughout XYO TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"meta",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@xylabs/typeof": "^4.13.
|
|
40
|
+
"@xylabs/typeof": "^4.13.21",
|
|
41
41
|
"cheerio": "^1.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|