schemas API
Everything the package exports, by the path you import it from. Open an export for its signature and options.
@evolve-framework/schemas
resolveGraphQLSchema and defineCommerceCodegen, the shared SDL snippets, and the resolver helpers: resolvePaginationArgs and buildPagination, resolveOrderKey, filterAddresses and filterAssociates, and cartPreviewImages and cartDefaultName
Classes
RichTextCollectorCollects what one document refers to while a converter walks it: each resolved link and each embed gets an id the tree refers to, and each heading an anchor no other heading in the document has.
import { RichTextCollector } from "@evolve-framework/schemas";new RichTextCollector(prefix: string)| Method | Description |
|---|---|
link(
kind: RichTextLinkKind,
path: string,
details?: (LinkedPage & LinkBehavior),
): string | Registers a link and answers the id its node refers to; a page link also keeps what the adapter knows about the page. |
embed(make: (id: string) => Embed | undefined): string | undefined | Registers an embed, which is given its id, and answers that id; undefined, registering nothing, where make answers undefined. |
anchor(children: readonly RichTextInline[]): string | An anchor for a heading with this text, unique within the document. |
result(children: RichTextBlockNode[]): ConvertedRichText<Embed> |
Functions
addDaysA YYYY-MM-DD date moved by a number of calendar days.
import { addDays } from "@evolve-framework/schemas";function addDays(date: string, days: number): stringReturns string
articleCategoryKeysThe category keys a product's articles may be tagged with, the most specific first: the primary category, then its ancestors from the nearest to the root.
import { articleCategoryKeys } from "@evolve-framework/schemas";function articleCategoryKeys( primaryCategory: CategoryTrail | null | undefined,): string[]| Option | Type | Description |
|---|---|---|
key? | string | null | |
ancestors? | readonly { key?: string | null | undefined; }[] | null |
Returns string[]
asTopicPageA section's overview as its topic's page: on the topic's path, headed by the topic's name and intro, and without the section's featured article.
import { asTopicPage } from "@evolve-framework/schemas";function asTopicPage<Overview, Topic>( overview: Overview, topic: Topic, path: string,): Overview & { topic: Topic;}Returns Overview & { topic: Topic; }
buildPaginationBuild the shared Pagination from what an engine returned.
import { buildPagination } from "@evolve-framework/schemas";totalCount stays undefined unless the engine counted exactly: an
approximate number in that field is a lie a client cannot detect. pageCount
follows it, since a page count cannot be derived from a count that does not
exist. hasNextPage is the guarantee that always holds, so it is derived
from the count when there is one and must be supplied otherwise.
function buildPagination( options: BuildInput,): Pagination| Option | Type | Description |
|---|---|---|
page | number | The resolved page, as returned by resolvePaginationArgs. |
pageSize | number | The resolved page size, as returned by resolvePaginationArgs. |
count | number | Items on this page, after the engine applied the limit. |
totalCount? | number | Exact number of matching items, or undefined where the engine caps or estimates its count. Never pass an approximation. |
hasNextPage? | boolean | Whether a further page exists, for engines that report it without a count. Derived from totalCount when omitted. |
Returns Pagination
cartArchiveCutoffThe moment before which a cart last touched counts as archived.
import { cartArchiveCutoff } from "@evolve-framework/schemas";function cartArchiveCutoff( afterDays?: number, now?: Date,): DateReturns Date
cartDefaultNameWhat to call a cart that has no name: its first line's product, then a plus and the number of further lines, such as "Accuboormachine + 2".
import { cartDefaultName } from "@evolve-framework/schemas";function cartDefaultName(lines: PreviewLine[]): string | undefinedReturns string | undefined
cartPreviewImagesThe images of a cart's first lines, in the order given, without repeating one, and at most limit of them (clamped to 1 to MAX_PREVIEW_IMAGES).
import { cartPreviewImages } from "@evolve-framework/schemas";function cartPreviewImages( lines: PreviewLine[], limit: number,): { url: string; alt?: string;}[]Returns { url: string; alt?: string; }[]
cellSpansA cell's spans as the tree keeps them: only a span of more than one.
import { cellSpans } from "@evolve-framework/schemas";function cellSpans( colSpan: unknown, rowSpan: unknown,): Pick<RichTextTableCell, "colSpan" | "rowSpan">Returns Pick<RichTextTableCell, "colSpan" | "rowSpan">
collectRelatedPagesThe entries a product shows, at most limit: those tagged with the most specific of keys first, the newest first among them, then the next key's.
import { collectRelatedPages } from "@evolve-framework/schemas";function collectRelatedPages<T>( keys: readonly string[], limit: number, source: RelatedPageSource<T>,): Promise<T[]>| Option | Type | Description |
|---|---|---|
tagged | (key: string, count: number) => Promise<readonly T[]> | At least the |
idOf | (entry: T) => string | An entry's identity, so one tagged with several keys counts once. |
categoryKeysOf | (entry: T) => readonly string[] | |
publishedAtOf | (entry: T) => string | undefined | When the entry was published, as an ISO string that sorts by date. |
Returns Promise<T[]>
contentSearchHitA page as a hit, summarized by its SEO description where it has one.
import { contentSearchHit } from "@evolve-framework/schemas";function contentSearchHit<P>( page: P,): { page: P; excerpt: string | undefined;}Returns { page: P; excerpt: string | undefined; }
contentSearchLimitThe number of hits to ask the CMS for: at least one, at most the cap.
import { contentSearchLimit } from "@evolve-framework/schemas";function contentSearchLimit(limit: number | null | undefined): numberReturns number
defineCommerceCodegenThe graphql-codegen configuration a commerce engine generates its resolver types with.
import { defineCommerceCodegen } from "@evolve-framework/schemas";function defineCommerceCodegen( options: CommerceCodegenOptions,): { overwrite: boolean; hooks: { afterAllFileWrite: string; }; schema: string; config: { scalars: { CountryCode: string; Currency: string; Date: string; DateTime: string; EmailAddress: string; JSON: string; Locale: string; Time: string; URL: string; FieldSet: string; link__Import: string; _FieldSet: string; }; strictScalars: boolean; }; generates: { "src/graphql/types.ts": { plugins: (string | { add: { content: string; }; })[]; config: { contextType: string; defaultMapper: string; enumsAsTypes: boolean; federation: boolean; makeResolverTypeCallable: boolean; maybeValue: string; useTypeImports: boolean; useImplementingTypes: boolean; }; }; };}| Option | Type | Description |
|---|---|---|
schemaFiles | string[] | The contract modules the engine serves, as named under |
schemaOptions? | SchemaOptions | |
extraOutputs? | Record<string, { plugins: string[]; }> | Outputs beyond |
Returns { overwrite: boolean; hooks: { afterAllFileWrite: string; }; schema: string; config: { scalars: { CountryCode: string; Currency: string; Date: string; DateTime: string; EmailAddress: string; JSON: string; Locale: string; Time: string; URL: string; FieldSet: string; link__Import: string; _FieldSet: string; }; strictScalars: boolean; }; generates: { "src/graphql/types.ts": { plugins: (string | { add: { content: string; }; })[]; config: { contextType: string; defaultMapper: string; enumsAsTypes: boolean; federation: boolean; makeResolverTypeCallable: boolean; maybeValue: string; useTypeImports: boolean; useImplementingTypes: boolean; }; }; }; }
deliveryCalendarThe calendar a DeliverySchedule describes, for an engine to serve: dates and slots for the shipping methods a cart can use, the slot a client chose, and the earliest delivery of one method.
import { deliveryCalendar } from "@evolve-framework/schemas";function deliveryCalendar( schedule: DeliverySchedule,): { entryFor: (key: string | undefined, country: string | undefined) => DeliveryScheduleEntry | undefined; earliestFor: (entry: DeliveryScheduleEntry, now: Date, availableFrom?: string) => { date: string; orderBefore?: string; } | undefined; /** Every date from `from` (today when absent) for `days` days, slots included. */ deliveryDates: (methods: SchedulableMethod[], country: string | undefined, range: { from?: string; days: number; }, now: Date) => ScheduledDate[]; /** The slot a client chose, rebuilt from its id; undefined when it is not offered. */ findSlot: (methods: SchedulableMethod[], country: string | undefined, slotId: string, now: Date) => { slot: ScheduledSlot; methodId: string; } | undefined; /** * The earliest delivery among the methods that ship to a country, for a * product page; the cheapest wins a tie. */ promise: (methods: SchedulableMethod[], country: string, now: Date, availableFrom?: string) => { deliverable: boolean; unavailableReason: DeliveryUnavailable; earliestDeliveryDate?: undefined; orderBefore?: undefined; carrier?: undefined; price?: undefined; } | { unavailableReason?: undefined; deliverable: boolean; earliestDeliveryDate: string; orderBefore: string | undefined; carrier: { key: string; name: string; }; price: DeliveryMoney; };}| Option | Type | Description |
|---|---|---|
methods | Record<string, DeliveryScheduleEntry> | Schedule per shipping method key; a method without one offers no slots. |
timeZone? | string | The zone the windows and the order deadline are read in. Defaults to Europe/Amsterdam. |
Returns { entryFor: (key: string | undefined, country: string | undefined) => DeliveryScheduleEntry | undefined; earliestFor: (entry: DeliveryScheduleEntry, now: Date, availableFrom?: string) => { date: string; orderBefore?: string; } | undefined; /** Every date from from(today when absent) fordays days, slots included. */ deliveryDates: (methods: SchedulableMethod[], country: string | undefined, range: { from?: string; days: number; }, now: Date) => ScheduledDate[]; /** The slot a client chose, rebuilt from its id; undefined when it is not offered. */ findSlot: (methods: SchedulableMethod[], country: string | undefined, slotId: string, now: Date) => { slot: ScheduledSlot; methodId: string; } | undefined; /** * The earliest delivery among the methods that ship to a country, for a * product page; the cheapest wins a tie. */ promise: (methods: SchedulableMethod[], country: string, now: Date, availableFrom?: string) => { deliverable: boolean; unavailableReason: DeliveryUnavailable; earliestDeliveryDate?: undefined; orderBefore?: undefined; carrier?: undefined; price?: undefined; } | { unavailableReason?: undefined; deliverable: boolean; earliestDeliveryDate: string; orderBefore: string | undefined; carrier: { key: string; name: string; }; price: DeliveryMoney; }; }
facetFiltersFromEntriesFilters from key=value entries, one value per entry, for a CMS field that holds a list of plain strings.
import { facetFiltersFromEntries } from "@evolve-framework/schemas";function facetFiltersFromEntries(entries: readonly string[]): FacetFilter[]Returns FacetFilter[]
facetFiltersFromQueryFilters from a storefront URL's query, as an editor pastes it: facets joined by "&", a facet's values by ",", such as "brand=head,wilson&sale=true".
import { facetFiltersFromQuery } from "@evolve-framework/schemas";function facetFiltersFromQuery(query: string): FacetFilter[]Returns FacetFilter[]
facetFilterSignatureA filter as one comparable string: facets by key, values sorted and deduplicated, and a facet that selects nothing left out, since it filters nothing.
import { facetFilterSignature } from "@evolve-framework/schemas";function facetFilterSignature(filters: readonly FacetFilter[]): stringReturns string
fieldTabThe tab a field belongs on, from its name alone, so Storyblok, Contentful and Payload put the same field on the same tab: search fields on SEO, the fields that configure an entry on Settings, and everything else on Content.
import { fieldTab } from "@evolve-framework/schemas";function fieldTab(name: string): "Content" | "SEO" | "Settings"Returns FieldTab
filterAddressesNarrow an address book to what a buyer typed.
import { filterAddresses } from "@evolve-framework/schemas";The rule lives here rather than in an engine so that a personal address book and a company one answer the same query the same way. They are read by one picker component, and a search that behaves differently depending on who owns the book is a difference nobody asked for.
function filterAddresses<T>( addresses: readonly T[], searchTerm: string | null | undefined,): T[]Returns T[]
filterAssociatesNarrow a unit's associates to what an administrator typed.
import { filterAssociates } from "@evolve-framework/schemas";The rule lives here rather than in an engine so that every engine serving the contract answers the same query the same way, and because the caller searching for one colleague by address cannot page through a whole company to find them.
function filterAssociates<T>( associates: readonly T[], searchTerm: string | null | undefined,): T[]Returns T[]
findSearchRedirectWhere the keyword list sends a search term: the first rule with a keyword equal to the whole term, compared without case, diacritics or extra spaces.
import { findSearchRedirect } from "@evolve-framework/schemas";function findSearchRedirect( rules: readonly SearchRedirectRule[], searchTerm: string,): SearchRedirectTarget | undefinedReturns SearchRedirectTarget | undefined
forMarketThe one of several candidates sharing a path that a market sees: one naming the country before one for every market.
import { forMarket } from "@evolve-framework/schemas";function forMarket<T>( candidates: readonly T[], country: string | null | undefined, marketsOf: (candidate: T) => Markets,): T | undefinedReturns T | undefined
headingLevelClamp a CMS heading level into the levels the tree allows.
import { headingLevel } from "@evolve-framework/schemas";function headingLevel(level: number): RichTextHeadingLevelReturns RichTextHeadingLevel
inMarketWhether content for these markets is shown in country.
import { inMarket } from "@evolve-framework/schemas";function inMarket( markets: Markets, country?: string | null,): booleanReturns boolean
isArchivedCartWhether a cart last touched at lastTouched is archived.
import { isArchivedCart } from "@evolve-framework/schemas";function isArchivedCart( lastTouched: string | Date, afterDays?: number, now?: Date,): booleanReturns boolean
isEmptyRichTextWhether a document shows nothing: only paragraphs without text, which is what a CMS keeps for a rich text field the editor cleared.
import { isEmptyRichText } from "@evolve-framework/schemas";function isEmptyRichText(document: RichTextDocument): boolean| Option | Type | Description |
|---|---|---|
type | "doc" | |
children | RichTextBlockNode[] |
Returns boolean
isoWeekdayISO weekday of a date: 1 is Monday, 7 is Sunday.
import { isoWeekday } from "@evolve-framework/schemas";function isoWeekday(date: string): numberReturns number
isSafeUrlWhether a link target is a URL a browser may follow from content: an absolute http(s) URL, a mail or phone link, or a path or anchor on the site.
import { isSafeUrl } from "@evolve-framework/schemas";function isSafeUrl(url: string): booleanReturns boolean
keyPatternVariablesTerraform variable blocks for every key pattern the given Terraform references as var.<name>, so a project sets them in its tfvars.
import { keyPatternVariables } from "@evolve-framework/schemas";function keyPatternVariables(terraform: string): stringReturns string
marketsVariableThe Terraform variable block for the markets, when the given Terraform references var.markets, so a project sets them in its tfvars.
import { marketsVariable } from "@evolve-framework/schemas";function marketsVariable(terraform: string): stringReturns string
newCartNameThe name a cart is given when it is created without one: the day it was made, in the store's language, so a list of carts does not read as one name repeated.
import { newCartName } from "@evolve-framework/schemas";function newCartName(locale: string, createdAt?: Date | undefined): stringReturns string
pageMetaFromSeoA page's metadata from its SEO fields, mapped the same way by every CMS: the title and description serve as the Open Graph ones too.
import { pageMetaFromSeo } from "@evolve-framework/schemas";function pageMetaFromSeo(seo: SeoFields): MappedPageMeta | undefined| Option | Type | Description |
|---|---|---|
seoTitle? | string | null | |
seoDescription? | string | null | |
seoImage? | string | null | The URL of the image, as the CMS serves it. |
Returns MappedPageMeta | undefined
pageTypeOfA mapped page's type by its GraphQL typename.
import { pageTypeOf } from "@evolve-framework/schemas";function pageTypeOf(typename: string | undefined): PageTypeName | undefinedReturns PageTypeName | undefined
pickupPointDirectoryThe points a fixed list offers, for an engine to serve.
import { pickupPointDirectory } from "@evolve-framework/schemas";function pickupPointDirectory( options: PickupPointListOptions,): { /** Points matching the search, nearest first when a position was given. */ search: (search: PickupPointSearch, methodFor: (key: string) => PickupMethod | undefined, now: Date) => ListedPickupPoint[]; /** The country a listed point is in, to look its methods up in. */ countryOf: (pickupPointId: string) => string | undefined; /** The point a client chose, with its method; undefined when it is not offered. */ find: (pickupPointId: string, methodFor: (key: string) => PickupMethod | undefined, now: Date) => { pickupPoint: ListedPickupPoint; methodId: string; } | undefined;}| Option | Type | Description |
|---|---|---|
points | PickupPointEntry[] | |
shippingMethods | Record<string, string> | Shipping method key per carrier key; a carrier without one offers no points. |
timeZone? | string | The zone opening hours are read in. Defaults to Europe/Amsterdam. |
leadDays? | number | Days between ordering and a parcel arriving at the point. Defaults to 1. |
readyAt? | string | Local time a parcel is ready on the day it arrives. Defaults to 12:00. |
Returns { /** Points matching the search, nearest first when a position was given. */ search: (search: PickupPointSearch, methodFor: (key: string) => PickupMethod | undefined, now: Date) => ListedPickupPoint[]; /** The country a listed point is in, to look its methods up in. */ countryOf: (pickupPointId: string) => string | undefined; /** The point a client chose, with its method; undefined when it is not offered. */ find: (pickupPointId: string, methodFor: (key: string) => PickupMethod | undefined, now: Date) => { pickupPoint: ListedPickupPoint; methodId: string; } | undefined; }
plainTextThe plain text of inline nodes, as a heading's anchor is made from.
import { plainText } from "@evolve-framework/schemas";function plainText(nodes: readonly RichTextInline[]): stringReturns string
quoteNodeA quote from its converted children.
import { quoteNode } from "@evolve-framework/schemas";function quoteNode(children: RichTextBlockNode[]): RichTextBlockNodeReturns RichTextBlockNode
resolveGraphQLSchemaThe contract modules named, as one merged schema document.
import { resolveGraphQLSchema } from "@evolve-framework/schemas";function resolveGraphQLSchema( schemaFiles: string[], options?: SchemaOptions,): string| Option | Type | Description |
|---|---|---|
includeB2B? | boolean | |
includeRevision? | boolean |
Returns string
resolveOrderKeyWhich of the two ways of naming an order the caller used.
import { resolveOrderKey } from "@evolve-framework/schemas";Exactly one, because the two can disagree and there is no right answer to pick when they do -- preferring one silently would resolve a different order from the one half the arguments asked for. Neither is refused for the same reason: it is a question with no subject rather than a request for all orders.
GraphQL says this properly with a oneOf input, which nothing in this schema uses yet. Until it does the rule lives here, so every engine answering the field enforces the same one and they cannot drift apart on it.
function resolveOrderKey( args: { id?: string | null | undefined; orderNumber?: string | null | undefined; },): OrderKey| Option | Type | Description |
|---|---|---|
id? | string | null | |
orderNumber? | string | null |
Returns OrderKey
resolvePaginationArgsClamp what a client asked for onto what an engine will serve.
import { resolvePaginationArgs } from "@evolve-framework/schemas";function resolvePaginationArgs( args: PaginationArgs,): { page: number; pageSize: number; offset: number; limit: number;}| Option | Type | Description |
|---|---|---|
page? | number | null | |
pageSize? | number | null |
Returns { page: number; pageSize: number; offset: number; limit: number; }
resolveSearchSelectionWhich parts of the ProductsResult this operation reads, through fragment spreads and inline fragments.
import { resolveSearchSelection } from "@evolve-framework/schemas";function resolveSearchSelection( info: Pick<GraphQLResolveInfo, "fieldNodes" | "fragments">,): SearchSelectionReturns SearchSelection
sameFacetFiltersWhether two filters select the same products, whatever their order.
import { sameFacetFilters } from "@evolve-framework/schemas";function sameFacetFilters( a: readonly FacetFilter[], b: readonly FacetFilter[],): booleanReturns boolean
splitKeywordsThe keywords an editor typed in one text field, separated by commas or line breaks, for a CMS that has no field holding a list of strings.
import { splitKeywords } from "@evolve-framework/schemas";function splitKeywords(text: string | null | undefined): string[]Returns string[]
splitTopicPathThe topic route a path could be: a section below the root, then the topic path segment and the topic's slug.
import { splitTopicPath } from "@evolve-framework/schemas";function splitTopicPath(path: string): TopicRoute | undefinedReturns TopicRoute | undefined
textMarksMarks as the tree keeps them: each once, and superscript and subscript not together, where the first of the two wins.
import { textMarks } from "@evolve-framework/schemas";function textMarks(marks: readonly RichTextMark[]): RichTextMark[]Returns RichTextMark[]
toFilterConditionA filter condition as an engine takes it: the values it matches, and the first of them as value for a reader of a single one.
import { toFilterCondition } from "@evolve-framework/schemas";function toFilterCondition( input: { key: string; value?: string | null | undefined; values?: string[] | null | undefined; },): { key: string; value: string; values: string[];}| Option | Type | Description |
|---|---|---|
key | string | |
value? | string | null | |
values? | string[] | null |
Returns { key: string; value: string; values: string[]; }
toPaymentBrandsThe PaymentBrandType values of the picked keys, in order, once each.
import { toPaymentBrands } from "@evolve-framework/schemas";function toPaymentBrands( keys: Maybe<Maybe<string>[]>,): Uppercase<PaymentBrand>[]Returns Uppercase<PaymentBrand>[]
topicPagePathA topic page's path below a section, whether or not the section's path ends in a slash.
import { topicPagePath } from "@evolve-framework/schemas";function topicPagePath( sectionPath: string, segment: string, slug: string,): stringReturns string
topicPageTranslatedPathsA topic page's path in each locale where the section has a path and both the segment and the topic's slug are set.
import { topicPageTranslatedPaths } from "@evolve-framework/schemas";function topicPageTranslatedPaths( sectionPaths: readonly { locale: string; path: string; }[], segments: Readonly<Record<string, string | null | undefined>>, slugs: Readonly<Record<string, string | null | undefined>>,): { locale: string; path: string;}[]Returns { locale: string; path: string; }[]
toRichTextEmbedA block a CMS placed in rich text, mapped through its registry, as the embed that wraps it.
import { toRichTextEmbed } from "@evolve-framework/schemas";function toRichTextEmbed( mapped: unknown, id: string,): RichTextEmbedValue | undefinedReturns RichTextEmbedValue | undefined
toSocialLinksThe SocialLink values of what an editor entered, in order, leaving out a row without a known platform or an https URL.
import { toSocialLinks } from "@evolve-framework/schemas";function toSocialLinks( rows: Maybe<Maybe<{ platform?: Maybe<string>; url?: Maybe<string>; }>[]>,): { platform: Uppercase<SocialPlatform>; url: string;}[]Returns { platform: Uppercase<SocialPlatform>; url: string; }[]
toStorefrontRouteThe StorefrontRouteType value of a picked key; undefined for any other.
import { toStorefrontRoute } from "@evolve-framework/schemas";function toStorefrontRoute( key: string | null | undefined,): Uppercase<StorefrontRoute> | undefinedReturns Uppercase<StorefrontRoute> | undefined
toTrustRatingThe TrustRating of what an editor entered; undefined unless the score, best score and count are set and the score lies between zero and the best.
import { toTrustRating } from "@evolve-framework/schemas";function toTrustRating( rating: { score?: Maybe<number>; maxScore?: Maybe<number>; count?: Maybe<number>; url?: Maybe<string>; },): { score: number; maxScore: number; count: number; url?: string;} | undefined| Option | Type | Description |
|---|---|---|
score? | Maybe<number> | |
maxScore? | Maybe<number> | |
count? | Maybe<number> | |
url? | Maybe<string> |
Returns { score: number; maxScore: number; count: number; url?: string; } | undefined
toUspIconThe UspIconType value of a picked key; undefined for any other.
import { toUspIcon } from "@evolve-framework/schemas";function toUspIcon( key: string | null | undefined,): Uppercase<UspIcon> | undefinedReturns Uppercase<UspIcon> | undefined
zonedDateThe calendar date an instant falls on in a time zone.
import { zonedDate } from "@evolve-framework/schemas";function zonedDate(instant: Date, timeZone: string): stringReturns string
zonedInstantThe instant a date and time of day denote in a time zone.
import { zonedInstant } from "@evolve-framework/schemas";function zonedInstant(date: string, time: string, timeZone: string): DateReturns Date
zonedTimeThe time of day (HH:MM) an instant falls on in a time zone.
import { zonedTime } from "@evolve-framework/schemas";function zonedTime(instant: Date, timeZone: string): stringReturns string
Constants
addressSnippetThe SDL of Address, AddressInput, AddressResult and SalutationType.
import { addressSnippet } from "@evolve-framework/schemas";const addressSnippet: DocumentNodebreadcrumbSnippetThe SDL of Breadcrumb and BreadcrumbType.
import { breadcrumbSnippet } from "@evolve-framework/schemas";const breadcrumbSnippet: DocumentNodecartErrorSnippetShared because more than one schema raises it: the cart operations every storefront has, the multiple-cart management a B2B one adds, and undoing the cart merge of a sign-in.
import { cartErrorSnippet } from "@evolve-framework/schemas";const cartErrorSnippet: DocumentNodeconstraintDirectiveSnippetThe SDL of the @constraint directive, which validates an input field.
import { constraintDirectiveSnippet } from "@evolve-framework/schemas";const constraintDirectiveSnippet: DocumentNodeDEFAULT_ARCHIVE_CARTS_AFTER_DAYSHow long a cart may go untouched before it is archived, by default.
import { DEFAULT_ARCHIVE_CARTS_AFTER_DAYS } from "@evolve-framework/schemas";const DEFAULT_ARCHIVE_CARTS_AFTER_DAYS: 60DEFAULT_ARTICLES_PER_PRODUCTHow many articles a product shows unless a module says otherwise.
import { DEFAULT_ARTICLES_PER_PRODUCT } from "@evolve-framework/schemas";const DEFAULT_ARTICLES_PER_PRODUCT: 4DEFAULT_KEY_PATTERNThe pattern a key is checked against when the project sets none: no whitespace.
import { DEFAULT_KEY_PATTERN } from "@evolve-framework/schemas";const DEFAULT_KEY_PATTERN: "^\\S+$"demoDeliveryScheduleA schedule for demo shipping methods, the way a Dutch shop offers its days.
import { demoDeliverySchedule } from "@evolve-framework/schemas";const demoDeliverySchedule: DeliveryScheduledemoPickupPointsPickup points around Utrecht Centraal, for demo shipping methods per carrier.
import { demoPickupPoints } from "@evolve-framework/schemas";const demoPickupPoints: PickupPointListOptionserrorsSnippetThe SDL of the Error interface, ValidationError and FieldValidationIssue.
import { errorsSnippet } from "@evolve-framework/schemas";const errorsSnippet: DocumentNodeFIELD_TABSThe editor tabs every CMS field sits on, in the order they are shown.
import { FIELD_TABS } from "@evolve-framework/schemas";const FIELD_TABS: readonly ["Content", "SEO", "Settings"]KEY_PATTERNSThe commerce keys an editor types into a CMS, each checked against a per-project pattern, because key formats differ per commerce backend.
import { KEY_PATTERNS } from "@evolve-framework/schemas";const KEY_PATTERNS: { readonly sku: { readonly variable: "sku_pattern"; readonly label: "a product SKU"; }; readonly category: { readonly variable: "category_id_pattern"; readonly …MAX_PAGE_SIZEThe largest page size an engine serves; a larger request is served at this size.
import { MAX_PAGE_SIZE } from "@evolve-framework/schemas";const MAX_PAGE_SIZE: 100MAX_PREVIEW_IMAGESThe most images a cart preview shows, whatever is asked for.
import { MAX_PREVIEW_IMAGES } from "@evolve-framework/schemas";const MAX_PREVIEW_IMAGES: 10moneySnippetThe SDL of Money: an amount in cents and its currency.
import { moneySnippet } from "@evolve-framework/schemas";const moneySnippet: DocumentNodeopenGraphSnippetThe SDL of OpenGraph.
import { openGraphSnippet } from "@evolve-framework/schemas";const openGraphSnippet: DocumentNodepageMetaSnippetThe SDL of PageMeta.
import { pageMetaSnippet } from "@evolve-framework/schemas";const pageMetaSnippet: DocumentNodepaginationSnippetThe SDL of Pagination.
import { paginationSnippet } from "@evolve-framework/schemas";const paginationSnippet: DocumentNodePAYMENT_BRANDSThe payment brands a CMS lets an editor pick: each key and its label.
import { PAYMENT_BRANDS } from "@evolve-framework/schemas";const PAYMENT_BRANDS: { readonly ideal: "iDEAL"; readonly bancontact: "Bancontact"; readonly visa: "Visa"; readonly mastercard: "Mastercard"; readonly american_express: "American Exp…paymentSnippetThe SDL of PaymentMethod, its options and extras, Payment and PaymentRedirect.
import { paymentSnippet } from "@evolve-framework/schemas";const paymentSnippet: DocumentNodepriceSnippetThe SDL of TaxedPrice, TaxedTotalPrice and Tax.
import { priceSnippet } from "@evolve-framework/schemas";const priceSnippet: DocumentNodePRODUCT_SOURCE_SORTSThe value each CMS stores for a source's sort, and the order it names.
import { PRODUCT_SOURCE_SORTS } from "@evolve-framework/schemas";const PRODUCT_SOURCE_SORTS: Record<string, ProductSourceSort>productImageSnippetThe SDL of ProductImage.
import { productImageSnippet } from "@evolve-framework/schemas";const productImageSnippet: DocumentNodeproductVariantSnippetThe variant as the purchase side references it.
import { productVariantSnippet } from "@evolve-framework/schemas";const productVariantSnippet: DocumentNoderateLimitDirectiveSnippetThe SDL of the @rateLimit directive.
import { rateLimitDirectiveSnippet } from "@evolve-framework/schemas";const rateLimitDirectiveSnippet: DocumentNoderesourceMetaSnippetThe SDL of ResourceMeta.
import { resourceMetaSnippet } from "@evolve-framework/schemas";const resourceMetaSnippet: DocumentNodescalarsSnippetThe SDL of the contract's scalars and of the @shareable and @requiresSession directives.
import { scalarsSnippet } from "@evolve-framework/schemas";const scalarsSnippet: DocumentNodeSOCIAL_PLATFORMSThe social networks a CMS lets an editor pick: each key and its label.
import { SOCIAL_PLATFORMS } from "@evolve-framework/schemas";const SOCIAL_PLATFORMS: { readonly facebook: "Facebook"; readonly instagram: "Instagram"; readonly linkedin: "LinkedIn"; readonly pinterest: "Pinterest"; readonly tiktok: "TikTok"; rea…storeContextSnippetThe SDL of StoreContext and StoreContextInput.
import { storeContextSnippet } from "@evolve-framework/schemas";const storeContextSnippet: DocumentNodeSTOREFRONT_ROUTESThe pages a CMS link may open that the storefront serves itself, by the key an editor picks.
import { STOREFRONT_ROUTES } from "@evolve-framework/schemas";const STOREFRONT_ROUTES: readonly ["home", "account", "orders", "cart", "search", "wishlist", "returns"]storeSnippetThe SDL of Store.
import { storeSnippet } from "@evolve-framework/schemas";const storeSnippet: DocumentNodetaxPortionSnippetThe SDL of TaxPortion.
import { taxPortionSnippet } from "@evolve-framework/schemas";const taxPortionSnippet: DocumentNodeUSP_ICONSThe icons a CMS lets an editor pick for a selling point: key and label.
import { USP_ICONS } from "@evolve-framework/schemas";const USP_ICONS: { readonly truck: "Truck"; readonly invoice: "Invoice"; readonly leaf: "Leaf"; readonly headset: "Headset"; readonly return: "Return"; readonly shield: "Shield"…Types
ConvertedRichTextA converted rich text: its tree, and what the tree refers to by id.
import { type ConvertedRichText } from "@evolve-framework/schemas";export type ConvertedRichText<Embed> = { document: RichTextDocument; links: ResolvedRichTextLink[]; embeds: Embed[];};DeliveryMoneyAn amount in minor units, as the contract's Money carries it.
import { type DeliveryMoney } from "@evolve-framework/schemas";export type DeliveryMoney = { centAmount: number; currency: string;};DeliveryScheduleWhen each shipping method delivers, keyed by shipping method key.
import { type DeliverySchedule } from "@evolve-framework/schemas";export type DeliverySchedule = { timeZone?: string; methods: Record<string, DeliveryScheduleEntry>;};DeliveryScheduleEntryWhen the carrier behind one shipping method delivers.
import { type DeliveryScheduleEntry } from "@evolve-framework/schemas";export type DeliveryScheduleEntry = { carrier: { key: string; name: string; }; windows: Array<{ from: string; until: string; }>; weekdays: number[]; leadDays?: number; orderBefore?: string; countries?: Record<string, Partial<Omit<DeliveryScheduleEntry, "countries">>>;};FacetFilterOne facet of a listing's filter and the values it selects.
import { type FacetFilter } from "@evolve-framework/schemas";export type FacetFilter = { key: string; values: readonly string[];};FieldTabOne of the editor tabs in FIELD_TABS.
import { type FieldTab } from "@evolve-framework/schemas";export type FieldTab = (typeof FIELD_TABS)[number];KeyKindA kind of commerce key in KEY_PATTERNS.
import { type KeyKind } from "@evolve-framework/schemas";export type KeyKind = keyof typeof KEY_PATTERNS;LinkedPageWhat an adapter knows about the page a link opens, beyond its path.
import { type LinkedPage } from "@evolve-framework/schemas";export type LinkedPage = { pageType?: PageTypeName; pageId?: string;};ListedPickupPointA pickup point as the contract's PickupPoint shows it.
import { type ListedPickupPoint } from "@evolve-framework/schemas";export type ListedPickupPoint = { id: string; name: string; carrier: { key: string; name: string; }; type: "SHOP" | "LOCKER"; address: PickupPointEntry["address"]; coordinates: { latitude: number; longitude: number; }; distanceInMeters?: number; alwaysOpen: boolean; openingHoursToday: Window[]; earliestPickupAt: string; openingHours: { date: string; windows: Window[]; }[]; price: DeliveryMoney; unavailableReason?: DeliveryUnavailable;};OrderKeyAn order named by its id or by its order number.
import { type OrderKey } from "@evolve-framework/schemas";export type OrderKey = { id: string;} | { orderNumber: string;};PageTypeNameThe types of page the contract knows, as the PageType enum names them.
import { type PageTypeName } from "@evolve-framework/schemas";export type PageTypeName = "CONTENT" | "CATALOG" | "ARTICLE" | "ARTICLE_OVERVIEW";PaginationThe contract's Pagination, as buildPagination returns it.
import { type Pagination } from "@evolve-framework/schemas";export type Pagination = { page: number; pageSize: number; totalCount?: number; pageCount?: number; hasNextPage: boolean; hasPreviousPage: boolean;};PickupMethodA shipping method a pickup point is delivered with, and what it costs.
import { type PickupMethod } from "@evolve-framework/schemas";export type PickupMethod = { id: string; price: DeliveryMoney;};PickupPointEntryA pickup point as a list describes it.
import { type PickupPointEntry } from "@evolve-framework/schemas";export type PickupPointEntry = { id: string; name: string; carrier: { key: string; name: string; }; type: "SHOP" | "LOCKER"; address: { streetName: string; streetNumber: string; postalCode: string; city: string; country: string; }; coordinates: { latitude: number; longitude: number; }; openingHours: "always" | Partial<Record<number, Window[]>>; unavailable?: DeliveryUnavailable;};PickupPointSearchWhere and for which carriers pickup points are searched.
import { type PickupPointSearch } from "@evolve-framework/schemas";export type PickupPointSearch = { country: string; coordinates?: { latitude: number; longitude: number; }; carrierKeys?: string[]; limit: number;};PreviewLineOne line of a cart, as a cart list previews it.
import { type PreviewLine } from "@evolve-framework/schemas";export type PreviewLine = { productName: string; image?: { url: string; alt?: string; };};ProductSourceSortThe sort orders a product source can name.
import { type ProductSourceSort } from "@evolve-framework/schemas";export type ProductSourceSort = "POPULARITY" | "NEWEST" | "PRICE_ASCENDING" | "PRICE_DESCENDING";RelatedPageSourceHow a CMS answers for its own entries.
import { type RelatedPageSource } from "@evolve-framework/schemas";export type RelatedPageSource<T> = { tagged: (key: string, count: number) => Promise<readonly T[]>; idOf: (entry: T) => string; categoryKeysOf: (entry: T) => readonly string[]; publishedAtOf: (entry: T) => string | undefined;};ResolvedRichTextLinkA link the adapter resolved: a page by its path in the current locale, or a URL.
import { type ResolvedRichTextLink } from "@evolve-framework/schemas";export type ResolvedRichTextLink = LinkedPage & LinkBehavior & { id: string; kind: RichTextLinkKind; path: string; anchor?: string;};RichTextBlockNodeA block in a rich text document or in a list item, quote or table cell.
import { type RichTextBlockNode } from "@evolve-framework/schemas";export type RichTextBlockNode = { type: "paragraph"; children: RichTextInline[];} | { type: "heading"; level: RichTextHeadingLevel; anchor: string; children: RichTextInline[];} | { type: "list"; ordered: boolean; children: RichTextListItem[];} | { type: "quote"; children: RichTextBlockNode[]; citation?: string;} | { type: "hr";} | { type: "embed"; embedId: string;} | { type: "table"; children: RichTextTableRow[];};RichTextDocumentThe vendor-neutral rich text tree every CMS adapter converts its own format into, and the one tree a storefront renders.
import { type RichTextDocument } from "@evolve-framework/schemas";export type RichTextDocument = { type: "doc"; children: RichTextBlockNode[];};RichTextEmbedValueAn embed as the contract's RichTextEmbed union holds it.
import { type RichTextEmbedValue } from "@evolve-framework/schemas";export type RichTextEmbedValue = { __typename: "RichTextImageEmbed"; id: string; image: unknown;} | { __typename: "RichTextVideoEmbed"; id: string; video: unknown;} | { __typename: "RichTextTipEmbed"; id: string; tip: unknown;} | { __typename: "RichTextPromoEmbed"; id: string; promo: unknown;} | { __typename: "RichTextShoppableImageEmbed"; id: string; shoppableImage: unknown;} | { __typename: "RichTextProductEmbed"; id: string; variant: { sku: string; };};RichTextHeadingLevelA heading's level: the page's H1 belongs to the template.
import { type RichTextHeadingLevel } from "@evolve-framework/schemas";export type RichTextHeadingLevel = 2 | 3 | 4;RichTextInlineInline content: text, a link around text, or a hard line break.
import { type RichTextInline } from "@evolve-framework/schemas";export type RichTextInline = RichTextText | { type: "link"; linkId: string; children: RichTextText[];} | { type: "hardBreak";};RichTextLinkKindWhether a rich text link opens a CMS page or a URL.
import { type RichTextLinkKind } from "@evolve-framework/schemas";export type RichTextLinkKind = "PAGE" | "URL";RichTextListItemAn item of a list.
import { type RichTextListItem } from "@evolve-framework/schemas";export type RichTextListItem = { type: "listItem"; children: RichTextBlockNode[];};RichTextMarkA text style a run of rich text carries.
import { type RichTextMark } from "@evolve-framework/schemas";export type RichTextMark = "bold" | "italic" | "underline" | "strike" | "code" | "superscript" | "subscript";RichTextTableCellA table cell; a header cell labels its row or column.
import { type RichTextTableCell } from "@evolve-framework/schemas";export type RichTextTableCell = { type: "tableHeaderCell" | "tableCell"; colSpan?: number; rowSpan?: number; children: RichTextBlockNode[];};RichTextTableRowA row of a table.
import { type RichTextTableRow } from "@evolve-framework/schemas";export type RichTextTableRow = { type: "tableRow"; children: RichTextTableCell[];};RichTextTextA run of text and its marks.
import { type RichTextText } from "@evolve-framework/schemas";export type RichTextText = { type: "text"; text: string; marks?: RichTextMark[];};SchedulableMethodA shipping method a cart can use, as an engine reads it, with its price.
import { type SchedulableMethod } from "@evolve-framework/schemas";export type SchedulableMethod = { id: string; key: string | undefined; price: DeliveryMoney;};ScheduledDateOne delivery day, its slots and the lowest price of those still available.
import { type ScheduledDate } from "@evolve-framework/schemas";export type ScheduledDate = { date: string; slots: ScheduledSlot[]; lowestPrice?: DeliveryMoney; unavailableReason?: DeliveryUnavailable;};ScheduledSlotOne delivery window on one day, with its price and carrier.
import { type ScheduledSlot } from "@evolve-framework/schemas";export type ScheduledSlot = { id: string; deliveryDate: string; window: { from: string; until: string; }; price: DeliveryMoney; carrier: { key: string; name: string; }; unavailableReason?: DeliveryUnavailable;};SearchableAddressThe fields an address search reads.
import { type SearchableAddress } from "@evolve-framework/schemas";export type SearchableAddress = { givenName?: string | null; familyName?: string | null; company?: string | null; streetAddress?: string | null; streetName?: string | null; streetNumber?: string | null; streetNumberSuffix?: string | null; postalCode?: string | null; city?: string | null; region?: string | null;};SearchableAssociateThe fields an associate search reads.
import { type SearchableAssociate } from "@evolve-framework/schemas";export type SearchableAssociate = { email?: string | null; givenName?: string | null; familyName?: string | null;};SearchRedirectRuleOne entry of a CMS's keyword list.
import { type SearchRedirectRule } from "@evolve-framework/schemas";export type SearchRedirectRule = { keywords: readonly string[]; target: SearchRedirectTarget | undefined;};SearchRedirectTargetWhere a keyword sends a search: a page of the site by its path, or a URL.
import { type SearchRedirectTarget } from "@evolve-framework/schemas";export type SearchRedirectTarget = LinkedPage & { kind: "PAGE" | "URL"; path: string;};SearchSelectionWhich parts of a ProductsResult a caller reads.
import { type SearchSelection } from "@evolve-framework/schemas";export type SearchSelection = { facets: boolean; items: boolean;};SeoFieldsThe SEO fields every page type carries, read from whichever CMS holds it.
import { type SeoFields } from "@evolve-framework/schemas";export type SeoFields = { seoTitle?: string | null; seoDescription?: string | null; seoImage?: string | null;};StorefrontRouteA key in STOREFRONT_ROUTES.
import { type StorefrontRoute } from "@evolve-framework/schemas";export type StorefrontRoute = (typeof STOREFRONT_ROUTES)[number];TopicRouteWhat a topic page's path names: its section's path, the segment and the topic's slug.
import { type TopicRoute } from "@evolve-framework/schemas";export type TopicRoute = { sectionPath: string; segment: string; slug: string;};Not listed: 2 options types. They appear as the tables under the constructors and functions they type.

