@uniformdev/canvas 19.8.0 → 19.9.2-alpha.3

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/index.d.ts CHANGED
@@ -2892,6 +2892,202 @@ interface external$6 {
2892
2892
  };
2893
2893
  operations: {};
2894
2894
  };
2895
+ "../../../lambda/functions/v1-redirect.swagger.yml": {
2896
+ paths: {
2897
+ "/api/v1/redirect": {
2898
+ /** Called to retrieve a list of redirects related to a project */
2899
+ get: {
2900
+ parameters: {
2901
+ query: {
2902
+ /** The project to fetch redirects for */
2903
+ projectId: string;
2904
+ /** Id of the redirect to retrieve */
2905
+ id?: string;
2906
+ /** Ids of the redirects to retrieve */
2907
+ ids?: string[];
2908
+ /** Source url to attempt to find redirects for */
2909
+ sourceUrl?: string;
2910
+ /** Id of the project map the source or target belongs to. */
2911
+ projectMapId?: string;
2912
+ /** Id of the project map node to find redirects for. */
2913
+ sourceProjectMapNodeId?: string;
2914
+ /** Id of the project map node to find redirects for. */
2915
+ targetProjectMapNodeId?: string;
2916
+ /** Column to order results by, only applicable if trie is not active. */
2917
+ orderBy?: "updated_at asc" | "updated_at desc" | "source_url asc" | "source_url desc" | "target_url asc" | "target_url desc" | "created_by asc" | "created_by desc";
2918
+ /** Limit the results to this number of results, ignored if using trie parameter. */
2919
+ limit?: number;
2920
+ /** Offset the results a certain amount, useful for pagination. */
2921
+ offset?: number;
2922
+ /** Search text to filter redirects by, filtering on the source and target urls */
2923
+ search?: string;
2924
+ };
2925
+ };
2926
+ responses: {
2927
+ /** OK */
2928
+ 200: {
2929
+ content: {
2930
+ "application/json": {
2931
+ redirects: external$6["../../../lambda/functions/v1-redirect.swagger.yml"]["components"]["schemas"]["RedirectGetResponse"];
2932
+ total?: number;
2933
+ resultUrl?: string;
2934
+ };
2935
+ };
2936
+ };
2937
+ 400: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["BadRequestError"];
2938
+ 401: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["UnauthorizedError"];
2939
+ 403: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["ForbiddenError"];
2940
+ 429: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["RateLimitError"];
2941
+ 500: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["InternalServerError"];
2942
+ };
2943
+ };
2944
+ put: {
2945
+ responses: {
2946
+ /** OK */
2947
+ 200: {
2948
+ content: {
2949
+ "application/json": {
2950
+ /**
2951
+ * Format: uuid
2952
+ * @description Id of the redirect
2953
+ */
2954
+ id: string;
2955
+ };
2956
+ };
2957
+ };
2958
+ /** OK */
2959
+ 204: never;
2960
+ 400: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["BadRequestError"];
2961
+ 401: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["UnauthorizedError"];
2962
+ 403: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["ForbiddenError"];
2963
+ 429: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["RateLimitError"];
2964
+ 500: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["InternalServerError"];
2965
+ };
2966
+ requestBody: {
2967
+ content: {
2968
+ "application/json": {
2969
+ /** @description Redirect object to insert */
2970
+ redirect: external$6["../../../lambda/functions/v1-redirect.swagger.yml"]["components"]["schemas"]["Redirect"];
2971
+ /**
2972
+ * Format: uuid
2973
+ * @description Project id to insert the redirect into
2974
+ */
2975
+ projectId: string;
2976
+ };
2977
+ };
2978
+ };
2979
+ };
2980
+ /** Called to delete a redirect */
2981
+ delete: {
2982
+ responses: {
2983
+ /** OK */
2984
+ 200: {
2985
+ content: {
2986
+ "application/json": {
2987
+ /**
2988
+ * Format: uuid
2989
+ * @description Id of the redirect
2990
+ */
2991
+ id: string;
2992
+ };
2993
+ };
2994
+ };
2995
+ /** OK */
2996
+ 204: never;
2997
+ 400: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["BadRequestError"];
2998
+ 401: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["UnauthorizedError"];
2999
+ 403: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["ForbiddenError"];
3000
+ 429: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["RateLimitError"];
3001
+ 500: external$6["../../../lambda/functions/swagger.yml"]["components"]["responses"]["InternalServerError"];
3002
+ };
3003
+ requestBody: {
3004
+ content: {
3005
+ "application/json": {
3006
+ /**
3007
+ * Format: uuid
3008
+ * @description Redirect id to be deleted.
3009
+ */
3010
+ id: string;
3011
+ /**
3012
+ * Format: uuid
3013
+ * @description Project the redirect belongs to.
3014
+ */
3015
+ projectId: string;
3016
+ };
3017
+ };
3018
+ };
3019
+ };
3020
+ /** Handles preflight requests. This endpoint allows CORS. */
3021
+ options: {
3022
+ responses: {
3023
+ /** OK */
3024
+ 204: never;
3025
+ };
3026
+ };
3027
+ };
3028
+ };
3029
+ components: {
3030
+ schemas: {
3031
+ RedirectGetResponse: {
3032
+ redirect: external$6["../../../lambda/functions/v1-redirect.swagger.yml"]["components"]["schemas"]["Redirect"];
3033
+ metadata: external$6["../../../lambda/functions/v1-redirect.swagger.yml"]["components"]["schemas"]["RedirectMetadata"];
3034
+ }[];
3035
+ RedirectMetadata: {
3036
+ /** @description The last time the redirect was modified in UTC */
3037
+ updatedAt?: string;
3038
+ /** @description The last user who modified this redirect */
3039
+ updatedBy?: string;
3040
+ /** @description The time the redirect was created in UTC */
3041
+ createdAt?: string;
3042
+ /** @description The user who created this redirect or system */
3043
+ createdBy?: string;
3044
+ };
3045
+ Redirect: {
3046
+ /**
3047
+ * Format: uuid
3048
+ * @description Id of the redirect.
3049
+ */
3050
+ id?: string;
3051
+ /** @description Source meant to match a url that needs to be redirected. */
3052
+ sourceUrl: string;
3053
+ /** @description Target meant to be redirected to. */
3054
+ targetUrl: string;
3055
+ /** @description Redirect type to occur from this redirect. */
3056
+ targetStatusCode: number;
3057
+ /**
3058
+ * Format: uuid
3059
+ * @description Project map node related to the source this redirect.
3060
+ */
3061
+ sourceProjectMapNodeId?: string;
3062
+ /**
3063
+ * Format: uuid
3064
+ * @description Project map node related to the target this redirect.
3065
+ */
3066
+ targetProjectMapNodeId?: string;
3067
+ /**
3068
+ * Format: uuid
3069
+ * @description Project map related to this redirect.
3070
+ */
3071
+ projectMapId?: string;
3072
+ /** @description Signals the redirect engine to retain query string parameters to the target url. */
3073
+ sourceRetainQuerystring?: boolean;
3074
+ /** @description Incoming requests must match the domain that's defined in the redirection source. */
3075
+ sourceMustMatchDomain?: boolean;
3076
+ /** @description Rewritten url should match the protocol (http / https) of the incoming request instead of whatever is defined in the redirection target. */
3077
+ targetPreserveIncomingProtocol?: boolean;
3078
+ /** @description Rewritten url should match the domain of the incoming request regardless of what is defined in the redirection target. */
3079
+ targetPreserveIncomingDomain?: boolean;
3080
+ /** @description Stop running rules after this redirect rule gets executed. */
3081
+ stopExecutingAfter?: boolean;
3082
+ /** @description Merge incoming querystring with the querystring defined on the redirection target, taking the incoming querystring parameter where a merge is not possible. */
3083
+ targetMergeQuerystring?: boolean;
3084
+ /** @description Label as system generated or user generated. */
3085
+ labelAsSystem?: boolean;
3086
+ };
3087
+ };
3088
+ };
3089
+ operations: {};
3090
+ };
2895
3091
  "../../../lambda/functions/v1-route.swagger.yml": {
2896
3092
  paths: {
2897
3093
  "/api/v1/route": {
@@ -2965,15 +3161,7 @@ interface external$6 {
2965
3161
  dynamicInputs?: external$6["../../../lambda/functions/v1-route.swagger.yml"]["components"]["schemas"]["RouteDynamicInputs"];
2966
3162
  /** @enum {string} */
2967
3163
  type: "redirect";
2968
- redirect: {
2969
- /** @description Target meant to be redirected to. */
2970
- targetUrl: string;
2971
- /**
2972
- * @description Redirect type to occur from this redirect.
2973
- * @enum {integer}
2974
- */
2975
- targetStatusCode?: 301 | 302 | 307 | 308;
2976
- };
3164
+ redirect: external$6["../../../lambda/functions/v1-redirect.swagger.yml"]["components"]["schemas"]["Redirect"];
2977
3165
  };
2978
3166
  /**
2979
3167
  * @description The route matches a composition.
@@ -3114,15 +3302,7 @@ interface components {
3114
3302
  dynamicInputs?: components["schemas"]["RouteDynamicInputs"];
3115
3303
  /** @enum {string} */
3116
3304
  type: "redirect";
3117
- redirect: {
3118
- /** @description Target meant to be redirected to. */
3119
- targetUrl: string;
3120
- /**
3121
- * @description Redirect type to occur from this redirect.
3122
- * @enum {integer}
3123
- */
3124
- targetStatusCode?: 301 | 302 | 307 | 308;
3125
- };
3305
+ redirect: external$5["v1-redirect.swagger.yml"]["components"]["schemas"]["Redirect"];
3126
3306
  };
3127
3307
  /**
3128
3308
  * @description The route matches a composition.
@@ -4002,6 +4182,202 @@ interface external$5 {
4002
4182
  };
4003
4183
  operations: {};
4004
4184
  };
4185
+ "v1-redirect.swagger.yml": {
4186
+ paths: {
4187
+ "/api/v1/redirect": {
4188
+ /** Called to retrieve a list of redirects related to a project */
4189
+ get: {
4190
+ parameters: {
4191
+ query: {
4192
+ /** The project to fetch redirects for */
4193
+ projectId: string;
4194
+ /** Id of the redirect to retrieve */
4195
+ id?: string;
4196
+ /** Ids of the redirects to retrieve */
4197
+ ids?: string[];
4198
+ /** Source url to attempt to find redirects for */
4199
+ sourceUrl?: string;
4200
+ /** Id of the project map the source or target belongs to. */
4201
+ projectMapId?: string;
4202
+ /** Id of the project map node to find redirects for. */
4203
+ sourceProjectMapNodeId?: string;
4204
+ /** Id of the project map node to find redirects for. */
4205
+ targetProjectMapNodeId?: string;
4206
+ /** Column to order results by, only applicable if trie is not active. */
4207
+ orderBy?: "updated_at asc" | "updated_at desc" | "source_url asc" | "source_url desc" | "target_url asc" | "target_url desc" | "created_by asc" | "created_by desc";
4208
+ /** Limit the results to this number of results, ignored if using trie parameter. */
4209
+ limit?: number;
4210
+ /** Offset the results a certain amount, useful for pagination. */
4211
+ offset?: number;
4212
+ /** Search text to filter redirects by, filtering on the source and target urls */
4213
+ search?: string;
4214
+ };
4215
+ };
4216
+ responses: {
4217
+ /** OK */
4218
+ 200: {
4219
+ content: {
4220
+ "application/json": {
4221
+ redirects: external$5["v1-redirect.swagger.yml"]["components"]["schemas"]["RedirectGetResponse"];
4222
+ total?: number;
4223
+ resultUrl?: string;
4224
+ };
4225
+ };
4226
+ };
4227
+ 400: external$5["swagger.yml"]["components"]["responses"]["BadRequestError"];
4228
+ 401: external$5["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
4229
+ 403: external$5["swagger.yml"]["components"]["responses"]["ForbiddenError"];
4230
+ 429: external$5["swagger.yml"]["components"]["responses"]["RateLimitError"];
4231
+ 500: external$5["swagger.yml"]["components"]["responses"]["InternalServerError"];
4232
+ };
4233
+ };
4234
+ put: {
4235
+ responses: {
4236
+ /** OK */
4237
+ 200: {
4238
+ content: {
4239
+ "application/json": {
4240
+ /**
4241
+ * Format: uuid
4242
+ * @description Id of the redirect
4243
+ */
4244
+ id: string;
4245
+ };
4246
+ };
4247
+ };
4248
+ /** OK */
4249
+ 204: never;
4250
+ 400: external$5["swagger.yml"]["components"]["responses"]["BadRequestError"];
4251
+ 401: external$5["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
4252
+ 403: external$5["swagger.yml"]["components"]["responses"]["ForbiddenError"];
4253
+ 429: external$5["swagger.yml"]["components"]["responses"]["RateLimitError"];
4254
+ 500: external$5["swagger.yml"]["components"]["responses"]["InternalServerError"];
4255
+ };
4256
+ requestBody: {
4257
+ content: {
4258
+ "application/json": {
4259
+ /** @description Redirect object to insert */
4260
+ redirect: external$5["v1-redirect.swagger.yml"]["components"]["schemas"]["Redirect"];
4261
+ /**
4262
+ * Format: uuid
4263
+ * @description Project id to insert the redirect into
4264
+ */
4265
+ projectId: string;
4266
+ };
4267
+ };
4268
+ };
4269
+ };
4270
+ /** Called to delete a redirect */
4271
+ delete: {
4272
+ responses: {
4273
+ /** OK */
4274
+ 200: {
4275
+ content: {
4276
+ "application/json": {
4277
+ /**
4278
+ * Format: uuid
4279
+ * @description Id of the redirect
4280
+ */
4281
+ id: string;
4282
+ };
4283
+ };
4284
+ };
4285
+ /** OK */
4286
+ 204: never;
4287
+ 400: external$5["swagger.yml"]["components"]["responses"]["BadRequestError"];
4288
+ 401: external$5["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
4289
+ 403: external$5["swagger.yml"]["components"]["responses"]["ForbiddenError"];
4290
+ 429: external$5["swagger.yml"]["components"]["responses"]["RateLimitError"];
4291
+ 500: external$5["swagger.yml"]["components"]["responses"]["InternalServerError"];
4292
+ };
4293
+ requestBody: {
4294
+ content: {
4295
+ "application/json": {
4296
+ /**
4297
+ * Format: uuid
4298
+ * @description Redirect id to be deleted.
4299
+ */
4300
+ id: string;
4301
+ /**
4302
+ * Format: uuid
4303
+ * @description Project the redirect belongs to.
4304
+ */
4305
+ projectId: string;
4306
+ };
4307
+ };
4308
+ };
4309
+ };
4310
+ /** Handles preflight requests. This endpoint allows CORS. */
4311
+ options: {
4312
+ responses: {
4313
+ /** OK */
4314
+ 204: never;
4315
+ };
4316
+ };
4317
+ };
4318
+ };
4319
+ components: {
4320
+ schemas: {
4321
+ RedirectGetResponse: {
4322
+ redirect: external$5["v1-redirect.swagger.yml"]["components"]["schemas"]["Redirect"];
4323
+ metadata: external$5["v1-redirect.swagger.yml"]["components"]["schemas"]["RedirectMetadata"];
4324
+ }[];
4325
+ RedirectMetadata: {
4326
+ /** @description The last time the redirect was modified in UTC */
4327
+ updatedAt?: string;
4328
+ /** @description The last user who modified this redirect */
4329
+ updatedBy?: string;
4330
+ /** @description The time the redirect was created in UTC */
4331
+ createdAt?: string;
4332
+ /** @description The user who created this redirect or system */
4333
+ createdBy?: string;
4334
+ };
4335
+ Redirect: {
4336
+ /**
4337
+ * Format: uuid
4338
+ * @description Id of the redirect.
4339
+ */
4340
+ id?: string;
4341
+ /** @description Source meant to match a url that needs to be redirected. */
4342
+ sourceUrl: string;
4343
+ /** @description Target meant to be redirected to. */
4344
+ targetUrl: string;
4345
+ /** @description Redirect type to occur from this redirect. */
4346
+ targetStatusCode: number;
4347
+ /**
4348
+ * Format: uuid
4349
+ * @description Project map node related to the source this redirect.
4350
+ */
4351
+ sourceProjectMapNodeId?: string;
4352
+ /**
4353
+ * Format: uuid
4354
+ * @description Project map node related to the target this redirect.
4355
+ */
4356
+ targetProjectMapNodeId?: string;
4357
+ /**
4358
+ * Format: uuid
4359
+ * @description Project map related to this redirect.
4360
+ */
4361
+ projectMapId?: string;
4362
+ /** @description Signals the redirect engine to retain query string parameters to the target url. */
4363
+ sourceRetainQuerystring?: boolean;
4364
+ /** @description Incoming requests must match the domain that's defined in the redirection source. */
4365
+ sourceMustMatchDomain?: boolean;
4366
+ /** @description Rewritten url should match the protocol (http / https) of the incoming request instead of whatever is defined in the redirection target. */
4367
+ targetPreserveIncomingProtocol?: boolean;
4368
+ /** @description Rewritten url should match the domain of the incoming request regardless of what is defined in the redirection target. */
4369
+ targetPreserveIncomingDomain?: boolean;
4370
+ /** @description Stop running rules after this redirect rule gets executed. */
4371
+ stopExecutingAfter?: boolean;
4372
+ /** @description Merge incoming querystring with the querystring defined on the redirection target, taking the incoming querystring parameter where a merge is not possible. */
4373
+ targetMergeQuerystring?: boolean;
4374
+ /** @description Label as system generated or user generated. */
4375
+ labelAsSystem?: boolean;
4376
+ };
4377
+ };
4378
+ };
4379
+ operations: {};
4380
+ };
4005
4381
  }
4006
4382
 
4007
4383
  type Components = components$2['schemas'];
@@ -6754,6 +7130,15 @@ declare function getComponentJsonPointer(ancestorsAndSelf: Array<ComponentLocati
6754
7130
  withSlots?: boolean | undefined;
6755
7131
  }): string;
6756
7132
 
7133
+ /** Writes colorized logs about composition fetch warnings or errors to the console */
7134
+ declare function logCompositionIssues(prefix: string, issues: CompositionIssue[], colour?: 'red' | 'green' | 'yellow' | 'white'): void;
7135
+
7136
+ /** Writes colorized logs about a composition API fetch to the console */
7137
+ declare function logCompositionResponse(compositionApiResponse: CompositionResolvedGetResponse, duration?: number): void;
7138
+
7139
+ /** Writes colorized logs about a route API response to the console */
7140
+ declare function logRouteResponse(response: RouteGetResponse, duration?: number): void;
7141
+
6757
7142
  interface ContextualEditingWindowData {
6758
7143
  framework?: ReadyMessage['framework'];
6759
7144
  version?: ReadyMessage['version'];
@@ -7169,4 +7554,4 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
7169
7554
 
7170
7555
  declare const CanvasClientError: typeof ApiClientError;
7171
7556
 
7172
- export { AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentLocationReference, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionUIStatus, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceInputIssue, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DismissPlaceholderMessage, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS, EDGE_MAX_CACHE_TTL, EDGE_MAX_L2_CACHE_TTL_IN_HOURS, EDGE_MIN_CACHE_TTL, EDGE_MIN_L2_CACHE_TTL_IN_HOURS, EMPTY_COMPOSITION, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, InvalidationResult, LimitPolicy, MessageHandler, MoveComponentMessage, OverrideIssue, OverrideOptions, PLACEHOLDER_ID, PreviewEventBus, PreviewPanelSettings, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RootComponentInstance, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SelectComponentMessage, SpecificProjectMap, SubscribeToCompositionOptions, TriggerCompositionActionMessage, UncachedCanvasClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, bindVariables, bindVariablesToObject, compose, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isReportRenderedCompositionsMessage, isSelectComponentMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, subscribeToComposition, unstable_CompositionRelationshipClient, unstable_RouteClient, walkComponentTree };
7557
+ export { AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentLocationReference, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionUIStatus, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceInputIssue, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DismissPlaceholderMessage, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS, EDGE_MAX_CACHE_TTL, EDGE_MAX_L2_CACHE_TTL_IN_HOURS, EDGE_MIN_CACHE_TTL, EDGE_MIN_L2_CACHE_TTL_IN_HOURS, EMPTY_COMPOSITION, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, InvalidationResult, LimitPolicy, MessageHandler, MoveComponentMessage, OverrideIssue, OverrideOptions, PLACEHOLDER_ID, PreviewEventBus, PreviewPanelSettings, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RootComponentInstance, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SelectComponentMessage, SpecificProjectMap, SubscribeToCompositionOptions, TriggerCompositionActionMessage, UncachedCanvasClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, bindVariables, bindVariablesToObject, compose, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isReportRenderedCompositionsMessage, isSelectComponentMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdatePreviewSettingsMessage, localize, logCompositionIssues, logCompositionResponse, logRouteResponse, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, subscribeToComposition, unstable_CompositionRelationshipClient, unstable_RouteClient, walkComponentTree };
package/dist/index.esm.js CHANGED
@@ -1264,6 +1264,163 @@ var UniqueBatchEntries = class {
1264
1264
  }
1265
1265
  };
1266
1266
 
1267
+ // src/logging/logCompositionIssues.ts
1268
+ import ansicolors from "ansi-colors";
1269
+ var { gray, green, italic, red, white, yellow } = ansicolors;
1270
+ function logCompositionIssues(prefix, issues, colour = "red") {
1271
+ const reversedIssues = [...issues].reverse();
1272
+ const colours = { red, green, yellow, white };
1273
+ console.error(
1274
+ `${colours[colour](prefix)}
1275
+ ${reversedIssues.map(
1276
+ (issue) => `${colours[colour](">")} ${italic(gray(indent(issue.type.toUpperCase(), 7)))} ${renderIssue(issue)}`
1277
+ ).join("\n")}`
1278
+ );
1279
+ }
1280
+ function renderIssue(issue) {
1281
+ var _a;
1282
+ let path;
1283
+ let type;
1284
+ let message = issue.message;
1285
+ let detail;
1286
+ if (issue.type !== "config") {
1287
+ path = issue.componentPath;
1288
+ type = issue.componentType;
1289
+ message = issue.message;
1290
+ }
1291
+ if (issue.type === "binding") {
1292
+ detail = `Binding expression: ${(_a = issue.expression) == null ? void 0 : _a.pointer}`;
1293
+ } else if (issue.type === "data") {
1294
+ detail = `Data resource name: ${issue.dataName}, data type: ${issue.dataType}`;
1295
+ }
1296
+ if (issue.type === "input") {
1297
+ detail = issue.inputName;
1298
+ }
1299
+ let result = `${white(blockify(message))}`;
1300
+ if (detail) {
1301
+ result += `
1302
+ ${indent(" ", 10)}${gray(`${detail}`)}`;
1303
+ }
1304
+ if (path && type) {
1305
+ result += `
1306
+ ${indent(" ", 10)}${gray(`Occurred on component ${type} at slot path ${path}`)}`;
1307
+ }
1308
+ return result;
1309
+ }
1310
+ function indent(str, len) {
1311
+ const indent2 = len != null ? len : 10;
1312
+ return str.padStart(indent2);
1313
+ }
1314
+ function blockify(str, len) {
1315
+ const indentSize = len != null ? len : 10;
1316
+ return str.split("\n").map((line, index) => index === 0 ? line : `${indent(" ", indentSize)}${line}`).join("\n");
1317
+ }
1318
+
1319
+ // src/logging/logCompositionResponse.ts
1320
+ import ansicolors2 from "ansi-colors";
1321
+ var { white: white2 } = ansicolors2;
1322
+ function logCompositionResponse(compositionApiResponse, duration) {
1323
+ var _a, _b;
1324
+ const resErrors = (_a = compositionApiResponse.errors) != null ? _a : [];
1325
+ const resWarnings = (_b = compositionApiResponse.warnings) != null ? _b : [];
1326
+ if (resErrors.length > 0) {
1327
+ logCompositionIssues(
1328
+ `Composition data error${resErrors.length === 1 ? "" : "s"}; some content may be missing`,
1329
+ resErrors,
1330
+ "red"
1331
+ );
1332
+ }
1333
+ if (resWarnings.length > 0) {
1334
+ logCompositionIssues(
1335
+ `Composition data warning${resWarnings.length === 1 ? "" : "s"}; some content may be missing`,
1336
+ resWarnings,
1337
+ "yellow"
1338
+ );
1339
+ }
1340
+ if (compositionApiResponse.diagnostics) {
1341
+ console.log(`
1342
+ Diagnostics`);
1343
+ const { compositionFetch, data } = compositionApiResponse.diagnostics;
1344
+ const table = {
1345
+ [`${white2("Composition")}`]: {
1346
+ "Duration (ms)": resolveDiagnosticsDuration(compositionFetch),
1347
+ "Edge Cached": compositionFetch == null ? void 0 : compositionFetch.cacheHit
1348
+ }
1349
+ };
1350
+ if (data) {
1351
+ data.forEach((d) => {
1352
+ table[d.dataName] = {
1353
+ "Duration (ms)": resolveDiagnosticsDuration(d.performance),
1354
+ "Edge Cached": d.performance.cacheHit,
1355
+ "Retry Count": d.performance.retryCount
1356
+ };
1357
+ });
1358
+ }
1359
+ table["Total Response"] = {
1360
+ "Duration (ms)": duration != null ? duration : "no data"
1361
+ };
1362
+ console.table(table);
1363
+ }
1364
+ }
1365
+ function resolveDiagnosticsDuration(data) {
1366
+ var _a, _b;
1367
+ if (!data) {
1368
+ return "no data";
1369
+ }
1370
+ return (_b = (_a = data.duration) != null ? _a : data.total) != null ? _b : "no data";
1371
+ }
1372
+
1373
+ // src/logging/logCompositionRouteResponse.ts
1374
+ import ansicolors3 from "ansi-colors";
1375
+ var { gray: gray2, green: green2, red: red2, yellow: yellow2 } = ansicolors3;
1376
+ function logRouteCompositionResponse(matched, duration) {
1377
+ var _a, _b;
1378
+ const resErrors = (_a = matched.compositionApiResponse.errors) != null ? _a : [];
1379
+ const resWarnings = (_b = matched.compositionApiResponse.warnings) != null ? _b : [];
1380
+ const colour = resErrors.length > 0 ? red2 : resWarnings.length > 0 ? yellow2 : green2;
1381
+ console.log(`${colour("Matched")} ${matched.type} ${matched.matchedRoute} (${duration}ms)`);
1382
+ if (matched.dynamicInputs) {
1383
+ const entries = Object.entries(matched.dynamicInputs);
1384
+ if (entries.length > 0) {
1385
+ console.log(
1386
+ ` ${gray2("Matched dynamic inputs:\n ")}`,
1387
+ entries.map(([k, v]) => `${k}: ${v}`).join("\n ")
1388
+ );
1389
+ }
1390
+ }
1391
+ logCompositionResponse(matched.compositionApiResponse, duration);
1392
+ }
1393
+
1394
+ // src/logging/logNotFoundRouteResponse.ts
1395
+ import ansicolors4 from "ansi-colors";
1396
+ var { yellow: yellow3 } = ansicolors4;
1397
+ function logNotFoundRouteResponse(_matched, duration) {
1398
+ console.log(`${yellow3("Not found")} no project map or redirect path match (${duration}ms)`);
1399
+ }
1400
+
1401
+ // src/logging/logRedirectRouteResponse.ts
1402
+ import ansicolors5 from "ansi-colors";
1403
+ var { green: green3 } = ansicolors5;
1404
+ function logRedirectRouteResponse(matched, duration) {
1405
+ console.log(
1406
+ `${green3("Matched")} ${matched.type} ${matched.matchedRoute} (${duration}ms)
1407
+ Target: ${matched.redirect.targetUrl}`
1408
+ );
1409
+ }
1410
+
1411
+ // src/logging/logRouteResponse.ts
1412
+ function logRouteResponse(response, duration) {
1413
+ if (response.type === "redirect") {
1414
+ logRedirectRouteResponse(response, duration);
1415
+ return;
1416
+ }
1417
+ if (response.type === "notFound") {
1418
+ logNotFoundRouteResponse(response, duration);
1419
+ return;
1420
+ }
1421
+ logRouteCompositionResponse(response, duration);
1422
+ }
1423
+
1267
1424
  // src/utils/hash.ts
1268
1425
  var generateHash = ({
1269
1426
  composition,
@@ -1767,6 +1924,9 @@ export {
1767
1924
  isUpdateCompositionMessage,
1768
1925
  isUpdatePreviewSettingsMessage,
1769
1926
  localize,
1927
+ logCompositionIssues,
1928
+ logCompositionResponse,
1929
+ logRouteResponse,
1770
1930
  mapSlotToPersonalizedVariations,
1771
1931
  mapSlotToTestVariations,
1772
1932
  nullLimitPolicy,
package/dist/index.js CHANGED
@@ -338,6 +338,9 @@ __export(src_exports, {
338
338
  isUpdateCompositionMessage: () => isUpdateCompositionMessage,
339
339
  isUpdatePreviewSettingsMessage: () => isUpdatePreviewSettingsMessage,
340
340
  localize: () => localize,
341
+ logCompositionIssues: () => logCompositionIssues,
342
+ logCompositionResponse: () => logCompositionResponse,
343
+ logRouteResponse: () => logRouteResponse,
341
344
  mapSlotToPersonalizedVariations: () => mapSlotToPersonalizedVariations,
342
345
  mapSlotToTestVariations: () => mapSlotToTestVariations,
343
346
  nullLimitPolicy: () => nullLimitPolicy,
@@ -1347,6 +1350,163 @@ var UniqueBatchEntries = class {
1347
1350
  }
1348
1351
  };
1349
1352
 
1353
+ // src/logging/logCompositionIssues.ts
1354
+ var import_ansi_colors = __toESM(require("ansi-colors"));
1355
+ var { gray, green, italic, red, white, yellow } = import_ansi_colors.default;
1356
+ function logCompositionIssues(prefix, issues, colour = "red") {
1357
+ const reversedIssues = [...issues].reverse();
1358
+ const colours = { red, green, yellow, white };
1359
+ console.error(
1360
+ `${colours[colour](prefix)}
1361
+ ${reversedIssues.map(
1362
+ (issue) => `${colours[colour](">")} ${italic(gray(indent(issue.type.toUpperCase(), 7)))} ${renderIssue(issue)}`
1363
+ ).join("\n")}`
1364
+ );
1365
+ }
1366
+ function renderIssue(issue) {
1367
+ var _a;
1368
+ let path;
1369
+ let type;
1370
+ let message = issue.message;
1371
+ let detail;
1372
+ if (issue.type !== "config") {
1373
+ path = issue.componentPath;
1374
+ type = issue.componentType;
1375
+ message = issue.message;
1376
+ }
1377
+ if (issue.type === "binding") {
1378
+ detail = `Binding expression: ${(_a = issue.expression) == null ? void 0 : _a.pointer}`;
1379
+ } else if (issue.type === "data") {
1380
+ detail = `Data resource name: ${issue.dataName}, data type: ${issue.dataType}`;
1381
+ }
1382
+ if (issue.type === "input") {
1383
+ detail = issue.inputName;
1384
+ }
1385
+ let result = `${white(blockify(message))}`;
1386
+ if (detail) {
1387
+ result += `
1388
+ ${indent(" ", 10)}${gray(`${detail}`)}`;
1389
+ }
1390
+ if (path && type) {
1391
+ result += `
1392
+ ${indent(" ", 10)}${gray(`Occurred on component ${type} at slot path ${path}`)}`;
1393
+ }
1394
+ return result;
1395
+ }
1396
+ function indent(str, len) {
1397
+ const indent2 = len != null ? len : 10;
1398
+ return str.padStart(indent2);
1399
+ }
1400
+ function blockify(str, len) {
1401
+ const indentSize = len != null ? len : 10;
1402
+ return str.split("\n").map((line, index) => index === 0 ? line : `${indent(" ", indentSize)}${line}`).join("\n");
1403
+ }
1404
+
1405
+ // src/logging/logCompositionResponse.ts
1406
+ var import_ansi_colors2 = __toESM(require("ansi-colors"));
1407
+ var { white: white2 } = import_ansi_colors2.default;
1408
+ function logCompositionResponse(compositionApiResponse, duration) {
1409
+ var _a, _b;
1410
+ const resErrors = (_a = compositionApiResponse.errors) != null ? _a : [];
1411
+ const resWarnings = (_b = compositionApiResponse.warnings) != null ? _b : [];
1412
+ if (resErrors.length > 0) {
1413
+ logCompositionIssues(
1414
+ `Composition data error${resErrors.length === 1 ? "" : "s"}; some content may be missing`,
1415
+ resErrors,
1416
+ "red"
1417
+ );
1418
+ }
1419
+ if (resWarnings.length > 0) {
1420
+ logCompositionIssues(
1421
+ `Composition data warning${resWarnings.length === 1 ? "" : "s"}; some content may be missing`,
1422
+ resWarnings,
1423
+ "yellow"
1424
+ );
1425
+ }
1426
+ if (compositionApiResponse.diagnostics) {
1427
+ console.log(`
1428
+ Diagnostics`);
1429
+ const { compositionFetch, data } = compositionApiResponse.diagnostics;
1430
+ const table = {
1431
+ [`${white2("Composition")}`]: {
1432
+ "Duration (ms)": resolveDiagnosticsDuration(compositionFetch),
1433
+ "Edge Cached": compositionFetch == null ? void 0 : compositionFetch.cacheHit
1434
+ }
1435
+ };
1436
+ if (data) {
1437
+ data.forEach((d) => {
1438
+ table[d.dataName] = {
1439
+ "Duration (ms)": resolveDiagnosticsDuration(d.performance),
1440
+ "Edge Cached": d.performance.cacheHit,
1441
+ "Retry Count": d.performance.retryCount
1442
+ };
1443
+ });
1444
+ }
1445
+ table["Total Response"] = {
1446
+ "Duration (ms)": duration != null ? duration : "no data"
1447
+ };
1448
+ console.table(table);
1449
+ }
1450
+ }
1451
+ function resolveDiagnosticsDuration(data) {
1452
+ var _a, _b;
1453
+ if (!data) {
1454
+ return "no data";
1455
+ }
1456
+ return (_b = (_a = data.duration) != null ? _a : data.total) != null ? _b : "no data";
1457
+ }
1458
+
1459
+ // src/logging/logCompositionRouteResponse.ts
1460
+ var import_ansi_colors3 = __toESM(require("ansi-colors"));
1461
+ var { gray: gray2, green: green2, red: red2, yellow: yellow2 } = import_ansi_colors3.default;
1462
+ function logRouteCompositionResponse(matched, duration) {
1463
+ var _a, _b;
1464
+ const resErrors = (_a = matched.compositionApiResponse.errors) != null ? _a : [];
1465
+ const resWarnings = (_b = matched.compositionApiResponse.warnings) != null ? _b : [];
1466
+ const colour = resErrors.length > 0 ? red2 : resWarnings.length > 0 ? yellow2 : green2;
1467
+ console.log(`${colour("Matched")} ${matched.type} ${matched.matchedRoute} (${duration}ms)`);
1468
+ if (matched.dynamicInputs) {
1469
+ const entries = Object.entries(matched.dynamicInputs);
1470
+ if (entries.length > 0) {
1471
+ console.log(
1472
+ ` ${gray2("Matched dynamic inputs:\n ")}`,
1473
+ entries.map(([k, v]) => `${k}: ${v}`).join("\n ")
1474
+ );
1475
+ }
1476
+ }
1477
+ logCompositionResponse(matched.compositionApiResponse, duration);
1478
+ }
1479
+
1480
+ // src/logging/logNotFoundRouteResponse.ts
1481
+ var import_ansi_colors4 = __toESM(require("ansi-colors"));
1482
+ var { yellow: yellow3 } = import_ansi_colors4.default;
1483
+ function logNotFoundRouteResponse(_matched, duration) {
1484
+ console.log(`${yellow3("Not found")} no project map or redirect path match (${duration}ms)`);
1485
+ }
1486
+
1487
+ // src/logging/logRedirectRouteResponse.ts
1488
+ var import_ansi_colors5 = __toESM(require("ansi-colors"));
1489
+ var { green: green3 } = import_ansi_colors5.default;
1490
+ function logRedirectRouteResponse(matched, duration) {
1491
+ console.log(
1492
+ `${green3("Matched")} ${matched.type} ${matched.matchedRoute} (${duration}ms)
1493
+ Target: ${matched.redirect.targetUrl}`
1494
+ );
1495
+ }
1496
+
1497
+ // src/logging/logRouteResponse.ts
1498
+ function logRouteResponse(response, duration) {
1499
+ if (response.type === "redirect") {
1500
+ logRedirectRouteResponse(response, duration);
1501
+ return;
1502
+ }
1503
+ if (response.type === "notFound") {
1504
+ logNotFoundRouteResponse(response, duration);
1505
+ return;
1506
+ }
1507
+ logRouteCompositionResponse(response, duration);
1508
+ }
1509
+
1350
1510
  // src/utils/hash.ts
1351
1511
  var generateHash = ({
1352
1512
  composition,
@@ -1851,6 +2011,9 @@ var CanvasClientError = import_api6.ApiClientError;
1851
2011
  isUpdateCompositionMessage,
1852
2012
  isUpdatePreviewSettingsMessage,
1853
2013
  localize,
2014
+ logCompositionIssues,
2015
+ logCompositionResponse,
2016
+ logRouteResponse,
1854
2017
  mapSlotToPersonalizedVariations,
1855
2018
  mapSlotToTestVariations,
1856
2019
  nullLimitPolicy,
package/dist/index.mjs CHANGED
@@ -1264,6 +1264,163 @@ var UniqueBatchEntries = class {
1264
1264
  }
1265
1265
  };
1266
1266
 
1267
+ // src/logging/logCompositionIssues.ts
1268
+ import ansicolors from "ansi-colors";
1269
+ var { gray, green, italic, red, white, yellow } = ansicolors;
1270
+ function logCompositionIssues(prefix, issues, colour = "red") {
1271
+ const reversedIssues = [...issues].reverse();
1272
+ const colours = { red, green, yellow, white };
1273
+ console.error(
1274
+ `${colours[colour](prefix)}
1275
+ ${reversedIssues.map(
1276
+ (issue) => `${colours[colour](">")} ${italic(gray(indent(issue.type.toUpperCase(), 7)))} ${renderIssue(issue)}`
1277
+ ).join("\n")}`
1278
+ );
1279
+ }
1280
+ function renderIssue(issue) {
1281
+ var _a;
1282
+ let path;
1283
+ let type;
1284
+ let message = issue.message;
1285
+ let detail;
1286
+ if (issue.type !== "config") {
1287
+ path = issue.componentPath;
1288
+ type = issue.componentType;
1289
+ message = issue.message;
1290
+ }
1291
+ if (issue.type === "binding") {
1292
+ detail = `Binding expression: ${(_a = issue.expression) == null ? void 0 : _a.pointer}`;
1293
+ } else if (issue.type === "data") {
1294
+ detail = `Data resource name: ${issue.dataName}, data type: ${issue.dataType}`;
1295
+ }
1296
+ if (issue.type === "input") {
1297
+ detail = issue.inputName;
1298
+ }
1299
+ let result = `${white(blockify(message))}`;
1300
+ if (detail) {
1301
+ result += `
1302
+ ${indent(" ", 10)}${gray(`${detail}`)}`;
1303
+ }
1304
+ if (path && type) {
1305
+ result += `
1306
+ ${indent(" ", 10)}${gray(`Occurred on component ${type} at slot path ${path}`)}`;
1307
+ }
1308
+ return result;
1309
+ }
1310
+ function indent(str, len) {
1311
+ const indent2 = len != null ? len : 10;
1312
+ return str.padStart(indent2);
1313
+ }
1314
+ function blockify(str, len) {
1315
+ const indentSize = len != null ? len : 10;
1316
+ return str.split("\n").map((line, index) => index === 0 ? line : `${indent(" ", indentSize)}${line}`).join("\n");
1317
+ }
1318
+
1319
+ // src/logging/logCompositionResponse.ts
1320
+ import ansicolors2 from "ansi-colors";
1321
+ var { white: white2 } = ansicolors2;
1322
+ function logCompositionResponse(compositionApiResponse, duration) {
1323
+ var _a, _b;
1324
+ const resErrors = (_a = compositionApiResponse.errors) != null ? _a : [];
1325
+ const resWarnings = (_b = compositionApiResponse.warnings) != null ? _b : [];
1326
+ if (resErrors.length > 0) {
1327
+ logCompositionIssues(
1328
+ `Composition data error${resErrors.length === 1 ? "" : "s"}; some content may be missing`,
1329
+ resErrors,
1330
+ "red"
1331
+ );
1332
+ }
1333
+ if (resWarnings.length > 0) {
1334
+ logCompositionIssues(
1335
+ `Composition data warning${resWarnings.length === 1 ? "" : "s"}; some content may be missing`,
1336
+ resWarnings,
1337
+ "yellow"
1338
+ );
1339
+ }
1340
+ if (compositionApiResponse.diagnostics) {
1341
+ console.log(`
1342
+ Diagnostics`);
1343
+ const { compositionFetch, data } = compositionApiResponse.diagnostics;
1344
+ const table = {
1345
+ [`${white2("Composition")}`]: {
1346
+ "Duration (ms)": resolveDiagnosticsDuration(compositionFetch),
1347
+ "Edge Cached": compositionFetch == null ? void 0 : compositionFetch.cacheHit
1348
+ }
1349
+ };
1350
+ if (data) {
1351
+ data.forEach((d) => {
1352
+ table[d.dataName] = {
1353
+ "Duration (ms)": resolveDiagnosticsDuration(d.performance),
1354
+ "Edge Cached": d.performance.cacheHit,
1355
+ "Retry Count": d.performance.retryCount
1356
+ };
1357
+ });
1358
+ }
1359
+ table["Total Response"] = {
1360
+ "Duration (ms)": duration != null ? duration : "no data"
1361
+ };
1362
+ console.table(table);
1363
+ }
1364
+ }
1365
+ function resolveDiagnosticsDuration(data) {
1366
+ var _a, _b;
1367
+ if (!data) {
1368
+ return "no data";
1369
+ }
1370
+ return (_b = (_a = data.duration) != null ? _a : data.total) != null ? _b : "no data";
1371
+ }
1372
+
1373
+ // src/logging/logCompositionRouteResponse.ts
1374
+ import ansicolors3 from "ansi-colors";
1375
+ var { gray: gray2, green: green2, red: red2, yellow: yellow2 } = ansicolors3;
1376
+ function logRouteCompositionResponse(matched, duration) {
1377
+ var _a, _b;
1378
+ const resErrors = (_a = matched.compositionApiResponse.errors) != null ? _a : [];
1379
+ const resWarnings = (_b = matched.compositionApiResponse.warnings) != null ? _b : [];
1380
+ const colour = resErrors.length > 0 ? red2 : resWarnings.length > 0 ? yellow2 : green2;
1381
+ console.log(`${colour("Matched")} ${matched.type} ${matched.matchedRoute} (${duration}ms)`);
1382
+ if (matched.dynamicInputs) {
1383
+ const entries = Object.entries(matched.dynamicInputs);
1384
+ if (entries.length > 0) {
1385
+ console.log(
1386
+ ` ${gray2("Matched dynamic inputs:\n ")}`,
1387
+ entries.map(([k, v]) => `${k}: ${v}`).join("\n ")
1388
+ );
1389
+ }
1390
+ }
1391
+ logCompositionResponse(matched.compositionApiResponse, duration);
1392
+ }
1393
+
1394
+ // src/logging/logNotFoundRouteResponse.ts
1395
+ import ansicolors4 from "ansi-colors";
1396
+ var { yellow: yellow3 } = ansicolors4;
1397
+ function logNotFoundRouteResponse(_matched, duration) {
1398
+ console.log(`${yellow3("Not found")} no project map or redirect path match (${duration}ms)`);
1399
+ }
1400
+
1401
+ // src/logging/logRedirectRouteResponse.ts
1402
+ import ansicolors5 from "ansi-colors";
1403
+ var { green: green3 } = ansicolors5;
1404
+ function logRedirectRouteResponse(matched, duration) {
1405
+ console.log(
1406
+ `${green3("Matched")} ${matched.type} ${matched.matchedRoute} (${duration}ms)
1407
+ Target: ${matched.redirect.targetUrl}`
1408
+ );
1409
+ }
1410
+
1411
+ // src/logging/logRouteResponse.ts
1412
+ function logRouteResponse(response, duration) {
1413
+ if (response.type === "redirect") {
1414
+ logRedirectRouteResponse(response, duration);
1415
+ return;
1416
+ }
1417
+ if (response.type === "notFound") {
1418
+ logNotFoundRouteResponse(response, duration);
1419
+ return;
1420
+ }
1421
+ logRouteCompositionResponse(response, duration);
1422
+ }
1423
+
1267
1424
  // src/utils/hash.ts
1268
1425
  var generateHash = ({
1269
1426
  composition,
@@ -1767,6 +1924,9 @@ export {
1767
1924
  isUpdateCompositionMessage,
1768
1925
  isUpdatePreviewSettingsMessage,
1769
1926
  localize,
1927
+ logCompositionIssues,
1928
+ logCompositionResponse,
1929
+ logRouteResponse,
1770
1930
  mapSlotToPersonalizedVariations,
1771
1931
  mapSlotToTestVariations,
1772
1932
  nullLimitPolicy,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.8.0",
3
+ "version": "19.9.2-alpha.3+547c8b11d",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -17,16 +17,6 @@
17
17
  }
18
18
  },
19
19
  "types": "./dist/index.d.ts",
20
- "typesVersions": {
21
- "*": {
22
- ".": [
23
- "./dist/index.d.ts"
24
- ],
25
- "cli": [
26
- "./dist/cli/cli.d.ts"
27
- ]
28
- }
29
- },
30
20
  "sideEffects": false,
31
21
  "scripts": {
32
22
  "build": "run-s update-openapi build:ts",
@@ -47,7 +37,8 @@
47
37
  "pusher-js": "8.0.1"
48
38
  },
49
39
  "dependencies": {
50
- "@uniformdev/context": "19.8.0",
40
+ "@uniformdev/context": "19.9.2-alpha.3+547c8b11d",
41
+ "ansi-colors": "^4.1.3",
51
42
  "immer": "9.0.21"
52
43
  },
53
44
  "files": [
@@ -56,5 +47,5 @@
56
47
  "publishConfig": {
57
48
  "access": "public"
58
49
  },
59
- "gitHead": "70eb9277bbfaee5f9245e1b26b4e77caede22944"
50
+ "gitHead": "547c8b11d4655b34250c2fbe3f016c9bc12c3905"
60
51
  }