@lde/search-api-graphql 0.30.1 → 0.30.2

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.
@@ -9,9 +9,10 @@ export interface LanguageString {
9
9
  /** Orders a localized value’s available languages against the request. */
10
10
  export type LanguageOrder = (available: readonly string[], accept: readonly string[]) => readonly string[];
11
11
  /**
12
- * Default ordering: requested languages first (in request order), then the
13
- * remaining tagged languages, then untagged (`und`) last — so `[0]` is always the
14
- * best available value.
12
+ * Default ordering: requested languages first (in request order, each matched
13
+ * as a language range – `nl-NL` finds `nl` – most specific first), then the
14
+ * remaining tagged languages, then untagged (`und`) last – so `[0]` is always
15
+ * the best available value.
15
16
  */
16
17
  export declare const defaultLanguageOrder: LanguageOrder;
17
18
  /** Flatten a language map into a best-first `LanguageString` list. */
@@ -1 +1 @@
1
- {"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../src/language.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;0EAE0E;AAC1E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,0EAA0E;AAC1E,MAAM,MAAM,aAAa,GAAG,CAC1B,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,MAAM,EAAE,SAAS,MAAM,EAAE,KACtB,SAAS,MAAM,EAAE,CAAC;AAEvB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAOlC,CAAC;AAEF,sEAAsE;AACtE,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,KAAK,EAAE,aAAa,GACnB,cAAc,EAAE,CAWlB"}
1
+ {"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../src/language.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD;;0EAE0E;AAC1E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,0EAA0E;AAC1E,MAAM,MAAM,aAAa,GAAG,CAC1B,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,MAAM,EAAE,SAAS,MAAM,EAAE,KACtB,SAAS,MAAM,EAAE,CAAC;AAEvB;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAWlC,CAAC;AAEF,sEAAsE;AACtE,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,KAAK,EAAE,aAAa,GACnB,cAAc,EAAE,CAWlB"}
package/dist/language.js CHANGED
@@ -1,10 +1,14 @@
1
+ import { matchLanguage } from '@lde/search/adapter';
1
2
  /**
2
- * Default ordering: requested languages first (in request order), then the
3
- * remaining tagged languages, then untagged (`und`) last — so `[0]` is always the
4
- * best available value.
3
+ * Default ordering: requested languages first (in request order, each matched
4
+ * as a language range – `nl-NL` finds `nl` – most specific first), then the
5
+ * remaining tagged languages, then untagged (`und`) last – so `[0]` is always
6
+ * the best available value.
5
7
  */
6
8
  export const defaultLanguageOrder = (available, accept) => {
7
- const requested = accept.filter((language) => available.includes(language));
9
+ const requested = [
10
+ ...new Set(accept.flatMap((language) => matchLanguage(language, available))),
11
+ ];
8
12
  const rest = available.filter((language) => language !== 'und' && !requested.includes(language));
9
13
  const untagged = available.includes('und') ? ['und'] : [];
10
14
  return [...requested, ...rest, ...untagged];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/search-api-graphql",
3
- "version": "0.30.1",
3
+ "version": "0.30.2",
4
4
  "description": "Engine- and domain-agnostic GraphQL surface for @lde/search: builds an executable GraphQLSchema from a whole SearchSchema at runtime (no codegen) – one root query field per SearchType – served by generic resolvers over any SearchEngine – and serves it as a framework-agnostic fetch handler with a self-contained playground, SDL endpoint, CORS and depth/cost limits. You supply the schema and per-type typeNames; it names neither your domain nor your engine.",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",
@@ -37,7 +37,7 @@
37
37
  "@escape.tech/graphql-armor-cost-limit": "^2.4.3",
38
38
  "@escape.tech/graphql-armor-max-depth": "^2.4.2",
39
39
  "@graphql-yoga/render-graphiql": "^5.24.4",
40
- "@lde/search": "^0.28.0",
40
+ "@lde/search": "^0.28.1",
41
41
  "commander": "^15.0.0",
42
42
  "dataloader": "^2.2.3",
43
43
  "graphql": "^16.9.0",