@squiz/dx-json-schema-lib 1.21.1-alpha.5 → 1.21.1-alpha.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -143,6 +143,7 @@ export type CoreSchemaMetaSchema5 = {
143
143
  */
144
144
  export type SchemaArray1 = CoreSchemaMetaSchema5[];
145
145
  export type StringArray1 = string[];
146
+ export type ImageAdditionalInfo = FileAdditionalInfo;
146
147
  export interface ComponentManifest {
147
148
  /**
148
149
  * the manifest schema version
@@ -201,6 +202,26 @@ export interface ComponentManifest {
201
202
  previews?: {
202
203
  [k: string]: PreviewDefinition;
203
204
  };
205
+ /**
206
+ * Mocked uri objects used in the preview
207
+ */
208
+ mockedUris?: {
209
+ /**
210
+ * Property for defining the mock URI object
211
+ */
212
+ [k: string]: {
213
+ type: 'file';
214
+ /**
215
+ * Path to uri object
216
+ */
217
+ path: string;
218
+ [k: string]: unknown;
219
+ } | {
220
+ type: 'inline';
221
+ value: MatrixAssetSchema;
222
+ [k: string]: unknown;
223
+ };
224
+ };
204
225
  }
205
226
  /**
206
227
  * Icon for the component in Matrix and the DXP
@@ -459,3 +480,378 @@ export interface FunctionPreviewConfiguration {
459
480
  export interface ResponseHeaders2 {
460
481
  [k: string]: string;
461
482
  }
483
+ /**
484
+ * Inline URI object
485
+ */
486
+ export interface MatrixAssetSchema {
487
+ /**
488
+ * The asset ID.
489
+ */
490
+ id: string;
491
+ /**
492
+ * The asset type code.
493
+ */
494
+ type: string;
495
+ /**
496
+ * The asset type friendly name.
497
+ */
498
+ type_name: string;
499
+ /**
500
+ * The asset semantic version.
501
+ */
502
+ version: string;
503
+ /**
504
+ * The asset standard field name.
505
+ */
506
+ name: string;
507
+ /**
508
+ * The asset standard field short name.
509
+ */
510
+ short_name: string;
511
+ /**
512
+ * A object representing the asset status of the asset resource.
513
+ */
514
+ status: {
515
+ /**
516
+ * The bitwise id of the asset status
517
+ */
518
+ id: 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256;
519
+ /**
520
+ * The type code of the asset status
521
+ */
522
+ code: 'archived' | 'under_construction' | 'pending_approval' | 'approved' | 'live' | 'live_approval' | 'editing' | 'editing_approval' | 'editing_approved';
523
+ /**
524
+ * The description of the asset status
525
+ */
526
+ name?: 'Archived' | 'Under Construction' | 'Pending Approval' | 'Approved To Go Live' | 'Live' | 'Up For Review' | 'Safe Editing' | 'Safe Editing Pending Approval' | 'Safe Edit Approved To Go Live';
527
+ };
528
+ /**
529
+ * A object representing when the asset status was created.
530
+ */
531
+ created: {
532
+ /**
533
+ * The creation date of the asset in ISO 8601 format.
534
+ */
535
+ date: string | null;
536
+ /**
537
+ * The asset ID of the User that created the asset.
538
+ */
539
+ user_id: string | null;
540
+ };
541
+ /**
542
+ * A object representing when the asset status was last updated.
543
+ */
544
+ updated: {
545
+ /**
546
+ * The last updated date of the asset in ISO 8601 format.
547
+ */
548
+ date: string | null;
549
+ /**
550
+ * The asset ID of the User that last updated the asset.
551
+ */
552
+ user_id: string | null;
553
+ };
554
+ /**
555
+ * A object representing when the asset status was last published.
556
+ */
557
+ published: {
558
+ /**
559
+ * The last published date of the asset in ISO 8601 format.
560
+ */
561
+ date: string | null;
562
+ /**
563
+ * The asset ID of the User that last published the asset.
564
+ */
565
+ user_id: string | null;
566
+ };
567
+ /**
568
+ * A object representing when the asset status was last changed.
569
+ */
570
+ status_changed?: {
571
+ /**
572
+ * The last date the state of the asset was changed in ISO 8601 format.
573
+ */
574
+ date: string | null;
575
+ /**
576
+ * The asset ID of the User that last changed the asset status.
577
+ */
578
+ user_id: string | null;
579
+ };
580
+ /**
581
+ * The primary URL for the asset.
582
+ */
583
+ url: string;
584
+ /**
585
+ * All URLs for the asset including the primary URL.
586
+ */
587
+ urls: string[];
588
+ /**
589
+ * List of attributes for the asset in key-value form.
590
+ */
591
+ attributes: {
592
+ [k: string]: unknown;
593
+ };
594
+ /**
595
+ * List of metadata values in key-value form.
596
+ */
597
+ metadata?: {
598
+ [k: string]: string[];
599
+ };
600
+ /**
601
+ * The contents for the asset (excluding file assets).
602
+ */
603
+ contents?: string;
604
+ /**
605
+ * The thumbnail image associated with the asset, shows a subset data of an image or image variety.
606
+ */
607
+ thumbnail?: {
608
+ /**
609
+ * The asset ID of the Image asset of the file.
610
+ */
611
+ asset_id?: string;
612
+ /**
613
+ * The accessible URL of the thumbnail image file.
614
+ */
615
+ url?: string;
616
+ /**
617
+ * The file name of the thumbnail image.
618
+ */
619
+ file_name?: string;
620
+ /**
621
+ * The image file width in pixels.
622
+ */
623
+ width?: number;
624
+ /**
625
+ * The image file height in pixels.
626
+ */
627
+ height?: number;
628
+ /**
629
+ * The file type of the image file, generally its extension.
630
+ */
631
+ file_type?: string;
632
+ /**
633
+ * The file size in bytes
634
+ */
635
+ file_size?: number;
636
+ /**
637
+ * The file size in human readable format
638
+ */
639
+ file_size_readable?: number;
640
+ /**
641
+ * The friendly name of the file asset
642
+ */
643
+ title?: string;
644
+ /**
645
+ * The alt attribute of the Image asset
646
+ */
647
+ alt?: string;
648
+ [k: string]: unknown;
649
+ };
650
+ /**
651
+ * All direct dependent child assets of the asset in normalized asset format.
652
+ */
653
+ include_dependents?: MatrixAssetSchema1[];
654
+ /**
655
+ * Additional data of an arbitrary nature related to the requested asset, which may include derived information or special child asset information.
656
+ */
657
+ additional?: AssetAdditionalInfo | FileAdditionalInfo | ImageAdditionalInfo | CalendarEventAdditionalInfo;
658
+ [k: string]: unknown;
659
+ }
660
+ export interface MatrixAssetSchema1 {
661
+ /**
662
+ * The asset ID.
663
+ */
664
+ id: string;
665
+ /**
666
+ * The asset type code.
667
+ */
668
+ type: string;
669
+ /**
670
+ * The asset type friendly name.
671
+ */
672
+ type_name: string;
673
+ /**
674
+ * The asset semantic version.
675
+ */
676
+ version: string;
677
+ /**
678
+ * The asset standard field name.
679
+ */
680
+ name: string;
681
+ /**
682
+ * The asset standard field short name.
683
+ */
684
+ short_name: string;
685
+ /**
686
+ * A object representing the asset status of the asset resource.
687
+ */
688
+ status: {
689
+ /**
690
+ * The bitwise id of the asset status
691
+ */
692
+ id: 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256;
693
+ /**
694
+ * The type code of the asset status
695
+ */
696
+ code: 'archived' | 'under_construction' | 'pending_approval' | 'approved' | 'live' | 'live_approval' | 'editing' | 'editing_approval' | 'editing_approved';
697
+ /**
698
+ * The description of the asset status
699
+ */
700
+ name?: 'Archived' | 'Under Construction' | 'Pending Approval' | 'Approved To Go Live' | 'Live' | 'Up For Review' | 'Safe Editing' | 'Safe Editing Pending Approval' | 'Safe Edit Approved To Go Live';
701
+ };
702
+ /**
703
+ * A object representing when the asset status was created.
704
+ */
705
+ created: {
706
+ /**
707
+ * The creation date of the asset in ISO 8601 format.
708
+ */
709
+ date: string | null;
710
+ /**
711
+ * The asset ID of the User that created the asset.
712
+ */
713
+ user_id: string | null;
714
+ };
715
+ /**
716
+ * A object representing when the asset status was last updated.
717
+ */
718
+ updated: {
719
+ /**
720
+ * The last updated date of the asset in ISO 8601 format.
721
+ */
722
+ date: string | null;
723
+ /**
724
+ * The asset ID of the User that last updated the asset.
725
+ */
726
+ user_id: string | null;
727
+ };
728
+ /**
729
+ * A object representing when the asset status was last published.
730
+ */
731
+ published: {
732
+ /**
733
+ * The last published date of the asset in ISO 8601 format.
734
+ */
735
+ date: string | null;
736
+ /**
737
+ * The asset ID of the User that last published the asset.
738
+ */
739
+ user_id: string | null;
740
+ };
741
+ /**
742
+ * A object representing when the asset status was last changed.
743
+ */
744
+ status_changed?: {
745
+ /**
746
+ * The last date the state of the asset was changed in ISO 8601 format.
747
+ */
748
+ date: string | null;
749
+ /**
750
+ * The asset ID of the User that last changed the asset status.
751
+ */
752
+ user_id: string | null;
753
+ };
754
+ /**
755
+ * The primary URL for the asset.
756
+ */
757
+ url: string;
758
+ /**
759
+ * All URLs for the asset including the primary URL.
760
+ */
761
+ urls: string[];
762
+ /**
763
+ * List of attributes for the asset in key-value form.
764
+ */
765
+ attributes: {
766
+ [k: string]: unknown;
767
+ };
768
+ /**
769
+ * List of metadata values in key-value form.
770
+ */
771
+ metadata?: {
772
+ [k: string]: string[];
773
+ };
774
+ /**
775
+ * The contents for the asset (excluding file assets).
776
+ */
777
+ contents?: string;
778
+ /**
779
+ * The thumbnail image associated with the asset, shows a subset data of an image or image variety.
780
+ */
781
+ thumbnail?: {
782
+ /**
783
+ * The asset ID of the Image asset of the file.
784
+ */
785
+ asset_id?: string;
786
+ /**
787
+ * The accessible URL of the thumbnail image file.
788
+ */
789
+ url?: string;
790
+ /**
791
+ * The file name of the thumbnail image.
792
+ */
793
+ file_name?: string;
794
+ /**
795
+ * The image file width in pixels.
796
+ */
797
+ width?: number;
798
+ /**
799
+ * The image file height in pixels.
800
+ */
801
+ height?: number;
802
+ /**
803
+ * The file type of the image file, generally its extension.
804
+ */
805
+ file_type?: string;
806
+ /**
807
+ * The file size in bytes
808
+ */
809
+ file_size?: number;
810
+ /**
811
+ * The file size in human readable format
812
+ */
813
+ file_size_readable?: number;
814
+ /**
815
+ * The friendly name of the file asset
816
+ */
817
+ title?: string;
818
+ /**
819
+ * The alt attribute of the Image asset
820
+ */
821
+ alt?: string;
822
+ [k: string]: unknown;
823
+ };
824
+ /**
825
+ * All direct dependent child assets of the asset in normalized asset format.
826
+ */
827
+ include_dependents?: MatrixAssetSchema1[];
828
+ /**
829
+ * Additional data of an arbitrary nature related to the requested asset, which may include derived information or special child asset information.
830
+ */
831
+ additional?: AssetAdditionalInfo | FileAdditionalInfo | ImageAdditionalInfo | CalendarEventAdditionalInfo;
832
+ [k: string]: unknown;
833
+ }
834
+ export interface AssetAdditionalInfo {
835
+ [k: string]: unknown;
836
+ }
837
+ export interface FileAdditionalInfo {
838
+ file_info?: {
839
+ file_name?: string;
840
+ size_readable?: string;
841
+ size_bytes?: number;
842
+ width?: number;
843
+ height?: number;
844
+ modified_readable?: string;
845
+ modified_unix?: number;
846
+ [k: string]: unknown;
847
+ };
848
+ [k: string]: unknown;
849
+ }
850
+ export interface CalendarEventAdditionalInfo {
851
+ event_info?: {
852
+ duration?: number;
853
+ frequency?: string;
854
+ [k: string]: unknown;
855
+ };
856
+ [k: string]: unknown;
857
+ }
@@ -361,6 +361,54 @@
361
361
  }
362
362
  }
363
363
  }
364
+ },
365
+ "mockedUris": {
366
+ "type": "object",
367
+ "description": "Mocked uri objects used in the preview",
368
+ "propertyNames": {
369
+ "type": "string",
370
+ "pattern": "^[a-z0-9_\\-]+:\\/\\/"
371
+ },
372
+ "additionalProperties": {
373
+ "type": "object",
374
+ "description": "Property for defining the mock URI object",
375
+ "properties": {
376
+ "type": {
377
+ "description": "An enum of 'file' or 'inline' for how the uri object is defined",
378
+ "enum": ["file", "inline"]
379
+ }
380
+ },
381
+ "required": ["type"],
382
+ "oneOf": [
383
+ {
384
+ "type": "object",
385
+ "properties": {
386
+ "type": {
387
+ "enum": ["file"]
388
+ },
389
+ "path": {
390
+ "type": "string",
391
+ "format": "uri-reference",
392
+ "description": "Path to uri object"
393
+ }
394
+ },
395
+ "required": ["type", "path"]
396
+ },
397
+ {
398
+ "type": "object",
399
+ "properties": {
400
+ "type": {
401
+ "enum": ["inline"]
402
+ },
403
+ "value": {
404
+ "$ref": "MatrixAssetSchema.json",
405
+ "description": "Inline URI object"
406
+ }
407
+ },
408
+ "required": ["type", "value"]
409
+ }
410
+ ]
411
+ }
364
412
  }
365
413
  },
366
414
  "required": ["name", "namespace", "displayName", "description", "version", "functions", "$schema", "mainFunction"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/dx-json-schema-lib",
3
- "version": "1.21.1-alpha.5",
3
+ "version": "1.21.1-alpha.7",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -30,5 +30,5 @@
30
30
  "json-schema-library": "7.4.5",
31
31
  "ts-brand": "0.0.2"
32
32
  },
33
- "gitHead": "e29eaf410e59548e7f9969206882e512750e9472"
33
+ "gitHead": "3473320147ec8528a9b52c791d28ef3ec0745c97"
34
34
  }
@@ -3,6 +3,8 @@ import JSONQuery, { Input } from '@sagold/json-query';
3
3
  import DxComponentInputSchema from './manifest/v1/DxComponentInputSchema.json';
4
4
  import DxComponentIcons from './manifest/v1/DxComponentIcons.json';
5
5
  import DxContentMetaSchema from './manifest/v1/DxContentMetaSchema.json';
6
+ import MatrixAssetSchema from './manifest/v1/MatrixAssetSchema.json';
7
+
6
8
  import Draft07Schema from './manifest/v1/Draft-07.json';
7
9
 
8
10
  import FormattedText from './formatted-text/v1/formattedText.json';
@@ -123,6 +125,7 @@ const v1Schema = new Draft07(v1, defaultConfig);
123
125
  v1Schema.addRemoteSchema('DxComponentInputSchema.json/DxContentMetaSchema.json', DxContentMetaSchema);
124
126
  v1Schema.addRemoteSchema('/DxComponentInputSchema.json', ComponentInputSchema.getSchema());
125
127
  v1Schema.addRemoteSchema('/DxComponentIcons.json', DxComponentIcons);
128
+ v1Schema.addRemoteSchema('/MatrixAssetSchema.json', MatrixAssetSchema);
126
129
  v1Schema.addRemoteSchema('http://json-schema.org/draft-07/schema', Draft07Schema);
127
130
  v1Schema.addRemoteSchema('http://json-schema.org/draft-07/schema#', Draft07Schema);
128
131
 
@@ -143,6 +146,7 @@ export const ManifestV1MetaSchema: MetaSchemaInput = {
143
146
  'DxComponentInputSchema.json/DxContentMetaSchema.json': DxContentMetaSchema,
144
147
  '/DxComponentInputSchema.json': DxComponentInputSchema,
145
148
  '/DxComponentIcons.json': DxComponentIcons,
149
+ '/MatrixAssetSchema.json': MatrixAssetSchema,
146
150
  'http://json-schema.org/draft-07/schema': Draft07Schema,
147
151
  'http://json-schema.org/draft-07/schema#': Draft07Schema,
148
152
  },