@entifix/next-shell 0.22.0 → 0.22.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"make-entity-crud.types.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/make-entity-crud.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,MAAM,EACN,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,gBAAgB,CAC1B,cAAc,GAAG,eAAe,CAAC,oBAAoB,CAAC,IACpD,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,GAIhC,MAAM,GACN;KACG,CAAC,IAAI,MAAM,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,SAAS;QACrD,IAAI,EAAE;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QAC9C,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,GACG,CAAC,GACD,KAAK;CACV,CAAC,MAAM,cAAc,CAAC,GACrB,MAAM,CAAC;AAEb;;;;;;;;;;;GAWG;AACH,KAAK,oBAAoB,GAAG,iBAAiB,SAAS;IAAE,SAAS,EAAE,MA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,UAAU,EAAE,qBAAqB,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;CAC5C"}
1
+ {"version":3,"file":"make-entity-crud.types.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/make-entity-crud.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,MAAM,EACN,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,gBAAgB,CAC1B,cAAc,GAAG,eAAe,CAAC,oBAAoB,CAAC,IACpD,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,GAIhC,MAAM,GACN;KACG,CAAC,IAAI,MAAM,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,SAAS;QACrD,IAAI,EAAE;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;QAC9C,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,GACG,CAAC,GACD,KAAK;CACV,CAAC,MAAM,cAAc,CAAC,GACrB,MAAM,CAAC;AAEb;;;;;;;;;;;GAWG;AACH,KAAK,oBAAoB,GAAG,iBAAiB,SAAS;IAAE,SAAS,EAAE,MAAM,CAAC,CAAA;CAAE,GACxE,CA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AAED,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED;;;;;;;GAOG;AAEH,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE5E;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;CAC5C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/crud/make-entity-crud.types.ts"],"sourcesContent":["import type {\n EntityFacetCounterTag,\n EntityRepositoryTag,\n} from '@entifix/business';\nimport type {\n Entity,\n EntityConstructor,\n EntityFieldDescriptor,\n EntityMetadataSource,\n EntityUseCaseRunner,\n EntityWriter,\n FilterGroup,\n} from '@entifix/core';\nimport type {\n EntityDraftStore,\n EntityLinkSourceConfig,\n} from '@entifix/react-integration';\nimport type { Context } from 'effect/Context';\nimport type { CustomTypeOptions } from 'i18next';\nimport type { ReactElement, ReactNode } from 'react';\n\n/**\n * The `entity` catalog keys that carry **both** form titles, a `label` and a\n * `plural`.\n *\n * Derived from the Spanish catalog rather than written out, so the union is the\n * catalog: an entity whose subtree has no `form.editTitle`/`form.newTitle`\n * cannot be handed to {@link makeEntityCrud} at all, and adding a reference\n * entity therefore starts by adding its copy to both locales. That is the whole\n * i18n gate for this factory — a host's catalog check typically scans its\n * domain packages for `@useCase()` decorators and never `.tsx`, so a runtime\n * key here would be checked by nothing.\n *\n * `label`/`plural` joined the condition when {@link EntityCrud} began carrying\n * them, so that a workspace tab and a nav entry derived from this descriptor\n * name the entity in the catalog's own words. They are part of the **type**\n * rather than a runtime assertion in the factory, because the catalog is\n * statically known here: a missing `plural` should fail at the call site that\n * generates the screens, not on the render that first tries to title a tab.\n *\n * Keeping the key typed is what lets the generated form call `useT('entity')`\n * with a template literal and still fail the build on a typo, instead of\n * reaching for the `useTranslateKey` escape hatch that authored copy must not\n * use. `AccountLabelKey` in `../session/account-links.ts` is the same trick\n * written out by hand; this one cannot drift because it is computed.\n */\nexport type EntityCatalogKey<\n TEntityCatalog = EntityCatalogOf<TypeOptionsResources>,\n> = [TEntityCatalog] extends [never]\n ? // No host augmentation in this compilation — this package's own specs, or\n // an adopter who has not declared one. The factory still works; the key is\n // simply unchecked, which is the same trade `useTranslateKey` makes.\n string\n : {\n [K in keyof TEntityCatalog]: TEntityCatalog[K] extends {\n form: { editTitle: string; newTitle: string };\n label: string;\n plural: string;\n }\n ? K\n : never;\n }[keyof TEntityCatalog] &\n string;\n\n/**\n * The host's `entity` namespace, read back out of its own `i18next`\n * augmentation.\n *\n * ⚠️ **The `entity` catalog is the host's, not entifix's.** It names *their*\n * entities — a parameter, an offering, a sales channel — so a framework that\n * shipped one would be shipping an application's product copy. Reading it back\n * through `CustomTypeOptions` keeps the key union computed rather than written\n * out, which is what stops it drifting, while leaving the catalog where it\n * belongs. A host that declares no augmentation gets `string`, and the factory\n * still works with the gate relaxed.\n */\ntype TypeOptionsResources = CustomTypeOptions extends { resources: infer R }\n ? R\n : never;\n\ntype EntityCatalogOf<TResources> = TResources extends { entity: infer E }\n ? E\n : never;\n\n/**\n * A relation the generated form edits with a picker.\n *\n * The target is named here rather than derived, because the common case is a\n * **plain foreign key**: when the target lives in another slice's store a typed\n * `EntityLink` is both an illegal import and a cross-store join, so the member\n * is a bare `string` (`ProductSpecification.brandId` into `catalog-reference`)\n * and its `@accessor()` has no vocabulary for \"the target's name\". Hence\n * `labelProperty`/`searchProperty` are stated at the call site instead of being\n * left to `describeEntityColumns`' `'name'` default, which happens to be right\n * today and states nothing.\n *\n * `searchProperty` must be `filterable` on the **target** or the service answers\n * `400`; `useEntityLinkSource` throws at render rather than letting that surface\n * as an empty suggestion list.\n */\nexport interface EntityCrudLink<TAdapters, TEntity extends Entity = Entity> {\n /** The owning entity's accessor name, e.g. `'brandId'`. */\n readonly field: string;\n readonly entityConstructor: EntityConstructor<Entity>;\n /**\n * Which adapter holds the **target's** repository. Often a different service\n * than the record's own: `catalog-reference` is another slice's store, so\n * resolving an id goes through that domain's own read path.\n */\n readonly repository: AdapterKey<TAdapters, Context<EntityRepositoryTag>>;\n /**\n * What the picker shows for a candidate. Defaults to `'name'`. The picker's\n * display only: a list, a read form and a confirm name the target through\n * the member's `references` and the host's `ReferenceLabelsHost`.\n */\n readonly labelProperty?: string;\n /** Defaults to `'name'`. Must be `filterable` on the target. */\n readonly searchProperty?: string;\n /**\n * A restriction on what may be picked **for this record**, ANDed into every\n * quick and browse request — `useEntityLinkSource`'s `baseFiltering`, built\n * from the record being edited rather than fixed at factory time.\n *\n * A record-dependent rule is the case it exists for: a parent picker that\n * must not offer the record itself or anything beneath it. That rule needs\n * more than the record — its descendants are other records — which is why\n * this is a **hook** and not a function of the record: it may load what it\n * needs through the host's own adapters, and answer `undefined` until it has.\n *\n * Called on every render of the single view, under the rules of hooks: once\n * per link, unconditionally, with `undefined` while the record loads and\n * throughout a create. `undefined` back means no restriction. Its members\n * must be `filterable` on the target, or the service answers `400`. It\n * narrows the suggestions and nothing else — the service still has to refuse\n * a value the picker would not have offered.\n */\n readonly useBaseFiltering?: (\n record: TEntity | undefined,\n ) => AnyFilterGroup | undefined;\n}\n\n/**\n * A restriction over a picker's target, with the target's type erased — the\n * link names its target only as `EntityConstructor<Entity>`, so a filter typed\n * on the real target would not be assignable. Erased for the reason\n * {@link AnyEntityLinkSourceConfig} is.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyFilterGroup = FilterGroup<any>;\n\n/**\n * A column whose value lives in another entity — a price that points at the\n * offering, the stock held of it, the brand it names — read in **one request\n * per column per page** through the target's own read path\n * ([ADR 0030](../../../../../../docs/adr/0030-a-reference-names-its-target-through-the-owners-read-port.md)).\n *\n * Matched one of two ways, never both:\n *\n * - `via` — a member of **this** entity that `references` the target, so the\n * target is read by `id=in=(…)` over the page's values of it;\n * - `match` — a member of the **target** holding this record's id, so the\n * target is read by `<match>=in=(…)` over the page's ids. It must be\n * `filterable` on the target.\n *\n * Zero matches read `—`, one reads its `member` through the target's own\n * descriptor (money reads as money), and more than one reads as a count. The\n * column is never sortable or filterable: its value is in another store, and a\n * sort the server cannot run would be a lie.\n */\nexport interface EntityCrudRelated<TAdapters> {\n /** The column's identity, unique among the list's columns. */\n readonly key: string;\n /** Catalog key for its header, e.g. `entity:product-offering.related.price`. */\n readonly labelKey: string;\n readonly target: EntityConstructor<Entity>;\n /** Which adapter holds the target's repository. The column names no adapter of its own. */\n readonly repository: AdapterKey<TAdapters, Context<EntityRepositoryTag>>;\n readonly via?: string;\n readonly match?: string;\n /** Narrows the matches, AND-ed with the match — the current price, the active stock. */\n readonly filtering?: AnyFilterGroup;\n /** The target's member the column shows. */\n readonly member: string;\n /** How one match renders, in place of its member's value — a picture, say. */\n readonly render?: (match: Entity) => ReactNode;\n}\n\n/** The keys of `TAdapters` whose value is assignable to `TValue`. */\nexport type AdapterKey<TAdapters, TValue> = {\n [K in keyof TAdapters]: TAdapters[K] extends TValue ? K : never;\n}[keyof TAdapters];\n\n/** A related region: this entity's records that refer to another record. */\nexport interface EntityCrudRelatedListProps<TEntity extends Entity> {\n /** Which records — those referring to the record whose page this is. Fixed, and shown as no chip. */\n readonly filtering: FilterGroup<TEntity>;\n /** Catalog key for the region's `h2`, and its entry in the page's section nav. */\n readonly labelKey: string;\n /**\n * The members a \"New\" from this region opens already set — the parent\n * record's id under the member that refers to it.\n */\n readonly prefill?: Readonly<Record<string, string>>;\n /** Where \"New\" goes, in place of this crud's create page with `prefill`. */\n readonly newHref?: string;\n readonly pageSize?: number;\n}\n\nexport interface EntityCrudOptions<TAdapters, TEntity extends Entity> {\n /** The domain shell's adapters hook, e.g. `useMarketplaceAdminAdapters`. */\n readonly useAdapters: () => TAdapters;\n /** Route prefix for both pages, e.g. `'/catalog/product-brand'`. */\n readonly basePath: string;\n /**\n * The entity's `entity` catalog key. Asserted against `@entity({ key })` at\n * factory time — the two are the same string by convention\n * (`entity:product-brand.label` mirrors `key: 'product-brand'`), and letting\n * them drift would title a form after a different entity.\n */\n readonly catalogKey: EntityCatalogKey;\n /** Which adapter holds this entity's own repository. */\n readonly repository: AdapterKey<TAdapters, Context<EntityRepositoryTag>>;\n /**\n * Members the form keeps but does not show — `id` always, plus anything a\n * transaction assigns. A hidden member still round-trips: it is dropped from\n * the rendered fields, not from the draft, so `reconstructEntity` carries it\n * back out of the seeded values.\n */\n readonly hiddenFields?: readonly string[];\n /** `<EntityColumn>` overrides for the list, for presentation metadata cannot express. */\n readonly columns?: ReactNode;\n /**\n * Extra controls beside the table's own — an `<EntityTableToolbar>`.\n *\n * Its own option rather than more `columns`, though both end up as\n * `EntityTable` children and the slots are sorted by component identity: a\n * toolbar filed under a columns prop is a name that lies, and the first thing\n * to go here is a link into a wizard, which is not a column by any reading.\n */\n readonly toolbar?: ReactNode;\n /**\n * How many rows the list asks for on its first load. Defaults to\n * `useDataLoading`'s own default.\n *\n * Raised for a vocabulary that should be seen whole: `EntityTable` nests a\n * hierarchy only within the page it was given, so a tree larger than one page\n * shows the children whose parent fell on another page as roots.\n */\n readonly pageSize?: number;\n /**\n * The filter the list opens with — a worklist, where the default view of a\n * record class is the rows someone has to act on. Shown in the filter panel\n * as the user's own, so it can be changed or cleared; unlike a link's\n * `useBaseFiltering`, it restricts nothing.\n *\n * Checked when the screen is generated against the same allowlist a service\n * applies to a query: a member that is not `filterable`, or a value of the\n * wrong type, throws here rather than answering `400` on every first load.\n */\n readonly initialFiltering?: FilterGroup<TEntity>;\n /**\n * How the record page's Delete is made safe\n * ([ADR 0026](../../../../../../docs/adr/0026-actions-hierarchy-overflow-and-destructive-verbs.md)):\n * `confirm` (the default) asks in an alert dialog naming the record; `typed`\n * asks for its name to be typed first — for the records a fleet boots from;\n * `undo` deletes at once and offers Undo, which saves the record back under\n * its id, so it needs a store whose save puts a record back rather than\n * refusing an id it no longer holds.\n */\n readonly delete?: 'confirm' | 'undo' | 'typed';\n /** Frozen at factory time — see `use-entity-link-sources.ts`. */\n readonly links?: readonly EntityCrudLink<TAdapters, TEntity>[];\n /** Columns whose values live in another entity, read per page. */\n readonly related?: readonly EntityCrudRelated<TAdapters>[];\n /**\n * The records that refer to this one, as regions under its form — each\n * usually another crud's `RelatedList`, held to this record's id. Rendered\n * for an existing record only, never on create. Not master-detail: each\n * region writes its own records through its own owner, with its own Save,\n * and there is no page-wide Save across stores.\n */\n readonly regions?: (record: TEntity) => readonly ReactNode[];\n /**\n * Where the entity's served affordances come from — `GET /api/<entity>/$metadata`.\n *\n * Supplying it is what turns on every served affordance:\n * Save and Delete filtered against the caller's real grants, the declared\n * verbs on the form, the row overflow menu, and the bulk bar. Omitting it\n * keeps the pre-0026 behaviour exactly, which is what every generated catalog\n * rendered before this option existed.\n *\n * A `EntityMetadataSource` rather than a URL because the two hosts reach\n * their service differently — one through the config-driven REST adapters,\n * one through a shell's own same-origin routes.\n */\n readonly metadataSource?: EntityMetadataSource;\n /**\n * Which adapter holds this entity's {@link EntityMetadataSource} — the same\n * source as {@link metadataSource}, resolved from the host's composition\n * instead of built by the caller.\n *\n * Prefer it: a source is a transport, and naming it by key keeps the module\n * that generates the screens free of the adapter that fetches, exactly as\n * {@link repository} already does for records. Supplying both is a build\n * error — two answers to where the document comes from.\n */\n readonly metadata?: AdapterKey<TAdapters, EntityMetadataSource>;\n /**\n * Which adapter runs this entity's `@useCase()` verbs — over REST against\n * the service that serves them, or in-process for records that live in the\n * browser. Resolved from the host's composition, as {@link repository} is.\n *\n * Supplying it lets the generated screens run what the served `$metadata`\n * lists for the caller: a row's menu and a form's buttons run a verb on a\n * record, and the bulk bar runs a `collection` verb over a selection,\n * reporting per row. A verb that resolves reloads what it changed; one that\n * refuses shows its coded message in the screen's error slot rather than as\n * a promise nobody catches.\n */\n readonly useCases?: AdapterKey<TAdapters, EntityUseCaseRunner>;\n /**\n * Which adapter makes this entity's saves and deletes, answering both\n * settle modes — `buildEntityRestAdapterWrite` over REST. Resolved from the\n * host's composition, as {@link repository} is.\n *\n * Omitted, the form writes through {@link repository}, and every write\n * settles. Supplied, a write the server hands to a flow keeps the form open\n * and waiting, with what was typed, until the flow settles: a completed one\n * returns to the list, and a failed one is toasted once by the\n * `PendingFlowsProvider` above while the form keeps its input.\n */\n readonly write?: AdapterKey<TAdapters, EntityWriter>;\n\n /**\n * An adapter context providing `EntityFacetCounterTag` — the REST client's\n * facets adapter, typically. Supplied, the list's filter panel shows how\n * many records hold each choice of an enum or boolean member, counted under\n * the filters in effect less that member's own.\n */\n readonly facets?: AdapterKey<TAdapters, Context<EntityFacetCounterTag>>;\n}\n\n/**\n * Props both hosts pass. A route host passes none — the slug comes from the URL\n * and a save returns to the list; the workspace tab host passes all of them.\n */\nexport interface EntityCrudSingleViewProps {\n /** Defaults to the `[slug]` route param. */\n readonly slug?: string;\n /** Defaults to navigating back to the list. */\n readonly onSaved?: () => void;\n readonly onDeleted?: () => void;\n /**\n * Where to autosave the edit. Supplying it is the whole opt-in: the form\n * seeds from the persisted draft, writes to it on every edit, and the page\n * clears it once a save or delete commits.\n *\n * A route host omits it and stays ephemeral, which is the rule stated as a\n * missing prop rather than as a flag — there is no value of \"absent\" that\n * accidentally starts persisting.\n */\n readonly draft?: EntityDraftStore;\n}\n\n/**\n * What the factory returns: a **named descriptor**, not four loose components.\n *\n * The identity fields are here so the workspace registry and the nav are derived\n * from a list of these rather than from the hand-written const maps they replace.\n */\nexport interface EntityCrud<TEntity extends Entity> {\n readonly entityConstructor: EntityConstructor<TEntity>;\n /** `@entity({ key })`, which is also `catalogKey` and the tab address payload. */\n readonly entityKey: EntityCatalogKey;\n /**\n * `@entity({ labelKey })` — how one record is named. A record tab's title.\n *\n * Read off the decorator rather than passed, so the tab strip, the nav and the\n * search results all name the entity from the one place it names itself.\n */\n readonly entityLabelKey: string;\n /** `@entity({ pluralKey })` — how the collection is named. A list tab's title. */\n readonly entityPluralKey: string;\n readonly basePath: string;\n readonly ListPage: () => ReactElement;\n readonly SingleViewPage: (props?: EntityCrudSingleViewProps) => ReactElement;\n /** This entity's records referring to another record, as a region of that record's page. */\n readonly RelatedList: (\n props: EntityCrudRelatedListProps<TEntity>,\n ) => ReactElement;\n}\n\n/**\n * A picker's transport with its context tags erased.\n *\n * The factory cannot preserve one type parameter per link — the pages that\n * build these know their adapters, the generated form only forwards them — and\n * `EntityForm.linkSources` is already `Record<string, EntityLinkSource<any>>`\n * for the same reason.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyEntityLinkSourceConfig = EntityLinkSourceConfig<Entity, any>;\n\n/**\n * One picker, resolved: the descriptor computed once at factory time, and the\n * use-cases plus adapter context the page builds per render.\n */\nexport interface EntityCrudLinkSource {\n readonly field: string;\n readonly descriptor: EntityFieldDescriptor;\n readonly config: AnyEntityLinkSourceConfig;\n}\n"],"names":[],"mappings":"AAmZA;;;CAGC,GACD,WAIC"}
1
+ {"version":3,"sources":["../../../src/lib/crud/make-entity-crud.types.ts"],"sourcesContent":["import type {\n EntityFacetCounterTag,\n EntityRepositoryTag,\n} from '@entifix/business';\nimport type {\n Entity,\n EntityConstructor,\n EntityFieldDescriptor,\n EntityMetadataSource,\n EntitySorting,\n EntityUseCaseRunner,\n EntityWriter,\n FilterGroup,\n} from '@entifix/core';\nimport type {\n EntityDraftStore,\n EntityLinkSourceConfig,\n} from '@entifix/react-integration';\nimport type { Context } from 'effect/Context';\nimport type { CustomTypeOptions } from 'i18next';\nimport type { ReactElement, ReactNode } from 'react';\n\n/**\n * The `entity` catalog keys that carry **both** form titles, a `label` and a\n * `plural`.\n *\n * Derived from the Spanish catalog rather than written out, so the union is the\n * catalog: an entity whose subtree has no `form.editTitle`/`form.newTitle`\n * cannot be handed to {@link makeEntityCrud} at all, and adding a reference\n * entity therefore starts by adding its copy to both locales. That is the whole\n * i18n gate for this factory — a host's catalog check typically scans its\n * domain packages for `@useCase()` decorators and never `.tsx`, so a runtime\n * key here would be checked by nothing.\n *\n * `label`/`plural` joined the condition when {@link EntityCrud} began carrying\n * them, so that a workspace tab and a nav entry derived from this descriptor\n * name the entity in the catalog's own words. They are part of the **type**\n * rather than a runtime assertion in the factory, because the catalog is\n * statically known here: a missing `plural` should fail at the call site that\n * generates the screens, not on the render that first tries to title a tab.\n *\n * Keeping the key typed is what lets the generated form call `useT('entity')`\n * with a template literal and still fail the build on a typo, instead of\n * reaching for the `useTranslateKey` escape hatch that authored copy must not\n * use. `AccountLabelKey` in `../session/account-links.ts` is the same trick\n * written out by hand; this one cannot drift because it is computed.\n */\nexport type EntityCatalogKey<\n TEntityCatalog = EntityCatalogOf<TypeOptionsResources>,\n> = [TEntityCatalog] extends [never]\n ? // No host augmentation in this compilation — this package's own specs, or\n // an adopter who has not declared one. The factory still works; the key is\n // simply unchecked, which is the same trade `useTranslateKey` makes.\n string\n : {\n [K in keyof TEntityCatalog]: TEntityCatalog[K] extends {\n form: { editTitle: string; newTitle: string };\n label: string;\n plural: string;\n }\n ? K\n : never;\n }[keyof TEntityCatalog] &\n string;\n\n/**\n * The host's `entity` namespace, read back out of its own `i18next`\n * augmentation.\n *\n * ⚠️ **The `entity` catalog is the host's, not entifix's.** It names *their*\n * entities — a parameter, an offering, a sales channel — so a framework that\n * shipped one would be shipping an application's product copy. Reading it back\n * through `CustomTypeOptions` keeps the key union computed rather than written\n * out, which is what stops it drifting, while leaving the catalog where it\n * belongs. A host that declares no augmentation gets `string`, and the factory\n * still works with the gate relaxed.\n */\ntype TypeOptionsResources = CustomTypeOptions extends { resources: infer R }\n ? R\n : never;\n\ntype EntityCatalogOf<TResources> = TResources extends { entity: infer E }\n ? E\n : never;\n\n/**\n * A relation the generated form edits with a picker.\n *\n * The target is named here rather than derived, because the common case is a\n * **plain foreign key**: when the target lives in another slice's store a typed\n * `EntityLink` is both an illegal import and a cross-store join, so the member\n * is a bare `string` (`ProductSpecification.brandId` into `catalog-reference`)\n * and its `@accessor()` has no vocabulary for \"the target's name\". Hence\n * `labelProperty`/`searchProperty` are stated at the call site instead of being\n * left to `describeEntityColumns`' `'name'` default, which happens to be right\n * today and states nothing.\n *\n * `searchProperty` must be `filterable` on the **target** or the service answers\n * `400`; `useEntityLinkSource` throws at render rather than letting that surface\n * as an empty suggestion list.\n */\nexport interface EntityCrudLink<TAdapters, TEntity extends Entity = Entity> {\n /** The owning entity's accessor name, e.g. `'brandId'`. */\n readonly field: string;\n readonly entityConstructor: EntityConstructor<Entity>;\n /**\n * Which adapter holds the **target's** repository. Often a different service\n * than the record's own: `catalog-reference` is another slice's store, so\n * resolving an id goes through that domain's own read path.\n */\n readonly repository: AdapterKey<TAdapters, Context<EntityRepositoryTag>>;\n /**\n * What the picker shows for a candidate. Defaults to `'name'`. The picker's\n * display only: a list, a read form and a confirm name the target through\n * the member's `references` and the host's `ReferenceLabelsHost`.\n */\n readonly labelProperty?: string;\n /** Defaults to `'name'`. Must be `filterable` on the target. */\n readonly searchProperty?: string;\n /**\n * A restriction on what may be picked **for this record**, ANDed into every\n * quick and browse request — `useEntityLinkSource`'s `baseFiltering`, built\n * from the record being edited rather than fixed at factory time.\n *\n * A record-dependent rule is the case it exists for: a parent picker that\n * must not offer the record itself or anything beneath it. That rule needs\n * more than the record — its descendants are other records — which is why\n * this is a **hook** and not a function of the record: it may load what it\n * needs through the host's own adapters, and answer `undefined` until it has.\n *\n * Called on every render of the single view, under the rules of hooks: once\n * per link, unconditionally, with `undefined` while the record loads and\n * throughout a create. `undefined` back means no restriction. Its members\n * must be `filterable` on the target, or the service answers `400`. It\n * narrows the suggestions and nothing else — the service still has to refuse\n * a value the picker would not have offered.\n */\n readonly useBaseFiltering?: (\n record: TEntity | undefined,\n ) => AnyFilterGroup | undefined;\n}\n\n/**\n * A restriction over a picker's target, with the target's type erased — the\n * link names its target only as `EntityConstructor<Entity>`, so a filter typed\n * on the real target would not be assignable. Erased for the reason\n * {@link AnyEntityLinkSourceConfig} is.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyFilterGroup = FilterGroup<any>;\n\n/**\n * A column whose value lives in another entity — a price that points at the\n * offering, the stock held of it, the brand it names — read in **one request\n * per column per page** through the target's own read path\n * ([ADR 0030](../../../../../../docs/adr/0030-a-reference-names-its-target-through-the-owners-read-port.md)).\n *\n * Matched one of two ways, never both:\n *\n * - `via` — a member of **this** entity that `references` the target, so the\n * target is read by `id=in=(…)` over the page's values of it;\n * - `match` — a member of the **target** holding this record's id, so the\n * target is read by `<match>=in=(…)` over the page's ids. It must be\n * `filterable` on the target.\n *\n * Zero matches read `—`, one reads its `member` through the target's own\n * descriptor (money reads as money), and more than one reads as a count. The\n * column is never sortable or filterable: its value is in another store, and a\n * sort the server cannot run would be a lie.\n */\nexport interface EntityCrudRelated<TAdapters> {\n /** The column's identity, unique among the list's columns. */\n readonly key: string;\n /** Catalog key for its header, e.g. `entity:product-offering.related.price`. */\n readonly labelKey: string;\n readonly target: EntityConstructor<Entity>;\n /** Which adapter holds the target's repository. The column names no adapter of its own. */\n readonly repository: AdapterKey<TAdapters, Context<EntityRepositoryTag>>;\n readonly via?: string;\n readonly match?: string;\n /** Narrows the matches, AND-ed with the match — the current price, the active stock. */\n readonly filtering?: AnyFilterGroup;\n /** The target's member the column shows. */\n readonly member: string;\n /** How one match renders, in place of its member's value — a picture, say. */\n readonly render?: (match: Entity) => ReactNode;\n}\n\n/** The keys of `TAdapters` whose value is assignable to `TValue`. */\nexport type AdapterKey<TAdapters, TValue> = {\n [K in keyof TAdapters]: TAdapters[K] extends TValue ? K : never;\n}[keyof TAdapters];\n\n/** A related region: this entity's records that refer to another record. */\nexport interface EntityCrudRelatedListProps<TEntity extends Entity> {\n /** Which records — those referring to the record whose page this is. Fixed, and shown as no chip. */\n readonly filtering: FilterGroup<TEntity>;\n /** Catalog key for the region's `h2`, and its entry in the page's section nav. */\n readonly labelKey: string;\n /**\n * The members a \"New\" from this region opens already set — the parent\n * record's id under the member that refers to it.\n */\n readonly prefill?: Readonly<Record<string, string>>;\n /** Where \"New\" goes, in place of this crud's create page with `prefill`. */\n readonly newHref?: string;\n readonly pageSize?: number;\n}\n\nexport interface EntityCrudOptions<TAdapters, TEntity extends Entity> {\n /** The domain shell's adapters hook, e.g. `useMarketplaceAdminAdapters`. */\n readonly useAdapters: () => TAdapters;\n /** Route prefix for both pages, e.g. `'/catalog/product-brand'`. */\n readonly basePath: string;\n /**\n * The entity's `entity` catalog key. Asserted against `@entity({ key })` at\n * factory time — the two are the same string by convention\n * (`entity:product-brand.label` mirrors `key: 'product-brand'`), and letting\n * them drift would title a form after a different entity.\n */\n readonly catalogKey: EntityCatalogKey;\n /** Which adapter holds this entity's own repository. */\n readonly repository: AdapterKey<TAdapters, Context<EntityRepositoryTag>>;\n /**\n * Members the form keeps but does not show — `id` always, plus anything a\n * transaction assigns. A hidden member still round-trips: it is dropped from\n * the rendered fields, not from the draft, so `reconstructEntity` carries it\n * back out of the seeded values.\n */\n readonly hiddenFields?: readonly string[];\n /** `<EntityColumn>` overrides for the list, for presentation metadata cannot express. */\n readonly columns?: ReactNode;\n /**\n * Extra controls beside the table's own — an `<EntityTableToolbar>`.\n *\n * Its own option rather than more `columns`, though both end up as\n * `EntityTable` children and the slots are sorted by component identity: a\n * toolbar filed under a columns prop is a name that lies, and the first thing\n * to go here is a link into a wizard, which is not a column by any reading.\n */\n readonly toolbar?: ReactNode;\n /**\n * How many rows the list asks for on its first load. Defaults to\n * `useDataLoading`'s own default.\n *\n * Raised for a vocabulary that should be seen whole: `EntityTable` nests a\n * hierarchy only within the page it was given, so a tree larger than one page\n * shows the children whose parent fell on another page as roots.\n */\n readonly pageSize?: number;\n /**\n * The filter the list opens with — a worklist, where the default view of a\n * record class is the rows someone has to act on. Shown in the filter panel\n * as the user's own, so it can be changed or cleared; unlike a link's\n * `useBaseFiltering`, it restricts nothing.\n *\n * Checked when the screen is generated against the same allowlist a service\n * applies to a query: a member that is not `filterable`, or a value of the\n * wrong type, throws here rather than answering `400` on every first load.\n */\n readonly initialFiltering?: FilterGroup<TEntity>;\n /**\n * The order the list opens in — a worklist again: the stock that is out\n * first, the oldest order first. The header reads as sorted by it, and a\n * click on another column replaces it.\n *\n * Checked when the screen is generated against the `sortable` allowlist a\n * service applies to a `sort` parameter: a member that is not `sortable`\n * throws here rather than answering `400` on every first load.\n */\n readonly initialSorting?: EntitySorting<TEntity>;\n /**\n * How the list reads for whoever is reading it — a hook the host supplies,\n * called on every render of the list page and of each `RelatedList`. A\n * vendor reading their own statement gets \"My payouts\" over a list with no\n * \"Vendor\" column, where an operator gets \"Vendor payouts\" and the column.\n *\n * Copy and presentation only. It decides nothing about what the reader may\n * read: the service narrows the records, and a column withheld here is a\n * column whose value the service still sends.\n */\n readonly useListView?: () => EntityCrudListView;\n /**\n * How the record page's Delete is made safe\n * ([ADR 0026](../../../../../../docs/adr/0026-actions-hierarchy-overflow-and-destructive-verbs.md)):\n * `confirm` (the default) asks in an alert dialog naming the record; `typed`\n * asks for its name to be typed first — for the records a fleet boots from;\n * `undo` deletes at once and offers Undo, which saves the record back under\n * its id, so it needs a store whose save puts a record back rather than\n * refusing an id it no longer holds.\n */\n readonly delete?: 'confirm' | 'undo' | 'typed';\n /** Frozen at factory time — see `use-entity-link-sources.ts`. */\n readonly links?: readonly EntityCrudLink<TAdapters, TEntity>[];\n /** Columns whose values live in another entity, read per page. */\n readonly related?: readonly EntityCrudRelated<TAdapters>[];\n /**\n * The records that refer to this one, as regions under its form — each\n * usually another crud's `RelatedList`, held to this record's id. Rendered\n * for an existing record only, never on create. Not master-detail: each\n * region writes its own records through its own owner, with its own Save,\n * and there is no page-wide Save across stores.\n */\n readonly regions?: (record: TEntity) => readonly ReactNode[];\n /**\n * Where the entity's served affordances come from — `GET /api/<entity>/$metadata`.\n *\n * Supplying it is what turns on every served affordance:\n * Save and Delete filtered against the caller's real grants, the declared\n * verbs on the form, the row overflow menu, and the bulk bar. Omitting it\n * keeps the pre-0026 behaviour exactly, which is what every generated catalog\n * rendered before this option existed.\n *\n * A `EntityMetadataSource` rather than a URL because the two hosts reach\n * their service differently — one through the config-driven REST adapters,\n * one through a shell's own same-origin routes.\n */\n readonly metadataSource?: EntityMetadataSource;\n /**\n * Which adapter holds this entity's {@link EntityMetadataSource} — the same\n * source as {@link metadataSource}, resolved from the host's composition\n * instead of built by the caller.\n *\n * Prefer it: a source is a transport, and naming it by key keeps the module\n * that generates the screens free of the adapter that fetches, exactly as\n * {@link repository} already does for records. Supplying both is a build\n * error — two answers to where the document comes from.\n */\n readonly metadata?: AdapterKey<TAdapters, EntityMetadataSource>;\n /**\n * Which adapter runs this entity's `@useCase()` verbs — over REST against\n * the service that serves them, or in-process for records that live in the\n * browser. Resolved from the host's composition, as {@link repository} is.\n *\n * Supplying it lets the generated screens run what the served `$metadata`\n * lists for the caller: a row's menu and a form's buttons run a verb on a\n * record, and the bulk bar runs a `collection` verb over a selection,\n * reporting per row. A verb that resolves reloads what it changed; one that\n * refuses shows its coded message in the screen's error slot rather than as\n * a promise nobody catches.\n */\n readonly useCases?: AdapterKey<TAdapters, EntityUseCaseRunner>;\n /**\n * Which adapter makes this entity's saves and deletes, answering both\n * settle modes — `buildEntityRestAdapterWrite` over REST. Resolved from the\n * host's composition, as {@link repository} is.\n *\n * Omitted, the form writes through {@link repository}, and every write\n * settles. Supplied, a write the server hands to a flow keeps the form open\n * and waiting, with what was typed, until the flow settles: a completed one\n * returns to the list, and a failed one is toasted once by the\n * `PendingFlowsProvider` above while the form keeps its input.\n */\n readonly write?: AdapterKey<TAdapters, EntityWriter>;\n\n /**\n * An adapter context providing `EntityFacetCounterTag` — the REST client's\n * facets adapter, typically. Supplied, the list's filter panel shows how\n * many records hold each choice of an enum or boolean member, counted under\n * the filters in effect less that member's own.\n */\n readonly facets?: AdapterKey<TAdapters, Context<EntityFacetCounterTag>>;\n}\n\n/**\n * Props both hosts pass. A route host passes none — the slug comes from the URL\n * and a save returns to the list; the workspace tab host passes all of them.\n */\nexport interface EntityCrudSingleViewProps {\n /** Defaults to the `[slug]` route param. */\n readonly slug?: string;\n /** Defaults to navigating back to the list. */\n readonly onSaved?: () => void;\n readonly onDeleted?: () => void;\n /**\n * Where to autosave the edit. Supplying it is the whole opt-in: the form\n * seeds from the persisted draft, writes to it on every edit, and the page\n * clears it once a save or delete commits.\n *\n * A route host omits it and stays ephemeral, which is the rule stated as a\n * missing prop rather than as a flag — there is no value of \"absent\" that\n * accidentally starts persisting.\n */\n readonly draft?: EntityDraftStore;\n}\n\n/**\n * What the factory returns: a **named descriptor**, not four loose components.\n *\n * The identity fields are here so the workspace registry and the nav are derived\n * from a list of these rather than from the hand-written const maps they replace.\n */\nexport interface EntityCrud<TEntity extends Entity> {\n readonly entityConstructor: EntityConstructor<TEntity>;\n /** `@entity({ key })`, which is also `catalogKey` and the tab address payload. */\n readonly entityKey: EntityCatalogKey;\n /**\n * `@entity({ labelKey })` — how one record is named. A record tab's title.\n *\n * Read off the decorator rather than passed, so the tab strip, the nav and the\n * search results all name the entity from the one place it names itself.\n */\n readonly entityLabelKey: string;\n /** `@entity({ pluralKey })` — how the collection is named. A list tab's title. */\n readonly entityPluralKey: string;\n /**\n * The list's title for whoever is reading it: the `titleKey` the host's\n * `useListView` answers, else {@link entityPluralKey}. A hook, so a host\n * titles a list's tab exactly as the page titles itself.\n */\n readonly useListTitleKey: () => string;\n readonly basePath: string;\n readonly ListPage: () => ReactElement;\n readonly SingleViewPage: (props?: EntityCrudSingleViewProps) => ReactElement;\n /** This entity's records referring to another record, as a region of that record's page. */\n readonly RelatedList: (\n props: EntityCrudRelatedListProps<TEntity>,\n ) => ReactElement;\n}\n\n/** What {@link EntityCrudOptions.useListView} answers for one reader. */\nexport interface EntityCrudListView {\n /**\n * The list's title, as a catalog key, in place of the entity's own\n * `pluralKey`. Also what {@link EntityCrud.useListTitleKey} answers, so a\n * host titles the list's tab the same way.\n */\n readonly titleKey?: string;\n /**\n * Columns this reader does not get, passed to `EntityTable` as\n * `hiddenColumns`: gone from the header, the settings, the filters, the sort\n * choices and the cards. A name that is not a column throws.\n */\n readonly hiddenColumns?: readonly string[];\n}\n\n/**\n * A picker's transport with its context tags erased.\n *\n * The factory cannot preserve one type parameter per link — the pages that\n * build these know their adapters, the generated form only forwards them — and\n * `EntityForm.linkSources` is already `Record<string, EntityLinkSource<any>>`\n * for the same reason.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyEntityLinkSourceConfig = EntityLinkSourceConfig<Entity, any>;\n\n/**\n * One picker, resolved: the descriptor computed once at factory time, and the\n * use-cases plus adapter context the page builds per render.\n */\nexport interface EntityCrudLinkSource {\n readonly field: string;\n readonly descriptor: EntityFieldDescriptor;\n readonly config: AnyEntityLinkSourceConfig;\n}\n"],"names":[],"mappings":"AA+bA;;;CAGC,GACD,WAIC"}
@@ -1 +1 @@
1
- {"version":3,"file":"record-search-route.d.ts","sourceRoot":"","sources":["../../../src/lib/search/record-search-route.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAC1C,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAE/C,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAChD,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAkHD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,GAAI,8CAIrC,wBAAwB,MAGC,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CA0D9D,CAAC"}
1
+ {"version":3,"file":"record-search-route.d.ts","sourceRoot":"","sources":["../../../src/lib/search/record-search-route.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAC1C,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAE/C,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAChD,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AA+KD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,GAAI,8CAIrC,wBAAwB,MAGC,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CA0D9D,CAAC"}
@@ -30,15 +30,12 @@ const unavailable = (source, failure, status)=>({
30
30
  })
31
31
  });
32
32
  /**
33
- * Ask one source, and **never reject**.
34
- *
35
- * Returning a typed outcome rather than throwing is what makes the fan-out a
36
- * plain `Promise.all`: isolation comes from this catch, not from
37
- * `allSettled` — whose rejected arm would then be unreachable and untestable.
38
- */ const runSource = async (source, term, limit, locale, token, timeoutMs)=>{
33
+ * One upstream read for a source, as a body or as the outcome that says why
34
+ * there is none — the source named either way.
35
+ */ const fetchBody = async (source, url, token, timeoutMs)=>{
39
36
  let upstream;
40
37
  try {
41
- upstream = await fetch(source.url(term, limit, locale), {
38
+ upstream = await fetch(url, {
42
39
  headers: bearerHeader(token),
43
40
  cache: 'no-store',
44
41
  signal: AbortSignal.timeout(timeoutMs)
@@ -47,24 +44,35 @@ const unavailable = (source, failure, status)=>({
47
44
  // `AbortSignal.timeout` rejects with a `DOMException` named `TimeoutError`;
48
45
  // branching on the name rather than the class keeps this reachable from a
49
46
  // test without fabricating a platform error.
50
- return unavailable(source, error.name === 'TimeoutError' ? new Timeout({
51
- dependency: source.key
52
- }) : new UpstreamUnavailable({
53
- upstream: source.key
54
- }));
47
+ return {
48
+ ok: false,
49
+ outcome: unavailable(source, error.name === 'TimeoutError' ? new Timeout({
50
+ dependency: source.key
51
+ }) : new UpstreamUnavailable({
52
+ upstream: source.key
53
+ }))
54
+ };
55
55
  }
56
56
  // The service says why, in a problem body; the code is the reason. A body
57
57
  // that is not one decodes as `protocol` — still named, never silent.
58
58
  if (!upstream.ok) {
59
59
  const body = await upstream.json().catch(()=>undefined);
60
- return unavailable(source, decodeProblem(body, upstream.status), upstream.status);
60
+ return {
61
+ ok: false,
62
+ outcome: unavailable(source, decodeProblem(body, upstream.status), upstream.status)
63
+ };
61
64
  }
62
- const body = await upstream.json().catch(()=>undefined);
63
- const page = source.read(body, locale);
64
- return page === undefined ? unavailable(source, new ProtocolFailure({
65
+ return {
66
+ ok: true,
67
+ body: await upstream.json().catch(()=>undefined),
68
+ status: upstream.status
69
+ };
70
+ };
71
+ const unreadable = (source, status)=>unavailable(source, new ProtocolFailure({
65
72
  reason: `${source.key} answered a page the source cannot read`,
66
- upstreamStatus: upstream.status
67
- }), upstream.status) : {
73
+ upstreamStatus: status
74
+ }), status);
75
+ const groupOf = (source, page)=>({
68
76
  ok: true,
69
77
  group: {
70
78
  source: source.key,
@@ -73,7 +81,45 @@ const unavailable = (source, failure, status)=>({
73
81
  items: page.items,
74
82
  total: page.total
75
83
  }
76
- };
84
+ });
85
+ /**
86
+ * Ask one source, and **never reject**.
87
+ *
88
+ * Returning a typed outcome rather than throwing is what makes the fan-out a
89
+ * plain `Promise.all`: isolation comes from this catch, not from
90
+ * `allSettled` — whose rejected arm would then be unreachable and untestable.
91
+ *
92
+ * A source searched through a reference takes two reads, one after the
93
+ * other, both under the caller's own session: the referenced records whose
94
+ * name matches the term, at their owner, then this source's records that
95
+ * refer to them. No match is an empty group without the second read, and
96
+ * either read failing degrades the group exactly as one read would.
97
+ */ const runSource = async (source, term, limit, locale, token, timeoutMs)=>{
98
+ let names;
99
+ let url;
100
+ if (source.through === undefined) {
101
+ url = source.url(term, limit, locale);
102
+ } else {
103
+ const matched = await fetchBody(source, source.through.url(term, limit, locale), token, timeoutMs);
104
+ if (!matched.ok) return matched.outcome;
105
+ const matches = source.through.read(matched.body, locale);
106
+ if (matches === undefined) return unreadable(source, matched.status);
107
+ if (matches.length === 0) return groupOf(source, {
108
+ items: [],
109
+ total: 0
110
+ });
111
+ names = new Map(matches.map((match)=>[
112
+ match.id,
113
+ match.label
114
+ ]));
115
+ url = source.through.urlFor([
116
+ ...names.keys()
117
+ ], limit);
118
+ }
119
+ const fetched = await fetchBody(source, url, token, timeoutMs);
120
+ if (!fetched.ok) return fetched.outcome;
121
+ const page = source.read(fetched.body, locale, names);
122
+ return page === undefined ? unreadable(source, fetched.status) : groupOf(source, page);
77
123
  };
78
124
  /**
79
125
  * The locale a search runs in: the one the caller names, else the one the
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/search/record-search-route.ts"],"sourcesContent":["import {\n decodeProblem,\n defaultLocale,\n type EntifixFailure,\n InvalidQuery,\n isLocale,\n type Locale,\n LOCALE_COOKIE,\n LOCALE_HEADER,\n ProtocolFailure,\n Timeout,\n Unauthenticated,\n UpstreamUnavailable,\n} from '@entifix/core';\nimport { NextResponse } from 'next/server';\n\nimport { problemResponse } from '../config/problem-response.js';\nimport { bearerHeader, sessionToken } from '../session/bearer.js';\nimport type {\n RecordSearchGroup,\n RecordSearchResponse,\n RecordSearchUnavailable,\n} from './record-search.types.js';\nimport type { RecordSearchSource } from './record-search-source.js';\n\nexport const SEARCH_TERM_PARAM = 'q';\nexport const SEARCH_SOURCES_PARAM = 'sources';\nexport const SEARCH_LIMIT_PARAM = 'limit';\n/** The reader's locale, which a localized member is searched, sorted and read in. */\nexport const SEARCH_LOCALE_PARAM = 'locale';\n\n/**\n * Below this, nothing is queried at all.\n *\n * A `like` becomes an unanchored `$regex` that ignores accents and case, which no index can\n * serve — so this endpoint is a collection scan by construction. One character\n * matches most of every collection and is worth nothing to the person typing, so\n * the floor costs them nothing and saves four scans per keystroke.\n */\nexport const MIN_TERM_LENGTH = 2;\nexport const DEFAULT_GROUP_LIMIT = 5;\nexport const MAX_GROUP_LIMIT = 20;\nexport const DEFAULT_SOURCE_TIMEOUT_MS = 1_500;\n\nexport interface RecordSearchRouteOptions {\n /**\n * The sources to fan out over, **in the order results are presented**. That\n * order is the ranking: an operator learns where a kind of record lands, which\n * a relevance score across four unrelated entities cannot offer.\n */\n readonly sources: readonly RecordSearchSource[];\n /** Per-source budget. Concurrent, so this also bounds the whole request. */\n readonly timeoutMs?: number;\n /** Records per group. */\n readonly limit?: number;\n}\n\ntype SourceOutcome =\n | { readonly ok: true; readonly group: RecordSearchGroup }\n | { readonly ok: false; readonly unavailable: RecordSearchUnavailable };\n\nconst unavailable = (\n source: RecordSearchSource,\n failure: EntifixFailure,\n status?: number,\n): SourceOutcome => ({\n ok: false,\n unavailable: {\n source: source.key,\n entity: source.entity,\n reason: failure.code,\n category: failure.category,\n ...(status === undefined ? {} : { status }),\n },\n});\n\n/**\n * Ask one source, and **never reject**.\n *\n * Returning a typed outcome rather than throwing is what makes the fan-out a\n * plain `Promise.all`: isolation comes from this catch, not from\n * `allSettled` — whose rejected arm would then be unreachable and untestable.\n */\nconst runSource = async (\n source: RecordSearchSource,\n term: string,\n limit: number,\n locale: Locale,\n token: string | undefined,\n timeoutMs: number,\n): Promise<SourceOutcome> => {\n let upstream: Response;\n try {\n upstream = await fetch(source.url(term, limit, locale), {\n headers: bearerHeader(token),\n cache: 'no-store',\n signal: AbortSignal.timeout(timeoutMs),\n });\n } catch (error) {\n // `AbortSignal.timeout` rejects with a `DOMException` named `TimeoutError`;\n // branching on the name rather than the class keeps this reachable from a\n // test without fabricating a platform error.\n return unavailable(\n source,\n (error as { name?: string }).name === 'TimeoutError'\n ? new Timeout({ dependency: source.key })\n : new UpstreamUnavailable({ upstream: source.key }),\n );\n }\n\n // The service says why, in a problem body; the code is the reason. A body\n // that is not one decodes as `protocol` — still named, never silent.\n if (!upstream.ok) {\n const body: unknown = await upstream.json().catch(() => undefined);\n return unavailable(\n source,\n decodeProblem(body, upstream.status),\n upstream.status,\n );\n }\n\n const body = await upstream.json().catch(() => undefined);\n const page = source.read(body, locale);\n return page === undefined\n ? unavailable(\n source,\n new ProtocolFailure({\n reason: `${source.key} answered a page the source cannot read`,\n upstreamStatus: upstream.status,\n }),\n upstream.status,\n )\n : {\n ok: true,\n group: {\n source: source.key,\n entity: source.entity,\n labelKey: source.labelKey,\n items: page.items,\n total: page.total,\n },\n };\n};\n\n/**\n * The locale a search runs in: the one the caller names, else the one the\n * host's locale proxy forwarded, else the reader's locale cookie, else the\n * host's default. Anything that is not a declared locale is passed over.\n */\nconst requestLocale = (request: Request, params: URLSearchParams): Locale => {\n const cookie = (request.headers.get('cookie') ?? '')\n .split(';')\n .map(part => part.trim().split('='))\n .find(([name]) => name === LOCALE_COOKIE)?.[1];\n return (\n [\n params.get(SEARCH_LOCALE_PARAM),\n request.headers.get(LOCALE_HEADER),\n cookie,\n ].find(isLocale) ?? defaultLocale()\n );\n};\n\nconst clampLimit = (raw: string | null, fallback: number): number => {\n const asked = Number(raw);\n if (!Number.isInteger(asked) || asked < 1) return fallback;\n return Math.min(asked, MAX_GROUP_LIMIT);\n};\n\n/**\n * `GET /api/search` — records matching a term, across every source this host\n * mounts.\n *\n * The caller's own session is the only credential that crosses: each source is\n * asked over the same guarded route its screens use, so what comes back is\n * already authorized for this principal and this organization. There is no\n * index, and there must never be one — a prefetched index is a tenant leak, and\n * it is the reason this is a fan-out rather than a search service.\n *\n * A source that fails is **named** in `unavailable` rather than dropped. An\n * absent group renders as \"no matches\", which is a confident claim the server is\n * in no position to make about a service it could not reach.\n */\nexport const createRecordSearchRoute = ({\n sources,\n timeoutMs = DEFAULT_SOURCE_TIMEOUT_MS,\n limit: defaultLimit = DEFAULT_GROUP_LIMIT,\n}: RecordSearchRouteOptions) => {\n const byKey = new Map(sources.map(source => [source.key, source]));\n\n return async function GET(request: Request): Promise<Response> {\n // The services decide what this caller may read; this only carries the\n // token. But the gate is not redundant: `catalog-reference` reads are\n // unauthenticated at the service by design, so without it a signed-out\n // caller gets brand matches back and the answer reads as a real search —\n // and the endpoint becomes an anonymous amplifier against that service.\n const token = await sessionToken();\n if (token === undefined) {\n return problemResponse(new Unauthenticated());\n }\n\n const params = new URL(request.url).searchParams;\n\n const asked = (params.get(SEARCH_SOURCES_PARAM) ?? '')\n .split(',')\n .filter(name => name !== '');\n const unknown = asked.find(name => !byKey.has(name));\n if (unknown !== undefined) {\n // Loud rather than ignored: no keystroke can produce this, only a caller\n // naming a source that does not exist — and silently searching everything\n // instead would answer a question nobody asked.\n return problemResponse(\n new InvalidQuery({ reason: `unknown search source \"${unknown}\"` }),\n );\n }\n const selected =\n asked.length === 0\n ? sources\n : sources.filter(source => asked.includes(source.key));\n\n const term = (params.get(SEARCH_TERM_PARAM) ?? '').trim();\n const answer = (body: RecordSearchResponse) =>\n // The body is scoped to one principal and one organization. `no-store` is\n // correctness here, not tuning.\n NextResponse.json(body, { headers: { 'cache-control': 'no-store' } });\n\n if (term.length < MIN_TERM_LENGTH) {\n return answer({ term, groups: [], unavailable: [] });\n }\n\n const limit = clampLimit(params.get(SEARCH_LIMIT_PARAM), defaultLimit);\n const locale = requestLocale(request, params);\n const outcomes = await Promise.all(\n selected.map(source =>\n runSource(source, term, limit, locale, token, timeoutMs),\n ),\n );\n\n return answer({\n term,\n // Declared order, never completion order — otherwise the list reshuffles\n // with the network and nobody can learn where anything lands.\n groups: outcomes.flatMap(outcome => (outcome.ok ? [outcome.group] : [])),\n unavailable: outcomes.flatMap(outcome =>\n outcome.ok ? [] : [outcome.unavailable],\n ),\n });\n };\n};\n"],"names":["decodeProblem","defaultLocale","InvalidQuery","isLocale","LOCALE_COOKIE","LOCALE_HEADER","ProtocolFailure","Timeout","Unauthenticated","UpstreamUnavailable","NextResponse","problemResponse","bearerHeader","sessionToken","SEARCH_TERM_PARAM","SEARCH_SOURCES_PARAM","SEARCH_LIMIT_PARAM","SEARCH_LOCALE_PARAM","MIN_TERM_LENGTH","DEFAULT_GROUP_LIMIT","MAX_GROUP_LIMIT","DEFAULT_SOURCE_TIMEOUT_MS","unavailable","source","failure","status","ok","key","entity","reason","code","category","undefined","runSource","term","limit","locale","token","timeoutMs","upstream","fetch","url","headers","cache","signal","AbortSignal","timeout","error","name","dependency","body","json","catch","page","read","upstreamStatus","group","labelKey","items","total","requestLocale","request","params","cookie","get","split","map","part","trim","find","clampLimit","raw","fallback","asked","Number","isInteger","Math","min","createRecordSearchRoute","sources","defaultLimit","byKey","Map","GET","URL","searchParams","filter","unknown","has","selected","length","includes","answer","groups","outcomes","Promise","all","flatMap","outcome"],"mappings":";AAAA,SACEA,aAAa,EACbC,aAAa,EAEbC,YAAY,EACZC,QAAQ,EAERC,aAAa,EACbC,aAAa,EACbC,eAAe,EACfC,OAAO,EACPC,eAAe,EACfC,mBAAmB,QACd,gBAAgB;AACvB,SAASC,YAAY,QAAQ,cAAc;AAE3C,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,YAAY,EAAEC,YA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AAKwD,MAAM,GAAGxE,iBAAiB;YACjC,OAAO0E,OAAO;gBAAE1D;gBAAM2D,QAAQ,EAAE;gBAAEvE,aAAa,EAAE;YAAC;QACpD;QAEA,MAAMa,QAAQmC,WAAWR,OAAOE,GAAG,CAAChD,qBAAqBgE;QACzD,MAAM5C,SAASwB,cAAcC,SAASC;QACtC,MAAMgC,WAAW,MAAMC,QAAQC,GAAG,CAChCP,SAASvB,GAAG,CAAC3C,CAAAA,SACXU,UAAUV,QAAQW,MAAMC,OAAOC,QAAQC,OAAOC;QAIlD,OAAOsD,OAAO;YACZ1D;YACA,yEAAyE;YACzE,8DAA8D;YAC9D2D,QAAQC,SAASG,OAAO,CAACC,CAAAA,UAAYA,QAAQxE,EAAE,GAAG;oBAACwE,QAAQ1C,KAAK;iBAAC,GAAG,EAAE;YACtElC,aAAawE,SAASG,OAAO,CAACC,CAAAA,UAC5BA,QAAQxE,EAAE,GAAG,EAAE,GAAG;oBAACwE,QAAQ5E,WAAW;iBAAC;QAE3C;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../src/lib/search/record-search-route.ts"],"sourcesContent":["import {\n decodeProblem,\n defaultLocale,\n type EntifixFailure,\n InvalidQuery,\n isLocale,\n type Locale,\n LOCALE_COOKIE,\n LOCALE_HEADER,\n ProtocolFailure,\n Timeout,\n Unauthenticated,\n UpstreamUnavailable,\n} from '@entifix/core';\nimport { NextResponse } from 'next/server';\n\nimport { problemResponse } from '../config/problem-response.js';\nimport { bearerHeader, sessionToken } from '../session/bearer.js';\nimport type {\n RecordSearchGroup,\n RecordSearchResponse,\n RecordSearchUnavailable,\n} from './record-search.types.js';\nimport type { RecordSearchSource } from './record-search-source.js';\n\nexport const SEARCH_TERM_PARAM = 'q';\nexport const SEARCH_SOURCES_PARAM = 'sources';\nexport const SEARCH_LIMIT_PARAM = 'limit';\n/** The reader's locale, which a localized member is searched, sorted and read in. */\nexport const SEARCH_LOCALE_PARAM = 'locale';\n\n/**\n * Below this, nothing is queried at all.\n *\n * A `like` becomes an unanchored `$regex` that ignores accents and case, which no index can\n * serve — so this endpoint is a collection scan by construction. One character\n * matches most of every collection and is worth nothing to the person typing, so\n * the floor costs them nothing and saves four scans per keystroke.\n */\nexport const MIN_TERM_LENGTH = 2;\nexport const DEFAULT_GROUP_LIMIT = 5;\nexport const MAX_GROUP_LIMIT = 20;\nexport const DEFAULT_SOURCE_TIMEOUT_MS = 1_500;\n\nexport interface RecordSearchRouteOptions {\n /**\n * The sources to fan out over, **in the order results are presented**. That\n * order is the ranking: an operator learns where a kind of record lands, which\n * a relevance score across four unrelated entities cannot offer.\n */\n readonly sources: readonly RecordSearchSource[];\n /** Per-source budget. Concurrent, so this also bounds the whole request. */\n readonly timeoutMs?: number;\n /** Records per group. */\n readonly limit?: number;\n}\n\ntype SourceOutcome =\n | { readonly ok: true; readonly group: RecordSearchGroup }\n | { readonly ok: false; readonly unavailable: RecordSearchUnavailable };\n\nconst unavailable = (\n source: RecordSearchSource,\n failure: EntifixFailure,\n status?: number,\n): SourceOutcome => ({\n ok: false,\n unavailable: {\n source: source.key,\n entity: source.entity,\n reason: failure.code,\n category: failure.category,\n ...(status === undefined ? {} : { status }),\n },\n});\n\ntype Fetched =\n | { readonly ok: true; readonly body: unknown; readonly status: number }\n | { readonly ok: false; readonly outcome: SourceOutcome };\n\n/**\n * One upstream read for a source, as a body or as the outcome that says why\n * there is none — the source named either way.\n */\nconst fetchBody = async (\n source: RecordSearchSource,\n url: string,\n token: string | undefined,\n timeoutMs: number,\n): Promise<Fetched> => {\n let upstream: Response;\n try {\n upstream = await fetch(url, {\n headers: bearerHeader(token),\n cache: 'no-store',\n signal: AbortSignal.timeout(timeoutMs),\n });\n } catch (error) {\n // `AbortSignal.timeout` rejects with a `DOMException` named `TimeoutError`;\n // branching on the name rather than the class keeps this reachable from a\n // test without fabricating a platform error.\n return {\n ok: false,\n outcome: unavailable(\n source,\n (error as { name?: string }).name === 'TimeoutError'\n ? new Timeout({ dependency: source.key })\n : new UpstreamUnavailable({ upstream: source.key }),\n ),\n };\n }\n\n // The service says why, in a problem body; the code is the reason. A body\n // that is not one decodes as `protocol` — still named, never silent.\n if (!upstream.ok) {\n const body: unknown = await upstream.json().catch(() => undefined);\n return {\n ok: false,\n outcome: unavailable(\n source,\n decodeProblem(body, upstream.status),\n upstream.status,\n ),\n };\n }\n\n return {\n ok: true,\n body: await upstream.json().catch(() => undefined),\n status: upstream.status,\n };\n};\n\nconst unreadable = (source: RecordSearchSource, status: number) =>\n unavailable(\n source,\n new ProtocolFailure({\n reason: `${source.key} answered a page the source cannot read`,\n upstreamStatus: status,\n }),\n status,\n );\n\nconst groupOf = (\n source: RecordSearchSource,\n page: { items: RecordSearchGroup['items']; total: number },\n): SourceOutcome => ({\n ok: true,\n group: {\n source: source.key,\n entity: source.entity,\n labelKey: source.labelKey,\n items: page.items,\n total: page.total,\n },\n});\n\n/**\n * Ask one source, and **never reject**.\n *\n * Returning a typed outcome rather than throwing is what makes the fan-out a\n * plain `Promise.all`: isolation comes from this catch, not from\n * `allSettled` — whose rejected arm would then be unreachable and untestable.\n *\n * A source searched through a reference takes two reads, one after the\n * other, both under the caller's own session: the referenced records whose\n * name matches the term, at their owner, then this source's records that\n * refer to them. No match is an empty group without the second read, and\n * either read failing degrades the group exactly as one read would.\n */\nconst runSource = async (\n source: RecordSearchSource,\n term: string,\n limit: number,\n locale: Locale,\n token: string | undefined,\n timeoutMs: number,\n): Promise<SourceOutcome> => {\n let names: ReadonlyMap<string, string> | undefined;\n let url: string;\n if (source.through === undefined) {\n url = source.url(term, limit, locale);\n } else {\n const matched = await fetchBody(\n source,\n source.through.url(term, limit, locale),\n token,\n timeoutMs,\n );\n if (!matched.ok) return matched.outcome;\n const matches = source.through.read(matched.body, locale);\n if (matches === undefined) return unreadable(source, matched.status);\n if (matches.length === 0) return groupOf(source, { items: [], total: 0 });\n names = new Map(matches.map(match => [match.id, match.label]));\n url = source.through.urlFor([...names.keys()], limit);\n }\n\n const fetched = await fetchBody(source, url, token, timeoutMs);\n if (!fetched.ok) return fetched.outcome;\n const page = source.read(fetched.body, locale, names);\n return page === undefined\n ? unreadable(source, fetched.status)\n : groupOf(source, page);\n};\n\n/**\n * The locale a search runs in: the one the caller names, else the one the\n * host's locale proxy forwarded, else the reader's locale cookie, else the\n * host's default. Anything that is not a declared locale is passed over.\n */\nconst requestLocale = (request: Request, params: URLSearchParams): Locale => {\n const cookie = (request.headers.get('cookie') ?? '')\n .split(';')\n .map(part => part.trim().split('='))\n .find(([name]) => name === LOCALE_COOKIE)?.[1];\n return (\n [\n params.get(SEARCH_LOCALE_PARAM),\n request.headers.get(LOCALE_HEADER),\n cookie,\n ].find(isLocale) ?? defaultLocale()\n );\n};\n\nconst clampLimit = (raw: string | null, fallback: number): number => {\n const asked = Number(raw);\n if (!Number.isInteger(asked) || asked < 1) return fallback;\n return Math.min(asked, MAX_GROUP_LIMIT);\n};\n\n/**\n * `GET /api/search` — records matching a term, across every source this host\n * mounts.\n *\n * The caller's own session is the only credential that crosses: each source is\n * asked over the same guarded route its screens use, so what comes back is\n * already authorized for this principal and this organization. There is no\n * index, and there must never be one — a prefetched index is a tenant leak, and\n * it is the reason this is a fan-out rather than a search service.\n *\n * A source that fails is **named** in `unavailable` rather than dropped. An\n * absent group renders as \"no matches\", which is a confident claim the server is\n * in no position to make about a service it could not reach.\n */\nexport const createRecordSearchRoute = ({\n sources,\n timeoutMs = DEFAULT_SOURCE_TIMEOUT_MS,\n limit: defaultLimit = DEFAULT_GROUP_LIMIT,\n}: RecordSearchRouteOptions) => {\n const byKey = new Map(sources.map(source => [source.key, source]));\n\n return async function GET(request: Request): Promise<Response> {\n // The services decide what this caller may read; this only carries the\n // token. But the gate is not redundant: `catalog-reference` reads are\n // unauthenticated at the service by design, so without it a signed-out\n // caller gets brand matches back and the answer reads as a real search —\n // and the endpoint becomes an anonymous amplifier against that service.\n const token = await sessionToken();\n if (token === undefined) {\n return problemResponse(new Unauthenticated());\n }\n\n const params = new URL(request.url).searchParams;\n\n const asked = (params.get(SEARCH_SOURCES_PARAM) ?? '')\n .split(',')\n .filter(name => name !== '');\n const unknown = asked.find(name => !byKey.has(name));\n if (unknown !== undefined) {\n // Loud rather than ignored: no keystroke can produce this, only a caller\n // naming a source that does not exist — and silently searching everything\n // instead would answer a question nobody asked.\n return problemResponse(\n new InvalidQuery({ reason: `unknown search source \"${unknown}\"` }),\n );\n }\n const selected =\n asked.length === 0\n ? sources\n : sources.filter(source => asked.includes(source.key));\n\n const term = (params.get(SEARCH_TERM_PARAM) ?? '').trim();\n const answer = (body: RecordSearchResponse) =>\n // The body is scoped to one principal and one organization. `no-store` is\n // correctness here, not tuning.\n NextResponse.json(body, { headers: { 'cache-control': 'no-store' } });\n\n if (term.length < MIN_TERM_LENGTH) {\n return answer({ term, groups: [], unavailable: [] });\n }\n\n const limit = clampLimit(params.get(SEARCH_LIMIT_PARAM), defaultLimit);\n const locale = requestLocale(request, params);\n const outcomes = await Promise.all(\n selected.map(source =>\n runSource(source, term, limit, locale, token, timeoutMs),\n ),\n );\n\n return answer({\n term,\n // Declared order, never completion order — otherwise the list reshuffles\n // with the network and nobody can learn where anything lands.\n groups: outcomes.flatMap(outcome => (outcome.ok ? [outcome.group] : [])),\n unavailable: outcomes.flatMap(outcome =>\n outcome.ok ? [] : [outcome.unavailable],\n ),\n });\n };\n};\n"],"names":["decodeProblem","defaultLocale","InvalidQuery","isLocale","LOCALE_COOKIE","LOCALE_HEADER","ProtocolFailure","Timeout","Unauthenticated","UpstreamUnavailable","NextResponse","problemResponse","bearerHeader","sessionToken","SEARCH_TERM_PARAM","SEARCH_SOURCES_PARAM","SEARCH_LIMIT_PARAM","SEARCH_LOCALE_PARAM","MIN_TERM_LENGTH","DEFAULT_GROUP_LIMIT","MAX_GROUP_LIMIT","DEFAULT_SOURCE_TIMEOUT_MS","unavailable","source","failure","status","ok","key","entity","reason","code","category","undefined","fetchBody","url","token","timeoutMs","upstream","fetch","headers","cache","signal","AbortSignal","timeout","error","outcome","name","dependency","body","json","catch","unreadable","upstreamStatus","groupOf","page","group","labelKey","items","total","runSource","term","limit","locale","names","through","matched","matches","read","length","Map","map","match","id","label","urlFor","keys","fetched","requestLocale","request","params","cookie","get","split","part","trim","find","clampLimit","raw","fallback","asked","Number","isInteger","Math","min","createRecordSearchRoute","sources","defaultLimit","byKey","GET","URL","searchParams","filter","unknown","has","selected","includes","answer","groups","outcomes","Promise","all","flatMap"],"mappings":";AAAA,SACEA,aAAa,EACbC,aAAa,EAEbC,YAAY,EACZC,QAAQ,EAERC,aAAa,EACbC,aAAa,EACbC,eAAe,EACfC,OAAO,EACPC,eAAe,EACfC,mBAAmB,QACd,gBAAgB;AACvB,SAASC,YAAY,QAAQ,cAAc;AAE3C,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,YAAY,EAAEC,YAAY,QAAQ,uBAAuB;AAQlE,OAAO,MAAMC,oBAAoB,IAAI;AACrC,OAAO,MAAMC,uBAAuB,UAAU;AAC9C,OAAO,MAAMC,qBAAqB,QAAQ;AAC1C,mFAAmF,GACnF,OAAO,MAAMC,sBAAsB,SAAS;AAE5C;;;;;;;CAOC,GACD,OAAO,MAAMC,kBAAkB,EAAE;AACjC,OAAO,MAAMC,sBAAsB,EAAE;AACrC,OAAO,MAAMC,kBAAkB,GAAG;AAClC,OAAO,MAAMC,4BAA4B,KAAM;AAmB/C,MAAMC,cAAc,CAClBC,QACAC,SACAC,SACmB,CAAA;QACnBC,IAAI;QACJJ,aAAa;YACXC,QAAQA,OAAOI,GAAG;YAClBC,QAAQL,OAAOK,MAAM;YACrBC,QAAQL,QAAQM,IAAI;YACpBC,UAAUP,QAAQO,QAAQ;WACtBN,WAAWO,YAAY,CAAC,IAAI;YAAEP;QAAO;IAE7C,CAAA;AAMA;;;CAGC,GACD,MAAMQ,YAAY,OAChBV,QACAW,KACAC,OACAC;IAEA,IAAIC;IACJ,IAAI;QACFA,WAAW,MAAMC,MAAMJ,KAAK;YAC1BK,SAAS3B,aAAauB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AgD;YAChD,OAAOrB,gBACL,IAAIT,aAAa;gBAAE2B,QAAQ,CAAC,uBAAuB,EAAEyE,QAAQ,CAAC,CAAC;YAAC;QAEpE;QACA,MAAME,WACJf,MAAMrB,MAAM,KAAK,IACb2B,UACAA,QAAQM,MAAM,CAAC9E,CAAAA,SAAUkE,MAAMgB,QAAQ,CAAClF,OAAOI,GAAG;QAExD,MAAMiC,OAAO,EAACmB,eAAAA,OAAOE,GAAG,CAACnE,8BAAXiE,eAAiC,IAAIK,IAAI;QACvD,MAAMsB,SAAS,CAAC1D,OACd,0EAA0E;YAC1E,gCAAgC;YAChCtC,aAAauC,IAAI,CAACD,MAAM;gBAAET,SAAS;oBAAE,iBAAiB;gBAAW;YAAE;QAErE,IAAIqB,KAAKQ,MAAM,GAAGlD,iBAAiB;YACjC,OAAOwF,OAAO;gBAAE9C;gBAAM+C,QAAQ,EAAE;gBAAErF,aAAa,EAAE;YAAC;QACpD;QAEA,MAAMuC,QAAQyB,WAAWP,OAAOE,GAAG,CAACjE,qBAAqBgF;QACzD,MAAMlC,SAASe,cAAcC,SAASC;QACtC,MAAM6B,WAAW,MAAMC,QAAQC,GAAG,CAChCN,SAASlC,GAAG,CAAC/C,CAAAA,SACXoC,UAAUpC,QAAQqC,MAAMC,OAAOC,QAAQ3B,OAAOC;QAIlD,OAAOsE,OAAO;YACZ9C;YACA,yEAAyE;YACzE,8DAA8D;YAC9D+C,QAAQC,SAASG,OAAO,CAAClE,CAAAA,UAAYA,QAAQnB,EAAE,GAAG;oBAACmB,QAAQU,KAAK;iBAAC,GAAG,EAAE;YACtEjC,aAAasF,SAASG,OAAO,CAAClE,CAAAA,UAC5BA,QAAQnB,EAAE,GAAG,EAAE,GAAG;oBAACmB,QAAQvB,WAAW;iBAAC;QAE3C;IACF;AACF,EAAE"}
@@ -16,23 +16,57 @@ export interface RecordSearchSourceConfig<TEntity extends Entity> {
16
16
  readonly entityConstructor: EntityConstructor<TEntity>;
17
17
  /** Where the owning service listens, **without** the `/api` suffix. */
18
18
  readonly baseUrl: string;
19
- /** The `filterable` string member a term is matched against with `like`. */
19
+ /**
20
+ * The `filterable` member a term is matched against: a string or localized
21
+ * member, matched with `like` — or, with {@link reference}, the member that
22
+ * holds the referenced record's id, matched with `=in=`.
23
+ */
20
24
  readonly searchProperty: string;
21
- /** The `sortable` member read as a record's label. */
22
- readonly labelProperty: string;
25
+ /**
26
+ * The `sortable` member read as a record's label. Omitted, the record names
27
+ * itself as every other surface names it — its `labelMember`, else the
28
+ * first member that can name it — and one nothing names is sent `unnamed`,
29
+ * by its short id; the group is then sorted by {@link searchProperty}, which
30
+ * must be `sortable`. Never given with {@link reference}, which labels.
31
+ */
32
+ readonly labelProperty?: string;
23
33
  /** An optional secondary line — a code, a role. */
24
34
  readonly sublabelProperty?: string;
25
35
  /** The group heading, as the entity's own `pluralKey`. */
26
36
  readonly labelKey: string;
27
37
  /** Where selecting a record lands. Locale-free; the caller prefixes it. */
28
38
  readonly href: (id: string) => string;
39
+ /**
40
+ * Search through the record {@link searchProperty} refers to, when that is
41
+ * what a person knows the record by: a stock item by its product's name.
42
+ * The term is matched against the referenced entity's label at its owner,
43
+ * and the records referring to the matches are read and labelled with
44
+ * their names.
45
+ */
46
+ readonly reference?: RecordSearchReference;
47
+ }
48
+ /** The entity a source is searched through, and where its owner listens. */
49
+ export interface RecordSearchReference {
50
+ readonly entityConstructor: EntityConstructor<any>;
51
+ /** Where the target's owning service listens, **without** the `/api` suffix. */
52
+ readonly baseUrl: string;
53
+ /**
54
+ * The target member the term is matched against and the records are
55
+ * labelled by — a filterable, sortable string or localized member. Defaults
56
+ * to the target's declared `labelMember`.
57
+ */
58
+ readonly labelProperty?: string;
59
+ }
60
+ /** One referenced record a term matched: its id, and what it is called. */
61
+ export interface RecordSearchMatch {
62
+ readonly id: string;
63
+ readonly label: string;
29
64
  }
30
65
  /** A declared source, reduced to what the fan-out actually calls. */
31
66
  export interface RecordSearchSource {
32
67
  readonly key: string;
33
68
  readonly entity: string;
34
69
  readonly labelKey: string;
35
- /** The upstream URL for one term. */
36
70
  /**
37
71
  * The upstream URL for one term, in the reader's locale — which a localized
38
72
  * search or label member is filtered and sorted in.
@@ -40,12 +74,23 @@ export interface RecordSearchSource {
40
74
  readonly url: (term: string, limit: number, locale: Locale) => string;
41
75
  /**
42
76
  * `undefined` when the body is not a readable `entityPage` envelope. A
43
- * localized label reads in `locale`.
77
+ * localized label reads in `locale`. Given `names`, a record is labelled by
78
+ * the name of the record it refers to, and the items come in their order.
44
79
  */
45
- readonly read: (body: unknown, locale: Locale) => {
80
+ readonly read: (body: unknown, locale: Locale, names?: ReadonlyMap<string, string>) => {
46
81
  items: RecordSearchOption[];
47
82
  total: number;
48
83
  } | undefined;
84
+ /**
85
+ * Present for a source searched through a reference: the target's URL for
86
+ * one term, its matches, and this source's URL for the records referring to
87
+ * them. When it is, {@link url} is never called.
88
+ */
89
+ readonly through?: {
90
+ readonly url: (term: string, limit: number, locale: Locale) => string;
91
+ readonly read: (body: unknown, locale: Locale) => readonly RecordSearchMatch[] | undefined;
92
+ readonly urlFor: (ids: readonly string[], limit: number) => string;
93
+ };
49
94
  }
50
95
  /**
51
96
  * Declare a record search source, validating it against the entity's own
@@ -61,5 +106,5 @@ export interface RecordSearchSource {
61
106
  * from a palette is indistinguishable from a permission the caller lacks — but
62
107
  * the blast radius is wider than the picker's, which fails only its own render.
63
108
  */
64
- export declare const defineRecordSearchSource: <TEntity extends Entity>({ key, entityConstructor, baseUrl, searchProperty, labelProperty, sublabelProperty, labelKey, href, }: RecordSearchSourceConfig<TEntity>) => RecordSearchSource;
109
+ export declare const defineRecordSearchSource: <TEntity extends Entity>({ key, entityConstructor, baseUrl, searchProperty, labelProperty, sublabelProperty, labelKey, href, reference, }: RecordSearchSourceConfig<TEntity>) => RecordSearchSource;
65
110
  //# sourceMappingURL=record-search-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"record-search-source.d.ts","sourceRoot":"","sources":["../../../src/lib/search/record-search-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