@fern-api/fern-api-dev 5.104.1 → 5.105.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.
Files changed (2) hide show
  1. package/cli.cjs +1122 -88
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -38761,11 +38761,11 @@ var require_errors = __commonJS({
38761
38761
  gen.code((0, codegen_1._)`${names_1.default.errors}++`);
38762
38762
  }
38763
38763
  function returnErrors(it3, errs) {
38764
- const { gen, validateName: validateName3, schemaEnv } = it3;
38764
+ const { gen, validateName: validateName4, schemaEnv } = it3;
38765
38765
  if (schemaEnv.$async) {
38766
38766
  gen.throw((0, codegen_1._)`new ${it3.ValidationError}(${errs})`);
38767
38767
  } else {
38768
- gen.assign((0, codegen_1._)`${validateName3}.errors`, errs);
38768
+ gen.assign((0, codegen_1._)`${validateName4}.errors`, errs);
38769
38769
  gen.return(false);
38770
38770
  }
38771
38771
  }
@@ -38834,13 +38834,13 @@ var require_boolSchema = __commonJS({
38834
38834
  message: "boolean schema is false"
38835
38835
  };
38836
38836
  function topBoolOrEmptySchema(it3) {
38837
- const { gen, schema, validateName: validateName3 } = it3;
38837
+ const { gen, schema, validateName: validateName4 } = it3;
38838
38838
  if (schema === false) {
38839
38839
  falseSchemaError(it3, false);
38840
38840
  } else if (typeof schema == "object" && schema.$async === true) {
38841
38841
  gen.return(names_1.default.data);
38842
38842
  } else {
38843
- gen.assign((0, codegen_1._)`${validateName3}.errors`, null);
38843
+ gen.assign((0, codegen_1._)`${validateName4}.errors`, null);
38844
38844
  gen.return(true);
38845
38845
  }
38846
38846
  }
@@ -39789,15 +39789,15 @@ var require_validate = __commonJS({
39789
39789
  validateFunction(it3, () => (0, boolSchema_1.topBoolOrEmptySchema)(it3));
39790
39790
  }
39791
39791
  exports2.validateFunctionCode = validateFunctionCode;
39792
- function validateFunction({ gen, validateName: validateName3, schema, schemaEnv, opts }, body) {
39792
+ function validateFunction({ gen, validateName: validateName4, schema, schemaEnv, opts }, body) {
39793
39793
  if (opts.code.es5) {
39794
- gen.func(validateName3, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
39794
+ gen.func(validateName4, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
39795
39795
  gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
39796
39796
  destructureValCxtES5(gen, opts);
39797
39797
  gen.code(body);
39798
39798
  });
39799
39799
  } else {
39800
- gen.func(validateName3, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
39800
+ gen.func(validateName4, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
39801
39801
  }
39802
39802
  }
39803
39803
  function destructureValCxt(opts) {
@@ -39836,8 +39836,8 @@ var require_validate = __commonJS({
39836
39836
  return;
39837
39837
  }
39838
39838
  function resetEvaluated(it3) {
39839
- const { gen, validateName: validateName3 } = it3;
39840
- it3.evaluated = gen.const("evaluated", (0, codegen_1._)`${validateName3}.evaluated`);
39839
+ const { gen, validateName: validateName4 } = it3;
39840
+ it3.evaluated = gen.const("evaluated", (0, codegen_1._)`${validateName4}.evaluated`);
39841
39841
  gen.if((0, codegen_1._)`${it3.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._)`${it3.evaluated}.props`, (0, codegen_1._)`undefined`));
39842
39842
  gen.if((0, codegen_1._)`${it3.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._)`${it3.evaluated}.items`, (0, codegen_1._)`undefined`));
39843
39843
  }
@@ -39919,11 +39919,11 @@ var require_validate = __commonJS({
39919
39919
  }
39920
39920
  }
39921
39921
  function returnResults(it3) {
39922
- const { gen, schemaEnv, validateName: validateName3, ValidationError: ValidationError5, opts } = it3;
39922
+ const { gen, schemaEnv, validateName: validateName4, ValidationError: ValidationError5, opts } = it3;
39923
39923
  if (schemaEnv.$async) {
39924
39924
  gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${ValidationError5}(${names_1.default.vErrors})`));
39925
39925
  } else {
39926
- gen.assign((0, codegen_1._)`${validateName3}.errors`, names_1.default.vErrors);
39926
+ gen.assign((0, codegen_1._)`${validateName4}.errors`, names_1.default.vErrors);
39927
39927
  if (opts.unevaluated)
39928
39928
  assignEvaluated(it3);
39929
39929
  gen.return((0, codegen_1._)`${names_1.default.errors} === 0`);
@@ -40348,8 +40348,8 @@ var require_compile = __commonJS({
40348
40348
  code: (0, codegen_1._)`require("ajv/dist/runtime/validation_error").default`
40349
40349
  });
40350
40350
  }
40351
- const validateName3 = gen.scopeName("validate");
40352
- sch.validateName = validateName3;
40351
+ const validateName4 = gen.scopeName("validate");
40352
+ sch.validateName = validateName4;
40353
40353
  const schemaCxt = {
40354
40354
  gen,
40355
40355
  allErrors: this.opts.allErrors,
@@ -40363,7 +40363,7 @@ var require_compile = __commonJS({
40363
40363
  dataTypes: [],
40364
40364
  definedProperties: /* @__PURE__ */ new Set(),
40365
40365
  topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) } : { ref: sch.schema }),
40366
- validateName: validateName3,
40366
+ validateName: validateName4,
40367
40367
  ValidationError: _ValidationError,
40368
40368
  schema: sch.schema,
40369
40369
  schemaEnv: sch,
@@ -40386,14 +40386,14 @@ var require_compile = __commonJS({
40386
40386
  sourceCode = this.opts.code.process(sourceCode, sch);
40387
40387
  const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
40388
40388
  const validate3 = makeValidate(this, this.scope.get());
40389
- this.scope.value(validateName3, { ref: validate3 });
40389
+ this.scope.value(validateName4, { ref: validate3 });
40390
40390
  validate3.errors = null;
40391
40391
  validate3.schema = sch.schema;
40392
40392
  validate3.schemaEnv = sch;
40393
40393
  if (sch.$async)
40394
40394
  validate3.$async = true;
40395
40395
  if (this.opts.code.source === true) {
40396
- validate3.source = { validateName: validateName3, validateCode, scopeValues: gen._values };
40396
+ validate3.source = { validateName: validateName4, validateCode, scopeValues: gen._values };
40397
40397
  }
40398
40398
  if (this.opts.unevaluated) {
40399
40399
  const { props, items } = schemaCxt;
@@ -42007,7 +42007,7 @@ var require_ref = __commonJS({
42007
42007
  schemaType: "string",
42008
42008
  code(cxt) {
42009
42009
  const { gen, schema: $ref, it: it3 } = cxt;
42010
- const { baseId, schemaEnv: env5, validateName: validateName3, opts, self: self2 } = it3;
42010
+ const { baseId, schemaEnv: env5, validateName: validateName4, opts, self: self2 } = it3;
42011
42011
  const { root: root6 } = env5;
42012
42012
  if (($ref === "#" || $ref === "#/") && baseId === root6.baseId)
42013
42013
  return callRootRef();
@@ -42019,7 +42019,7 @@ var require_ref = __commonJS({
42019
42019
  return inlineRefSchema(schOrEnv);
42020
42020
  function callRootRef() {
42021
42021
  if (env5 === root6)
42022
- return callRef(cxt, validateName3, env5, env5.$async);
42022
+ return callRef(cxt, validateName4, env5, env5.$async);
42023
42023
  const rootName = gen.scopeValue("root", { ref: root6 });
42024
42024
  return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root6, root6.$async);
42025
42025
  }
@@ -180798,11 +180798,11 @@ var require_errors2 = __commonJS({
180798
180798
  gen.code((0, codegen_1._)`${names_1.default.errors}++`);
180799
180799
  }
180800
180800
  function returnErrors(it3, errs) {
180801
- const { gen, validateName: validateName3, schemaEnv } = it3;
180801
+ const { gen, validateName: validateName4, schemaEnv } = it3;
180802
180802
  if (schemaEnv.$async) {
180803
180803
  gen.throw((0, codegen_1._)`new ${it3.ValidationError}(${errs})`);
180804
180804
  } else {
180805
- gen.assign((0, codegen_1._)`${validateName3}.errors`, errs);
180805
+ gen.assign((0, codegen_1._)`${validateName4}.errors`, errs);
180806
180806
  gen.return(false);
180807
180807
  }
180808
180808
  }
@@ -180872,13 +180872,13 @@ var require_boolSchema2 = __commonJS({
180872
180872
  message: "boolean schema is false"
180873
180873
  };
180874
180874
  function topBoolOrEmptySchema(it3) {
180875
- const { gen, schema, validateName: validateName3 } = it3;
180875
+ const { gen, schema, validateName: validateName4 } = it3;
180876
180876
  if (schema === false) {
180877
180877
  falseSchemaError(it3, false);
180878
180878
  } else if (typeof schema == "object" && schema.$async === true) {
180879
180879
  gen.return(names_1.default.data);
180880
180880
  } else {
180881
- gen.assign((0, codegen_1._)`${validateName3}.errors`, null);
180881
+ gen.assign((0, codegen_1._)`${validateName4}.errors`, null);
180882
180882
  gen.return(true);
180883
180883
  }
180884
180884
  }
@@ -181699,15 +181699,15 @@ var require_validate2 = __commonJS({
181699
181699
  }
181700
181700
  validateFunction(it3, () => (0, boolSchema_1.topBoolOrEmptySchema)(it3));
181701
181701
  }
181702
- function validateFunction({ gen, validateName: validateName3, schema, schemaEnv, opts }, body) {
181702
+ function validateFunction({ gen, validateName: validateName4, schema, schemaEnv, opts }, body) {
181703
181703
  if (opts.code.es5) {
181704
- gen.func(validateName3, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
181704
+ gen.func(validateName4, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
181705
181705
  gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
181706
181706
  destructureValCxtES5(gen, opts);
181707
181707
  gen.code(body);
181708
181708
  });
181709
181709
  } else {
181710
- gen.func(validateName3, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
181710
+ gen.func(validateName4, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
181711
181711
  }
181712
181712
  }
181713
181713
  function destructureValCxt(opts) {
@@ -181748,8 +181748,8 @@ var require_validate2 = __commonJS({
181748
181748
  return;
181749
181749
  }
181750
181750
  function resetEvaluated(it3) {
181751
- const { gen, validateName: validateName3 } = it3;
181752
- it3.evaluated = gen.const("evaluated", (0, codegen_1._)`${validateName3}.evaluated`);
181751
+ const { gen, validateName: validateName4 } = it3;
181752
+ it3.evaluated = gen.const("evaluated", (0, codegen_1._)`${validateName4}.evaluated`);
181753
181753
  gen.if((0, codegen_1._)`${it3.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._)`${it3.evaluated}.props`, (0, codegen_1._)`undefined`));
181754
181754
  gen.if((0, codegen_1._)`${it3.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._)`${it3.evaluated}.items`, (0, codegen_1._)`undefined`));
181755
181755
  }
@@ -181831,11 +181831,11 @@ var require_validate2 = __commonJS({
181831
181831
  }
181832
181832
  }
181833
181833
  function returnResults(it3) {
181834
- const { gen, schemaEnv, validateName: validateName3, ValidationError: ValidationError5, opts } = it3;
181834
+ const { gen, schemaEnv, validateName: validateName4, ValidationError: ValidationError5, opts } = it3;
181835
181835
  if (schemaEnv.$async) {
181836
181836
  gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${ValidationError5}(${names_1.default.vErrors})`));
181837
181837
  } else {
181838
- gen.assign((0, codegen_1._)`${validateName3}.errors`, names_1.default.vErrors);
181838
+ gen.assign((0, codegen_1._)`${validateName4}.errors`, names_1.default.vErrors);
181839
181839
  if (opts.unevaluated)
181840
181840
  assignEvaluated(it3);
181841
181841
  gen.return((0, codegen_1._)`${names_1.default.errors} === 0`);
@@ -182262,8 +182262,8 @@ var require_compile2 = __commonJS({
182262
182262
  code: (0, codegen_1._)`require("ajv/dist/runtime/validation_error").default`
182263
182263
  });
182264
182264
  }
182265
- const validateName3 = gen.scopeName("validate");
182266
- sch.validateName = validateName3;
182265
+ const validateName4 = gen.scopeName("validate");
182266
+ sch.validateName = validateName4;
182267
182267
  const schemaCxt = {
182268
182268
  gen,
182269
182269
  allErrors: this.opts.allErrors,
@@ -182277,7 +182277,7 @@ var require_compile2 = __commonJS({
182277
182277
  dataTypes: [],
182278
182278
  definedProperties: /* @__PURE__ */ new Set(),
182279
182279
  topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) } : { ref: sch.schema }),
182280
- validateName: validateName3,
182280
+ validateName: validateName4,
182281
182281
  ValidationError: _ValidationError,
182282
182282
  schema: sch.schema,
182283
182283
  schemaEnv: sch,
@@ -182300,14 +182300,14 @@ var require_compile2 = __commonJS({
182300
182300
  sourceCode = this.opts.code.process(sourceCode, sch);
182301
182301
  const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
182302
182302
  const validate3 = makeValidate(this, this.scope.get());
182303
- this.scope.value(validateName3, { ref: validate3 });
182303
+ this.scope.value(validateName4, { ref: validate3 });
182304
182304
  validate3.errors = null;
182305
182305
  validate3.schema = sch.schema;
182306
182306
  validate3.schemaEnv = sch;
182307
182307
  if (sch.$async)
182308
182308
  validate3.$async = true;
182309
182309
  if (this.opts.code.source === true) {
182310
- validate3.source = { validateName: validateName3, validateCode, scopeValues: gen._values };
182310
+ validate3.source = { validateName: validateName4, validateCode, scopeValues: gen._values };
182311
182311
  }
182312
182312
  if (this.opts.unevaluated) {
182313
182313
  const { props, items } = schemaCxt;
@@ -183485,7 +183485,7 @@ var require_ref2 = __commonJS({
183485
183485
  schemaType: "string",
183486
183486
  code(cxt) {
183487
183487
  const { gen, schema: $ref, it: it3 } = cxt;
183488
- const { baseId, schemaEnv: env5, validateName: validateName3, opts, self: self2 } = it3;
183488
+ const { baseId, schemaEnv: env5, validateName: validateName4, opts, self: self2 } = it3;
183489
183489
  const { root: root6 } = env5;
183490
183490
  if (($ref === "#" || $ref === "#/") && baseId === root6.baseId)
183491
183491
  return callRootRef();
@@ -183497,7 +183497,7 @@ var require_ref2 = __commonJS({
183497
183497
  return inlineRefSchema(schOrEnv);
183498
183498
  function callRootRef() {
183499
183499
  if (env5 === root6)
183500
- return callRef(cxt, validateName3, env5, env5.$async);
183500
+ return callRef(cxt, validateName4, env5, env5.$async);
183501
183501
  const rootName = gen.scopeValue("root", { ref: root6 });
183502
183502
  return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root6, root6.$async);
183503
183503
  }
@@ -200171,6 +200171,19 @@ var init_Source5 = __esm({
200171
200171
  });
200172
200172
 
200173
200173
  // ../../commons/api-workspace-commons/lib/Spec.js
200174
+ function groupGraphQLSpecsByNamespace(specs) {
200175
+ const grouped = /* @__PURE__ */ new Map();
200176
+ for (const spec of specs) {
200177
+ const key2 = spec.namespace ?? "";
200178
+ const existing = grouped.get(key2);
200179
+ if (existing != null) {
200180
+ existing.push(spec);
200181
+ } else {
200182
+ grouped.set(key2, [spec]);
200183
+ }
200184
+ }
200185
+ return grouped;
200186
+ }
200174
200187
  var init_Spec = __esm({
200175
200188
  "../../commons/api-workspace-commons/lib/Spec.js"() {
200176
200189
  "use strict";
@@ -235999,6 +236012,48 @@ async function getDefaultRemote({ repoRoot, context: context3 }) {
235999
236012
  const remotes = result.stdout.split("\n").map((line) => line.trim());
236000
236013
  return remotes.includes("origin") ? "origin" : remotes[0];
236001
236014
  }
236015
+ async function worktreeContainsGitLfsPointers({ worktreePath, ref: ref2, sha, context: context3 }) {
236016
+ const result = await runGit({
236017
+ args: ["grep", "-l", "-I", "-e", "^version https://git-lfs.github.com/spec/v1$", "--", "."],
236018
+ cwd: worktreePath,
236019
+ context: context3
236020
+ });
236021
+ if (result.exitCode === 0) {
236022
+ return true;
236023
+ }
236024
+ if (result.exitCode === 1) {
236025
+ return false;
236026
+ }
236027
+ throw new CliError({
236028
+ message: `Failed to inspect git ref '${ref2}' (${sha}) for Git LFS pointers: ${result.stderr || result.stdout}`,
236029
+ code: CliError.Code.ConfigError
236030
+ });
236031
+ }
236032
+ async function materializeGitLfsFiles({ worktreePath, ref: ref2, sha, context: context3 }) {
236033
+ if (!await worktreeContainsGitLfsPointers({ worktreePath, ref: ref2, sha, context: context3 })) {
236034
+ return;
236035
+ }
236036
+ const remote = await getDefaultRemote({ repoRoot: worktreePath, context: context3 });
236037
+ const pullResult = await runGit({
236038
+ args: remote != null ? ["lfs", "pull", "--include=*", "--exclude=", remote] : ["lfs", "checkout"],
236039
+ cwd: worktreePath,
236040
+ context: context3
236041
+ });
236042
+ if (pullResult.exitCode !== 0) {
236043
+ const output2 = pullResult.stderr || pullResult.stdout;
236044
+ const gitLfsUnavailable = output2.includes("'lfs' is not a git command");
236045
+ throw new CliError({
236046
+ message: gitLfsUnavailable ? `Git LFS is required to materialize files for git ref '${ref2}' (${sha}). Install Git LFS and retry.` : `Failed to materialize Git LFS files for git ref '${ref2}' (${sha}): ${output2}`,
236047
+ code: CliError.Code.ConfigError
236048
+ });
236049
+ }
236050
+ if (await worktreeContainsGitLfsPointers({ worktreePath, ref: ref2, sha, context: context3 })) {
236051
+ throw new CliError({
236052
+ message: `Git LFS files for git ref '${ref2}' (${sha}) could not be materialized. Ensure the required LFS objects are available from the configured git remote.`,
236053
+ code: CliError.Code.ConfigError
236054
+ });
236055
+ }
236056
+ }
236002
236057
  async function tryResolveSha({ repoRoot, ref: ref2, context: context3 }) {
236003
236058
  const result = await runGit({
236004
236059
  // `--end-of-options` terminates option parsing so a ref beginning with `-` cannot be read as
@@ -236114,6 +236169,7 @@ async function materializeGitRef({ ref: ref2, absolutePathToFernFolder, context:
236114
236169
  code: CliError.Code.ConfigError
236115
236170
  });
236116
236171
  }
236172
+ await materializeGitLfsFiles({ worktreePath, ref: ref2, sha, context: context3 });
236117
236173
  const materialized = {
236118
236174
  ref: ref2,
236119
236175
  sha,
@@ -365704,6 +365760,9 @@ function getNullableType(type7) {
365704
365760
  return isNonNullType(type7) ? type7.ofType : type7;
365705
365761
  }
365706
365762
  }
365763
+ function isNamedType(type7) {
365764
+ return isScalarType(type7) || isObjectType(type7) || isInterfaceType(type7) || isUnionType(type7) || isEnumType(type7) || isInputObjectType(type7);
365765
+ }
365707
365766
  function getNamedType(type7) {
365708
365767
  if (type7) {
365709
365768
  let unwrappedType = type7;
@@ -366268,6 +366327,18 @@ var init_definition = __esm({
366268
366327
  });
366269
366328
 
366270
366329
  // ../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/utilities/typeComparators.mjs
366330
+ function isEqualType(typeA, typeB) {
366331
+ if (typeA === typeB) {
366332
+ return true;
366333
+ }
366334
+ if (isNonNullType(typeA) && isNonNullType(typeB)) {
366335
+ return isEqualType(typeA.ofType, typeB.ofType);
366336
+ }
366337
+ if (isListType2(typeA) && isListType2(typeB)) {
366338
+ return isEqualType(typeA.ofType, typeB.ofType);
366339
+ }
366340
+ return false;
366341
+ }
366271
366342
  function isTypeSubTypeOf(schema, maybeSubType, superType) {
366272
366343
  if (maybeSubType === superType) {
366273
366344
  return true;
@@ -367312,6 +367383,15 @@ var init_introspection = __esm({
367312
367383
  });
367313
367384
 
367314
367385
  // ../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/type/schema.mjs
367386
+ function isSchema(schema) {
367387
+ return instanceOf(schema, GraphQLSchema);
367388
+ }
367389
+ function assertSchema(schema) {
367390
+ if (!isSchema(schema)) {
367391
+ throw new Error(`Expected ${inspect4(schema)} to be a GraphQL schema.`);
367392
+ }
367393
+ return schema;
367394
+ }
367315
367395
  function collectReferencedTypes(type7, typeSet) {
367316
367396
  const namedType = getNamedType(type7);
367317
367397
  if (!typeSet.has(namedType)) {
@@ -367344,6 +367424,7 @@ var init_schema2 = __esm({
367344
367424
  "use strict";
367345
367425
  init_devAssert();
367346
367426
  init_inspect();
367427
+ init_instanceOf();
367347
367428
  init_isObjectLike2();
367348
367429
  init_toObjMap();
367349
367430
  init_ast2();
@@ -367526,6 +367607,464 @@ var init_schema2 = __esm({
367526
367607
  }
367527
367608
  });
367528
367609
 
367610
+ // ../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/type/validate.mjs
367611
+ function validateSchema2(schema) {
367612
+ assertSchema(schema);
367613
+ if (schema.__validationErrors) {
367614
+ return schema.__validationErrors;
367615
+ }
367616
+ const context3 = new SchemaValidationContext(schema);
367617
+ validateRootTypes(context3);
367618
+ validateDirectives(context3);
367619
+ validateTypes(context3);
367620
+ const errors4 = context3.getErrors();
367621
+ schema.__validationErrors = errors4;
367622
+ return errors4;
367623
+ }
367624
+ function validateRootTypes(context3) {
367625
+ const schema = context3.schema;
367626
+ const queryType = schema.getQueryType();
367627
+ if (!queryType) {
367628
+ context3.reportError("Query root type must be provided.", schema.astNode);
367629
+ } else if (!isObjectType(queryType)) {
367630
+ var _getOperationTypeNode;
367631
+ context3.reportError(
367632
+ `Query root type must be Object type, it cannot be ${inspect4(
367633
+ queryType
367634
+ )}.`,
367635
+ (_getOperationTypeNode = getOperationTypeNode(
367636
+ schema,
367637
+ OperationTypeNode.QUERY
367638
+ )) !== null && _getOperationTypeNode !== void 0 ? _getOperationTypeNode : queryType.astNode
367639
+ );
367640
+ }
367641
+ const mutationType = schema.getMutationType();
367642
+ if (mutationType && !isObjectType(mutationType)) {
367643
+ var _getOperationTypeNode2;
367644
+ context3.reportError(
367645
+ `Mutation root type must be Object type if provided, it cannot be ${inspect4(mutationType)}.`,
367646
+ (_getOperationTypeNode2 = getOperationTypeNode(
367647
+ schema,
367648
+ OperationTypeNode.MUTATION
367649
+ )) !== null && _getOperationTypeNode2 !== void 0 ? _getOperationTypeNode2 : mutationType.astNode
367650
+ );
367651
+ }
367652
+ const subscriptionType = schema.getSubscriptionType();
367653
+ if (subscriptionType && !isObjectType(subscriptionType)) {
367654
+ var _getOperationTypeNode3;
367655
+ context3.reportError(
367656
+ `Subscription root type must be Object type if provided, it cannot be ${inspect4(subscriptionType)}.`,
367657
+ (_getOperationTypeNode3 = getOperationTypeNode(
367658
+ schema,
367659
+ OperationTypeNode.SUBSCRIPTION
367660
+ )) !== null && _getOperationTypeNode3 !== void 0 ? _getOperationTypeNode3 : subscriptionType.astNode
367661
+ );
367662
+ }
367663
+ }
367664
+ function getOperationTypeNode(schema, operation) {
367665
+ var _flatMap$find;
367666
+ return (_flatMap$find = [schema.astNode, ...schema.extensionASTNodes].flatMap(
367667
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
367668
+ (schemaNode) => {
367669
+ var _schemaNode$operation;
367670
+ return (
367671
+ /* c8 ignore next */
367672
+ (_schemaNode$operation = schemaNode === null || schemaNode === void 0 ? void 0 : schemaNode.operationTypes) !== null && _schemaNode$operation !== void 0 ? _schemaNode$operation : []
367673
+ );
367674
+ }
367675
+ ).find((operationNode) => operationNode.operation === operation)) === null || _flatMap$find === void 0 ? void 0 : _flatMap$find.type;
367676
+ }
367677
+ function validateDirectives(context3) {
367678
+ for (const directive of context3.schema.getDirectives()) {
367679
+ if (!isDirective(directive)) {
367680
+ context3.reportError(
367681
+ `Expected directive but got: ${inspect4(directive)}.`,
367682
+ directive === null || directive === void 0 ? void 0 : directive.astNode
367683
+ );
367684
+ continue;
367685
+ }
367686
+ validateName3(context3, directive);
367687
+ if (directive.locations.length === 0) {
367688
+ context3.reportError(
367689
+ `Directive @${directive.name} must include 1 or more locations.`,
367690
+ directive.astNode
367691
+ );
367692
+ }
367693
+ for (const arg of directive.args) {
367694
+ validateName3(context3, arg);
367695
+ if (!isInputType(arg.type)) {
367696
+ context3.reportError(
367697
+ `The type of @${directive.name}(${arg.name}:) must be Input Type but got: ${inspect4(arg.type)}.`,
367698
+ arg.astNode
367699
+ );
367700
+ }
367701
+ if (isRequiredArgument(arg) && arg.deprecationReason != null) {
367702
+ var _arg$astNode;
367703
+ context3.reportError(
367704
+ `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`,
367705
+ [
367706
+ getDeprecatedDirectiveNode(arg.astNode),
367707
+ (_arg$astNode = arg.astNode) === null || _arg$astNode === void 0 ? void 0 : _arg$astNode.type
367708
+ ]
367709
+ );
367710
+ }
367711
+ }
367712
+ }
367713
+ }
367714
+ function validateName3(context3, node4) {
367715
+ if (node4.name.startsWith("__")) {
367716
+ context3.reportError(
367717
+ `Name "${node4.name}" must not begin with "__", which is reserved by GraphQL introspection.`,
367718
+ node4.astNode
367719
+ );
367720
+ }
367721
+ }
367722
+ function validateTypes(context3) {
367723
+ const validateInputObjectCircularRefs = createInputObjectCircularRefsValidator(context3);
367724
+ const typeMap = context3.schema.getTypeMap();
367725
+ for (const type7 of Object.values(typeMap)) {
367726
+ if (!isNamedType(type7)) {
367727
+ context3.reportError(
367728
+ `Expected GraphQL named type but got: ${inspect4(type7)}.`,
367729
+ type7.astNode
367730
+ );
367731
+ continue;
367732
+ }
367733
+ if (!isIntrospectionType(type7)) {
367734
+ validateName3(context3, type7);
367735
+ }
367736
+ if (isObjectType(type7)) {
367737
+ validateFields(context3, type7);
367738
+ validateInterfaces(context3, type7);
367739
+ } else if (isInterfaceType(type7)) {
367740
+ validateFields(context3, type7);
367741
+ validateInterfaces(context3, type7);
367742
+ } else if (isUnionType(type7)) {
367743
+ validateUnionMembers(context3, type7);
367744
+ } else if (isEnumType(type7)) {
367745
+ validateEnumValues(context3, type7);
367746
+ } else if (isInputObjectType(type7)) {
367747
+ validateInputFields(context3, type7);
367748
+ validateInputObjectCircularRefs(type7);
367749
+ }
367750
+ }
367751
+ }
367752
+ function validateFields(context3, type7) {
367753
+ const fields = Object.values(type7.getFields());
367754
+ if (fields.length === 0) {
367755
+ context3.reportError(`Type ${type7.name} must define one or more fields.`, [
367756
+ type7.astNode,
367757
+ ...type7.extensionASTNodes
367758
+ ]);
367759
+ }
367760
+ for (const field5 of fields) {
367761
+ validateName3(context3, field5);
367762
+ if (!isOutputType(field5.type)) {
367763
+ var _field$astNode;
367764
+ context3.reportError(
367765
+ `The type of ${type7.name}.${field5.name} must be Output Type but got: ${inspect4(field5.type)}.`,
367766
+ (_field$astNode = field5.astNode) === null || _field$astNode === void 0 ? void 0 : _field$astNode.type
367767
+ );
367768
+ }
367769
+ for (const arg of field5.args) {
367770
+ const argName = arg.name;
367771
+ validateName3(context3, arg);
367772
+ if (!isInputType(arg.type)) {
367773
+ var _arg$astNode2;
367774
+ context3.reportError(
367775
+ `The type of ${type7.name}.${field5.name}(${argName}:) must be Input Type but got: ${inspect4(arg.type)}.`,
367776
+ (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 ? void 0 : _arg$astNode2.type
367777
+ );
367778
+ }
367779
+ if (isRequiredArgument(arg) && arg.deprecationReason != null) {
367780
+ var _arg$astNode3;
367781
+ context3.reportError(
367782
+ `Required argument ${type7.name}.${field5.name}(${argName}:) cannot be deprecated.`,
367783
+ [
367784
+ getDeprecatedDirectiveNode(arg.astNode),
367785
+ (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 ? void 0 : _arg$astNode3.type
367786
+ ]
367787
+ );
367788
+ }
367789
+ }
367790
+ }
367791
+ }
367792
+ function validateInterfaces(context3, type7) {
367793
+ const ifaceTypeNames = /* @__PURE__ */ Object.create(null);
367794
+ for (const iface of type7.getInterfaces()) {
367795
+ if (!isInterfaceType(iface)) {
367796
+ context3.reportError(
367797
+ `Type ${inspect4(type7)} must only implement Interface types, it cannot implement ${inspect4(iface)}.`,
367798
+ getAllImplementsInterfaceNodes(type7, iface)
367799
+ );
367800
+ continue;
367801
+ }
367802
+ if (type7 === iface) {
367803
+ context3.reportError(
367804
+ `Type ${type7.name} cannot implement itself because it would create a circular reference.`,
367805
+ getAllImplementsInterfaceNodes(type7, iface)
367806
+ );
367807
+ continue;
367808
+ }
367809
+ if (ifaceTypeNames[iface.name]) {
367810
+ context3.reportError(
367811
+ `Type ${type7.name} can only implement ${iface.name} once.`,
367812
+ getAllImplementsInterfaceNodes(type7, iface)
367813
+ );
367814
+ continue;
367815
+ }
367816
+ ifaceTypeNames[iface.name] = true;
367817
+ validateTypeImplementsAncestors(context3, type7, iface);
367818
+ validateTypeImplementsInterface(context3, type7, iface);
367819
+ }
367820
+ }
367821
+ function validateTypeImplementsInterface(context3, type7, iface) {
367822
+ const typeFieldMap = type7.getFields();
367823
+ for (const ifaceField of Object.values(iface.getFields())) {
367824
+ const fieldName = ifaceField.name;
367825
+ const typeField = typeFieldMap[fieldName];
367826
+ if (!typeField) {
367827
+ context3.reportError(
367828
+ `Interface field ${iface.name}.${fieldName} expected but ${type7.name} does not provide it.`,
367829
+ [ifaceField.astNode, type7.astNode, ...type7.extensionASTNodes]
367830
+ );
367831
+ continue;
367832
+ }
367833
+ if (!isTypeSubTypeOf(context3.schema, typeField.type, ifaceField.type)) {
367834
+ var _ifaceField$astNode, _typeField$astNode;
367835
+ context3.reportError(
367836
+ `Interface field ${iface.name}.${fieldName} expects type ${inspect4(ifaceField.type)} but ${type7.name}.${fieldName} is type ${inspect4(typeField.type)}.`,
367837
+ [
367838
+ (_ifaceField$astNode = ifaceField.astNode) === null || _ifaceField$astNode === void 0 ? void 0 : _ifaceField$astNode.type,
367839
+ (_typeField$astNode = typeField.astNode) === null || _typeField$astNode === void 0 ? void 0 : _typeField$astNode.type
367840
+ ]
367841
+ );
367842
+ }
367843
+ for (const ifaceArg of ifaceField.args) {
367844
+ const argName = ifaceArg.name;
367845
+ const typeArg = typeField.args.find((arg) => arg.name === argName);
367846
+ if (!typeArg) {
367847
+ context3.reportError(
367848
+ `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type7.name}.${fieldName} does not provide it.`,
367849
+ [ifaceArg.astNode, typeField.astNode]
367850
+ );
367851
+ continue;
367852
+ }
367853
+ if (!isEqualType(ifaceArg.type, typeArg.type)) {
367854
+ var _ifaceArg$astNode, _typeArg$astNode;
367855
+ context3.reportError(
367856
+ `Interface field argument ${iface.name}.${fieldName}(${argName}:) expects type ${inspect4(ifaceArg.type)} but ${type7.name}.${fieldName}(${argName}:) is type ${inspect4(typeArg.type)}.`,
367857
+ [
367858
+ (_ifaceArg$astNode = ifaceArg.astNode) === null || _ifaceArg$astNode === void 0 ? void 0 : _ifaceArg$astNode.type,
367859
+ (_typeArg$astNode = typeArg.astNode) === null || _typeArg$astNode === void 0 ? void 0 : _typeArg$astNode.type
367860
+ ]
367861
+ );
367862
+ }
367863
+ }
367864
+ for (const typeArg of typeField.args) {
367865
+ const argName = typeArg.name;
367866
+ const ifaceArg = ifaceField.args.find((arg) => arg.name === argName);
367867
+ if (!ifaceArg && isRequiredArgument(typeArg)) {
367868
+ context3.reportError(
367869
+ `Object field ${type7.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`,
367870
+ [typeArg.astNode, ifaceField.astNode]
367871
+ );
367872
+ }
367873
+ }
367874
+ }
367875
+ }
367876
+ function validateTypeImplementsAncestors(context3, type7, iface) {
367877
+ const ifaceInterfaces = type7.getInterfaces();
367878
+ for (const transitive of iface.getInterfaces()) {
367879
+ if (!ifaceInterfaces.includes(transitive)) {
367880
+ context3.reportError(
367881
+ transitive === type7 ? `Type ${type7.name} cannot implement ${iface.name} because it would create a circular reference.` : `Type ${type7.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`,
367882
+ [
367883
+ ...getAllImplementsInterfaceNodes(iface, transitive),
367884
+ ...getAllImplementsInterfaceNodes(type7, iface)
367885
+ ]
367886
+ );
367887
+ }
367888
+ }
367889
+ }
367890
+ function validateUnionMembers(context3, union23) {
367891
+ const memberTypes = union23.getTypes();
367892
+ if (memberTypes.length === 0) {
367893
+ context3.reportError(
367894
+ `Union type ${union23.name} must define one or more member types.`,
367895
+ [union23.astNode, ...union23.extensionASTNodes]
367896
+ );
367897
+ }
367898
+ const includedTypeNames = /* @__PURE__ */ Object.create(null);
367899
+ for (const memberType of memberTypes) {
367900
+ if (includedTypeNames[memberType.name]) {
367901
+ context3.reportError(
367902
+ `Union type ${union23.name} can only include type ${memberType.name} once.`,
367903
+ getUnionMemberTypeNodes(union23, memberType.name)
367904
+ );
367905
+ continue;
367906
+ }
367907
+ includedTypeNames[memberType.name] = true;
367908
+ if (!isObjectType(memberType)) {
367909
+ context3.reportError(
367910
+ `Union type ${union23.name} can only include Object types, it cannot include ${inspect4(memberType)}.`,
367911
+ getUnionMemberTypeNodes(union23, String(memberType))
367912
+ );
367913
+ }
367914
+ }
367915
+ }
367916
+ function validateEnumValues(context3, enumType2) {
367917
+ const enumValues = enumType2.getValues();
367918
+ if (enumValues.length === 0) {
367919
+ context3.reportError(
367920
+ `Enum type ${enumType2.name} must define one or more values.`,
367921
+ [enumType2.astNode, ...enumType2.extensionASTNodes]
367922
+ );
367923
+ }
367924
+ for (const enumValue of enumValues) {
367925
+ validateName3(context3, enumValue);
367926
+ }
367927
+ }
367928
+ function validateInputFields(context3, inputObj) {
367929
+ const fields = Object.values(inputObj.getFields());
367930
+ if (fields.length === 0) {
367931
+ context3.reportError(
367932
+ `Input Object type ${inputObj.name} must define one or more fields.`,
367933
+ [inputObj.astNode, ...inputObj.extensionASTNodes]
367934
+ );
367935
+ }
367936
+ for (const field5 of fields) {
367937
+ validateName3(context3, field5);
367938
+ if (!isInputType(field5.type)) {
367939
+ var _field$astNode2;
367940
+ context3.reportError(
367941
+ `The type of ${inputObj.name}.${field5.name} must be Input Type but got: ${inspect4(field5.type)}.`,
367942
+ (_field$astNode2 = field5.astNode) === null || _field$astNode2 === void 0 ? void 0 : _field$astNode2.type
367943
+ );
367944
+ }
367945
+ if (isRequiredInputField(field5) && field5.deprecationReason != null) {
367946
+ var _field$astNode3;
367947
+ context3.reportError(
367948
+ `Required input field ${inputObj.name}.${field5.name} cannot be deprecated.`,
367949
+ [
367950
+ getDeprecatedDirectiveNode(field5.astNode),
367951
+ (_field$astNode3 = field5.astNode) === null || _field$astNode3 === void 0 ? void 0 : _field$astNode3.type
367952
+ ]
367953
+ );
367954
+ }
367955
+ if (inputObj.isOneOf) {
367956
+ validateOneOfInputObjectField(inputObj, field5, context3);
367957
+ }
367958
+ }
367959
+ }
367960
+ function validateOneOfInputObjectField(type7, field5, context3) {
367961
+ if (isNonNullType(field5.type)) {
367962
+ var _field$astNode4;
367963
+ context3.reportError(
367964
+ `OneOf input field ${type7.name}.${field5.name} must be nullable.`,
367965
+ (_field$astNode4 = field5.astNode) === null || _field$astNode4 === void 0 ? void 0 : _field$astNode4.type
367966
+ );
367967
+ }
367968
+ if (field5.defaultValue !== void 0) {
367969
+ context3.reportError(
367970
+ `OneOf input field ${type7.name}.${field5.name} cannot have a default value.`,
367971
+ field5.astNode
367972
+ );
367973
+ }
367974
+ }
367975
+ function createInputObjectCircularRefsValidator(context3) {
367976
+ const visitedTypes = /* @__PURE__ */ Object.create(null);
367977
+ const fieldPath = [];
367978
+ const fieldPathIndexByTypeName = /* @__PURE__ */ Object.create(null);
367979
+ return detectCycleRecursive;
367980
+ function detectCycleRecursive(inputObj) {
367981
+ if (visitedTypes[inputObj.name]) {
367982
+ return;
367983
+ }
367984
+ visitedTypes[inputObj.name] = true;
367985
+ fieldPathIndexByTypeName[inputObj.name] = fieldPath.length;
367986
+ const fields = Object.values(inputObj.getFields());
367987
+ for (const field5 of fields) {
367988
+ if (isNonNullType(field5.type) && isInputObjectType(field5.type.ofType)) {
367989
+ const fieldType = field5.type.ofType;
367990
+ const cycleIndex = fieldPathIndexByTypeName[fieldType.name];
367991
+ fieldPath.push(field5);
367992
+ if (cycleIndex === void 0) {
367993
+ detectCycleRecursive(fieldType);
367994
+ } else {
367995
+ const cyclePath = fieldPath.slice(cycleIndex);
367996
+ const pathStr = cyclePath.map((fieldObj) => fieldObj.name).join(".");
367997
+ context3.reportError(
367998
+ `Cannot reference Input Object "${fieldType.name}" within itself through a series of non-null fields: "${pathStr}".`,
367999
+ cyclePath.map((fieldObj) => fieldObj.astNode)
368000
+ );
368001
+ }
368002
+ fieldPath.pop();
368003
+ }
368004
+ }
368005
+ fieldPathIndexByTypeName[inputObj.name] = void 0;
368006
+ }
368007
+ }
368008
+ function getAllImplementsInterfaceNodes(type7, iface) {
368009
+ const { astNode, extensionASTNodes } = type7;
368010
+ const nodes = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes;
368011
+ return nodes.flatMap((typeNode) => {
368012
+ var _typeNode$interfaces;
368013
+ return (
368014
+ /* c8 ignore next */
368015
+ (_typeNode$interfaces = typeNode.interfaces) !== null && _typeNode$interfaces !== void 0 ? _typeNode$interfaces : []
368016
+ );
368017
+ }).filter((ifaceNode) => ifaceNode.name.value === iface.name);
368018
+ }
368019
+ function getUnionMemberTypeNodes(union23, typeName) {
368020
+ const { astNode, extensionASTNodes } = union23;
368021
+ const nodes = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes;
368022
+ return nodes.flatMap((unionNode) => {
368023
+ var _unionNode$types;
368024
+ return (
368025
+ /* c8 ignore next */
368026
+ (_unionNode$types = unionNode.types) !== null && _unionNode$types !== void 0 ? _unionNode$types : []
368027
+ );
368028
+ }).filter((typeNode) => typeNode.name.value === typeName);
368029
+ }
368030
+ function getDeprecatedDirectiveNode(definitionNode) {
368031
+ var _definitionNode$direc;
368032
+ return definitionNode === null || definitionNode === void 0 ? void 0 : (_definitionNode$direc = definitionNode.directives) === null || _definitionNode$direc === void 0 ? void 0 : _definitionNode$direc.find(
368033
+ (node4) => node4.name.value === GraphQLDeprecatedDirective.name
368034
+ );
368035
+ }
368036
+ var SchemaValidationContext;
368037
+ var init_validate2 = __esm({
368038
+ "../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/type/validate.mjs"() {
368039
+ "use strict";
368040
+ init_inspect();
368041
+ init_GraphQLError();
368042
+ init_ast2();
368043
+ init_typeComparators();
368044
+ init_definition();
368045
+ init_directives();
368046
+ init_introspection();
368047
+ init_schema2();
368048
+ SchemaValidationContext = class {
368049
+ constructor(schema) {
368050
+ this._errors = [];
368051
+ this.schema = schema;
368052
+ }
368053
+ reportError(message, nodes) {
368054
+ const _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes;
368055
+ this._errors.push(
368056
+ new GraphQLError(message, {
368057
+ nodes: _nodes
368058
+ })
368059
+ );
368060
+ }
368061
+ getErrors() {
368062
+ return this._errors;
368063
+ }
368064
+ };
368065
+ }
368066
+ });
368067
+
367529
368068
  // ../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/utilities/typeFromAST.mjs
367530
368069
  function typeFromAST(schema, typeNode) {
367531
368070
  switch (typeNode.kind) {
@@ -370613,7 +371152,7 @@ function assertValidSDL(documentAST) {
370613
371152
  }
370614
371153
  }
370615
371154
  var QueryDocumentKeysToValidate;
370616
- var init_validate2 = __esm({
371155
+ var init_validate3 = __esm({
370617
371156
  "../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/validation/validate.mjs"() {
370618
371157
  "use strict";
370619
371158
  init_mapValue();
@@ -370633,6 +371172,18 @@ var init_type3 = __esm({
370633
371172
  "../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/type/index.mjs"() {
370634
371173
  "use strict";
370635
371174
  init_definition();
371175
+ init_directives();
371176
+ init_validate2();
371177
+ }
371178
+ });
371179
+
371180
+ // ../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/language/index.mjs
371181
+ var init_language = __esm({
371182
+ "../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/language/index.mjs"() {
371183
+ "use strict";
371184
+ init_kinds();
371185
+ init_parser();
371186
+ init_printer();
370636
371187
  }
370637
371188
  });
370638
371189
 
@@ -371541,25 +372092,14 @@ function buildASTSchema(documentAST, options2) {
371541
372092
  ];
371542
372093
  return new GraphQLSchema({ ...config5, directives });
371543
372094
  }
371544
- function buildSchema(source2, options2) {
371545
- const document4 = parse9(source2, {
371546
- noLocation: options2 === null || options2 === void 0 ? void 0 : options2.noLocation,
371547
- allowLegacyFragmentVariables: options2 === null || options2 === void 0 ? void 0 : options2.allowLegacyFragmentVariables
371548
- });
371549
- return buildASTSchema(document4, {
371550
- assumeValidSDL: options2 === null || options2 === void 0 ? void 0 : options2.assumeValidSDL,
371551
- assumeValid: options2 === null || options2 === void 0 ? void 0 : options2.assumeValid
371552
- });
371553
- }
371554
372095
  var init_buildASTSchema = __esm({
371555
372096
  "../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/utilities/buildASTSchema.mjs"() {
371556
372097
  "use strict";
371557
372098
  init_devAssert();
371558
372099
  init_kinds();
371559
- init_parser();
371560
372100
  init_directives();
371561
372101
  init_schema2();
371562
- init_validate2();
372102
+ init_validate3();
371563
372103
  init_extendSchema();
371564
372104
  }
371565
372105
  });
@@ -371770,10 +372310,445 @@ var init_graphql = __esm({
371770
372310
  "../../../node_modules/.pnpm/graphql@16.13.2/node_modules/graphql/index.mjs"() {
371771
372311
  "use strict";
371772
372312
  init_type3();
372313
+ init_language();
371773
372314
  init_utilities2();
371774
372315
  }
371775
372316
  });
371776
372317
 
372318
+ // ../api-importers/graphql/lib/mergeGraphQlDocuments.js
372319
+ function mergeGraphQlDocuments(sources) {
372320
+ const conflicts2 = [];
372321
+ const types4 = /* @__PURE__ */ new Map();
372322
+ const directiveDefinitions = /* @__PURE__ */ new Map();
372323
+ const operationTypes = /* @__PURE__ */ new Map();
372324
+ const otherDefinitions = [];
372325
+ const inaccessible = { types: /* @__PURE__ */ new Set(), seen: false };
372326
+ for (const source2 of sources) {
372327
+ for (const definition3 of parseSource(source2).definitions) {
372328
+ if (definition3.kind === Kind.DIRECTIVE_DEFINITION) {
372329
+ const directiveName = definition3.name.value;
372330
+ if (FEDERATION_DIRECTIVES.has(directiveName)) {
372331
+ continue;
372332
+ }
372333
+ const owner = directiveDefinitions.get(directiveName);
372334
+ if (owner == null) {
372335
+ directiveDefinitions.set(directiveName, { definition: definition3, filePath: source2.filePath });
372336
+ } else if (print(owner.definition) !== print(definition3)) {
372337
+ conflicts2.push({
372338
+ typeName: `@${directiveName}`,
372339
+ memberName: "<declaration>",
372340
+ kept: owner.filePath,
372341
+ dropped: source2.filePath
372342
+ });
372343
+ }
372344
+ continue;
372345
+ }
372346
+ if (definition3.kind === Kind.SCHEMA_DEFINITION || definition3.kind === Kind.SCHEMA_EXTENSION) {
372347
+ for (const operationType of definition3.operationTypes ?? []) {
372348
+ const owner = operationTypes.get(operationType.operation);
372349
+ if (owner == null) {
372350
+ operationTypes.set(operationType.operation, { operationType, filePath: source2.filePath });
372351
+ } else if (owner.operationType.type.name.value !== operationType.type.name.value) {
372352
+ conflicts2.push({
372353
+ typeName: "schema",
372354
+ memberName: operationType.operation,
372355
+ kept: owner.filePath,
372356
+ dropped: source2.filePath
372357
+ });
372358
+ }
372359
+ }
372360
+ continue;
372361
+ }
372362
+ if (isTypeExtension(definition3)) {
372363
+ mergeTypeDefinition({
372364
+ incoming: typeExtensionToDefinition(definition3),
372365
+ isExtension: true,
372366
+ filePath: source2.filePath,
372367
+ types: types4,
372368
+ conflicts: conflicts2,
372369
+ inaccessible
372370
+ });
372371
+ continue;
372372
+ }
372373
+ if (isTypeDefinition(definition3)) {
372374
+ mergeTypeDefinition({
372375
+ incoming: definition3,
372376
+ isExtension: false,
372377
+ filePath: source2.filePath,
372378
+ types: types4,
372379
+ conflicts: conflicts2,
372380
+ inaccessible
372381
+ });
372382
+ continue;
372383
+ }
372384
+ if (definition3.kind === Kind.OPERATION_DEFINITION || definition3.kind === Kind.FRAGMENT_DEFINITION) {
372385
+ continue;
372386
+ }
372387
+ otherDefinitions.push(definition3);
372388
+ }
372389
+ }
372390
+ if (inaccessible.seen) {
372391
+ const queryRootName = queryRootTypeName(operationTypes, types4);
372392
+ pruneInaccessibleTypes(types4, inaccessible.types);
372393
+ pruneUnsatisfiedInterfaces(types4);
372394
+ if (queryRootName != null && !types4.has(queryRootName)) {
372395
+ throw new Error(`Every field on the GraphQL query root "${queryRootName}" returns a type marked @inaccessible (${[...inaccessible.types].sort().join(", ")}), so the merged schema has no reachable operations. Remove @inaccessible from at least one reachable type, or exclude these files from the docs.`);
372396
+ }
372397
+ }
372398
+ const definitions7 = [
372399
+ ...[...directiveDefinitions.values()].map((entry) => entry.definition),
372400
+ ...otherDefinitions,
372401
+ ...[...types4.values()].map((type7) => type7.definition)
372402
+ ];
372403
+ const rootOperationTypes = [...operationTypes.values()].map((entry) => entry.operationType).filter((operationType) => types4.has(operationType.type.name.value));
372404
+ if (rootOperationTypes.length > 0) {
372405
+ definitions7.push({ kind: Kind.SCHEMA_DEFINITION, operationTypes: rootOperationTypes });
372406
+ }
372407
+ return { document: { kind: Kind.DOCUMENT, definitions: definitions7 }, conflicts: conflicts2 };
372408
+ }
372409
+ function queryRootTypeName(operationTypes, types4) {
372410
+ const declared = operationTypes.get("query")?.operationType.type.name.value;
372411
+ if (declared != null) {
372412
+ return types4.has(declared) ? declared : void 0;
372413
+ }
372414
+ return types4.has("Query") ? "Query" : void 0;
372415
+ }
372416
+ function parseSource(source2) {
372417
+ try {
372418
+ return parse9(source2.sdl);
372419
+ } catch (error50) {
372420
+ throw new Error(`${source2.filePath}: ${error50 instanceof Error ? error50.message : String(error50)}`);
372421
+ }
372422
+ }
372423
+ function isTypeDefinition(definition3) {
372424
+ return definition3.kind === Kind.SCALAR_TYPE_DEFINITION || definition3.kind === Kind.OBJECT_TYPE_DEFINITION || definition3.kind === Kind.INTERFACE_TYPE_DEFINITION || definition3.kind === Kind.UNION_TYPE_DEFINITION || definition3.kind === Kind.ENUM_TYPE_DEFINITION || definition3.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION;
372425
+ }
372426
+ function isTypeExtension(definition3) {
372427
+ return definition3.kind === Kind.SCALAR_TYPE_EXTENSION || definition3.kind === Kind.OBJECT_TYPE_EXTENSION || definition3.kind === Kind.INTERFACE_TYPE_EXTENSION || definition3.kind === Kind.UNION_TYPE_EXTENSION || definition3.kind === Kind.ENUM_TYPE_EXTENSION || definition3.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION;
372428
+ }
372429
+ function typeExtensionToDefinition(extension4) {
372430
+ switch (extension4.kind) {
372431
+ case Kind.SCALAR_TYPE_EXTENSION:
372432
+ return { ...extension4, kind: Kind.SCALAR_TYPE_DEFINITION, description: void 0 };
372433
+ case Kind.OBJECT_TYPE_EXTENSION:
372434
+ return { ...extension4, kind: Kind.OBJECT_TYPE_DEFINITION, description: void 0 };
372435
+ case Kind.INTERFACE_TYPE_EXTENSION:
372436
+ return { ...extension4, kind: Kind.INTERFACE_TYPE_DEFINITION, description: void 0 };
372437
+ case Kind.UNION_TYPE_EXTENSION:
372438
+ return { ...extension4, kind: Kind.UNION_TYPE_DEFINITION, description: void 0 };
372439
+ case Kind.ENUM_TYPE_EXTENSION:
372440
+ return { ...extension4, kind: Kind.ENUM_TYPE_DEFINITION, description: void 0 };
372441
+ case Kind.INPUT_OBJECT_TYPE_EXTENSION:
372442
+ return { ...extension4, kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, description: void 0 };
372443
+ }
372444
+ }
372445
+ function stripFederationDirectives(directives) {
372446
+ if (directives == null) {
372447
+ return void 0;
372448
+ }
372449
+ return directives.filter((directive) => !FEDERATION_DIRECTIVES.has(directive.name.value));
372450
+ }
372451
+ function isInaccessible(node4) {
372452
+ return node4.directives?.some((directive) => directive.name.value === INACCESSIBLE_DIRECTIVE) ?? false;
372453
+ }
372454
+ function cleanArguments(args, inaccessible) {
372455
+ return args?.filter(keepAccessible(inaccessible)).map((argument) => ({
372456
+ ...argument,
372457
+ directives: stripFederationDirectives(argument.directives)
372458
+ }));
372459
+ }
372460
+ function keepAccessible(inaccessible) {
372461
+ return (node4) => {
372462
+ if (!isInaccessible(node4)) {
372463
+ return true;
372464
+ }
372465
+ inaccessible.seen = true;
372466
+ return false;
372467
+ };
372468
+ }
372469
+ function cleanTypeDefinition(definition3, inaccessible) {
372470
+ const directives = stripFederationDirectives(definition3.directives);
372471
+ if (isInaccessible(definition3)) {
372472
+ inaccessible.seen = true;
372473
+ inaccessible.types.add(definition3.name.value);
372474
+ }
372475
+ const keep = keepAccessible(inaccessible);
372476
+ switch (definition3.kind) {
372477
+ case Kind.OBJECT_TYPE_DEFINITION:
372478
+ case Kind.INTERFACE_TYPE_DEFINITION:
372479
+ return {
372480
+ ...definition3,
372481
+ directives,
372482
+ fields: definition3.fields?.filter(keep).map((field5) => ({
372483
+ ...field5,
372484
+ directives: stripFederationDirectives(field5.directives),
372485
+ arguments: cleanArguments(field5.arguments, inaccessible)
372486
+ }))
372487
+ };
372488
+ case Kind.INPUT_OBJECT_TYPE_DEFINITION:
372489
+ return {
372490
+ ...definition3,
372491
+ directives,
372492
+ fields: definition3.fields?.filter(keep).map((field5) => ({
372493
+ ...field5,
372494
+ directives: stripFederationDirectives(field5.directives)
372495
+ }))
372496
+ };
372497
+ case Kind.ENUM_TYPE_DEFINITION:
372498
+ return {
372499
+ ...definition3,
372500
+ directives,
372501
+ values: definition3.values?.filter(keep).map((value2) => ({
372502
+ ...value2,
372503
+ directives: stripFederationDirectives(value2.directives)
372504
+ }))
372505
+ };
372506
+ case Kind.SCALAR_TYPE_DEFINITION:
372507
+ case Kind.UNION_TYPE_DEFINITION:
372508
+ return { ...definition3, directives };
372509
+ }
372510
+ }
372511
+ function namedTypeName(type7) {
372512
+ switch (type7.kind) {
372513
+ case Kind.NAMED_TYPE:
372514
+ return type7.name.value;
372515
+ case Kind.LIST_TYPE:
372516
+ case Kind.NON_NULL_TYPE:
372517
+ return namedTypeName(type7.type);
372518
+ }
372519
+ }
372520
+ function pruneInaccessibleTypes(types4, inaccessibleTypes) {
372521
+ const removed = /* @__PURE__ */ new Set();
372522
+ for (const typeName of inaccessibleTypes) {
372523
+ if (types4.delete(typeName)) {
372524
+ removed.add(typeName);
372525
+ }
372526
+ }
372527
+ let changed = true;
372528
+ while (changed) {
372529
+ changed = false;
372530
+ for (const [typeName, type7] of types4) {
372531
+ const pruned = pruneReferences(type7.definition, removed);
372532
+ if (pruned == null) {
372533
+ types4.delete(typeName);
372534
+ removed.add(typeName);
372535
+ changed = true;
372536
+ continue;
372537
+ }
372538
+ if (pruned !== type7.definition) {
372539
+ type7.definition = pruned;
372540
+ changed = true;
372541
+ }
372542
+ }
372543
+ }
372544
+ }
372545
+ function fieldNamesOf(definition3) {
372546
+ if (definition3.kind !== Kind.OBJECT_TYPE_DEFINITION && definition3.kind !== Kind.INTERFACE_TYPE_DEFINITION) {
372547
+ return /* @__PURE__ */ new Set();
372548
+ }
372549
+ return new Set((definition3.fields ?? []).map((field5) => field5.name.value));
372550
+ }
372551
+ function pruneUnsatisfiedInterfaces(types4) {
372552
+ for (const type7 of types4.values()) {
372553
+ const definition3 = type7.definition;
372554
+ if (definition3.kind !== Kind.OBJECT_TYPE_DEFINITION && definition3.kind !== Kind.INTERFACE_TYPE_DEFINITION) {
372555
+ continue;
372556
+ }
372557
+ const declared = definition3.interfaces ?? [];
372558
+ const ownFields = fieldNamesOf(definition3);
372559
+ const interfaces = declared.filter((node4) => {
372560
+ const implemented = types4.get(node4.name.value);
372561
+ if (implemented == null) {
372562
+ return false;
372563
+ }
372564
+ return [...fieldNamesOf(implemented.definition)].every((fieldName) => ownFields.has(fieldName));
372565
+ });
372566
+ if (interfaces.length !== declared.length) {
372567
+ type7.definition = { ...definition3, interfaces };
372568
+ }
372569
+ }
372570
+ }
372571
+ function pruneReferences(definition3, removed) {
372572
+ switch (definition3.kind) {
372573
+ case Kind.OBJECT_TYPE_DEFINITION:
372574
+ case Kind.INTERFACE_TYPE_DEFINITION: {
372575
+ const fields = (definition3.fields ?? []).filter((field5) => !removed.has(namedTypeName(field5.type)) && !(field5.arguments ?? []).some((argument) => removed.has(namedTypeName(argument.type))));
372576
+ if (fields.length === 0) {
372577
+ return null;
372578
+ }
372579
+ const interfaces = (definition3.interfaces ?? []).filter((node4) => !removed.has(node4.name.value));
372580
+ if (fields.length === definition3.fields?.length && interfaces.length === (definition3.interfaces ?? []).length) {
372581
+ return definition3;
372582
+ }
372583
+ return { ...definition3, fields, interfaces };
372584
+ }
372585
+ case Kind.INPUT_OBJECT_TYPE_DEFINITION: {
372586
+ const fields = (definition3.fields ?? []).filter((field5) => !removed.has(namedTypeName(field5.type)));
372587
+ if (fields.length === 0) {
372588
+ return null;
372589
+ }
372590
+ return fields.length === definition3.fields?.length ? definition3 : { ...definition3, fields };
372591
+ }
372592
+ case Kind.UNION_TYPE_DEFINITION: {
372593
+ const members = (definition3.types ?? []).filter((node4) => !removed.has(node4.name.value));
372594
+ if (members.length === 0) {
372595
+ return null;
372596
+ }
372597
+ return members.length === definition3.types?.length ? definition3 : { ...definition3, types: members };
372598
+ }
372599
+ case Kind.ENUM_TYPE_DEFINITION:
372600
+ return definition3.values?.length === 0 ? null : definition3;
372601
+ case Kind.SCALAR_TYPE_DEFINITION:
372602
+ return definition3;
372603
+ }
372604
+ }
372605
+ function mergeTypeDefinition({ incoming, isExtension, filePath, types: types4, conflicts: conflicts2, inaccessible }) {
372606
+ const name2 = incoming.name.value;
372607
+ const cleaned = cleanTypeDefinition(incoming, inaccessible);
372608
+ const existing = types4.get(name2);
372609
+ if (existing == null) {
372610
+ types4.set(name2, initMergedType(cleaned, filePath, isExtension));
372611
+ return;
372612
+ }
372613
+ if (existing.definition.kind !== cleaned.kind) {
372614
+ conflicts2.push({
372615
+ typeName: name2,
372616
+ memberName: "<declaration>",
372617
+ kept: existing.filePath,
372618
+ dropped: filePath
372619
+ });
372620
+ return;
372621
+ }
372622
+ if (existing.fromExtension && !isExtension) {
372623
+ const promoted = initMergedType(cleaned, filePath, false);
372624
+ promoted.definition = mergeMembers(promoted, existing.definition, existing.filePath, conflicts2);
372625
+ types4.set(name2, promoted);
372626
+ return;
372627
+ }
372628
+ existing.definition = mergeMembers(existing, cleaned, filePath, conflicts2);
372629
+ }
372630
+ function initMergedType(definition3, filePath, fromExtension) {
372631
+ const members = /* @__PURE__ */ new Map();
372632
+ for (const member of getMembers(definition3)) {
372633
+ members.set(member.name.value, { filePath, signature: memberSignature(member) });
372634
+ }
372635
+ return { definition: definition3, filePath, members, fromExtension };
372636
+ }
372637
+ function getMembers(definition3) {
372638
+ switch (definition3.kind) {
372639
+ case Kind.OBJECT_TYPE_DEFINITION:
372640
+ case Kind.INTERFACE_TYPE_DEFINITION:
372641
+ case Kind.INPUT_OBJECT_TYPE_DEFINITION:
372642
+ return definition3.fields ?? [];
372643
+ case Kind.ENUM_TYPE_DEFINITION:
372644
+ return definition3.values ?? [];
372645
+ case Kind.UNION_TYPE_DEFINITION:
372646
+ return definition3.types ?? [];
372647
+ case Kind.SCALAR_TYPE_DEFINITION:
372648
+ return [];
372649
+ }
372650
+ }
372651
+ function memberSignature(member) {
372652
+ if (member.kind === Kind.FIELD_DEFINITION) {
372653
+ const args = (member.arguments ?? []).map((argument) => `${argument.name.value}:${print(argument.type)}`);
372654
+ return `${print(member.type)}(${args.join(",")})`;
372655
+ }
372656
+ if (member.kind === Kind.INPUT_VALUE_DEFINITION) {
372657
+ return print(member.type);
372658
+ }
372659
+ return member.name.value;
372660
+ }
372661
+ function mergeMembers(existing, incoming, filePath, conflicts2) {
372662
+ const base4 = existing.definition;
372663
+ const description = base4.description ?? incoming.description;
372664
+ const typeName = base4.name.value;
372665
+ const dedupe = (current3, additional) => {
372666
+ const merged = [...current3 ?? []];
372667
+ for (const member of additional ?? []) {
372668
+ const memberName = member.name.value;
372669
+ const signature = memberSignature(member);
372670
+ const owner = existing.members.get(memberName);
372671
+ if (owner != null) {
372672
+ if (owner.signature !== signature) {
372673
+ conflicts2.push({ typeName, memberName, kept: owner.filePath, dropped: filePath });
372674
+ }
372675
+ continue;
372676
+ }
372677
+ existing.members.set(memberName, { filePath, signature });
372678
+ merged.push(member);
372679
+ }
372680
+ return merged;
372681
+ };
372682
+ if (base4.kind === Kind.OBJECT_TYPE_DEFINITION && incoming.kind === Kind.OBJECT_TYPE_DEFINITION) {
372683
+ return {
372684
+ ...base4,
372685
+ description,
372686
+ interfaces: dedupeNamedTypes(base4.interfaces, incoming.interfaces),
372687
+ fields: dedupe(base4.fields, incoming.fields)
372688
+ };
372689
+ }
372690
+ if (base4.kind === Kind.INTERFACE_TYPE_DEFINITION && incoming.kind === Kind.INTERFACE_TYPE_DEFINITION) {
372691
+ return {
372692
+ ...base4,
372693
+ description,
372694
+ interfaces: dedupeNamedTypes(base4.interfaces, incoming.interfaces),
372695
+ fields: dedupe(base4.fields, incoming.fields)
372696
+ };
372697
+ }
372698
+ if (base4.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION && incoming.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION) {
372699
+ return { ...base4, description, fields: dedupe(base4.fields, incoming.fields) };
372700
+ }
372701
+ if (base4.kind === Kind.ENUM_TYPE_DEFINITION && incoming.kind === Kind.ENUM_TYPE_DEFINITION) {
372702
+ return { ...base4, description, values: dedupe(base4.values, incoming.values) };
372703
+ }
372704
+ if (base4.kind === Kind.UNION_TYPE_DEFINITION && incoming.kind === Kind.UNION_TYPE_DEFINITION) {
372705
+ return { ...base4, description, types: dedupeNamedTypes(base4.types, incoming.types) };
372706
+ }
372707
+ return { ...base4, description };
372708
+ }
372709
+ function dedupeNamedTypes(current3, additional) {
372710
+ const seen = new Set((current3 ?? []).map((type7) => type7.name.value));
372711
+ const merged = [...current3 ?? []];
372712
+ for (const type7 of additional ?? []) {
372713
+ if (!seen.has(type7.name.value)) {
372714
+ seen.add(type7.name.value);
372715
+ merged.push(type7);
372716
+ }
372717
+ }
372718
+ return merged;
372719
+ }
372720
+ var INACCESSIBLE_DIRECTIVE, FEDERATION_DIRECTIVES;
372721
+ var init_mergeGraphQlDocuments = __esm({
372722
+ "../api-importers/graphql/lib/mergeGraphQlDocuments.js"() {
372723
+ "use strict";
372724
+ init_graphql();
372725
+ INACCESSIBLE_DIRECTIVE = "inaccessible";
372726
+ FEDERATION_DIRECTIVES = /* @__PURE__ */ new Set([
372727
+ "link",
372728
+ "key",
372729
+ "external",
372730
+ "requires",
372731
+ "provides",
372732
+ "shareable",
372733
+ "inaccessible",
372734
+ "override",
372735
+ "extends",
372736
+ "composeDirective",
372737
+ "interfaceObject",
372738
+ "tag",
372739
+ "authenticated",
372740
+ "requiresScopes",
372741
+ "policy",
372742
+ // federation v2.8
372743
+ "context",
372744
+ "fromContext",
372745
+ // federation v2.9 (demand control)
372746
+ "cost",
372747
+ "listSize"
372748
+ ]);
372749
+ }
372750
+ });
372751
+
371777
372752
  // ../api-importers/graphql/lib/GraphQLConverter.js
371778
372753
  var import_promises39, GraphQLConverter;
371779
372754
  var init_GraphQLConverter = __esm({
@@ -371782,17 +372757,18 @@ var init_GraphQLConverter = __esm({
371782
372757
  init_js();
371783
372758
  import_promises39 = require("fs/promises");
371784
372759
  init_graphql();
372760
+ init_mergeGraphQlDocuments();
371785
372761
  GraphQLConverter = class {
371786
372762
  schema;
371787
372763
  context;
371788
- filePath;
372764
+ filePaths;
371789
372765
  namespace;
371790
372766
  processingTypes = /* @__PURE__ */ new Set();
371791
372767
  types = {};
371792
372768
  examplesByOperation = /* @__PURE__ */ new Map();
371793
372769
  constructor({ context: context3, filePath, namespace, examples }) {
371794
372770
  this.context = context3;
371795
- this.filePath = filePath;
372771
+ this.filePaths = Array.isArray(filePath) ? filePath : [filePath];
371796
372772
  this.namespace = namespace;
371797
372773
  if (examples != null) {
371798
372774
  for (const entry of examples) {
@@ -371803,15 +372779,32 @@ var init_GraphQLConverter = __esm({
371803
372779
  variables: ex.variables ?? void 0,
371804
372780
  response: ex.response ?? void 0
371805
372781
  }));
371806
- if (entry.operationType != null) {
371807
- const key2 = `${entry.operationType.toLowerCase()}:${entry.operation}`;
371808
- this.examplesByOperation.set(key2, mapped);
371809
- } else {
371810
- this.examplesByOperation.set(entry.operation, mapped);
372782
+ const key2 = entry.operationType != null ? `${entry.operationType.toLowerCase()}:${entry.operation}` : entry.operation;
372783
+ if (this.examplesByOperation.has(key2)) {
372784
+ this.context.logger.warn(`Multiple GraphQL examples provided for "${key2}". Keeping the first and ignoring the rest.`);
372785
+ continue;
371811
372786
  }
372787
+ this.examplesByOperation.set(key2, mapped);
371812
372788
  }
371813
372789
  }
371814
372790
  }
372791
+ // `@deprecated` is a standard, consumer-facing directive (unlike the federation directives
372792
+ // dropped during merging), so it is carried through as availability metadata.
372793
+ availabilityOf(node4) {
372794
+ return node4.deprecationReason != null ? "Deprecated" : void 0;
372795
+ }
372796
+ // The deprecation reason has nowhere to live in the FDR shape other than the description,
372797
+ // and it is the part consumers act on ("use X instead").
372798
+ describeWithDeprecation(node4) {
372799
+ const description = node4.description ?? void 0;
372800
+ if (node4.deprecationReason == null || node4.deprecationReason === DEFAULT_DEPRECATION_REASON) {
372801
+ return description;
372802
+ }
372803
+ const deprecation = `**Deprecated:** ${node4.deprecationReason}`;
372804
+ return description != null ? `${description}
372805
+
372806
+ ${deprecation}` : deprecation;
372807
+ }
371815
372808
  isBuiltInScalar(typeName) {
371816
372809
  return ["String", "Int", "Float", "Boolean", "ID"].includes(typeName);
371817
372810
  }
@@ -371844,9 +372837,42 @@ var init_GraphQLConverter = __esm({
371844
372837
  }
371845
372838
  return fields.every((f3) => f3.args.length > 0);
371846
372839
  }
372840
+ /**
372841
+ * Builds the merged document, reporting SDL problems instead of silently accepting them.
372842
+ *
372843
+ * `assumeValidSDL` is the fallback rather than the default: merged subgraphs can still carry
372844
+ * constructs that only compose at runtime (e.g. a directive whose definition lives in the
372845
+ * supergraph), and failing the docs build on those would make federation unusable.
372846
+ */
372847
+ buildSchema(document4) {
372848
+ try {
372849
+ const schema = buildASTSchema(document4);
372850
+ for (const error50 of validateSchema2(schema)) {
372851
+ this.context.logger.warn(`Invalid GraphQL schema: ${error50.message}`);
372852
+ }
372853
+ return schema;
372854
+ } catch (validationError) {
372855
+ let schema;
372856
+ try {
372857
+ schema = buildASTSchema(document4, { assumeValidSDL: true });
372858
+ } catch {
372859
+ throw validationError;
372860
+ }
372861
+ this.context.logger.warn(`Invalid GraphQL schema: ${validationError instanceof Error ? validationError.message : String(validationError)} Continuing without SDL validation.`);
372862
+ return schema;
372863
+ }
372864
+ }
371847
372865
  async convert() {
371848
- const sdlContent = await (0, import_promises39.readFile)(this.filePath, "utf-8");
371849
- this.schema = buildSchema(sdlContent);
372866
+ const sources = await Promise.all(this.filePaths.map(async (filePath) => ({
372867
+ filePath,
372868
+ sdl: await (0, import_promises39.readFile)(filePath, "utf-8")
372869
+ })));
372870
+ const { document: document4, conflicts: conflicts2 } = mergeGraphQlDocuments(sources);
372871
+ for (const conflict of conflicts2) {
372872
+ const member = `${conflict.typeName}.${conflict.memberName}`;
372873
+ this.context.logger.warn(conflict.kept === conflict.dropped ? `GraphQL schema conflict: ${member} is declared more than once in ${conflict.kept} with differing shapes. Keeping the first declaration.` : `GraphQL schema conflict: ${member} is defined in both ${conflict.kept} and ${conflict.dropped}. Keeping the definition from ${conflict.kept}.`);
372874
+ }
372875
+ this.schema = this.buildSchema(document4);
371850
372876
  this.collectTypeDefinitions();
371851
372877
  const pendingOperations = [];
371852
372878
  const queryType = this.schema.getQueryType();
@@ -372040,8 +373066,8 @@ var init_GraphQLConverter = __esm({
372040
373066
  operationType,
372041
373067
  name: name2,
372042
373068
  displayName: void 0,
372043
- description: field5.description ?? void 0,
372044
- availability: void 0,
373069
+ description: this.describeWithDeprecation(field5),
373070
+ availability: this.availabilityOf(field5),
372045
373071
  fieldPath: fieldPath != null && fieldPath.length > 0 ? fieldPath : void 0,
372046
373072
  arguments: args.length > 0 ? args : void 0,
372047
373073
  returnType: this.convertOutputType(field5.type),
@@ -372052,8 +373078,8 @@ var init_GraphQLConverter = __esm({
372052
373078
  convertArgument(arg) {
372053
373079
  return {
372054
373080
  name: arg.name,
372055
- description: arg.description ?? void 0,
372056
- availability: void 0,
373081
+ description: this.describeWithDeprecation(arg),
373082
+ availability: this.availabilityOf(arg),
372057
373083
  type: this.convertInputType(arg.type),
372058
373084
  defaultValue: arg.defaultValue
372059
373085
  };
@@ -372223,8 +373249,8 @@ var init_GraphQLConverter = __esm({
372223
373249
  type: "enum",
372224
373250
  values: values2.map((value2) => ({
372225
373251
  value: value2.name,
372226
- description: value2.description ?? void 0,
372227
- availability: void 0
373252
+ description: this.describeWithDeprecation(value2),
373253
+ availability: this.availabilityOf(value2)
372228
373254
  })),
372229
373255
  default: void 0
372230
373256
  };
@@ -372234,8 +373260,8 @@ var init_GraphQLConverter = __esm({
372234
373260
  const properties7 = Object.entries(fields).map(([fieldName, field5]) => ({
372235
373261
  key: FdrAPI_exports.PropertyKey(fieldName),
372236
373262
  valueType: this.convertOutputType(field5.type),
372237
- description: field5.description ?? void 0,
372238
- availability: void 0,
373263
+ description: this.describeWithDeprecation(field5),
373264
+ availability: this.availabilityOf(field5),
372239
373265
  propertyAccess: void 0,
372240
373266
  arguments: field5.args.length > 0 ? field5.args.map((arg) => this.convertArgument(arg)) : void 0
372241
373267
  }));
@@ -372282,8 +373308,8 @@ var init_GraphQLConverter = __esm({
372282
373308
  const properties7 = Object.entries(fields).map(([fieldName, field5]) => ({
372283
373309
  key: FdrAPI_exports.PropertyKey(fieldName),
372284
373310
  valueType: this.convertOutputType(field5.type),
372285
- description: field5.description ?? void 0,
372286
- availability: void 0,
373311
+ description: this.describeWithDeprecation(field5),
373312
+ availability: this.availabilityOf(field5),
372287
373313
  propertyAccess: void 0,
372288
373314
  arguments: field5.args.length > 0 ? field5.args.map((arg) => this.convertArgument(arg)) : void 0
372289
373315
  }));
@@ -372299,8 +373325,8 @@ var init_GraphQLConverter = __esm({
372299
373325
  const properties7 = Object.entries(fields).map(([fieldName, field5]) => ({
372300
373326
  key: FdrAPI_exports.PropertyKey(fieldName),
372301
373327
  valueType: this.convertInputType(field5.type),
372302
- description: field5.description ?? void 0,
372303
- availability: void 0,
373328
+ description: this.describeWithDeprecation(field5),
373329
+ availability: this.availabilityOf(field5),
372304
373330
  propertyAccess: void 0
372305
373331
  }));
372306
373332
  return {
@@ -372687,20 +373713,21 @@ var init_OSSWorkspace = __esm({
372687
373713
  async processGraphQLSpecs(context3) {
372688
373714
  const { GraphQLConverter: GraphQLConverter2 } = await Promise.resolve().then(() => (init_lib34(), lib_exports9));
372689
373715
  const graphqlSpecs = this.allSpecs.filter((spec) => spec.type === "graphql");
372690
- for (const spec of graphqlSpecs) {
373716
+ for (const [, specs] of groupGraphQLSpecsByNamespace(graphqlSpecs)) {
373717
+ const filePaths = specs.map((spec) => spec.absoluteFilepath);
372691
373718
  try {
372692
- const examples = await loadGraphQlExamples(spec.absoluteFilepathToExamples, context3);
373719
+ const examples = (await Promise.all(specs.map((spec) => loadGraphQlExamples(spec.absoluteFilepathToExamples, context3)))).filter(isNonNullish).flat();
372693
373720
  const converter = new GraphQLConverter2({
372694
373721
  context: context3,
372695
- filePath: spec.absoluteFilepath,
372696
- namespace: spec.namespace,
373722
+ filePath: filePaths,
373723
+ namespace: specs[0]?.namespace,
372697
373724
  examples
372698
373725
  });
372699
373726
  const result = await converter.convert();
372700
373727
  Object.assign(this.graphqlOperations, result.graphqlOperations);
372701
373728
  Object.assign(this.graphqlTypes, result.types);
372702
373729
  } catch (error50) {
372703
- context3.logger.error(`Failed to process GraphQL spec ${spec.absoluteFilepath}:`, extractErrorMessage(error50));
373730
+ context3.logger.error(`Failed to process GraphQL spec(s) ${filePaths.join(", ")}:`, extractErrorMessage(error50));
372704
373731
  }
372705
373732
  }
372706
373733
  }
@@ -472773,6 +473800,7 @@ var import_dayjs3, import_utc3, import_fs26, import_promises80, import_gray_matt
472773
473800
  var init_DocsDefinitionResolver = __esm({
472774
473801
  "../docs-resolver/lib/DocsDefinitionResolver.js"() {
472775
473802
  "use strict";
473803
+ init_lib17();
472776
473804
  init_lib36();
472777
473805
  init_lib20();
472778
473806
  init_lib4();
@@ -474195,25 +475223,27 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
474195
475223
  return { operations: graphqlOperations, types: graphqlTypes, namespacesByOperationId };
474196
475224
  }
474197
475225
  const graphqlSpecs = workspace.allSpecs.filter((spec) => spec.type === "graphql");
474198
- for (const spec of graphqlSpecs) {
475226
+ for (const [, specs] of groupGraphQLSpecsByNamespace(graphqlSpecs)) {
475227
+ const filePaths = specs.map((spec) => spec.absoluteFilepath);
475228
+ const namespace = specs[0]?.namespace;
474199
475229
  try {
474200
- const examples = await this.loadGraphQlExamples(spec.absoluteFilepathToExamples);
475230
+ const examples = (await Promise.all(specs.map((spec) => this.loadGraphQlExamples(spec.absoluteFilepathToExamples)))).filter(isNonNullish).flat();
474201
475231
  const converter = new GraphQLConverter({
474202
475232
  context: this.taskContext,
474203
- filePath: spec.absoluteFilepath,
474204
- namespace: spec.namespace,
475233
+ filePath: filePaths,
475234
+ namespace,
474205
475235
  examples
474206
475236
  });
474207
475237
  const graphqlResult = await converter.convert();
474208
475238
  Object.assign(graphqlOperations, graphqlResult.graphqlOperations);
474209
475239
  Object.assign(graphqlTypes, graphqlResult.types);
474210
- if (spec.namespace) {
475240
+ if (namespace) {
474211
475241
  for (const operationId of Object.keys(graphqlResult.graphqlOperations)) {
474212
- namespacesByOperationId.set(FdrAPI_exports.GraphQlOperationId(operationId), spec.namespace);
475242
+ namespacesByOperationId.set(FdrAPI_exports.GraphQlOperationId(operationId), namespace);
474213
475243
  }
474214
475244
  }
474215
475245
  } catch (error50) {
474216
- this.taskContext.logger.error(`Failed to process GraphQL spec ${spec.absoluteFilepath}:`, String(error50));
475246
+ this.taskContext.logger.error(`Failed to process GraphQL spec(s) ${filePaths.join(", ")}:`, extractErrorMessage(error50));
474217
475247
  }
474218
475248
  }
474219
475249
  return { operations: graphqlOperations, types: graphqlTypes, namespacesByOperationId };
@@ -703487,7 +704517,7 @@ var AccessTokenPosthogManager = class {
703487
704517
  properties: {
703488
704518
  ...event,
703489
704519
  ...event.properties,
703490
- version: "5.104.1",
704520
+ version: "5.105.1",
703491
704521
  usingAccessToken: true,
703492
704522
  ...getRunIdProperties()
703493
704523
  }
@@ -703553,7 +704583,7 @@ var UserPosthogManager = class {
703553
704583
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
703554
704584
  event: "CLI",
703555
704585
  properties: {
703556
- version: "5.104.1",
704586
+ version: "5.105.1",
703557
704587
  ...event,
703558
704588
  ...event.properties,
703559
704589
  usingAccessToken: false,
@@ -884936,7 +885966,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
884936
885966
  var LOGS_FOLDER_NAME = "logs";
884937
885967
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
884938
885968
  function getCliSource() {
884939
- const version7 = "5.104.1";
885969
+ const version7 = "5.105.1";
884940
885970
  return `cli@${version7}`;
884941
885971
  }
884942
885972
  var DebugLogger = class {
@@ -911022,7 +912052,7 @@ var LegacyDocsPublisher = class {
911022
912052
  previewId,
911023
912053
  disableTemplates: void 0,
911024
912054
  skipUpload,
911025
- cliVersion: "5.104.1",
912055
+ cliVersion: "5.105.1",
911026
912056
  loginCommand: "fern auth login"
911027
912057
  });
911028
912058
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -951691,6 +952721,7 @@ var RUST_KEYWORDS = /* @__PURE__ */ new Set([
951691
952721
  "virtual",
951692
952722
  "yield"
951693
952723
  ]);
952724
+ var RUST_NON_RAW_KEYWORDS = /* @__PURE__ */ new Set(["crate", "self", "Self", "super"]);
951694
952725
  var RUST_RESERVED_TYPES = /* @__PURE__ */ new Set([
951695
952726
  "Box",
951696
952727
  "Option",
@@ -952110,6 +953141,9 @@ function escapeRustKeyword(name2) {
952110
953141
  if (/^[0-9]/.test(name2)) {
952111
953142
  return `_${name2}`;
952112
953143
  }
953144
+ if (RUST_NON_RAW_KEYWORDS.has(name2)) {
953145
+ return `${name2}_`;
953146
+ }
952113
953147
  return RUST_KEYWORDS.has(name2) ? `r#${name2}` : name2;
952114
953148
  }
952115
953149
  function escapeRustReservedType(name2) {
@@ -978393,7 +979427,7 @@ function getAutomationContextFromEnv() {
978393
979427
  config_branch: process.env.FERN_CONFIG_BRANCH,
978394
979428
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
978395
979429
  trigger: process.env.GITHUB_EVENT_NAME,
978396
- cli_version: "5.104.1"
979430
+ cli_version: "5.105.1"
978397
979431
  };
978398
979432
  }
978399
979433
  function isAutomationMode() {
@@ -979225,7 +980259,7 @@ var CliContext = class _CliContext {
979225
980259
  if (false) {
979226
980260
  this.logger.error("CLI_VERSION is not defined");
979227
980261
  }
979228
- return "5.104.1";
980262
+ return "5.105.1";
979229
980263
  }
979230
980264
  getCliName() {
979231
980265
  if (false) {