@uniformdev/canvas 19.14.1 → 19.14.2-alpha.11

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
@@ -7337,15 +7337,6 @@ declare function getComponentJsonPointer(ancestorsAndSelf: Array<ComponentLocati
7337
7337
  withSlots?: boolean | undefined;
7338
7338
  }): string;
7339
7339
 
7340
- /** Writes colorized logs about composition fetch warnings or errors to the console */
7341
- declare function logCompositionIssues(prefix: string, issues: CompositionIssue[], colour?: 'red' | 'green' | 'yellow' | 'white'): void;
7342
-
7343
- /** Writes colorized logs about a composition API fetch to the console */
7344
- declare function logCompositionResponse(compositionApiResponse: CompositionResolvedGetResponse, duration?: number): void;
7345
-
7346
- /** Writes colorized logs about a route API response to the console */
7347
- declare function logRouteResponse(response: RouteGetResponse, duration?: number): void;
7348
-
7349
7340
  interface ContextualEditingWindowData {
7350
7341
  framework?: ReadyMessage['framework'];
7351
7342
  version?: ReadyMessage['version'];
@@ -7761,4 +7752,4 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
7761
7752
 
7762
7753
  declare const CanvasClientError: typeof ApiClientError;
7763
7754
 
7764
- 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, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NonProjectMapLinkParamValue, OverrideIssue, OverrideOptions, PLACEHOLDER_ID, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, 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 };
7755
+ 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, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NonProjectMapLinkParamValue, OverrideIssue, OverrideOptions, PLACEHOLDER_ID, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, 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 };
package/dist/index.esm.js CHANGED
@@ -1264,163 +1264,6 @@ 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
-
1424
1267
  // src/utils/hash.ts
1425
1268
  var generateHash = ({
1426
1269
  composition,
@@ -1924,9 +1767,6 @@ export {
1924
1767
  isUpdateCompositionMessage,
1925
1768
  isUpdatePreviewSettingsMessage,
1926
1769
  localize,
1927
- logCompositionIssues,
1928
- logCompositionResponse,
1929
- logRouteResponse,
1930
1770
  mapSlotToPersonalizedVariations,
1931
1771
  mapSlotToTestVariations,
1932
1772
  nullLimitPolicy,
package/dist/index.js CHANGED
@@ -338,9 +338,6 @@ __export(src_exports, {
338
338
  isUpdateCompositionMessage: () => isUpdateCompositionMessage,
339
339
  isUpdatePreviewSettingsMessage: () => isUpdatePreviewSettingsMessage,
340
340
  localize: () => localize,
341
- logCompositionIssues: () => logCompositionIssues,
342
- logCompositionResponse: () => logCompositionResponse,
343
- logRouteResponse: () => logRouteResponse,
344
341
  mapSlotToPersonalizedVariations: () => mapSlotToPersonalizedVariations,
345
342
  mapSlotToTestVariations: () => mapSlotToTestVariations,
346
343
  nullLimitPolicy: () => nullLimitPolicy,
@@ -1350,163 +1347,6 @@ var UniqueBatchEntries = class {
1350
1347
  }
1351
1348
  };
1352
1349
 
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
-
1510
1350
  // src/utils/hash.ts
1511
1351
  var generateHash = ({
1512
1352
  composition,
@@ -2011,9 +1851,6 @@ var CanvasClientError = import_api6.ApiClientError;
2011
1851
  isUpdateCompositionMessage,
2012
1852
  isUpdatePreviewSettingsMessage,
2013
1853
  localize,
2014
- logCompositionIssues,
2015
- logCompositionResponse,
2016
- logRouteResponse,
2017
1854
  mapSlotToPersonalizedVariations,
2018
1855
  mapSlotToTestVariations,
2019
1856
  nullLimitPolicy,
package/dist/index.mjs CHANGED
@@ -1264,163 +1264,6 @@ 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
-
1424
1267
  // src/utils/hash.ts
1425
1268
  var generateHash = ({
1426
1269
  composition,
@@ -1924,9 +1767,6 @@ export {
1924
1767
  isUpdateCompositionMessage,
1925
1768
  isUpdatePreviewSettingsMessage,
1926
1769
  localize,
1927
- logCompositionIssues,
1928
- logCompositionResponse,
1929
- logRouteResponse,
1930
1770
  mapSlotToPersonalizedVariations,
1931
1771
  mapSlotToTestVariations,
1932
1772
  nullLimitPolicy,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.14.1",
3
+ "version": "19.14.2-alpha.11+79c4dd05d",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -38,8 +38,7 @@
38
38
  "pusher-js": "8.0.1"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/context": "19.14.1",
42
- "ansi-colors": "^4.1.3",
41
+ "@uniformdev/context": "19.14.2-alpha.11+79c4dd05d",
43
42
  "immer": "9.0.21"
44
43
  },
45
44
  "files": [
@@ -48,5 +47,5 @@
48
47
  "publishConfig": {
49
48
  "access": "public"
50
49
  },
51
- "gitHead": "edd5e3bb74b148c5b947109a794a3bab42384cb7"
50
+ "gitHead": "79c4dd05dd9fb452762d03812539d5cf0eba44fa"
52
51
  }