@squiz/edge-dev-render-runtime-lib 2.4.0 → 2.4.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.
@@ -2321,6 +2321,43 @@
2321
2321
  "type": "object",
2322
2322
  "additionalProperties": false
2323
2323
  },
2324
+ "UiMetadata": {
2325
+ "allOf": [
2326
+ {
2327
+ "properties": {
2328
+ "autoReload": {
2329
+ "type": "boolean",
2330
+ "description": "Whether the component should automatically reload when the input is changed"
2331
+ }
2332
+ },
2333
+ "additionalProperties": {},
2334
+ "type": "object"
2335
+ },
2336
+ {
2337
+ "anyOf": [
2338
+ {
2339
+ "properties": {
2340
+ "collapsedByDefault": {
2341
+ "type": "boolean"
2342
+ }
2343
+ },
2344
+ "type": "object"
2345
+ },
2346
+ {
2347
+ "properties": {
2348
+ "quickOption": {
2349
+ "type": "boolean"
2350
+ },
2351
+ "inlineEditable": {
2352
+ "type": "boolean"
2353
+ }
2354
+ },
2355
+ "type": "object"
2356
+ }
2357
+ ]
2358
+ }
2359
+ ]
2360
+ },
2324
2361
  "CoreSchemaMetaSchema2": {
2325
2362
  "anyOf": [
2326
2363
  {
@@ -2503,23 +2540,11 @@
2503
2540
  ]
2504
2541
  },
2505
2542
  "enum": {
2506
- "items": {
2507
- "type": "boolean",
2508
- "enum": [
2509
- true
2510
- ],
2511
- "nullable": false
2512
- },
2543
+ "items": {},
2513
2544
  "type": "array",
2514
2545
  "minItems": 1
2515
2546
  },
2516
- "const": {
2517
- "type": "boolean",
2518
- "enum": [
2519
- true
2520
- ],
2521
- "nullable": false
2522
- },
2547
+ "const": {},
2523
2548
  "propertyNames": {
2524
2549
  "$ref": "#/components/schemas/CoreSchemaMetaSchema2"
2525
2550
  },
@@ -2565,16 +2590,8 @@
2565
2590
  "$ref": "#/components/schemas/StringArray"
2566
2591
  },
2567
2592
  "minProperties": {
2568
- "allOf": [
2569
- {
2570
- "type": "number",
2571
- "format": "double"
2572
- },
2573
- {
2574
- "type": "number",
2575
- "format": "double"
2576
- }
2577
- ]
2593
+ "type": "number",
2594
+ "format": "double"
2578
2595
  },
2579
2596
  "maxProperties": {
2580
2597
  "type": "number",
@@ -2587,16 +2604,8 @@
2587
2604
  "type": "boolean"
2588
2605
  },
2589
2606
  "minItems": {
2590
- "allOf": [
2591
- {
2592
- "type": "number",
2593
- "format": "double"
2594
- },
2595
- {
2596
- "type": "number",
2597
- "format": "double"
2598
- }
2599
- ]
2607
+ "type": "number",
2608
+ "format": "double"
2600
2609
  },
2601
2610
  "maxItems": {
2602
2611
  "type": "number",
@@ -2619,16 +2628,8 @@
2619
2628
  "type": "string"
2620
2629
  },
2621
2630
  "minLength": {
2622
- "allOf": [
2623
- {
2624
- "type": "number",
2625
- "format": "double"
2626
- },
2627
- {
2628
- "type": "number",
2629
- "format": "double"
2630
- }
2631
- ]
2631
+ "type": "number",
2632
+ "format": "double"
2632
2633
  },
2633
2634
  "maxLength": {
2634
2635
  "type": "number",
@@ -2655,13 +2656,7 @@
2655
2656
  "format": "double"
2656
2657
  },
2657
2658
  "examples": {
2658
- "items": {
2659
- "type": "boolean",
2660
- "enum": [
2661
- true
2662
- ],
2663
- "nullable": false
2664
- },
2659
+ "items": {},
2665
2660
  "type": "array"
2666
2661
  },
2667
2662
  "writeOnly": {
@@ -2670,13 +2665,7 @@
2670
2665
  "readOnly": {
2671
2666
  "type": "boolean"
2672
2667
  },
2673
- "default": {
2674
- "type": "boolean",
2675
- "enum": [
2676
- true
2677
- ],
2678
- "nullable": false
2679
- },
2668
+ "default": {},
2680
2669
  "description": {
2681
2670
  "type": "string"
2682
2671
  },
@@ -2745,27 +2734,7 @@
2745
2734
  "type": "string"
2746
2735
  },
2747
2736
  "ui:metadata": {
2748
- "anyOf": [
2749
- {
2750
- "properties": {
2751
- "collapsedByDefault": {
2752
- "type": "boolean"
2753
- }
2754
- },
2755
- "type": "object"
2756
- },
2757
- {
2758
- "properties": {
2759
- "quickOption": {
2760
- "type": "boolean"
2761
- },
2762
- "inlineEditable": {
2763
- "type": "boolean"
2764
- }
2765
- },
2766
- "type": "object"
2767
- }
2768
- ]
2737
+ "$ref": "#/components/schemas/UiMetadata"
2769
2738
  },
2770
2739
  "$schema": {
2771
2740
  "type": "string"
@@ -2782,13 +2751,7 @@
2782
2751
  "description": {
2783
2752
  "type": "string"
2784
2753
  },
2785
- "default": {
2786
- "type": "boolean",
2787
- "enum": [
2788
- true
2789
- ],
2790
- "nullable": false
2791
- },
2754
+ "default": {},
2792
2755
  "readOnly": {
2793
2756
  "type": "boolean"
2794
2757
  },
@@ -2796,13 +2759,7 @@
2796
2759
  "type": "boolean"
2797
2760
  },
2798
2761
  "examples": {
2799
- "items": {
2800
- "type": "boolean",
2801
- "enum": [
2802
- true
2803
- ],
2804
- "nullable": false
2805
- },
2762
+ "items": {},
2806
2763
  "type": "array"
2807
2764
  },
2808
2765
  "multipleOf": {
@@ -2830,16 +2787,8 @@
2830
2787
  "format": "double"
2831
2788
  },
2832
2789
  "minLength": {
2833
- "allOf": [
2834
- {
2835
- "type": "number",
2836
- "format": "double"
2837
- },
2838
- {
2839
- "type": "number",
2840
- "format": "double"
2841
- }
2842
- ]
2790
+ "type": "number",
2791
+ "format": "double"
2843
2792
  },
2844
2793
  "pattern": {
2845
2794
  "type": "string"
@@ -2862,16 +2811,8 @@
2862
2811
  "format": "double"
2863
2812
  },
2864
2813
  "minItems": {
2865
- "allOf": [
2866
- {
2867
- "type": "number",
2868
- "format": "double"
2869
- },
2870
- {
2871
- "type": "number",
2872
- "format": "double"
2873
- }
2874
- ]
2814
+ "type": "number",
2815
+ "format": "double"
2875
2816
  },
2876
2817
  "uniqueItems": {
2877
2818
  "type": "boolean"
@@ -2884,16 +2825,8 @@
2884
2825
  "format": "double"
2885
2826
  },
2886
2827
  "minProperties": {
2887
- "allOf": [
2888
- {
2889
- "type": "number",
2890
- "format": "double"
2891
- },
2892
- {
2893
- "type": "number",
2894
- "format": "double"
2895
- }
2896
- ]
2828
+ "type": "number",
2829
+ "format": "double"
2897
2830
  },
2898
2831
  "required": {
2899
2832
  "$ref": "#/components/schemas/StringArray"
@@ -2939,21 +2872,9 @@
2939
2872
  "propertyNames": {
2940
2873
  "$ref": "#/components/schemas/CoreSchemaMetaSchema2"
2941
2874
  },
2942
- "const": {
2943
- "type": "boolean",
2944
- "enum": [
2945
- true
2946
- ],
2947
- "nullable": false
2948
- },
2875
+ "const": {},
2949
2876
  "enum": {
2950
- "items": {
2951
- "type": "boolean",
2952
- "enum": [
2953
- true
2954
- ],
2955
- "nullable": false
2956
- },
2877
+ "items": {},
2957
2878
  "type": "array",
2958
2879
  "minItems": 1
2959
2880
  },
@@ -3396,23 +3317,11 @@
3396
3317
  ]
3397
3318
  },
3398
3319
  "enum": {
3399
- "items": {
3400
- "type": "boolean",
3401
- "enum": [
3402
- true
3403
- ],
3404
- "nullable": false
3405
- },
3320
+ "items": {},
3406
3321
  "type": "array",
3407
3322
  "minItems": 1
3408
3323
  },
3409
- "const": {
3410
- "type": "boolean",
3411
- "enum": [
3412
- true
3413
- ],
3414
- "nullable": false
3415
- },
3324
+ "const": {},
3416
3325
  "propertyNames": {
3417
3326
  "$ref": "#/components/schemas/CoreSchemaMetaSchema5"
3418
3327
  },
@@ -3458,16 +3367,8 @@
3458
3367
  "$ref": "#/components/schemas/StringArray1"
3459
3368
  },
3460
3369
  "minProperties": {
3461
- "allOf": [
3462
- {
3463
- "type": "number",
3464
- "format": "double"
3465
- },
3466
- {
3467
- "type": "number",
3468
- "format": "double"
3469
- }
3470
- ]
3370
+ "type": "number",
3371
+ "format": "double"
3471
3372
  },
3472
3373
  "maxProperties": {
3473
3374
  "type": "number",
@@ -3480,16 +3381,8 @@
3480
3381
  "type": "boolean"
3481
3382
  },
3482
3383
  "minItems": {
3483
- "allOf": [
3484
- {
3485
- "type": "number",
3486
- "format": "double"
3487
- },
3488
- {
3489
- "type": "number",
3490
- "format": "double"
3491
- }
3492
- ]
3384
+ "type": "number",
3385
+ "format": "double"
3493
3386
  },
3494
3387
  "maxItems": {
3495
3388
  "type": "number",
@@ -3512,16 +3405,8 @@
3512
3405
  "type": "string"
3513
3406
  },
3514
3407
  "minLength": {
3515
- "allOf": [
3516
- {
3517
- "type": "number",
3518
- "format": "double"
3519
- },
3520
- {
3521
- "type": "number",
3522
- "format": "double"
3523
- }
3524
- ]
3408
+ "type": "number",
3409
+ "format": "double"
3525
3410
  },
3526
3411
  "maxLength": {
3527
3412
  "type": "number",
@@ -3548,13 +3433,7 @@
3548
3433
  "format": "double"
3549
3434
  },
3550
3435
  "examples": {
3551
- "items": {
3552
- "type": "boolean",
3553
- "enum": [
3554
- true
3555
- ],
3556
- "nullable": false
3557
- },
3436
+ "items": {},
3558
3437
  "type": "array"
3559
3438
  },
3560
3439
  "writeOnly": {
@@ -3563,13 +3442,7 @@
3563
3442
  "readOnly": {
3564
3443
  "type": "boolean"
3565
3444
  },
3566
- "default": {
3567
- "type": "boolean",
3568
- "enum": [
3569
- true
3570
- ],
3571
- "nullable": false
3572
- },
3445
+ "default": {},
3573
3446
  "description": {
3574
3447
  "type": "string"
3575
3448
  },
@@ -3630,13 +3503,7 @@
3630
3503
  "description": {
3631
3504
  "type": "string"
3632
3505
  },
3633
- "default": {
3634
- "type": "boolean",
3635
- "enum": [
3636
- true
3637
- ],
3638
- "nullable": false
3639
- },
3506
+ "default": {},
3640
3507
  "readOnly": {
3641
3508
  "type": "boolean"
3642
3509
  },
@@ -3644,13 +3511,7 @@
3644
3511
  "type": "boolean"
3645
3512
  },
3646
3513
  "examples": {
3647
- "items": {
3648
- "type": "boolean",
3649
- "enum": [
3650
- true
3651
- ],
3652
- "nullable": false
3653
- },
3514
+ "items": {},
3654
3515
  "type": "array"
3655
3516
  },
3656
3517
  "multipleOf": {
@@ -3678,16 +3539,8 @@
3678
3539
  "format": "double"
3679
3540
  },
3680
3541
  "minLength": {
3681
- "allOf": [
3682
- {
3683
- "type": "number",
3684
- "format": "double"
3685
- },
3686
- {
3687
- "type": "number",
3688
- "format": "double"
3689
- }
3690
- ]
3542
+ "type": "number",
3543
+ "format": "double"
3691
3544
  },
3692
3545
  "pattern": {
3693
3546
  "type": "string"
@@ -3710,16 +3563,8 @@
3710
3563
  "format": "double"
3711
3564
  },
3712
3565
  "minItems": {
3713
- "allOf": [
3714
- {
3715
- "type": "number",
3716
- "format": "double"
3717
- },
3718
- {
3719
- "type": "number",
3720
- "format": "double"
3721
- }
3722
- ]
3566
+ "type": "number",
3567
+ "format": "double"
3723
3568
  },
3724
3569
  "uniqueItems": {
3725
3570
  "type": "boolean"
@@ -3732,16 +3577,8 @@
3732
3577
  "format": "double"
3733
3578
  },
3734
3579
  "minProperties": {
3735
- "allOf": [
3736
- {
3737
- "type": "number",
3738
- "format": "double"
3739
- },
3740
- {
3741
- "type": "number",
3742
- "format": "double"
3743
- }
3744
- ]
3580
+ "type": "number",
3581
+ "format": "double"
3745
3582
  },
3746
3583
  "required": {
3747
3584
  "$ref": "#/components/schemas/StringArray1"
@@ -3787,21 +3624,9 @@
3787
3624
  "propertyNames": {
3788
3625
  "$ref": "#/components/schemas/CoreSchemaMetaSchema5"
3789
3626
  },
3790
- "const": {
3791
- "type": "boolean",
3792
- "enum": [
3793
- true
3794
- ],
3795
- "nullable": false
3796
- },
3627
+ "const": {},
3797
3628
  "enum": {
3798
- "items": {
3799
- "type": "boolean",
3800
- "enum": [
3801
- true
3802
- ],
3803
- "nullable": false
3804
- },
3629
+ "items": {},
3805
3630
  "type": "array",
3806
3631
  "minItems": 1
3807
3632
  },
@@ -4905,6 +4730,25 @@
4905
4730
  },
4906
4731
  "type": "object",
4907
4732
  "description": "Mocked uri objects used in the preview"
4733
+ },
4734
+ "ui:metadata": {
4735
+ "properties": {
4736
+ "autoReload": {
4737
+ "allOf": [
4738
+ {
4739
+ "type": "boolean"
4740
+ },
4741
+ {
4742
+ "type": "string"
4743
+ }
4744
+ ]
4745
+ }
4746
+ },
4747
+ "additionalProperties": {},
4748
+ "required": [
4749
+ "autoReload"
4750
+ ],
4751
+ "type": "object"
4908
4752
  }
4909
4753
  },
4910
4754
  "required": [
@@ -4944,7 +4788,7 @@
4944
4788
  },
4945
4789
  "info": {
4946
4790
  "title": "@squiz/edge-dev-render-runtime-lib",
4947
- "version": "2.3.1",
4791
+ "version": "2.4.1",
4948
4792
  "description": "Package of Edge rendering utilities for components in dev mode",
4949
4793
  "license": {
4950
4794
  "name": "ISC"
@@ -4990,6 +4834,67 @@
4990
4834
  "security": [],
4991
4835
  "parameters": []
4992
4836
  }
4837
+ },
4838
+ "/s/{namespace}/{componentName}/{version}/{staticFile*}": {
4839
+ "get": {
4840
+ "operationId": "GetPreview",
4841
+ "responses": {
4842
+ "204": {
4843
+ "description": "No content"
4844
+ }
4845
+ },
4846
+ "security": [],
4847
+ "parameters": [
4848
+ {
4849
+ "in": "path",
4850
+ "name": "namespace",
4851
+ "required": true,
4852
+ "schema": {
4853
+ "type": "string"
4854
+ }
4855
+ },
4856
+ {
4857
+ "in": "path",
4858
+ "name": "componentName",
4859
+ "required": true,
4860
+ "schema": {
4861
+ "type": "string"
4862
+ }
4863
+ },
4864
+ {
4865
+ "in": "path",
4866
+ "name": "version",
4867
+ "required": true,
4868
+ "schema": {
4869
+ "type": "string"
4870
+ }
4871
+ },
4872
+ {
4873
+ "in": "path",
4874
+ "name": "staticFile",
4875
+ "required": true,
4876
+ "schema": {
4877
+ "type": "string"
4878
+ }
4879
+ },
4880
+ {
4881
+ "in": "query",
4882
+ "name": "_componentSet",
4883
+ "required": false,
4884
+ "schema": {
4885
+ "type": "string"
4886
+ }
4887
+ },
4888
+ {
4889
+ "in": "query",
4890
+ "name": "_previewKey",
4891
+ "required": false,
4892
+ "schema": {
4893
+ "type": "string"
4894
+ }
4895
+ }
4896
+ ]
4897
+ }
4993
4898
  }
4994
4899
  },
4995
4900
  "servers": [
@@ -6,6 +6,7 @@ import { Config } from '../../ioc';
6
6
  import { Request as ExpressRequest, Response as ExpressResponse } from 'express';
7
7
  import { ComponentPreviewService } from '../../PreviewComponentService';
8
8
  import { ComponentExecutionInput, RenderInputService } from '../../RenderInputService';
9
+ import { ContextAwareness } from '../../component-runner/ComponentRunnerService';
9
10
  type ComponentManifest = MANIFEST_MODELS.v1.ComponentManifest;
10
11
  type ComponentSchema = {
11
12
  name: string;
@@ -49,11 +50,11 @@ export declare class DevelopmentController extends Controller {
49
50
  * @param {*} [data]
50
51
  * @memberof DevelopmentController
51
52
  */
52
- TemporaryPreview(req: ExpressRequest, componentId: string, functionName: string, headers?: any, envVars?: any, data?: any): Promise<void>;
53
- getDefaultFunctionRendering(expressRequest: ExpressRequest, componentId: string, componentSet?: string, previewKey?: string): Promise<void>;
54
- getGivenFunctionRendering(expressRequest: ExpressRequest, componentId: string, functionName: string, componentSet?: string, previewKey?: string): Promise<void>;
53
+ TemporaryPreview(req: ExpressRequest, componentId: string, functionName: string, headers?: any, envVars?: any, data?: any, contextMatrixAssetId?: string, contextMatrixUrl?: string): Promise<void>;
54
+ getDefaultFunctionRendering(expressRequest: ExpressRequest, componentId: string, componentSet?: string, previewKey?: string, contextMatrixAssetId?: string, contextMatrixUrl?: string): Promise<void>;
55
+ getGivenFunctionRendering(expressRequest: ExpressRequest, componentId: string, functionName: string, componentSet?: string, previewKey?: string, contextMatrixAssetId?: string, contextMatrixUrl?: string): Promise<void>;
55
56
  protected handleResponse(input: ComponentExecutionInput, output: FunctionReturnTypes, response: ExpressResponse): void;
56
- protected doFunctionRender(renderInput: ComponentExecutionInput): Promise<FunctionReturnTypes>;
57
+ protected doFunctionRender(renderInput: ComponentExecutionInput, ctx?: ContextAwareness): Promise<FunctionReturnTypes>;
57
58
  private renderAndValidateOutput;
58
59
  protected setHeadersOnResponse(renderInput: ComponentExecutionInput, response: ExpressResponse): void;
59
60
  private checkDevMode;
@@ -0,0 +1,14 @@
1
+ import { Controller } from 'tsoa';
2
+ import { ManifestService, ComponentSetService, ComponentFunctionService, ManifestV1, ComponentSet, ManifestModel, Manifest, Headers } from '@squiz/component-lib';
3
+ import { type Request as ExpressRequest } from 'express';
4
+ export declare class StaticController extends Controller {
5
+ protected manifestService: ManifestService;
6
+ protected componentSetService: ComponentSetService;
7
+ protected componentFunctionService: ComponentFunctionService;
8
+ constructor(manifestService: ManifestService, componentSetService: ComponentSetService, componentFunctionService: ComponentFunctionService);
9
+ getPreview(namespace: string, componentName: string, version: string, staticFile: string, req: ExpressRequest, _componentSet?: string, _previewKey?: string): Promise<void>;
10
+ private setResponseHeaders;
11
+ protected getHeadersForInputType(_componentSet: string | undefined, _previewKey: string | undefined, manifest: Manifest): Promise<Headers>;
12
+ protected getValidatedSet(_componentSet: string, manifest: ManifestV1): Promise<ComponentSet>;
13
+ protected getValidatedPreviewDefinition(_previewKey: string, manifestModel: ManifestModel): Promise<import("packages/dx-json-schema-lib/src/manifest/v1/v1").PreviewDefinition>;
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/edge-dev-render-runtime-lib",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Package of Edge rendering utilities for components in dev mode",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -18,7 +18,7 @@
18
18
  "@opentelemetry/semantic-conventions": "^1.17.1",
19
19
  "@squiz/component-lib": "^1.80.1",
20
20
  "@squiz/component-logger-lib": "^1.71.1",
21
- "@squiz/component-web-api-lib": "^1.65.4",
21
+ "@squiz/component-web-api-lib": "^1.66.1",
22
22
  "@squiz/dx-common-lib": "^1.68.3",
23
23
  "@squiz/dx-json-schema-lib": "^1.76.1",
24
24
  "@squiz/dx-logger-lib": "^1.64.0",