Looks like there was some work done to allow exporting the schema, but I think it missed a function or two. I encountered this error when attempting to export my schema:
/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/dist/exportSchema.js:821
throw new Error(`The function being exported as ${locationHint} references external variables: \`${[
^
Error: The function being exported as StringFilter.fields[isNull].extensions.grafast["applyPlan"][$$scope][2] references external variables: `sql`. Please ensure this function is wrapped in `EXPORTABLE(() => ...)`. Fn:
(i, _v, $input) => sql `${i} ${$input.eval() ? sql `IS NULL` : sql `IS NOT NULL`}`
at funcToAst (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1352:11)
at func (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1251:12)
at _convertToAST (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1028:12)
at convertToIdentifierViaAST (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1156:7)
at <anonymous> (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1279:12)
at Array.map (<anonymous>)
at factoryAst (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1265:37)
at convertToIdentifierViaAST (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1155:7)
at handleSubvalue (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:983:19)
at <anonymous> (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1050:24)
at Array.forEach (<anonymous>)
at _convertToAST (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1048:13)
at convertToIdentifierViaAST (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1156:7)
at <anonymous> (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1652:13)
at Array.forEach (<anonymous>)
at exportSchemaTypeDefs (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1536:15)
at exportSchemaAsString (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1850:5)
at exportSchema (/home/nick/code/cloud/tycho-service/packages/operations-metrics/node_modules/graphile-export/src/exportSchema.ts:1949:26)
at main (/home/nick/code/cloud/tycho-service/packages/operations-metrics/tools/export-schema.ts:14:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at <anonymous> (/home/nick/code/cloud/tycho-service/packages/operations-metrics/tools/export-schema.ts:21:1)
Node.js v18.19.0
npm ERR! Lifecycle script `export-schema` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: @tailosinc/tycho-operations-metrics-service@1.0.0
npm ERR! at location: /home/nick/code/cloud/tycho-service/packages/operations-metrics
Looks like there was some work done to allow exporting the schema, but I think it missed a function or two. I encountered this error when attempting to export my schema:
Relevant packages from
package.json
taken from this latest release: