5etools-utils 0.9.13 → 0.9.15

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/lib/UtilClean.js CHANGED
@@ -3,12 +3,14 @@ const _CLEAN_JSON_REPLACEMENTS = {
3
3
  "–": "\\u2013",
4
4
  "‑": "\\u2011",
5
5
  "−": "\\u2212",
6
- "": `\\"`,
7
- "”": `\\"`,
6
+ " ": "\\u00A0",
7
+
8
8
  "’": "'",
9
9
  "‘": "'",
10
+ "’": "'",
10
11
  "…": "...",
11
- " ": "\\u00A0",
12
+ "\u200B": "", // zero-width space
13
+ "\u2002": " ", // em space
12
14
  "ff": "ff",
13
15
  "ffi": "ffi",
14
16
  "ffl": "ffl",
@@ -23,6 +25,9 @@ const _CLEAN_JSON_REPLACEMENTS = {
23
25
  "Nj": "Nj",
24
26
  "nj": "nj",
25
27
  "ſt": "ft",
28
+ "“": `"`,
29
+ "”": `"`,
30
+ "\u201a": ",",
26
31
  };
27
32
  const _CLEAN_JSON_REPLACEMENT_REGEX = new RegExp(Object.keys(_CLEAN_JSON_REPLACEMENTS).join("|"), "g");
28
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5etools-utils",
3
- "version": "0.9.13",
3
+ "version": "0.9.15",
4
4
  "description": "Shared utilities for the 5etools ecosystem.",
5
5
  "type": "module",
6
6
  "main": "lib/Api.js",
@@ -1,41 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "fluff-recipes.json",
4
- "version": "1.1.2",
4
+ "version": "1.2.0",
5
5
  "type": "object",
6
6
  "properties": {
7
+ "_meta": {
8
+ "$ref": "util.json#/$defs/metaBlock"
9
+ },
7
10
  "recipeFluff": {
8
- "type": "array",
9
- "minItems": 1,
10
- "uniqueItems": true,
11
- "items": {
12
- "type": "object",
13
- "properties": {
14
- "name": {
15
- "type": "string"
16
- },
17
- "source": {
18
- "$ref": "util.json#/$defs/source"
19
- },
20
- "images": {
21
- "type": "array",
22
- "items": {
23
- "$ref": "entry.json#/$defs/entryImage"
24
- }
25
- },
26
- "entries": {
27
- "type": "array",
28
- "items": {
29
- "$ref": "entry.json"
30
- }
31
- }
32
- },
33
- "required": [
34
- "name",
35
- "source"
36
- ],
37
- "additionalProperties": false
38
- }
11
+ "$ref": "util.json#/$defs/genericFluffArray"
39
12
  }
40
13
  },
41
14
  "additionalProperties": false
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "recipes.json",
4
- "version": "1.2.6",
4
+ "version": "1.4.0",
5
5
  "type": "object",
6
6
  "$defs": {
7
- "recipe": {
7
+ "recipeData": {
8
8
  "type": "object",
9
9
  "properties": {
10
10
  "name": {
@@ -19,15 +19,18 @@
19
19
  "time": {
20
20
  "type": "object",
21
21
  "properties": {
22
+ "total": {
23
+ "$ref": "util-time.json#/$defs/timeMinutes"
24
+ },
22
25
  "cooking": {
23
- "$ref": "util-time.json#/$defs/time"
26
+ "$ref": "util-time.json#/$defs/timeMinutes"
24
27
  },
25
28
  "preparation": {
26
- "$ref": "util-time.json#/$defs/time"
29
+ "$ref": "util-time.json#/$defs/timeMinutes"
27
30
  }
28
31
  },
29
32
  "additionalProperties": false,
30
- "minProperties": 2
33
+ "minProperties": 1
31
34
  },
32
35
  "serves": {
33
36
  "oneOf": [
@@ -178,16 +181,450 @@
178
181
  "$ref": "util.json#/$defs/foundryImg"
179
182
  }
180
183
  },
181
- "required": [
182
- "name",
183
- "source",
184
- "instructions",
185
- "ingredients"
186
- ],
187
184
  "additionalProperties": false
185
+ },
186
+ "recipe": {
187
+ "anyOf": [
188
+ {
189
+ "type": "object",
190
+ "properties": {
191
+ "name": {
192
+ "type": "string"
193
+ },
194
+ "source": {
195
+ "$ref": "util.json#/$defs/source"
196
+ },
197
+ "page": {
198
+ "$ref": "util.json#/$defs/page"
199
+ },
200
+ "time": {
201
+ "type": "object",
202
+ "properties": {
203
+ "total": {
204
+ "$ref": "util-time.json#/$defs/timeMinutes"
205
+ },
206
+ "cooking": {
207
+ "$ref": "util-time.json#/$defs/timeMinutes"
208
+ },
209
+ "preparation": {
210
+ "$ref": "util-time.json#/$defs/timeMinutes"
211
+ }
212
+ },
213
+ "additionalProperties": false,
214
+ "minProperties": 1
215
+ },
216
+ "serves": {
217
+ "oneOf": [
218
+ {
219
+ "type": "object",
220
+ "properties": {
221
+ "min": {
222
+ "type": "integer"
223
+ },
224
+ "max": {
225
+ "type": "integer"
226
+ },
227
+ "note": {
228
+ "$ref": "entry.json"
229
+ }
230
+ },
231
+ "required": [
232
+ "min",
233
+ "max"
234
+ ],
235
+ "additionalProperties": false
236
+ },
237
+ {
238
+ "type": "object",
239
+ "properties": {
240
+ "exact": {
241
+ "type": "integer"
242
+ },
243
+ "note": {
244
+ "$ref": "entry.json"
245
+ }
246
+ },
247
+ "required": [
248
+ "exact"
249
+ ],
250
+ "additionalProperties": false
251
+ }
252
+ ]
253
+ },
254
+ "makes": {
255
+ "$ref": "entry.json"
256
+ },
257
+ "ingredients": {
258
+ "type": "array",
259
+ "items": {
260
+ "$ref": "entry.json"
261
+ }
262
+ },
263
+ "equipment": {
264
+ "type": "array",
265
+ "items": {
266
+ "$ref": "entry.json"
267
+ }
268
+ },
269
+ "instructions": {
270
+ "type": "array",
271
+ "items": {
272
+ "$ref": "entry.json"
273
+ }
274
+ },
275
+ "noteCook": {
276
+ "type": "array",
277
+ "items": {
278
+ "$ref": "entry.json"
279
+ }
280
+ },
281
+ "type": {
282
+ "type": "string",
283
+ "examples": [
284
+ "Dwarven",
285
+ "Elven",
286
+ "Elixir/Ale",
287
+ "Human",
288
+ "Halfling",
289
+ "Uncommon Cuisine"
290
+ ]
291
+ },
292
+ "diet": {
293
+ "type": "string",
294
+ "description": "C: Vegetarian [aka \"cheese\"]\n V: Vegan\n X: Omnivorous",
295
+ "enum": [
296
+ "C",
297
+ "V",
298
+ "X"
299
+ ]
300
+ },
301
+ "miscTags": {
302
+ "type": "array",
303
+ "items": {
304
+ "type": "string",
305
+ "enum": [
306
+ "alcohol"
307
+ ]
308
+ }
309
+ },
310
+ "allergenGroups": {
311
+ "type": "array",
312
+ "description": "One of the 14 major food allergens; see https://erudus.com/food-allergens for more information.",
313
+ "items": {
314
+ "type": "string",
315
+ "enum": [
316
+ "celery",
317
+ "crustaceans",
318
+ "eggs",
319
+ "fish",
320
+ "gluten",
321
+ "lupin",
322
+ "milk",
323
+ "molluscs",
324
+ "mustard",
325
+ "nuts",
326
+ "peanuts",
327
+ "sesame",
328
+ "soya",
329
+ "sulphites"
330
+ ]
331
+ }
332
+ },
333
+ "dishTypes": {
334
+ "type": "array",
335
+ "items": {
336
+ "type": "string",
337
+ "examples": [
338
+ "appetizer",
339
+ "bread",
340
+ "cocktail",
341
+ "dessert",
342
+ "drink",
343
+ "entree",
344
+ "pastry",
345
+ "salad",
346
+ "side",
347
+ "snack",
348
+ "soup"
349
+ ]
350
+ }
351
+ },
352
+ "hasFluff": {
353
+ "type": "boolean"
354
+ },
355
+ "hasFluffImages": {
356
+ "type": "boolean"
357
+ },
358
+ "fluff": {
359
+ "$ref": "util.json#/$defs/fluffObject"
360
+ },
361
+ "foundryImg": {
362
+ "$ref": "util.json#/$defs/foundryImg"
363
+ }
364
+ },
365
+ "additionalProperties": false,
366
+ "required": [
367
+ "name",
368
+ "source",
369
+ "instructions",
370
+ "ingredients"
371
+ ]
372
+ },
373
+ {
374
+ "type": "object",
375
+ "properties": {
376
+ "name": {
377
+ "type": "string"
378
+ },
379
+ "source": {
380
+ "$ref": "util.json#/$defs/source"
381
+ },
382
+ "page": {
383
+ "$ref": "util.json#/$defs/page"
384
+ },
385
+ "time": {
386
+ "type": "object",
387
+ "properties": {
388
+ "total": {
389
+ "$ref": "util-time.json#/$defs/timeMinutes"
390
+ },
391
+ "cooking": {
392
+ "$ref": "util-time.json#/$defs/timeMinutes"
393
+ },
394
+ "preparation": {
395
+ "$ref": "util-time.json#/$defs/timeMinutes"
396
+ }
397
+ },
398
+ "additionalProperties": false,
399
+ "minProperties": 1
400
+ },
401
+ "serves": {
402
+ "oneOf": [
403
+ {
404
+ "type": "object",
405
+ "properties": {
406
+ "min": {
407
+ "type": "integer"
408
+ },
409
+ "max": {
410
+ "type": "integer"
411
+ },
412
+ "note": {
413
+ "$ref": "entry.json"
414
+ }
415
+ },
416
+ "required": [
417
+ "min",
418
+ "max"
419
+ ],
420
+ "additionalProperties": false
421
+ },
422
+ {
423
+ "type": "object",
424
+ "properties": {
425
+ "exact": {
426
+ "type": "integer"
427
+ },
428
+ "note": {
429
+ "$ref": "entry.json"
430
+ }
431
+ },
432
+ "required": [
433
+ "exact"
434
+ ],
435
+ "additionalProperties": false
436
+ }
437
+ ]
438
+ },
439
+ "makes": {
440
+ "$ref": "entry.json"
441
+ },
442
+ "ingredients": {
443
+ "type": "array",
444
+ "items": {
445
+ "$ref": "entry.json"
446
+ }
447
+ },
448
+ "equipment": {
449
+ "type": "array",
450
+ "items": {
451
+ "$ref": "entry.json"
452
+ }
453
+ },
454
+ "instructions": {
455
+ "type": "array",
456
+ "items": {
457
+ "$ref": "entry.json"
458
+ }
459
+ },
460
+ "noteCook": {
461
+ "type": "array",
462
+ "items": {
463
+ "$ref": "entry.json"
464
+ }
465
+ },
466
+ "type": {
467
+ "type": "string",
468
+ "examples": [
469
+ "Dwarven",
470
+ "Elven",
471
+ "Elixir/Ale",
472
+ "Human",
473
+ "Halfling",
474
+ "Uncommon Cuisine"
475
+ ]
476
+ },
477
+ "diet": {
478
+ "type": "string",
479
+ "description": "C: Vegetarian [aka \"cheese\"]\n V: Vegan\n X: Omnivorous",
480
+ "enum": [
481
+ "C",
482
+ "V",
483
+ "X"
484
+ ]
485
+ },
486
+ "miscTags": {
487
+ "type": "array",
488
+ "items": {
489
+ "type": "string",
490
+ "enum": [
491
+ "alcohol"
492
+ ]
493
+ }
494
+ },
495
+ "allergenGroups": {
496
+ "type": "array",
497
+ "description": "One of the 14 major food allergens; see https://erudus.com/food-allergens for more information.",
498
+ "items": {
499
+ "type": "string",
500
+ "enum": [
501
+ "celery",
502
+ "crustaceans",
503
+ "eggs",
504
+ "fish",
505
+ "gluten",
506
+ "lupin",
507
+ "milk",
508
+ "molluscs",
509
+ "mustard",
510
+ "nuts",
511
+ "peanuts",
512
+ "sesame",
513
+ "soya",
514
+ "sulphites"
515
+ ]
516
+ }
517
+ },
518
+ "dishTypes": {
519
+ "type": "array",
520
+ "items": {
521
+ "type": "string",
522
+ "examples": [
523
+ "appetizer",
524
+ "bread",
525
+ "cocktail",
526
+ "dessert",
527
+ "drink",
528
+ "entree",
529
+ "pastry",
530
+ "salad",
531
+ "side",
532
+ "snack",
533
+ "soup"
534
+ ]
535
+ }
536
+ },
537
+ "hasFluff": {
538
+ "type": "boolean"
539
+ },
540
+ "hasFluffImages": {
541
+ "type": "boolean"
542
+ },
543
+ "fluff": {
544
+ "$ref": "util.json#/$defs/fluffObject"
545
+ },
546
+ "foundryImg": {
547
+ "$ref": "util.json#/$defs/foundryImg"
548
+ },
549
+ "_copy": {
550
+ "type": "object",
551
+ "properties": {
552
+ "name": {
553
+ "type": "string"
554
+ },
555
+ "source": {
556
+ "$ref": "util.json#/$defs/source"
557
+ },
558
+ "pantheon": {
559
+ "description": "Used in deity data",
560
+ "type": "string"
561
+ },
562
+ "shortName": {
563
+ "description": "Used in subclass data",
564
+ "type": "string"
565
+ },
566
+ "className": {
567
+ "description": "Used in subclass data",
568
+ "type": "string"
569
+ },
570
+ "classSource": {
571
+ "description": "Used in subclass data",
572
+ "$ref": "util.json#/$defs/source"
573
+ },
574
+ "raceName": {
575
+ "description": "Used in race feature data",
576
+ "type": "string"
577
+ },
578
+ "raceSource": {
579
+ "description": "Used in race feature data",
580
+ "$ref": "util.json#/$defs/source"
581
+ },
582
+ "_mod": {
583
+ "$ref": "util.json#/$defs/_modObject"
584
+ },
585
+ "_trait": {
586
+ "type": "object",
587
+ "properties": {
588
+ "name": {
589
+ "type": "string"
590
+ },
591
+ "source": {
592
+ "$ref": "util.json#/$defs/source"
593
+ }
594
+ },
595
+ "required": [
596
+ "name",
597
+ "source"
598
+ ]
599
+ },
600
+ "_preserve": {
601
+ "type": "object",
602
+ "patternProperties": {
603
+ ".*": {
604
+ "const": true
605
+ }
606
+ }
607
+ }
608
+ },
609
+ "required": [
610
+ "name",
611
+ "source"
612
+ ],
613
+ "additionalProperties": false
614
+ }
615
+ },
616
+ "additionalProperties": false,
617
+ "required": [
618
+ "_copy"
619
+ ]
620
+ }
621
+ ]
188
622
  }
189
623
  },
190
624
  "properties": {
625
+ "_meta": {
626
+ "$ref": "util.json#/$defs/metaBlock"
627
+ },
191
628
  "recipe": {
192
629
  "type": "array",
193
630
  "uniqueItems": true,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "util-time.json",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "title": "Util: Time",
6
6
  "$defs": {
7
7
  "time": {
@@ -29,6 +29,9 @@
29
29
  "unit"
30
30
  ],
31
31
  "additionalProperties": false
32
+ },
33
+ "timeMinutes": {
34
+ "type": "integer"
32
35
  }
33
36
  }
34
37
  }
@@ -1,41 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "fluff-recipes.json",
4
- "version": "1.1.2",
4
+ "version": "1.2.0",
5
5
  "type": "object",
6
6
  "properties": {
7
+ "_meta": {
8
+ "$ref": "util.json#/$defs/metaBlock"
9
+ },
7
10
  "recipeFluff": {
8
- "type": "array",
9
- "minItems": 1,
10
- "uniqueItems": true,
11
- "items": {
12
- "type": "object",
13
- "properties": {
14
- "name": {
15
- "type": "string"
16
- },
17
- "source": {
18
- "$ref": "util.json#/$defs/source"
19
- },
20
- "images": {
21
- "type": "array",
22
- "items": {
23
- "$ref": "entry.json#/$defs/entryImage"
24
- }
25
- },
26
- "entries": {
27
- "type": "array",
28
- "items": {
29
- "$ref": "entry.json"
30
- }
31
- }
32
- },
33
- "required": [
34
- "name",
35
- "source"
36
- ],
37
- "additionalProperties": false
38
- }
11
+ "$ref": "util.json#/$defs/genericFluffArray"
39
12
  }
40
13
  },
41
14
  "additionalProperties": false