@lde/search-api-graphql 0.29.0 → 0.29.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.
@@ -1 +1 @@
1
- {"version":3,"file":"build-schema.d.ts","sourceRoot":"","sources":["../src/build-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,aAAa,EAQd,MAAM,SAAS,CAAC;AACjB,OAAO,EAKL,KAAK,YAAY,EAIjB,KAAK,WAAW,EAChB,KAAK,YAAY,EAElB,MAAM,aAAa,CAAC;AAsBrB,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAIvB,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC5B;;sDAEkD;IAClD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACjE;AAED;2EAC2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC;yCACqC;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;uBACmB;IACnB,QAAQ,CAAC,aAAa,CAAC,EAAE,CACvB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,aAAa,KACnB,WAAW,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC;;kEAE8D;IAC9D,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC7D,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACvC;;gDAE4C;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AA4GD;;;;;;;;;GASG;AACH,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AAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AA4GD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,yBAA8B,GACtC,aAAa,CAw6Bf;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAER"}
@@ -342,9 +342,10 @@ export function buildGraphQLSchema(schema, options = {}) {
342
342
  * referenced shape. A **surfaced inline** reference is served as the nested
343
343
  * object its Reference Type declares – its own `output` fields, configured by
344
344
  * exactly the same per-kind rules a root type’s fields are – so the response
345
- * shape matches the data’s shape. Its `id` is nullable: a referent needs no
346
- * identity, and a blank-node one nests without one. Every other reference
347
- * stays the id-plus-label pair its strategy carries.
345
+ * shape matches the data’s shape. It offers no `id`: a referent needs no
346
+ * identity, so the projection stores none, and its `output` fields are all a
347
+ * client can select. Every other reference stays the id-plus-label pair its
348
+ * strategy carries.
348
349
  */
349
350
  function registerReferenceType(field, owner) {
350
351
  if (field.kind !== 'reference' ||
@@ -383,6 +384,11 @@ export function buildGraphQLSchema(schema, options = {}) {
383
384
  const nested = (field.ref.strategy === 'lookup'
384
385
  ? rootTypesByName.get(field.ref.target)
385
386
  : nestedReferenceType(schema, field));
387
+ // An inline entry carries no `id`, so its output fields are all a client
388
+ // can select; GraphQL refuses an object type with none.
389
+ if (nested.class === undefined && outputFields(nested).length === 0) {
390
+ throw new Error(`Inline reference “${owner.name}.${field.name}” is \`output\`, but its reference type “${typeName}” declares no \`output\` field, so the API has nothing to serve for an entry; mark a field of “${typeName}” \`output\`, or drop \`output\` from the reference.`);
391
+ }
386
392
  referenceTypes.set(typeName, new GraphQLObjectType({
387
393
  name: graphQLName,
388
394
  // A thunk, so a Reference Type nesting another one resolves whatever
@@ -402,10 +408,9 @@ export function buildGraphQLSchema(schema, options = {}) {
402
408
  ? {}
403
409
  : {
404
410
  id: {
405
- type: field.ref?.strategy === 'lookup' &&
406
- !nullableIdTargets.has(typeName)
407
- ? new GraphQLNonNull(iriScalar)
408
- : iriScalar,
411
+ type: nullableIdTargets.has(typeName)
412
+ ? iriScalar
413
+ : new GraphQLNonNull(iriScalar),
409
414
  },
410
415
  }),
411
416
  ...Object.fromEntries(outputFields(nested).map((nestedField) => [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/search-api-graphql",
3
- "version": "0.29.0",
3
+ "version": "0.29.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",
@@ -36,13 +36,13 @@
36
36
  "dependencies": {
37
37
  "@escape.tech/graphql-armor-cost-limit": "^2.4.3",
38
38
  "@escape.tech/graphql-armor-max-depth": "^2.4.2",
39
- "@graphql-yoga/render-graphiql": "^5.21.3",
40
- "@lde/search": "^0.27.0",
39
+ "@graphql-yoga/render-graphiql": "^5.24.2",
40
+ "@lde/search": "^0.27.2",
41
41
  "commander": "^15.0.0",
42
42
  "dataloader": "^2.2.3",
43
43
  "graphql": "^16.9.0",
44
- "graphql-yoga": "^5.21.3",
45
- "negotiator": "^1.0.0",
44
+ "graphql-yoga": "^5.24.1",
45
+ "negotiator": "^1.1.0",
46
46
  "tslib": "^2.3.0"
47
47
  },
48
48
  "peerDependencies": {