@callimacus/thamyr-core 4.9.0 → 4.10.0

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.
@@ -478,6 +478,44 @@ type WhisperPayload = {
478
478
  generated_at: number;
479
479
  ttl_ms: number;
480
480
  };
481
+ type SkesisItemPage = {
482
+ /**
483
+ * The canonical page path, `/map/{locale}/{slug}/{id}`, as the sitemap lists it
484
+ */
485
+ path: string;
486
+ /**
487
+ * The catalogue locale the item is read in, as the engine spells it (e.g. `en-IT`)
488
+ */
489
+ locale: string;
490
+ kind: string;
491
+ /**
492
+ * The URL segment the site publishes the item's kind under
493
+ */
494
+ slug: string;
495
+ /**
496
+ * The item's title, or its id when it has none
497
+ */
498
+ title: string;
499
+ /**
500
+ * The item's description, as plain text
501
+ */
502
+ description?: string;
503
+ /**
504
+ * The URL of the item's first image
505
+ */
506
+ image?: string;
507
+ /**
508
+ * The item as stored, for a page that shows more than the crawler is served
509
+ */
510
+ item: {
511
+ id: string;
512
+ kind: string;
513
+ locale: string;
514
+ fields: {
515
+ [key: string]: unknown;
516
+ };
517
+ };
518
+ };
481
519
  type ProductMatch = {
482
520
  match?: {
483
521
  id: string;
@@ -3009,6 +3047,37 @@ type SkesisRelatedResponses = {
3009
3047
  */
3010
3048
  200: SkesisRelatedResponse;
3011
3049
  };
3050
+ type SkesisGetItemByPathErrors = {
3051
+ /**
3052
+ * Validation error
3053
+ */
3054
+ 400: unknown;
3055
+ /**
3056
+ * Missing or invalid access token
3057
+ */
3058
+ 401: unknown;
3059
+ /**
3060
+ * The caller is not permitted to perform this operation
3061
+ */
3062
+ 403: PinaxForbidden;
3063
+ /**
3064
+ * Path did not resolve to a published item
3065
+ */
3066
+ 404: PublicError;
3067
+ /**
3068
+ * Skesis engine unavailable (rate cap, upstream failure, or not configured); retry later
3069
+ */
3070
+ 502: {
3071
+ error: string;
3072
+ errorId: string;
3073
+ };
3074
+ };
3075
+ type SkesisGetItemByPathResponses = {
3076
+ /**
3077
+ * Success
3078
+ */
3079
+ 200: SkesisItemPage;
3080
+ };
3012
3081
 
3013
3082
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
3014
3083
  /**
@@ -3214,6 +3283,14 @@ declare class Skesis extends HeyApiClient {
3214
3283
  anchorId: string;
3215
3284
  locale?: string;
3216
3285
  }, options?: Options<never, ThrowOnError>): RequestResult<SkesisRelatedResponses, SkesisRelatedErrors, ThrowOnError>;
3286
+ /**
3287
+ * Get a catalogue item page by its path
3288
+ *
3289
+ * Resolves a `/map/{locale}/{slug}/{id}` path from the sitemap to what the crawler is served there: a visible item of a kind the site publishes as pages, in that locale. Pass the path as the browser shows it (`location.pathname`). A document wins a path both could name, so resolve a `/map/` path with `content.getDocumentByPath` first and with this read on its 404. A path that names no such item is a 404, not a 400.
3290
+ */
3291
+ getItemByPath<ThrowOnError extends boolean = false>(parameters: {
3292
+ path: string;
3293
+ }, options?: Options<never, ThrowOnError>): RequestResult<SkesisGetItemByPathResponses, SkesisGetItemByPathErrors, ThrowOnError>;
3217
3294
  }
3218
3295
  declare class CallimacusApi extends HeyApiClient {
3219
3296
  static readonly __registry: HeyApiRegistry<CallimacusApi>;
@@ -3913,7 +3990,9 @@ type MapPath = {
3913
3990
  */
3914
3991
  declare function parseMapPath(pathname: string): MapPath | undefined;
3915
3992
  /**
3916
- What a `/map/…` pathname shows: one document, or the per-language index.
3993
+ What a `/map/…` pathname shows: one document, the per-language index, or one
3994
+ catalogue item (`language` is then the catalogue locale, `slug` the kind's
3995
+ slug and the item id).
3917
3996
  */
3918
3997
  type MapPage = {
3919
3998
  kind: 'document';
@@ -3924,11 +4003,18 @@ type MapPage = {
3924
4003
  kind: 'index';
3925
4004
  language: string;
3926
4005
  entries: DocumentIndexEntry[];
4006
+ } | {
4007
+ kind: 'item';
4008
+ language: string;
4009
+ slug: string;
4010
+ itemPage: SkesisItemPage;
3927
4011
  };
3928
4012
  /**
3929
4013
  Resolves what to show at a `/map/…` pathname: the document at
3930
- `/map/{language}/{slug}`, or the entries of the per-language index at
3931
- `/map/{language}` — the same list the crawler is served, newest first.
4014
+ `/map/{language}/{slug}`, the entries of the per-language index at
4015
+ `/map/{language}` — the same list the crawler is served, newest first — or the
4016
+ catalogue item at `/map/{locale}/{kind-slug}/{id}`. A document wins a path both
4017
+ could name, as it does in the server render.
3932
4018
  @param api - A `Thamyr` instance, or the React package's `thamyrApi`.
3933
4019
  @param pathname - `location.pathname`.
3934
4020
  @returns `undefined` when the pathname is not a `/map/` path or names no
@@ -3936,7 +4022,7 @@ type MapPage = {
3936
4022
  failure (network, a 5xx, an SDK not initialized) rejects — with a
3937
4023
  `ThamyrHttpError` when a response arrived.
3938
4024
  */
3939
- declare function resolveMapPage(api: Pick<CallimacusApi, 'content'>, pathname: string): Promise<MapPage | undefined>;
4025
+ declare function resolveMapPage(api: Pick<CallimacusApi, 'content' | 'skesis'>, pathname: string): Promise<MapPage | undefined>;
3940
4026
 
3941
4027
  /**
3942
4028
  Structured payload the server attaches to a refused handshake (SOL-1100):
@@ -4153,4 +4239,4 @@ declare function transformImageUrl(cdnUrl: string, edits: ImageEdits): string;
4153
4239
  declare function randomUuid(): string;
4154
4240
 
4155
4241
  export { ACTION_TYPES, ADD_TO_CART_RESULT_BLOCK, CallimacusApi, CallimacusEvent, CallimacusService, ChapterStatus, ClientEvents, DELIVER_RESULT_BLOCK, GalleryMode, LANDING_VALUE_MAX_LENGTH, MAX_HANDSHAKE_RETRIES, SLInputEventType, ServerEvents, ThamyrHttpError, ThamyrResponseType, UserInteractionType, actionOf, addToCartResultOf, applyBlockPatch, blockKeyOf, callimacusService, classifyConnectError, createContractClient, deliverResultOf, extractTtsAudio, fieldsOf, interactionRound, isCustomBlock, isMasterProduct, isSetProduct, landingRound, logger, parseConnectRejection, parseMapPath, randomUuid, receptorsOf, resolveMapPage, shouldRetryHandshake, transformImageUrl };
4156
- export type { Action, ActionType, AddToCartResult, BCProduct, Basket, Block, BlockPatch, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, DeliverResult, DocumentIndexEntry, ErrorCallback, ErrorMessage, Gallery, GenericProduct, HomePage, Image, ImageEdits, ImageFormatEdit, ImageResizeEdit, InteractionContext, InteractionId, InteractionOptions, InteractionPayload, InteractionPayloadMap, LegacyBlock, LocalizedEPArtwork, LocalizedEPChapter, LogLevel, LoggerConfig, MapPage, MapPath, MasterProduct, MasterProductWithVariationGroup, OptionItem, ProductItem, ProductMatch, RecommendationsResponse, RiveManifest, RoundOptions, SLDocument, SLDocumentSection, SLInputEvent, ServerResponseCallback, SetProduct, SkesisItem, SkesisRelatedResponse, SkesisSimilarResponse, Story, SuggestPayload, Suggestions, ThamyrInteractionMap, ThamyrResponse, Topic, TopicContentsPage, TopicSummary, TtsAudio, UiElement, UiObserverConfig, UiSnapshot, UserInteraction, Variant, VariationAttribute, VariationGroup, Video, WhisperPayload };
4242
+ export type { Action, ActionType, AddToCartResult, BCProduct, Basket, Block, BlockPatch, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, DeliverResult, DocumentIndexEntry, ErrorCallback, ErrorMessage, Gallery, GenericProduct, HomePage, Image, ImageEdits, ImageFormatEdit, ImageResizeEdit, InteractionContext, InteractionId, InteractionOptions, InteractionPayload, InteractionPayloadMap, LegacyBlock, LocalizedEPArtwork, LocalizedEPChapter, LogLevel, LoggerConfig, MapPage, MapPath, MasterProduct, MasterProductWithVariationGroup, OptionItem, ProductItem, ProductMatch, RecommendationsResponse, RiveManifest, RoundOptions, SLDocument, SLDocumentSection, SLInputEvent, ServerResponseCallback, SetProduct, SkesisItem, SkesisItemPage, SkesisRelatedResponse, SkesisSimilarResponse, Story, SuggestPayload, Suggestions, ThamyrInteractionMap, ThamyrResponse, Topic, TopicContentsPage, TopicSummary, TtsAudio, UiElement, UiObserverConfig, UiSnapshot, UserInteraction, Variant, VariationAttribute, VariationGroup, Video, WhisperPayload };
@@ -476,6 +476,44 @@ type WhisperPayload = {
476
476
  generated_at: number;
477
477
  ttl_ms: number;
478
478
  };
479
+ type SkesisItemPage = {
480
+ /**
481
+ * The canonical page path, `/map/{locale}/{slug}/{id}`, as the sitemap lists it
482
+ */
483
+ path: string;
484
+ /**
485
+ * The catalogue locale the item is read in, as the engine spells it (e.g. `en-IT`)
486
+ */
487
+ locale: string;
488
+ kind: string;
489
+ /**
490
+ * The URL segment the site publishes the item's kind under
491
+ */
492
+ slug: string;
493
+ /**
494
+ * The item's title, or its id when it has none
495
+ */
496
+ title: string;
497
+ /**
498
+ * The item's description, as plain text
499
+ */
500
+ description?: string;
501
+ /**
502
+ * The URL of the item's first image
503
+ */
504
+ image?: string;
505
+ /**
506
+ * The item as stored, for a page that shows more than the crawler is served
507
+ */
508
+ item: {
509
+ id: string;
510
+ kind: string;
511
+ locale: string;
512
+ fields: {
513
+ [key: string]: unknown;
514
+ };
515
+ };
516
+ };
479
517
  type ProductMatch = {
480
518
  match?: {
481
519
  id: string;
@@ -3007,6 +3045,37 @@ type SkesisRelatedResponses = {
3007
3045
  */
3008
3046
  200: SkesisRelatedResponse;
3009
3047
  };
3048
+ type SkesisGetItemByPathErrors = {
3049
+ /**
3050
+ * Validation error
3051
+ */
3052
+ 400: unknown;
3053
+ /**
3054
+ * Missing or invalid access token
3055
+ */
3056
+ 401: unknown;
3057
+ /**
3058
+ * The caller is not permitted to perform this operation
3059
+ */
3060
+ 403: PinaxForbidden;
3061
+ /**
3062
+ * Path did not resolve to a published item
3063
+ */
3064
+ 404: PublicError;
3065
+ /**
3066
+ * Skesis engine unavailable (rate cap, upstream failure, or not configured); retry later
3067
+ */
3068
+ 502: {
3069
+ error: string;
3070
+ errorId: string;
3071
+ };
3072
+ };
3073
+ type SkesisGetItemByPathResponses = {
3074
+ /**
3075
+ * Success
3076
+ */
3077
+ 200: SkesisItemPage;
3078
+ };
3010
3079
 
3011
3080
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
3012
3081
  /**
@@ -3212,6 +3281,14 @@ declare class Skesis extends HeyApiClient {
3212
3281
  anchorId: string;
3213
3282
  locale?: string;
3214
3283
  }, options?: Options<never, ThrowOnError>): RequestResult<SkesisRelatedResponses, SkesisRelatedErrors, ThrowOnError>;
3284
+ /**
3285
+ * Get a catalogue item page by its path
3286
+ *
3287
+ * Resolves a `/map/{locale}/{slug}/{id}` path from the sitemap to what the crawler is served there: a visible item of a kind the site publishes as pages, in that locale. Pass the path as the browser shows it (`location.pathname`). A document wins a path both could name, so resolve a `/map/` path with `content.getDocumentByPath` first and with this read on its 404. A path that names no such item is a 404, not a 400.
3288
+ */
3289
+ getItemByPath<ThrowOnError extends boolean = false>(parameters: {
3290
+ path: string;
3291
+ }, options?: Options<never, ThrowOnError>): RequestResult<SkesisGetItemByPathResponses, SkesisGetItemByPathErrors, ThrowOnError>;
3215
3292
  }
3216
3293
  declare class CallimacusApi extends HeyApiClient {
3217
3294
  static readonly __registry: HeyApiRegistry<CallimacusApi>;
@@ -3911,7 +3988,9 @@ type MapPath = {
3911
3988
  */
3912
3989
  declare function parseMapPath(pathname: string): MapPath | undefined;
3913
3990
  /**
3914
- What a `/map/…` pathname shows: one document, or the per-language index.
3991
+ What a `/map/…` pathname shows: one document, the per-language index, or one
3992
+ catalogue item (`language` is then the catalogue locale, `slug` the kind's
3993
+ slug and the item id).
3915
3994
  */
3916
3995
  type MapPage = {
3917
3996
  kind: 'document';
@@ -3922,11 +4001,18 @@ type MapPage = {
3922
4001
  kind: 'index';
3923
4002
  language: string;
3924
4003
  entries: DocumentIndexEntry[];
4004
+ } | {
4005
+ kind: 'item';
4006
+ language: string;
4007
+ slug: string;
4008
+ itemPage: SkesisItemPage;
3925
4009
  };
3926
4010
  /**
3927
4011
  Resolves what to show at a `/map/…` pathname: the document at
3928
- `/map/{language}/{slug}`, or the entries of the per-language index at
3929
- `/map/{language}` — the same list the crawler is served, newest first.
4012
+ `/map/{language}/{slug}`, the entries of the per-language index at
4013
+ `/map/{language}` — the same list the crawler is served, newest first — or the
4014
+ catalogue item at `/map/{locale}/{kind-slug}/{id}`. A document wins a path both
4015
+ could name, as it does in the server render.
3930
4016
  @param api - A `Thamyr` instance, or the React package's `thamyrApi`.
3931
4017
  @param pathname - `location.pathname`.
3932
4018
  @returns `undefined` when the pathname is not a `/map/` path or names no
@@ -3934,7 +4020,7 @@ type MapPage = {
3934
4020
  failure (network, a 5xx, an SDK not initialized) rejects — with a
3935
4021
  `ThamyrHttpError` when a response arrived.
3936
4022
  */
3937
- declare function resolveMapPage(api: Pick<CallimacusApi, 'content'>, pathname: string): Promise<MapPage | undefined>;
4023
+ declare function resolveMapPage(api: Pick<CallimacusApi, 'content' | 'skesis'>, pathname: string): Promise<MapPage | undefined>;
3938
4024
 
3939
4025
  /**
3940
4026
  Structured payload the server attaches to a refused handshake (SOL-1100):
@@ -4212,4 +4298,4 @@ declare function clearIntentSessionId(): void;
4212
4298
  declare function setIntentSessionMaxAge(_seconds: number): void;
4213
4299
 
4214
4300
  export { ACTION_TYPES, ADD_TO_CART_RESULT_BLOCK, CallimacusApi, CallimacusEvent, CallimacusService, ChapterStatus, ClientEvents, DELIVER_RESULT_BLOCK, GalleryMode, LANDING_VALUE_MAX_LENGTH, MAX_HANDSHAKE_RETRIES, SLInputEventType, ServerEvents, ThamyrHttpError, ThamyrResponseType, UserInteractionType, actionOf, addToCartResultOf, applyBlockPatch, blockKeyOf, callimacusService, classifyConnectError, clearIntentSessionId, createContractClient, deliverResultOf, ensureIntentSessionId, extractTtsAudio, fieldsOf, getIntentSessionId, initIntent, interactionRound, isCustomBlock, isMasterProduct, isSetProduct, landingRound, logger, parseConnectRejection, parseMapPath, randomUuid, receptorsOf, resolveMapPage, setConsent, setDebug, setDebugPanel, setGeo, setIntentSessionMaxAge, shouldRetryHandshake, transformImageUrl };
4215
- export type { Action, ActionType, AddToCartResult, BCProduct, Basket, Block, BlockPatch, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, DeliverResult, DocumentIndexEntry, ErrorCallback, ErrorMessage, Gallery, GenericProduct, HomePage, Image, ImageEdits, ImageFormatEdit, ImageResizeEdit, InitOptions, InteractionContext, InteractionId, InteractionOptions, InteractionPayload, InteractionPayloadMap, LegacyBlock, LocalizedEPArtwork, LocalizedEPChapter, LogLevel, LoggerConfig, MapPage, MapPath, MasterProduct, MasterProductWithVariationGroup, OptionItem, ProductItem, ProductMatch, RecommendationsResponse, RiveManifest, RoundOptions, SLDocument, SLDocumentSection, SLInputEvent, ServerResponseCallback, SetProduct, SkesisItem, SkesisRelatedResponse, SkesisSimilarResponse, Story, SuggestPayload, Suggestions, ThamyrInteractionMap, ThamyrResponse, Topic, TopicContentsPage, TopicSummary, TtsAudio, UiElement, UiObserverConfig, UiSnapshot, UserInteraction, Variant, VariationAttribute, VariationGroup, Video, WhisperPayload };
4301
+ export type { Action, ActionType, AddToCartResult, BCProduct, Basket, Block, BlockPatch, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, DeliverResult, DocumentIndexEntry, ErrorCallback, ErrorMessage, Gallery, GenericProduct, HomePage, Image, ImageEdits, ImageFormatEdit, ImageResizeEdit, InitOptions, InteractionContext, InteractionId, InteractionOptions, InteractionPayload, InteractionPayloadMap, LegacyBlock, LocalizedEPArtwork, LocalizedEPChapter, LogLevel, LoggerConfig, MapPage, MapPath, MasterProduct, MasterProductWithVariationGroup, OptionItem, ProductItem, ProductMatch, RecommendationsResponse, RiveManifest, RoundOptions, SLDocument, SLDocumentSection, SLInputEvent, ServerResponseCallback, SetProduct, SkesisItem, SkesisItemPage, SkesisRelatedResponse, SkesisSimilarResponse, Story, SuggestPayload, Suggestions, ThamyrInteractionMap, ThamyrResponse, Topic, TopicContentsPage, TopicSummary, TtsAudio, UiElement, UiObserverConfig, UiSnapshot, UserInteraction, Variant, VariationAttribute, VariationGroup, Video, WhisperPayload };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@callimacus/thamyr-core",
3
- "version": "4.9.0",
3
+ "version": "4.10.0",
4
4
  "private": false,
5
5
  "description": "Core package for Thamyr",
6
6
  "license": "SEE LICENSE IN LICENSE.md",