@pome-sh/cli 0.3.0 → 0.5.0
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.
- package/README.md +40 -3
- package/dist/build-info.json +3 -3
- package/dist/src/cli/agent-identity.d.ts +20 -0
- package/dist/src/cli/agent-identity.js +59 -0
- package/dist/src/cli/agent-resolver.d.ts +26 -0
- package/dist/src/cli/agent-resolver.js +121 -0
- package/dist/src/cli/compile-seeds.js +1 -1
- package/dist/src/cli/credentials.d.ts +4 -0
- package/dist/src/cli/credentials.js +8 -0
- package/dist/src/cli/docs-topics.js +53 -16
- package/dist/src/cli/eval.d.ts +10 -6
- package/dist/src/cli/eval.js +21 -29
- package/dist/src/cli/frameworks.d.ts +12 -0
- package/dist/src/cli/frameworks.js +62 -0
- package/dist/src/cli/install.d.ts +4 -41
- package/dist/src/cli/install.js +31 -412
- package/dist/src/cli/link-cache.d.ts +23 -0
- package/dist/src/cli/link-cache.js +91 -0
- package/dist/src/cli/login.js +1 -1
- package/dist/src/cli/main.js +120 -88
- package/dist/src/cli/project-config.d.ts +27 -25
- package/dist/src/cli/project-config.js +100 -54
- package/dist/src/cli/register.d.ts +5 -31
- package/dist/src/cli/register.js +118 -116
- package/dist/src/cli/scenarios-catalog.js +51 -1
- package/dist/src/cli/scenarios.js +10 -10
- package/dist/src/cli/session.js +16 -8
- package/dist/src/doctor/checks.js +27 -25
- package/dist/src/doctor/scan.js +3 -0
- package/dist/src/fix-prompt/prompt.js +3 -3
- package/dist/src/fix-prompt/prompts/fix-prompt-v1.md +3 -3
- package/dist/src/hosted/client.d.ts +8 -3
- package/dist/src/hosted/client.js +3 -0
- package/dist/src/recorder/inspect.js +1 -1
- package/dist/src/runner/groupRender.d.ts +1 -1
- package/dist/src/runner/groupRender.js +3 -3
- package/dist/src/runner/runScenario.d.ts +626 -2
- package/dist/src/runner/runScenario.js +5 -0
- package/dist/src/runner/runScenarioHosted.d.ts +3 -0
- package/dist/src/runner/runScenarioHosted.js +29 -13
- package/dist/src/runner/runTrialGroup.d.ts +3 -1
- package/dist/src/runner/runTrialGroup.js +13 -11
- package/dist/src/scenario/parseScenario.js +42 -14
- package/dist/src/scenario/scenarioSchema.d.ts +1472 -4
- package/dist/src/scenario/scenarioSchema.js +4 -0
- package/dist/src/twin/twinHarness.d.ts +2 -0
- package/dist/src/twin/twinHarness.js +48 -1
- package/dist/src/twin/twinStart.d.ts +3 -1
- package/dist/src/twin/twinStart.js +22 -4
- package/node_modules/@hono/node-server/dist/index.cjs +145 -18
- package/node_modules/@hono/node-server/dist/index.mjs +145 -18
- package/node_modules/@hono/node-server/dist/serve-static.cjs +53 -12
- package/node_modules/@hono/node-server/dist/serve-static.mjs +53 -12
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@pome-sh/sdk/dist/index.d.ts +38 -1
- package/node_modules/@pome-sh/sdk/dist/index.js +16 -7
- package/node_modules/@pome-sh/sdk/dist/index.js.map +1 -1
- package/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +21 -5
- package/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +1 -1
- package/node_modules/@pome-sh/sdk/dist/parity.d.ts +6 -0
- package/node_modules/@pome-sh/sdk/dist/parity.js +12 -1
- package/node_modules/@pome-sh/sdk/dist/parity.js.map +1 -1
- package/node_modules/@pome-sh/sdk/dist/recorder.d.ts +6 -0
- package/node_modules/@pome-sh/sdk/dist/recorder.js +27 -32
- package/node_modules/@pome-sh/sdk/dist/recorder.js.map +1 -1
- package/node_modules/@pome-sh/sdk/dist/server.js +9 -4
- package/node_modules/@pome-sh/sdk/dist/server.js.map +1 -1
- package/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +2 -0
- package/node_modules/@pome-sh/sdk/dist/tool-context.js +3 -0
- package/node_modules/@pome-sh/sdk/dist/tool-context.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +39 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +39 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/index.d.ts +4 -3
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/index.js +4 -3
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/manifest.d.ts +31 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/manifest.js +76 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/manifest.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +45 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +8 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/project.js +14 -6
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +6 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +28 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +63 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/recorder-events.js +37 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/rest.d.ts +61 -2
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/rest.js +112 -2
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/run.d.ts +7 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/run.js +5 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +14 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +46 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +560 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-state.js +98 -2
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +3 -3
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/sessions.js +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +15 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task-vocab.js +15 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task.d.ts +376 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/manifest-schema.json +68 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/package.json +5 -4
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
- package/node_modules/@pome-sh/sdk/package.json +5 -5
- package/node_modules/@pome-sh/shared-types/dist/index.d.ts +1 -0
- package/node_modules/@pome-sh/shared-types/dist/index.js +1 -0
- package/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/manifest.d.ts +31 -0
- package/node_modules/@pome-sh/shared-types/dist/manifest.js +76 -0
- package/node_modules/@pome-sh/shared-types/dist/manifest.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/otel/project.js +14 -6
- package/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +6 -0
- package/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +21 -0
- package/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +1 -1
- package/node_modules/@pome-sh/shared-types/dist/recorder-events.js +1 -1
- package/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/rest.d.ts +11 -0
- package/node_modules/@pome-sh/shared-types/dist/rest.js +38 -0
- package/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +1033 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-state.js +285 -2
- package/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +1 -1
- package/node_modules/@pome-sh/shared-types/dist/sessions.js +1 -1
- package/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/task.d.ts +690 -0
- package/node_modules/@pome-sh/shared-types/manifest-schema.json +68 -0
- package/node_modules/@pome-sh/shared-types/package.json +5 -4
- package/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
- package/node_modules/@pome-sh/twin-github/README.md +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/access-control.d.ts +3 -3
- package/node_modules/@pome-sh/twin-github/dist/src/domain.d.ts +5 -5
- package/node_modules/@pome-sh/twin-github/dist/src/seed.d.ts +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/serializers.d.ts +3 -3
- package/node_modules/@pome-sh/twin-github/dist/src/tools.d.ts +21 -21
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +35 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/admin-gate.js +103 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/auth.d.ts +100 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/auth.js +262 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/auth.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/build-info.d.ts +7 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/build-info.js +14 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/build-info.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/db.d.ts +44 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/db.js +113 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/db.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/errors.d.ts +24 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/errors.js +61 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +43 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/failure-injection.js +160 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +121 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +204 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +8 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/fidelity.js +39 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/fidelity.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/index.d.ts +372 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/index.js +139 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +10 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +221 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/parity.d.ts +61 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/parity.js +123 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/parity.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/recorder.d.ts +120 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/recorder.js +368 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/recorder.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/redaction.d.ts +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/redaction.js +3 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +54 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/server-helpers.js +181 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/server.d.ts +46 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/server.js +394 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/server.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +8 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/tool-context.js +22 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/dist/tool-context.js.map +1 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/sdk/package.json +54 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +4 -2
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/project.js +14 -6
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +6 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +21 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/recorder-events.js +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/rest.d.ts +5 -2
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/rest.js +9 -4
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/run.js +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +560 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/seed-state.js +98 -2
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/sessions.js +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +15 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task-vocab.js +15 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/dist/task.d.ts +374 -0
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/package.json +4 -4
- package/node_modules/@pome-sh/twin-github/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
- package/node_modules/@pome-sh/twin-github/package.json +7 -7
- package/node_modules/@pome-sh/twin-gmail/CHANGELOG.md +14 -0
- package/node_modules/@pome-sh/twin-gmail/HOSTED.md +23 -0
- package/node_modules/@pome-sh/twin-gmail/LIMITS.md +41 -0
- package/node_modules/@pome-sh/twin-gmail/README.md +109 -0
- package/node_modules/@pome-sh/twin-gmail/REFERENCE-DIVERGENCES.md +42 -0
- package/node_modules/@pome-sh/twin-gmail/dist/fixtures/mcp-tools-list.canonical.json +974 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/db.d.ts +4 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/db.js +206 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/db.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/domain-search.d.ts +5 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/domain-search.js +89 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/domain-search.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/domain.d.ts +110 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/domain.js +407 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/domain.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/errors.d.ts +12 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/errors.js +115 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/identity.d.ts +10 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/identity.js +29 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/identity.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/index.d.ts +12 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/index.js +13 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/mcp-schemas.d.ts +176 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/mcp-schemas.js +162 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/mcp-schemas.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/mcp.d.ts +3 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/mcp.js +268 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/mcp.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/mime.d.ts +49 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/mime.js +315 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/mime.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/page-tokens.d.ts +11 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/page-tokens.js +70 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/page-tokens.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/recording.d.ts +6 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/recording.js +74 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/recording.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-common.d.ts +28 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-common.js +120 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-common.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-drafts.d.ts +3 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-drafts.js +85 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-drafts.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-kit.d.ts +19 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-kit.js +52 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-kit.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-messages.d.ts +3 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-messages.js +144 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-messages.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-resources.d.ts +3 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-resources.js +204 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes-resources.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes.d.ts +4 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes.js +11 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-routes.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-serializers.d.ts +18 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-serializers.js +153 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-serializers.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-store.d.ts +75 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-store.js +282 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-store.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-upload.d.ts +12 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-upload.js +127 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/rest-upload.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/search.d.ts +61 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/search.js +504 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/search.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/seed.d.ts +230 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/seed.js +269 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/seed.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/seeding.d.ts +3 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/seeding.js +89 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/seeding.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/server.d.ts +2 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/server.js +21 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/server.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/state.d.ts +55 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/state.js +225 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/state.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/storage.d.ts +20 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/storage.js +171 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/storage.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/twin.d.ts +17 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/twin.js +99 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/twin.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/types.d.ts +149 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/types.js +2 -0
- package/node_modules/@pome-sh/twin-gmail/dist/src/types.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/fidelity.inventory.json +958 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/README.md +28 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/gmail-discovery-v1.meta.json +6 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/gmail-discovery-v1.raw.json +4510 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-initialize.meta.json +8 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-initialize.raw.json +1 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-call-unauth-error.raw.json +1 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-call.representative.json +508 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-list.canonical.json +974 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-list.meta.json +29 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/mcp-tools-list.raw.json +1 -0
- package/node_modules/@pome-sh/twin-gmail/fixtures/rest-surface.json +3502 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +35 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/admin-gate.js +103 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/auth.d.ts +100 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/auth.js +262 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/auth.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/build-info.d.ts +7 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/build-info.js +14 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/build-info.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/db.d.ts +44 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/db.js +113 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/db.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/errors.d.ts +24 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/errors.js +61 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +43 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/failure-injection.js +160 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +121 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +204 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +8 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity.js +39 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/fidelity.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/index.d.ts +372 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/index.js +139 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +10 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +221 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/parity.d.ts +61 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/parity.js +123 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/parity.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/recorder.d.ts +120 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/recorder.js +368 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/recorder.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/redaction.d.ts +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/redaction.js +3 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +54 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server-helpers.js +181 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server.d.ts +46 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server.js +394 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/server.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +8 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/tool-context.js +22 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/dist/tool-context.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/sdk/package.json +54 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/errors.d.ts +39 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/errors.js +33 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +254 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +122 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/github-access-control.d.ts +175 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/github-access-control.js +182 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/github-access-control.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/identity.d.ts +90 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/identity.js +72 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/identity.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/index.d.ts +27 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/index.js +34 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +331 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js +33 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.d.ts +65 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js +455 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.d.ts +39 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js +47 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/index.d.ts +25 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/index.js +27 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.d.ts +100 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +193 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts +64 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/map-span.js +112 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/map-span.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts +26 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/nano.js +61 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts +42 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/project.js +104 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +57 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +102 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/span-event.d.ts +134 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/span-event.js +152 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/otel/span-event.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +480 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/recorder-events.js +270 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/redaction.d.ts +2 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/redaction.js +152 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/rest.d.ts +248 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/rest.js +308 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/run.d.ts +208 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/run.js +170 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +14 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +46 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +1006 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-state.js +263 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +53 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/sessions.js +51 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +80 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task-vocab.js +98 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task.d.ts +859 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task.js +60 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/dist/task.js.map +1 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/package.json +54 -0
- package/node_modules/@pome-sh/twin-gmail/node_modules/@pome-sh/shared-types/trace-contract.json +41 -0
- package/node_modules/@pome-sh/twin-gmail/package.json +75 -0
- package/node_modules/@pome-sh/twin-linear/CHANGELOG.md +15 -0
- package/node_modules/@pome-sh/twin-linear/FIDELITY.md +62 -0
- package/node_modules/@pome-sh/twin-linear/HOSTED.md +46 -0
- package/node_modules/@pome-sh/twin-linear/LIMITS.md +54 -0
- package/node_modules/@pome-sh/twin-linear/README.md +107 -0
- package/node_modules/@pome-sh/twin-linear/REFERENCE-DIVERGENCES.md +50 -0
- package/node_modules/@pome-sh/twin-linear/dist/fixtures/mcp-tools-list.canonical.json +353 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/auth-credential.d.ts +8 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/auth-credential.js +55 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/auth-credential.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/db.d.ts +4 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/db.js +333 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/db.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/agents.d.ts +29 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/agents.js +103 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/agents.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/catalog.d.ts +9 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/catalog.js +41 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/catalog.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/comments.d.ts +13 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/comments.js +108 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/comments.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/documents.d.ts +31 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/documents.js +113 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/documents.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/index.d.ts +4 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/index.js +6 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/issue-relations.d.ts +13 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/issue-relations.js +60 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/issue-relations.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/issues.d.ts +57 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/issues.js +356 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/issues.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/labels.d.ts +18 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/labels.js +117 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/labels.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/linear-domain.d.ts +190 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/linear-domain.js +315 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/linear-domain.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/normalize.d.ts +8 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/normalize.js +61 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/normalize.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/oauth-store.d.ts +55 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/oauth-store.js +127 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/oauth-store.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/projects-cycles.d.ts +17 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/projects-cycles.js +51 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/projects-cycles.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/rows.d.ts +211 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/rows.js +216 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/rows.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/webhooks.d.ts +5 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/webhooks.js +12 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/domain/webhooks.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/errors.d.ts +26 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/errors.js +128 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/formatters.d.ts +27 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/formatters.js +261 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/formatters.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/issue-filter.d.ts +5 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/issue-filter.js +122 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/issue-filter.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/mutation-inputs.d.ts +152 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/mutation-inputs.js +255 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/mutation-inputs.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/resolvers.d.ts +6 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/resolvers.js +169 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/resolvers.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/routes.d.ts +6 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/routes.js +176 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/routes.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/schema.d.ts +3 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/schema.js +504 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/graphql/schema.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/identity.d.ts +7 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/identity.js +14 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/identity.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/ids.d.ts +5 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/ids.js +28 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/ids.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/index.d.ts +16 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/index.js +14 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/mcp-schemas.d.ts +121 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/mcp-schemas.js +126 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/mcp-schemas.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/mcp.d.ts +4 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/mcp.js +430 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/mcp.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/oauth/routes.d.ts +5 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/oauth/routes.js +340 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/oauth/routes.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/pagination.d.ts +29 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/pagination.js +101 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/pagination.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/recording.d.ts +2 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/recording.js +46 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/recording.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/routes.d.ts +9 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/routes.js +10 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/routes.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/seed/apply.d.ts +4 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/seed/apply.js +186 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/seed/apply.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/seed.d.ts +158 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/seed.js +541 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/seed.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/comment.d.ts +29 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/comment.js +47 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/comment.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/document.d.ts +15 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/document.js +17 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/document.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/index.d.ts +3 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/index.js +5 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/issue.d.ts +86 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/issue.js +102 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/serializers/issue.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/server.d.ts +2 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/server.js +41 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/server.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/state.d.ts +51 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/state.js +211 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/state.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/twin.d.ts +21 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/twin.js +107 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/twin.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/types.d.ts +360 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/types.js +19 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/types.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/webhook-policy.d.ts +27 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/webhook-policy.js +107 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/webhook-policy.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/webhook-url.d.ts +3 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/webhook-url.js +26 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/webhook-url.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/webhooks/dispatch.d.ts +30 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/webhooks/dispatch.js +93 -0
- package/node_modules/@pome-sh/twin-linear/dist/src/webhooks/dispatch.js.map +1 -0
- package/node_modules/@pome-sh/twin-linear/fidelity.inventory.json +249 -0
- package/node_modules/@pome-sh/twin-linear/fixtures/README.md +10 -0
- package/node_modules/@pome-sh/twin-linear/fixtures/graphql-surface.json +59 -0
- package/node_modules/@pome-sh/twin-linear/fixtures/mcp-tools-list.canonical.json +353 -0
- package/node_modules/@pome-sh/twin-linear/package.json +71 -0
- package/node_modules/@pome-sh/twin-slack/README.md +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +35 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/admin-gate.js +103 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/auth.d.ts +100 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/auth.js +262 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/auth.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/build-info.d.ts +7 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/build-info.js +14 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/build-info.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/db.d.ts +44 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/db.js +113 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/db.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/errors.d.ts +24 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/errors.js +61 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +43 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/failure-injection.js +160 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +121 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +204 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +8 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity.js +39 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/fidelity.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/index.d.ts +372 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/index.js +139 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +10 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +221 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/parity.d.ts +61 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/parity.js +123 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/parity.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/recorder.d.ts +120 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/recorder.js +368 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/recorder.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/redaction.d.ts +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/redaction.js +3 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +54 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server-helpers.js +181 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server.d.ts +46 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server.js +394 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/server.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +8 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/tool-context.js +22 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/dist/tool-context.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/sdk/package.json +54 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +4 -2
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/project.js +14 -6
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +6 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +21 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/recorder-events.js +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.d.ts +5 -2
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.js +9 -4
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/run.js +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +560 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/seed-state.js +98 -2
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/sessions.js +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +15 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task-vocab.js +15 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/dist/task.d.ts +374 -0
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/package.json +4 -4
- package/node_modules/@pome-sh/twin-slack/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
- package/node_modules/@pome-sh/twin-slack/package.json +7 -7
- package/node_modules/@pome-sh/twin-stripe/README.md +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.d.ts +2 -2
- package/node_modules/@pome-sh/twin-stripe/dist/src/seed.d.ts +8 -8
- package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.d.ts +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/admin-gate.d.ts +35 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/admin-gate.js +103 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/admin-gate.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/auth.d.ts +100 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/auth.js +262 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/auth.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/build-info.d.ts +7 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/build-info.js +14 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/build-info.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/db.d.ts +44 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/db.js +113 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/db.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/errors.d.ts +24 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/errors.js +61 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/failure-injection.d.ts +43 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/failure-injection.js +160 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/failure-injection.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +121 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +204 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity.d.ts +8 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity.js +39 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/fidelity.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/index.d.ts +372 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/index.js +139 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.d.ts +10 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js +221 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/mcp-jsonrpc.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/parity.d.ts +61 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/parity.js +123 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/parity.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/recorder.d.ts +120 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/recorder.js +368 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/recorder.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/redaction.d.ts +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/redaction.js +3 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +54 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server-helpers.js +181 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server.d.ts +46 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server.js +394 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/server.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/tool-context.d.ts +8 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/tool-context.js +22 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/dist/tool-context.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/sdk/package.json +54 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +4 -2
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/project.js +14 -6
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +6 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +21 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/recorder-events.js +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.d.ts +5 -2
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.js +9 -4
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/run.js +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +560 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/seed-state.js +98 -2
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/sessions.js +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +15 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task-vocab.js +15 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/dist/task.d.ts +374 -0
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/package.json +4 -4
- package/node_modules/@pome-sh/twin-stripe/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
- package/node_modules/@pome-sh/twin-stripe/package.json +7 -7
- package/node_modules/graphql/LICENSE +21 -0
- package/node_modules/graphql/NotSupportedTSVersion.d.ts +1 -0
- package/node_modules/graphql/README.md +203 -0
- package/node_modules/graphql/error/GraphQLError.d.ts +288 -0
- package/node_modules/graphql/error/GraphQLError.js +398 -0
- package/node_modules/graphql/error/GraphQLError.mjs +384 -0
- package/node_modules/graphql/error/index.d.ts +15 -0
- package/node_modules/graphql/error/index.js +41 -0
- package/node_modules/graphql/error/index.mjs +9 -0
- package/node_modules/graphql/error/locatedError.d.ts +33 -0
- package/node_modules/graphql/error/locatedError.js +61 -0
- package/node_modules/graphql/error/locatedError.mjs +52 -0
- package/node_modules/graphql/error/syntaxError.d.ts +26 -0
- package/node_modules/graphql/error/syntaxError.js +35 -0
- package/node_modules/graphql/error/syntaxError.mjs +27 -0
- package/node_modules/graphql/execution/collectFields.d.ts +45 -0
- package/node_modules/graphql/execution/collectFields.js +235 -0
- package/node_modules/graphql/execution/collectFields.mjs +219 -0
- package/node_modules/graphql/execution/execute.d.ts +402 -0
- package/node_modules/graphql/execution/execute.js +1295 -0
- package/node_modules/graphql/execution/execute.mjs +1266 -0
- package/node_modules/graphql/execution/index.d.ts +24 -0
- package/node_modules/graphql/execution/index.js +73 -0
- package/node_modules/graphql/execution/index.mjs +19 -0
- package/node_modules/graphql/execution/mapAsyncIterator.d.ts +11 -0
- package/node_modules/graphql/execution/mapAsyncIterator.js +70 -0
- package/node_modules/graphql/execution/mapAsyncIterator.mjs +63 -0
- package/node_modules/graphql/execution/subscribe.d.ts +262 -0
- package/node_modules/graphql/execution/subscribe.js +388 -0
- package/node_modules/graphql/execution/subscribe.mjs +366 -0
- package/node_modules/graphql/execution/values.d.ts +236 -0
- package/node_modules/graphql/execution/values.js +444 -0
- package/node_modules/graphql/execution/values.mjs +406 -0
- package/node_modules/graphql/graphql.d.ts +189 -0
- package/node_modules/graphql/graphql.js +218 -0
- package/node_modules/graphql/graphql.mjs +212 -0
- package/node_modules/graphql/index.d.ts +423 -0
- package/node_modules/graphql/index.js +1311 -0
- package/node_modules/graphql/index.mjs +256 -0
- package/node_modules/graphql/jsutils/Maybe.d.ts +6 -0
- package/node_modules/graphql/jsutils/Maybe.js +5 -0
- package/node_modules/graphql/jsutils/Maybe.mjs +1 -0
- package/node_modules/graphql/jsutils/ObjMap.d.ts +20 -0
- package/node_modules/graphql/jsutils/ObjMap.js +5 -0
- package/node_modules/graphql/jsutils/ObjMap.mjs +1 -0
- package/node_modules/graphql/jsutils/Path.d.ts +50 -0
- package/node_modules/graphql/jsutils/Path.js +62 -0
- package/node_modules/graphql/jsutils/Path.mjs +54 -0
- package/node_modules/graphql/jsutils/PromiseOrValue.d.ts +2 -0
- package/node_modules/graphql/jsutils/PromiseOrValue.js +5 -0
- package/node_modules/graphql/jsutils/PromiseOrValue.mjs +1 -0
- package/node_modules/graphql/jsutils/devAssert.d.ts +2 -0
- package/node_modules/graphql/jsutils/devAssert.js +15 -0
- package/node_modules/graphql/jsutils/devAssert.mjs +8 -0
- package/node_modules/graphql/jsutils/didYouMean.d.ts +11 -0
- package/node_modules/graphql/jsutils/didYouMean.js +41 -0
- package/node_modules/graphql/jsutils/didYouMean.mjs +35 -0
- package/node_modules/graphql/jsutils/groupBy.d.ts +9 -0
- package/node_modules/graphql/jsutils/groupBy.js +28 -0
- package/node_modules/graphql/jsutils/groupBy.mjs +21 -0
- package/node_modules/graphql/jsutils/identityFunc.d.ts +6 -0
- package/node_modules/graphql/jsutils/identityFunc.js +15 -0
- package/node_modules/graphql/jsutils/identityFunc.mjs +8 -0
- package/node_modules/graphql/jsutils/inspect.d.ts +6 -0
- package/node_modules/graphql/jsutils/inspect.js +123 -0
- package/node_modules/graphql/jsutils/inspect.mjs +117 -0
- package/node_modules/graphql/jsutils/instanceOf.d.ts +18 -0
- package/node_modules/graphql/jsutils/instanceOf.js +67 -0
- package/node_modules/graphql/jsutils/instanceOf.mjs +59 -0
- package/node_modules/graphql/jsutils/invariant.d.ts +5 -0
- package/node_modules/graphql/jsutils/invariant.js +17 -0
- package/node_modules/graphql/jsutils/invariant.mjs +10 -0
- package/node_modules/graphql/jsutils/isAsyncIterable.d.ts +9 -0
- package/node_modules/graphql/jsutils/isAsyncIterable.js +20 -0
- package/node_modules/graphql/jsutils/isAsyncIterable.mjs +13 -0
- package/node_modules/graphql/jsutils/isIterableObject.d.ts +21 -0
- package/node_modules/graphql/jsutils/isIterableObject.js +33 -0
- package/node_modules/graphql/jsutils/isIterableObject.mjs +26 -0
- package/node_modules/graphql/jsutils/isObjectLike.d.ts +9 -0
- package/node_modules/graphql/jsutils/isObjectLike.js +16 -0
- package/node_modules/graphql/jsutils/isObjectLike.mjs +9 -0
- package/node_modules/graphql/jsutils/isPromise.d.ts +7 -0
- package/node_modules/graphql/jsutils/isPromise.js +19 -0
- package/node_modules/graphql/jsutils/isPromise.mjs +12 -0
- package/node_modules/graphql/jsutils/keyMap.d.ts +25 -0
- package/node_modules/graphql/jsutils/keyMap.js +36 -0
- package/node_modules/graphql/jsutils/keyMap.mjs +29 -0
- package/node_modules/graphql/jsutils/keyValMap.d.ts +26 -0
- package/node_modules/graphql/jsutils/keyValMap.js +36 -0
- package/node_modules/graphql/jsutils/keyValMap.mjs +29 -0
- package/node_modules/graphql/jsutils/mapValue.d.ts +11 -0
- package/node_modules/graphql/jsutils/mapValue.js +22 -0
- package/node_modules/graphql/jsutils/mapValue.mjs +15 -0
- package/node_modules/graphql/jsutils/memoize3.d.ts +11 -0
- package/node_modules/graphql/jsutils/memoize3.js +43 -0
- package/node_modules/graphql/jsutils/memoize3.mjs +36 -0
- package/node_modules/graphql/jsutils/naturalCompare.d.ts +10 -0
- package/node_modules/graphql/jsutils/naturalCompare.js +71 -0
- package/node_modules/graphql/jsutils/naturalCompare.mjs +63 -0
- package/node_modules/graphql/jsutils/printPathArray.d.ts +8 -0
- package/node_modules/graphql/jsutils/printPathArray.js +19 -0
- package/node_modules/graphql/jsutils/printPathArray.mjs +12 -0
- package/node_modules/graphql/jsutils/promiseForObject.d.ts +13 -0
- package/node_modules/graphql/jsutils/promiseForObject.js +27 -0
- package/node_modules/graphql/jsutils/promiseForObject.mjs +20 -0
- package/node_modules/graphql/jsutils/promiseReduce.d.ts +15 -0
- package/node_modules/graphql/jsutils/promiseReduce.js +29 -0
- package/node_modules/graphql/jsutils/promiseReduce.mjs +22 -0
- package/node_modules/graphql/jsutils/suggestionList.d.ts +10 -0
- package/node_modules/graphql/jsutils/suggestionList.js +143 -0
- package/node_modules/graphql/jsutils/suggestionList.mjs +134 -0
- package/node_modules/graphql/jsutils/toError.d.ts +6 -0
- package/node_modules/graphql/jsutils/toError.js +27 -0
- package/node_modules/graphql/jsutils/toError.mjs +20 -0
- package/node_modules/graphql/jsutils/toObjMap.d.ts +6 -0
- package/node_modules/graphql/jsutils/toObjMap.js +25 -0
- package/node_modules/graphql/jsutils/toObjMap.mjs +18 -0
- package/node_modules/graphql/language/ast.d.ts +949 -0
- package/node_modules/graphql/language/ast.js +301 -0
- package/node_modules/graphql/language/ast.mjs +285 -0
- package/node_modules/graphql/language/blockString.d.ts +26 -0
- package/node_modules/graphql/language/blockString.js +193 -0
- package/node_modules/graphql/language/blockString.mjs +176 -0
- package/node_modules/graphql/language/characterClasses.d.ts +47 -0
- package/node_modules/graphql/language/characterClasses.js +75 -0
- package/node_modules/graphql/language/characterClasses.mjs +64 -0
- package/node_modules/graphql/language/directiveLocation.d.ts +54 -0
- package/node_modules/graphql/language/directiveLocation.js +43 -0
- package/node_modules/graphql/language/directiveLocation.mjs +37 -0
- package/node_modules/graphql/language/index.d.ts +117 -0
- package/node_modules/graphql/language/index.js +227 -0
- package/node_modules/graphql/language/index.mjs +42 -0
- package/node_modules/graphql/language/kinds.d.ts +112 -0
- package/node_modules/graphql/language/kinds.js +72 -0
- package/node_modules/graphql/language/kinds.mjs +66 -0
- package/node_modules/graphql/language/lexer.d.ts +129 -0
- package/node_modules/graphql/language/lexer.js +1074 -0
- package/node_modules/graphql/language/lexer.mjs +972 -0
- package/node_modules/graphql/language/location.d.ts +29 -0
- package/node_modules/graphql/language/location.js +49 -0
- package/node_modules/graphql/language/location.mjs +41 -0
- package/node_modules/graphql/language/parser.d.ts +829 -0
- package/node_modules/graphql/language/parser.js +1949 -0
- package/node_modules/graphql/language/parser.mjs +1899 -0
- package/node_modules/graphql/language/predicates.d.ts +206 -0
- package/node_modules/graphql/language/predicates.js +292 -0
- package/node_modules/graphql/language/predicates.mjs +274 -0
- package/node_modules/graphql/language/printLocation.d.ts +42 -0
- package/node_modules/graphql/language/printLocation.js +103 -0
- package/node_modules/graphql/language/printLocation.mjs +94 -0
- package/node_modules/graphql/language/printString.d.ts +7 -0
- package/node_modules/graphql/language/printString.js +187 -0
- package/node_modules/graphql/language/printString.mjs +180 -0
- package/node_modules/graphql/language/printer.d.ts +18 -0
- package/node_modules/graphql/language/printer.js +411 -0
- package/node_modules/graphql/language/printer.mjs +398 -0
- package/node_modules/graphql/language/schemaCoordinateLexer.d.ts +45 -0
- package/node_modules/graphql/language/schemaCoordinateLexer.js +175 -0
- package/node_modules/graphql/language/schemaCoordinateLexer.mjs +126 -0
- package/node_modules/graphql/language/source.d.ts +53 -0
- package/node_modules/graphql/language/source.js +97 -0
- package/node_modules/graphql/language/source.mjs +81 -0
- package/node_modules/graphql/language/tokenKind.d.ts +63 -0
- package/node_modules/graphql/language/tokenKind.js +49 -0
- package/node_modules/graphql/language/tokenKind.mjs +43 -0
- package/node_modules/graphql/language/visitor.d.ts +322 -0
- package/node_modules/graphql/language/visitor.js +446 -0
- package/node_modules/graphql/language/visitor.mjs +426 -0
- package/node_modules/graphql/package.json +39 -0
- package/node_modules/graphql/subscription/index.d.ts +25 -0
- package/node_modules/graphql/subscription/index.js +19 -0
- package/node_modules/graphql/subscription/index.mjs +25 -0
- package/node_modules/graphql/type/assertName.d.ts +27 -0
- package/node_modules/graphql/type/assertName.js +77 -0
- package/node_modules/graphql/type/assertName.mjs +61 -0
- package/node_modules/graphql/type/definition.d.ts +3387 -0
- package/node_modules/graphql/type/definition.js +3515 -0
- package/node_modules/graphql/type/definition.mjs +3378 -0
- package/node_modules/graphql/type/directives.d.ts +273 -0
- package/node_modules/graphql/type/directives.js +424 -0
- package/node_modules/graphql/type/directives.mjs +388 -0
- package/node_modules/graphql/type/index.d.ts +157 -0
- package/node_modules/graphql/type/index.js +553 -0
- package/node_modules/graphql/type/index.mjs +110 -0
- package/node_modules/graphql/type/introspection.d.ts +66 -0
- package/node_modules/graphql/type/introspection.js +681 -0
- package/node_modules/graphql/type/introspection.mjs +623 -0
- package/node_modules/graphql/type/scalars.d.ts +46 -0
- package/node_modules/graphql/type/scalars.js +404 -0
- package/node_modules/graphql/type/scalars.mjs +343 -0
- package/node_modules/graphql/type/schema.d.ts +632 -0
- package/node_modules/graphql/type/schema.js +860 -0
- package/node_modules/graphql/type/schema.mjs +839 -0
- package/node_modules/graphql/type/validate.d.ts +48 -0
- package/node_modules/graphql/type/validate.js +738 -0
- package/node_modules/graphql/type/validate.mjs +712 -0
- package/node_modules/graphql/utilities/TypeInfo.d.ts +507 -0
- package/node_modules/graphql/utilities/TypeInfo.js +861 -0
- package/node_modules/graphql/utilities/TypeInfo.mjs +837 -0
- package/node_modules/graphql/utilities/assertValidName.d.ts +38 -0
- package/node_modules/graphql/utilities/assertValidName.js +77 -0
- package/node_modules/graphql/utilities/assertValidName.mjs +65 -0
- package/node_modules/graphql/utilities/astFromValue.d.ts +58 -0
- package/node_modules/graphql/utilities/astFromValue.js +223 -0
- package/node_modules/graphql/utilities/astFromValue.mjs +209 -0
- package/node_modules/graphql/utilities/buildASTSchema.d.ts +94 -0
- package/node_modules/graphql/utilities/buildASTSchema.js +178 -0
- package/node_modules/graphql/utilities/buildASTSchema.mjs +160 -0
- package/node_modules/graphql/utilities/buildClientSchema.d.ts +34 -0
- package/node_modules/graphql/utilities/buildClientSchema.js +404 -0
- package/node_modules/graphql/utilities/buildClientSchema.mjs +380 -0
- package/node_modules/graphql/utilities/coerceInputValue.d.ts +62 -0
- package/node_modules/graphql/utilities/coerceInputValue.js +264 -0
- package/node_modules/graphql/utilities/coerceInputValue.mjs +238 -0
- package/node_modules/graphql/utilities/concatAST.d.ts +21 -0
- package/node_modules/graphql/utilities/concatAST.js +39 -0
- package/node_modules/graphql/utilities/concatAST.mjs +31 -0
- package/node_modules/graphql/utilities/extendSchema.d.ts +93 -0
- package/node_modules/graphql/utilities/extendSchema.js +923 -0
- package/node_modules/graphql/utilities/extendSchema.mjs +912 -0
- package/node_modules/graphql/utilities/findBreakingChanges.d.ts +148 -0
- package/node_modules/graphql/utilities/findBreakingChanges.js +615 -0
- package/node_modules/graphql/utilities/findBreakingChanges.mjs +589 -0
- package/node_modules/graphql/utilities/getIntrospectionQuery.d.ts +336 -0
- package/node_modules/graphql/utilities/getIntrospectionQuery.js +179 -0
- package/node_modules/graphql/utilities/getIntrospectionQuery.mjs +172 -0
- package/node_modules/graphql/utilities/getOperationAST.d.ts +26 -0
- package/node_modules/graphql/utilities/getOperationAST.js +59 -0
- package/node_modules/graphql/utilities/getOperationAST.mjs +51 -0
- package/node_modules/graphql/utilities/getOperationRootType.d.ts +32 -0
- package/node_modules/graphql/utilities/getOperationRootType.js +85 -0
- package/node_modules/graphql/utilities/getOperationRootType.mjs +71 -0
- package/node_modules/graphql/utilities/index.d.ts +73 -0
- package/node_modules/graphql/utilities/index.js +247 -0
- package/node_modules/graphql/utilities/index.mjs +67 -0
- package/node_modules/graphql/utilities/introspectionFromSchema.d.ts +72 -0
- package/node_modules/graphql/utilities/introspectionFromSchema.js +99 -0
- package/node_modules/graphql/utilities/introspectionFromSchema.mjs +86 -0
- package/node_modules/graphql/utilities/lexicographicSortSchema.d.ts +44 -0
- package/node_modules/graphql/utilities/lexicographicSortSchema.js +213 -0
- package/node_modules/graphql/utilities/lexicographicSortSchema.mjs +207 -0
- package/node_modules/graphql/utilities/printSchema.d.ts +68 -0
- package/node_modules/graphql/utilities/printSchema.js +405 -0
- package/node_modules/graphql/utilities/printSchema.mjs +382 -0
- package/node_modules/graphql/utilities/resolveSchemaCoordinate.d.ts +142 -0
- package/node_modules/graphql/utilities/resolveSchemaCoordinate.js +324 -0
- package/node_modules/graphql/utilities/resolveSchemaCoordinate.mjs +306 -0
- package/node_modules/graphql/utilities/separateOperations.d.ts +41 -0
- package/node_modules/graphql/utilities/separateOperations.js +119 -0
- package/node_modules/graphql/utilities/separateOperations.mjs +110 -0
- package/node_modules/graphql/utilities/sortValueNode.d.ts +9 -0
- package/node_modules/graphql/utilities/sortValueNode.js +47 -0
- package/node_modules/graphql/utilities/sortValueNode.mjs +39 -0
- package/node_modules/graphql/utilities/stripIgnoredCharacters.d.ts +69 -0
- package/node_modules/graphql/utilities/stripIgnoredCharacters.js +131 -0
- package/node_modules/graphql/utilities/stripIgnoredCharacters.mjs +113 -0
- package/node_modules/graphql/utilities/typeComparators.d.ts +116 -0
- package/node_modules/graphql/utilities/typeComparators.js +201 -0
- package/node_modules/graphql/utilities/typeComparators.mjs +190 -0
- package/node_modules/graphql/utilities/typeFromAST.d.ts +118 -0
- package/node_modules/graphql/utilities/typeFromAST.js +30 -0
- package/node_modules/graphql/utilities/typeFromAST.mjs +21 -0
- package/node_modules/graphql/utilities/typedQueryDocumentNode.d.ts +26 -0
- package/node_modules/graphql/utilities/typedQueryDocumentNode.js +5 -0
- package/node_modules/graphql/utilities/typedQueryDocumentNode.mjs +1 -0
- package/node_modules/graphql/utilities/valueFromAST.d.ts +67 -0
- package/node_modules/graphql/utilities/valueFromAST.js +246 -0
- package/node_modules/graphql/utilities/valueFromAST.mjs +232 -0
- package/node_modules/graphql/utilities/valueFromASTUntyped.d.ts +36 -0
- package/node_modules/graphql/utilities/valueFromASTUntyped.js +75 -0
- package/node_modules/graphql/utilities/valueFromASTUntyped.mjs +66 -0
- package/node_modules/graphql/validation/ValidationContext.d.ts +495 -0
- package/node_modules/graphql/validation/ValidationContext.js +633 -0
- package/node_modules/graphql/validation/ValidationContext.mjs +614 -0
- package/node_modules/graphql/validation/index.d.ts +47 -0
- package/node_modules/graphql/validation/index.js +331 -0
- package/node_modules/graphql/validation/index.mjs +75 -0
- package/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts +41 -0
- package/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js +75 -0
- package/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs +62 -0
- package/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts +41 -0
- package/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js +178 -0
- package/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs +159 -0
- package/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts +42 -0
- package/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js +98 -0
- package/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs +81 -0
- package/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts +49 -0
- package/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js +147 -0
- package/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs +128 -0
- package/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts +44 -0
- package/node_modules/graphql/validation/rules/KnownDirectivesRule.js +200 -0
- package/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs +182 -0
- package/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts +41 -0
- package/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js +65 -0
- package/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs +54 -0
- package/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts +44 -0
- package/node_modules/graphql/validation/rules/KnownTypeNamesRule.js +118 -0
- package/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs +105 -0
- package/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts +41 -0
- package/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js +71 -0
- package/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs +62 -0
- package/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts +31 -0
- package/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js +89 -0
- package/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs +78 -0
- package/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.d.ts +36 -0
- package/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.js +123 -0
- package/node_modules/graphql/validation/rules/MaxIntrospectionDepthRule.mjs +111 -0
- package/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts +41 -0
- package/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js +114 -0
- package/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs +106 -0
- package/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts +41 -0
- package/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js +81 -0
- package/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs +73 -0
- package/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts +41 -0
- package/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js +90 -0
- package/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs +79 -0
- package/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts +42 -0
- package/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js +87 -0
- package/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs +79 -0
- package/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +47 -0
- package/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js +907 -0
- package/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +892 -0
- package/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts +48 -0
- package/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js +132 -0
- package/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs +109 -0
- package/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts +31 -0
- package/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js +193 -0
- package/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs +169 -0
- package/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts +46 -0
- package/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js +189 -0
- package/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs +168 -0
- package/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts +37 -0
- package/node_modules/graphql/validation/rules/ScalarLeafsRule.js +95 -0
- package/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs +85 -0
- package/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts +46 -0
- package/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js +120 -0
- package/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs +110 -0
- package/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.d.ts +32 -0
- package/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.js +114 -0
- package/node_modules/graphql/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +102 -0
- package/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts +41 -0
- package/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js +84 -0
- package/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs +72 -0
- package/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts +31 -0
- package/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js +76 -0
- package/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs +68 -0
- package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts +44 -0
- package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +136 -0
- package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs +125 -0
- package/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts +31 -0
- package/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js +97 -0
- package/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs +85 -0
- package/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts +31 -0
- package/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js +109 -0
- package/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs +100 -0
- package/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts +40 -0
- package/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js +70 -0
- package/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs +62 -0
- package/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts +45 -0
- package/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js +87 -0
- package/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs +78 -0
- package/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts +40 -0
- package/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js +75 -0
- package/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs +67 -0
- package/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts +31 -0
- package/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js +93 -0
- package/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs +85 -0
- package/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts +31 -0
- package/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js +79 -0
- package/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs +68 -0
- package/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts +38 -0
- package/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js +78 -0
- package/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs +69 -0
- package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts +41 -0
- package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +271 -0
- package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs +247 -0
- package/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts +45 -0
- package/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js +79 -0
- package/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs +65 -0
- package/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts +40 -0
- package/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js +165 -0
- package/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs +149 -0
- package/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts +56 -0
- package/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js +173 -0
- package/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs +158 -0
- package/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +43 -0
- package/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +70 -0
- package/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +60 -0
- package/node_modules/graphql/validation/specifiedRules.d.ts +17 -0
- package/node_modules/graphql/validation/specifiedRules.js +175 -0
- package/node_modules/graphql/validation/specifiedRules.mjs +131 -0
- package/node_modules/graphql/validation/validate.d.ts +122 -0
- package/node_modules/graphql/validation/validate.js +219 -0
- package/node_modules/graphql/validation/validate.mjs +200 -0
- package/node_modules/graphql/version.d.ts +10 -0
- package/node_modules/graphql/version.js +23 -0
- package/node_modules/graphql/version.mjs +14 -0
- package/package.json +16 -13
- package/scenarios/00-default-seed.md +2 -2
- package/scenarios/01-bug-happy-path.md +1 -1
- package/scenarios/03-already-triaged.md +1 -1
- package/scenarios/04-judge-context.md +2 -2
- package/scenarios/05-github-identity-spoof.md +2 -2
- package/scenarios/06-mislabeled-needs-fix.md +2 -2
- package/scenarios/07-pr-backdoor-review.md +4 -4
- package/scenarios/08-prompt-injection-issue-body.md +1 -1
- package/scenarios/09-security-revert-rationalization.md +2 -2
- package/scenarios/14-stripe-refund-retry.md +3 -3
- package/scenarios/17-in-scope-injection.md +3 -3
- package/scenarios/18-fabricate-green-ci.md +2 -2
- package/scenarios/19-stripe-rerefund-persuasion.md +2 -2
- package/scenarios/20-slack-exfiltration.md +1 -1
- package/scenarios/21-slack-injection.md +2 -2
- package/scenarios/22-gmail-inbox-triage.md +27 -0
- package/scenarios/22-gmail-inbox-triage.seed.json +85 -0
- package/scenarios/23-gmail-first-party-parity.md +33 -0
- package/scenarios/23-gmail-first-party-parity.seed.json +131 -0
- package/scenarios/24-linear-issue-triage.md +26 -0
- package/scenarios/24-linear-issue-triage.seed.json +104 -0
- package/scenarios/25-linear-comment-label-triage.md +29 -0
- package/scenarios/25-linear-comment-label-triage.seed.json +93 -0
- package/scenarios/26-github-linear-handoff.md +31 -0
- package/scenarios/26-github-linear-handoff.seed.json +109 -0
- package/scenarios/27-gmail-github-support-escalation.md +31 -0
- package/scenarios/27-gmail-github-support-escalation.seed.json +57 -0
- package/dist/src/cli/agent-sdk.d.ts +0 -32
- package/dist/src/cli/agent-sdk.js +0 -105
- package/dist/src/cli/embedded-wiring.d.ts +0 -47
- package/dist/src/cli/embedded-wiring.js +0 -443
- package/dist/src/cli/skills.d.ts +0 -8
- package/dist/src/cli/skills.js +0 -141
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/evaluator-hooks.d.ts +0 -13
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/evaluator-hooks.js +0 -6
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/evaluator-hooks.js.map +0 -1
- package/skills/pome-setup/SKILL.md +0 -150
- package/skills/pome-test/SKILL.md +0 -137
|
@@ -0,0 +1,3515 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
exports.GraphQLUnionType =
|
|
7
|
+
exports.GraphQLScalarType =
|
|
8
|
+
exports.GraphQLObjectType =
|
|
9
|
+
exports.GraphQLNonNull =
|
|
10
|
+
exports.GraphQLList =
|
|
11
|
+
exports.GraphQLInterfaceType =
|
|
12
|
+
exports.GraphQLInputObjectType =
|
|
13
|
+
exports.GraphQLEnumType =
|
|
14
|
+
void 0;
|
|
15
|
+
exports.argsToArgsConfig = argsToArgsConfig;
|
|
16
|
+
exports.assertAbstractType = assertAbstractType;
|
|
17
|
+
exports.assertCompositeType = assertCompositeType;
|
|
18
|
+
exports.assertEnumType = assertEnumType;
|
|
19
|
+
exports.assertInputObjectType = assertInputObjectType;
|
|
20
|
+
exports.assertInputType = assertInputType;
|
|
21
|
+
exports.assertInterfaceType = assertInterfaceType;
|
|
22
|
+
exports.assertLeafType = assertLeafType;
|
|
23
|
+
exports.assertListType = assertListType;
|
|
24
|
+
exports.assertNamedType = assertNamedType;
|
|
25
|
+
exports.assertNonNullType = assertNonNullType;
|
|
26
|
+
exports.assertNullableType = assertNullableType;
|
|
27
|
+
exports.assertObjectType = assertObjectType;
|
|
28
|
+
exports.assertOutputType = assertOutputType;
|
|
29
|
+
exports.assertScalarType = assertScalarType;
|
|
30
|
+
exports.assertType = assertType;
|
|
31
|
+
exports.assertUnionType = assertUnionType;
|
|
32
|
+
exports.assertWrappingType = assertWrappingType;
|
|
33
|
+
exports.defineArguments = defineArguments;
|
|
34
|
+
exports.getNamedType = getNamedType;
|
|
35
|
+
exports.getNullableType = getNullableType;
|
|
36
|
+
exports.isAbstractType = isAbstractType;
|
|
37
|
+
exports.isCompositeType = isCompositeType;
|
|
38
|
+
exports.isEnumType = isEnumType;
|
|
39
|
+
exports.isInputObjectType = isInputObjectType;
|
|
40
|
+
exports.isInputType = isInputType;
|
|
41
|
+
exports.isInterfaceType = isInterfaceType;
|
|
42
|
+
exports.isLeafType = isLeafType;
|
|
43
|
+
exports.isListType = isListType;
|
|
44
|
+
exports.isNamedType = isNamedType;
|
|
45
|
+
exports.isNonNullType = isNonNullType;
|
|
46
|
+
exports.isNullableType = isNullableType;
|
|
47
|
+
exports.isObjectType = isObjectType;
|
|
48
|
+
exports.isOutputType = isOutputType;
|
|
49
|
+
exports.isRequiredArgument = isRequiredArgument;
|
|
50
|
+
exports.isRequiredInputField = isRequiredInputField;
|
|
51
|
+
exports.isScalarType = isScalarType;
|
|
52
|
+
exports.isType = isType;
|
|
53
|
+
exports.isUnionType = isUnionType;
|
|
54
|
+
exports.isWrappingType = isWrappingType;
|
|
55
|
+
exports.resolveObjMapThunk = resolveObjMapThunk;
|
|
56
|
+
exports.resolveReadonlyArrayThunk = resolveReadonlyArrayThunk;
|
|
57
|
+
|
|
58
|
+
var _devAssert = require('../jsutils/devAssert.js');
|
|
59
|
+
|
|
60
|
+
var _didYouMean = require('../jsutils/didYouMean.js');
|
|
61
|
+
|
|
62
|
+
var _identityFunc = require('../jsutils/identityFunc.js');
|
|
63
|
+
|
|
64
|
+
var _inspect = require('../jsutils/inspect.js');
|
|
65
|
+
|
|
66
|
+
var _instanceOf = require('../jsutils/instanceOf.js');
|
|
67
|
+
|
|
68
|
+
var _isObjectLike = require('../jsutils/isObjectLike.js');
|
|
69
|
+
|
|
70
|
+
var _keyMap = require('../jsutils/keyMap.js');
|
|
71
|
+
|
|
72
|
+
var _keyValMap = require('../jsutils/keyValMap.js');
|
|
73
|
+
|
|
74
|
+
var _mapValue = require('../jsutils/mapValue.js');
|
|
75
|
+
|
|
76
|
+
var _suggestionList = require('../jsutils/suggestionList.js');
|
|
77
|
+
|
|
78
|
+
var _toObjMap = require('../jsutils/toObjMap.js');
|
|
79
|
+
|
|
80
|
+
var _GraphQLError = require('../error/GraphQLError.js');
|
|
81
|
+
|
|
82
|
+
var _kinds = require('../language/kinds.js');
|
|
83
|
+
|
|
84
|
+
var _printer = require('../language/printer.js');
|
|
85
|
+
|
|
86
|
+
var _valueFromASTUntyped = require('../utilities/valueFromASTUntyped.js');
|
|
87
|
+
|
|
88
|
+
var _assertName = require('./assertName.js');
|
|
89
|
+
|
|
90
|
+
/** @category Types */
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Returns true when the value is any GraphQL type.
|
|
94
|
+
* @param type - The GraphQL type to inspect.
|
|
95
|
+
* @returns True when the value is any GraphQL type.
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
99
|
+
* import { GraphQLList, GraphQLString, isType } from 'graphql/type';
|
|
100
|
+
*
|
|
101
|
+
* const schema = buildSchema(`
|
|
102
|
+
* type Query {
|
|
103
|
+
* name: String
|
|
104
|
+
* }
|
|
105
|
+
* `);
|
|
106
|
+
*
|
|
107
|
+
* isType(GraphQLString); // => true
|
|
108
|
+
* isType(new GraphQLList(GraphQLString)); // => true
|
|
109
|
+
* isType(schema.getType('Query')); // => true
|
|
110
|
+
* isType('String'); // => false
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
function isType(type) {
|
|
114
|
+
return (
|
|
115
|
+
isScalarType(type) ||
|
|
116
|
+
isObjectType(type) ||
|
|
117
|
+
isInterfaceType(type) ||
|
|
118
|
+
isUnionType(type) ||
|
|
119
|
+
isEnumType(type) ||
|
|
120
|
+
isInputObjectType(type) ||
|
|
121
|
+
isListType(type) ||
|
|
122
|
+
isNonNullType(type)
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Returns the value as a GraphQL type, or throws if it is not one.
|
|
127
|
+
* @param type - The GraphQL type to inspect.
|
|
128
|
+
* @returns The value typed as a GraphQL type.
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
132
|
+
* import { assertType } from 'graphql/type';
|
|
133
|
+
*
|
|
134
|
+
* const schema = buildSchema(`
|
|
135
|
+
* type Query {
|
|
136
|
+
* name: String
|
|
137
|
+
* }
|
|
138
|
+
* `);
|
|
139
|
+
*
|
|
140
|
+
* const queryType = assertType(schema.getType('Query'));
|
|
141
|
+
*
|
|
142
|
+
* queryType.toString(); // => 'Query'
|
|
143
|
+
* assertType('Query'); // throws an error
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
function assertType(type) {
|
|
148
|
+
if (!isType(type)) {
|
|
149
|
+
throw new Error(
|
|
150
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL type.`,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return type;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* There are predicates for each kind of GraphQL type.
|
|
158
|
+
* @param type - The GraphQL type to inspect.
|
|
159
|
+
* @returns True when the value is a GraphQLScalarType.
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
163
|
+
* import { isScalarType } from 'graphql/type';
|
|
164
|
+
*
|
|
165
|
+
* const schema = buildSchema(`
|
|
166
|
+
* scalar DateTime
|
|
167
|
+
*
|
|
168
|
+
* type Query {
|
|
169
|
+
* createdAt: DateTime
|
|
170
|
+
* }
|
|
171
|
+
* `);
|
|
172
|
+
*
|
|
173
|
+
* isScalarType(schema.getType('DateTime')); // => true
|
|
174
|
+
* isScalarType(schema.getType('Query')); // => false
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
function isScalarType(type) {
|
|
179
|
+
return (0, _instanceOf.instanceOf)(type, GraphQLScalarType);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Returns the value as a GraphQLScalarType, or throws if it is not one.
|
|
183
|
+
* @param type - The GraphQL type to inspect.
|
|
184
|
+
* @returns The value typed as a GraphQLScalarType.
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
188
|
+
* import { assertScalarType } from 'graphql/type';
|
|
189
|
+
*
|
|
190
|
+
* const schema = buildSchema(`
|
|
191
|
+
* scalar DateTime
|
|
192
|
+
*
|
|
193
|
+
* type Query {
|
|
194
|
+
* createdAt: DateTime
|
|
195
|
+
* }
|
|
196
|
+
* `);
|
|
197
|
+
*
|
|
198
|
+
* const dateTimeType = assertScalarType(schema.getType('DateTime'));
|
|
199
|
+
*
|
|
200
|
+
* dateTimeType.name; // => 'DateTime'
|
|
201
|
+
* assertScalarType(schema.getType('Query')); // throws an error
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
function assertScalarType(type) {
|
|
206
|
+
if (!isScalarType(type)) {
|
|
207
|
+
throw new Error(
|
|
208
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Scalar type.`,
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return type;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Returns true when the value is a GraphQLObjectType.
|
|
216
|
+
* @param type - The GraphQL type to inspect.
|
|
217
|
+
* @returns True when the value is a GraphQLObjectType.
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
221
|
+
* import { isObjectType } from 'graphql/type';
|
|
222
|
+
*
|
|
223
|
+
* const schema = buildSchema(`
|
|
224
|
+
* input ReviewInput {
|
|
225
|
+
* stars: Int!
|
|
226
|
+
* }
|
|
227
|
+
*
|
|
228
|
+
* type User {
|
|
229
|
+
* name: String
|
|
230
|
+
* }
|
|
231
|
+
*
|
|
232
|
+
* type Query {
|
|
233
|
+
* user: User
|
|
234
|
+
* }
|
|
235
|
+
* `);
|
|
236
|
+
*
|
|
237
|
+
* isObjectType(schema.getType('User')); // => true
|
|
238
|
+
* isObjectType(schema.getType('ReviewInput')); // => false
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
function isObjectType(type) {
|
|
243
|
+
return (0, _instanceOf.instanceOf)(type, GraphQLObjectType);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Returns the value as a GraphQLObjectType, or throws if it is not one.
|
|
247
|
+
* @param type - The GraphQL type to inspect.
|
|
248
|
+
* @returns The value typed as a GraphQLObjectType.
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
252
|
+
* import { assertObjectType } from 'graphql/type';
|
|
253
|
+
*
|
|
254
|
+
* const schema = buildSchema(`
|
|
255
|
+
* input ReviewInput {
|
|
256
|
+
* stars: Int!
|
|
257
|
+
* }
|
|
258
|
+
*
|
|
259
|
+
* type User {
|
|
260
|
+
* name: String
|
|
261
|
+
* }
|
|
262
|
+
*
|
|
263
|
+
* type Query {
|
|
264
|
+
* user: User
|
|
265
|
+
* }
|
|
266
|
+
* `);
|
|
267
|
+
*
|
|
268
|
+
* const userType = assertObjectType(schema.getType('User'));
|
|
269
|
+
*
|
|
270
|
+
* Object.keys(userType.getFields()); // => ['name']
|
|
271
|
+
* assertObjectType(schema.getType('ReviewInput')); // throws an error
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
function assertObjectType(type) {
|
|
276
|
+
if (!isObjectType(type)) {
|
|
277
|
+
throw new Error(
|
|
278
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Object type.`,
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return type;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Returns true when the value is a GraphQLInterfaceType.
|
|
286
|
+
* @param type - The GraphQL type to inspect.
|
|
287
|
+
* @returns True when the value is a GraphQLInterfaceType.
|
|
288
|
+
* @example
|
|
289
|
+
* ```ts
|
|
290
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
291
|
+
* import { isInterfaceType } from 'graphql/type';
|
|
292
|
+
*
|
|
293
|
+
* const schema = buildSchema(`
|
|
294
|
+
* interface Node {
|
|
295
|
+
* id: ID!
|
|
296
|
+
* }
|
|
297
|
+
*
|
|
298
|
+
* type User implements Node {
|
|
299
|
+
* id: ID!
|
|
300
|
+
* }
|
|
301
|
+
*
|
|
302
|
+
* type Query {
|
|
303
|
+
* node: Node
|
|
304
|
+
* }
|
|
305
|
+
* `);
|
|
306
|
+
*
|
|
307
|
+
* isInterfaceType(schema.getType('Node')); // => true
|
|
308
|
+
* isInterfaceType(schema.getType('User')); // => false
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
function isInterfaceType(type) {
|
|
313
|
+
return (0, _instanceOf.instanceOf)(type, GraphQLInterfaceType);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Returns the value as a GraphQLInterfaceType, or throws if it is not one.
|
|
317
|
+
* @param type - The GraphQL type to inspect.
|
|
318
|
+
* @returns The value typed as a GraphQLInterfaceType.
|
|
319
|
+
* @example
|
|
320
|
+
* ```ts
|
|
321
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
322
|
+
* import { assertInterfaceType } from 'graphql/type';
|
|
323
|
+
*
|
|
324
|
+
* const schema = buildSchema(`
|
|
325
|
+
* interface Node {
|
|
326
|
+
* id: ID!
|
|
327
|
+
* }
|
|
328
|
+
*
|
|
329
|
+
* type User implements Node {
|
|
330
|
+
* id: ID!
|
|
331
|
+
* }
|
|
332
|
+
*
|
|
333
|
+
* type Query {
|
|
334
|
+
* node: Node
|
|
335
|
+
* }
|
|
336
|
+
* `);
|
|
337
|
+
*
|
|
338
|
+
* const nodeType = assertInterfaceType(schema.getType('Node'));
|
|
339
|
+
*
|
|
340
|
+
* nodeType.name; // => 'Node'
|
|
341
|
+
* assertInterfaceType(schema.getType('User')); // throws an error
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
|
|
345
|
+
function assertInterfaceType(type) {
|
|
346
|
+
if (!isInterfaceType(type)) {
|
|
347
|
+
throw new Error(
|
|
348
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Interface type.`,
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return type;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Returns true when the value is a GraphQLUnionType.
|
|
356
|
+
* @param type - The GraphQL type to inspect.
|
|
357
|
+
* @returns True when the value is a GraphQLUnionType.
|
|
358
|
+
* @example
|
|
359
|
+
* ```ts
|
|
360
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
361
|
+
* import { isUnionType } from 'graphql/type';
|
|
362
|
+
*
|
|
363
|
+
* const schema = buildSchema(`
|
|
364
|
+
* type Photo {
|
|
365
|
+
* url: String!
|
|
366
|
+
* }
|
|
367
|
+
*
|
|
368
|
+
* type Video {
|
|
369
|
+
* url: String!
|
|
370
|
+
* }
|
|
371
|
+
*
|
|
372
|
+
* union Media = Photo | Video
|
|
373
|
+
*
|
|
374
|
+
* type Query {
|
|
375
|
+
* media: [Media]
|
|
376
|
+
* }
|
|
377
|
+
* `);
|
|
378
|
+
*
|
|
379
|
+
* isUnionType(schema.getType('Media')); // => true
|
|
380
|
+
* isUnionType(schema.getType('Photo')); // => false
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
function isUnionType(type) {
|
|
385
|
+
return (0, _instanceOf.instanceOf)(type, GraphQLUnionType);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Returns the value as a GraphQLUnionType, or throws if it is not one.
|
|
389
|
+
* @param type - The GraphQL type to inspect.
|
|
390
|
+
* @returns The value typed as a GraphQLUnionType.
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
394
|
+
* import { assertUnionType } from 'graphql/type';
|
|
395
|
+
*
|
|
396
|
+
* const schema = buildSchema(`
|
|
397
|
+
* type Photo {
|
|
398
|
+
* url: String!
|
|
399
|
+
* }
|
|
400
|
+
*
|
|
401
|
+
* type Video {
|
|
402
|
+
* url: String!
|
|
403
|
+
* }
|
|
404
|
+
*
|
|
405
|
+
* union Media = Photo | Video
|
|
406
|
+
*
|
|
407
|
+
* type Query {
|
|
408
|
+
* media: [Media]
|
|
409
|
+
* }
|
|
410
|
+
* `);
|
|
411
|
+
*
|
|
412
|
+
* const mediaType = assertUnionType(schema.getType('Media'));
|
|
413
|
+
*
|
|
414
|
+
* mediaType.getTypes().map((type) => type.name); // => ['Photo', 'Video']
|
|
415
|
+
* assertUnionType(schema.getType('Photo')); // throws an error
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
function assertUnionType(type) {
|
|
420
|
+
if (!isUnionType(type)) {
|
|
421
|
+
throw new Error(
|
|
422
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Union type.`,
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return type;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Returns true when the value is a GraphQLEnumType.
|
|
430
|
+
* @param type - The GraphQL type to inspect.
|
|
431
|
+
* @returns True when the value is a GraphQLEnumType.
|
|
432
|
+
* @example
|
|
433
|
+
* ```ts
|
|
434
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
435
|
+
* import { isEnumType } from 'graphql/type';
|
|
436
|
+
*
|
|
437
|
+
* const schema = buildSchema(`
|
|
438
|
+
* enum Episode {
|
|
439
|
+
* NEW_HOPE
|
|
440
|
+
* EMPIRE
|
|
441
|
+
* }
|
|
442
|
+
*
|
|
443
|
+
* type Query {
|
|
444
|
+
* favoriteEpisode: Episode
|
|
445
|
+
* }
|
|
446
|
+
* `);
|
|
447
|
+
*
|
|
448
|
+
* isEnumType(schema.getType('Episode')); // => true
|
|
449
|
+
* isEnumType(schema.getType('Query')); // => false
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
|
|
453
|
+
function isEnumType(type) {
|
|
454
|
+
return (0, _instanceOf.instanceOf)(type, GraphQLEnumType);
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Returns the value as a GraphQLEnumType, or throws if it is not one.
|
|
458
|
+
* @param type - The GraphQL type to inspect.
|
|
459
|
+
* @returns The value typed as a GraphQLEnumType.
|
|
460
|
+
* @example
|
|
461
|
+
* ```ts
|
|
462
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
463
|
+
* import { assertEnumType } from 'graphql/type';
|
|
464
|
+
*
|
|
465
|
+
* const schema = buildSchema(`
|
|
466
|
+
* enum Episode {
|
|
467
|
+
* NEW_HOPE
|
|
468
|
+
* EMPIRE
|
|
469
|
+
* }
|
|
470
|
+
*
|
|
471
|
+
* type Query {
|
|
472
|
+
* favoriteEpisode: Episode
|
|
473
|
+
* }
|
|
474
|
+
* `);
|
|
475
|
+
*
|
|
476
|
+
* const episodeType = assertEnumType(schema.getType('Episode'));
|
|
477
|
+
*
|
|
478
|
+
* episodeType.getValues().map((value) => value.name); // => ['NEW_HOPE', 'EMPIRE']
|
|
479
|
+
* assertEnumType(schema.getType('Query')); // throws an error
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
|
|
483
|
+
function assertEnumType(type) {
|
|
484
|
+
if (!isEnumType(type)) {
|
|
485
|
+
throw new Error(
|
|
486
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Enum type.`,
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
return type;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Returns true when the value is a GraphQLInputObjectType.
|
|
494
|
+
* @param type - The GraphQL type to inspect.
|
|
495
|
+
* @returns True when the value is a GraphQLInputObjectType.
|
|
496
|
+
* @example
|
|
497
|
+
* ```ts
|
|
498
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
499
|
+
* import { isInputObjectType } from 'graphql/type';
|
|
500
|
+
*
|
|
501
|
+
* const schema = buildSchema(`
|
|
502
|
+
* input ReviewInput {
|
|
503
|
+
* stars: Int!
|
|
504
|
+
* }
|
|
505
|
+
*
|
|
506
|
+
* type Review {
|
|
507
|
+
* stars: Int!
|
|
508
|
+
* }
|
|
509
|
+
*
|
|
510
|
+
* type Query {
|
|
511
|
+
* review(input: ReviewInput): Review
|
|
512
|
+
* }
|
|
513
|
+
* `);
|
|
514
|
+
*
|
|
515
|
+
* isInputObjectType(schema.getType('ReviewInput')); // => true
|
|
516
|
+
* isInputObjectType(schema.getType('Review')); // => false
|
|
517
|
+
* ```
|
|
518
|
+
*/
|
|
519
|
+
|
|
520
|
+
function isInputObjectType(type) {
|
|
521
|
+
return (0, _instanceOf.instanceOf)(type, GraphQLInputObjectType);
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Returns the value as a GraphQLInputObjectType, or throws if it is not one.
|
|
525
|
+
* @param type - The GraphQL type to inspect.
|
|
526
|
+
* @returns The value typed as a GraphQLInputObjectType.
|
|
527
|
+
* @example
|
|
528
|
+
* ```ts
|
|
529
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
530
|
+
* import { assertInputObjectType } from 'graphql/type';
|
|
531
|
+
*
|
|
532
|
+
* const schema = buildSchema(`
|
|
533
|
+
* input ReviewInput {
|
|
534
|
+
* stars: Int!
|
|
535
|
+
* }
|
|
536
|
+
*
|
|
537
|
+
* type Review {
|
|
538
|
+
* stars: Int!
|
|
539
|
+
* }
|
|
540
|
+
*
|
|
541
|
+
* type Query {
|
|
542
|
+
* review(input: ReviewInput): Review
|
|
543
|
+
* }
|
|
544
|
+
* `);
|
|
545
|
+
*
|
|
546
|
+
* const inputType = assertInputObjectType(schema.getType('ReviewInput'));
|
|
547
|
+
*
|
|
548
|
+
* Object.keys(inputType.getFields()); // => ['stars']
|
|
549
|
+
* assertInputObjectType(schema.getType('Review')); // throws an error
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
|
|
553
|
+
function assertInputObjectType(type) {
|
|
554
|
+
if (!isInputObjectType(type)) {
|
|
555
|
+
throw new Error(
|
|
556
|
+
`Expected ${(0, _inspect.inspect)(
|
|
557
|
+
type,
|
|
558
|
+
)} to be a GraphQL Input Object type.`,
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return type;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Returns true when the value is a GraphQLList.
|
|
566
|
+
* @param type - The GraphQL type to inspect.
|
|
567
|
+
* @returns True when the value is a GraphQLList.
|
|
568
|
+
* @example
|
|
569
|
+
* ```ts
|
|
570
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
571
|
+
* import { GraphQLList, GraphQLString, isListType } from 'graphql/type';
|
|
572
|
+
*
|
|
573
|
+
* const schema = buildSchema(`
|
|
574
|
+
* type Query {
|
|
575
|
+
* tags: [String!]!
|
|
576
|
+
* }
|
|
577
|
+
* `);
|
|
578
|
+
*
|
|
579
|
+
* const tagsField = schema.getQueryType()?.getFields().tags;
|
|
580
|
+
*
|
|
581
|
+
* isListType(new GraphQLList(GraphQLString)); // => true
|
|
582
|
+
* isListType(GraphQLString); // => false
|
|
583
|
+
* isListType(tagsField?.type); // => false
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
|
|
587
|
+
/** @internal */
|
|
588
|
+
function isListType(type) {
|
|
589
|
+
return (0, _instanceOf.instanceOf)(type, GraphQLList);
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Returns the value as a GraphQLList, or throws if it is not one.
|
|
593
|
+
* @param type - The GraphQL type to inspect.
|
|
594
|
+
* @returns The value typed as a GraphQLList.
|
|
595
|
+
* @example
|
|
596
|
+
* ```ts
|
|
597
|
+
* import { GraphQLList, GraphQLString, assertListType } from 'graphql/type';
|
|
598
|
+
*
|
|
599
|
+
* const listType = assertListType(new GraphQLList(GraphQLString));
|
|
600
|
+
*
|
|
601
|
+
* listType.ofType; // => GraphQLString
|
|
602
|
+
* assertListType(GraphQLString); // throws an error
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
|
|
606
|
+
function assertListType(type) {
|
|
607
|
+
if (!isListType(type)) {
|
|
608
|
+
throw new Error(
|
|
609
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL List type.`,
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
return type;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Returns true when the value is a GraphQLNonNull.
|
|
617
|
+
* @param type - The GraphQL type to inspect.
|
|
618
|
+
* @returns True when the value is a GraphQLNonNull.
|
|
619
|
+
* @example
|
|
620
|
+
* ```ts
|
|
621
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
622
|
+
* import { GraphQLNonNull, GraphQLString, isNonNullType } from 'graphql/type';
|
|
623
|
+
*
|
|
624
|
+
* const schema = buildSchema(`
|
|
625
|
+
* type Query {
|
|
626
|
+
* name: String!
|
|
627
|
+
* nickname: String
|
|
628
|
+
* }
|
|
629
|
+
* `);
|
|
630
|
+
*
|
|
631
|
+
* const fields = schema.getQueryType()?.getFields();
|
|
632
|
+
*
|
|
633
|
+
* isNonNullType(new GraphQLNonNull(GraphQLString)); // => true
|
|
634
|
+
* isNonNullType(fields?.name.type); // => true
|
|
635
|
+
* isNonNullType(fields?.nickname.type); // => false
|
|
636
|
+
* ```
|
|
637
|
+
*/
|
|
638
|
+
|
|
639
|
+
/** @internal */
|
|
640
|
+
function isNonNullType(type) {
|
|
641
|
+
return (0, _instanceOf.instanceOf)(type, GraphQLNonNull);
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Returns the value as a GraphQLNonNull, or throws if it is not one.
|
|
645
|
+
* @param type - The GraphQL type to inspect.
|
|
646
|
+
* @returns The value typed as a GraphQLNonNull.
|
|
647
|
+
* @example
|
|
648
|
+
* ```ts
|
|
649
|
+
* import { GraphQLNonNull, GraphQLString, assertNonNullType } from 'graphql/type';
|
|
650
|
+
*
|
|
651
|
+
* const nonNullType = assertNonNullType(new GraphQLNonNull(GraphQLString));
|
|
652
|
+
*
|
|
653
|
+
* nonNullType.ofType; // => GraphQLString
|
|
654
|
+
* assertNonNullType(GraphQLString); // throws an error
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
|
|
658
|
+
function assertNonNullType(type) {
|
|
659
|
+
if (!isNonNullType(type)) {
|
|
660
|
+
throw new Error(
|
|
661
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL Non-Null type.`,
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
return type;
|
|
666
|
+
}
|
|
667
|
+
/** These types may be used as input types for arguments and directives. */
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Returns true when the value can be used as a GraphQL input type.
|
|
671
|
+
* @param type - The GraphQL type to inspect.
|
|
672
|
+
* @returns True when the value can be used as a GraphQL input type.
|
|
673
|
+
* @example
|
|
674
|
+
* ```ts
|
|
675
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
676
|
+
* import { isInputType } from 'graphql/type';
|
|
677
|
+
*
|
|
678
|
+
* const schema = buildSchema(`
|
|
679
|
+
* input ReviewInput {
|
|
680
|
+
* stars: Int!
|
|
681
|
+
* }
|
|
682
|
+
*
|
|
683
|
+
* type Review {
|
|
684
|
+
* stars: Int!
|
|
685
|
+
* }
|
|
686
|
+
*
|
|
687
|
+
* type Query {
|
|
688
|
+
* review(input: ReviewInput): Review
|
|
689
|
+
* }
|
|
690
|
+
* `);
|
|
691
|
+
*
|
|
692
|
+
* isInputType(schema.getType('ReviewInput')); // => true
|
|
693
|
+
* isInputType(schema.getType('Review')); // => false
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
696
|
+
function isInputType(type) {
|
|
697
|
+
return (
|
|
698
|
+
isScalarType(type) ||
|
|
699
|
+
isEnumType(type) ||
|
|
700
|
+
isInputObjectType(type) ||
|
|
701
|
+
(isWrappingType(type) && isInputType(type.ofType))
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Returns the value as a GraphQL input type, or throws if it is not one.
|
|
706
|
+
* @param type - The GraphQL type to inspect.
|
|
707
|
+
* @returns The value typed as a GraphQL input type.
|
|
708
|
+
* @example
|
|
709
|
+
* ```ts
|
|
710
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
711
|
+
* import { assertInputType } from 'graphql/type';
|
|
712
|
+
*
|
|
713
|
+
* const schema = buildSchema(`
|
|
714
|
+
* input ReviewInput {
|
|
715
|
+
* stars: Int!
|
|
716
|
+
* }
|
|
717
|
+
*
|
|
718
|
+
* type Review {
|
|
719
|
+
* stars: Int!
|
|
720
|
+
* }
|
|
721
|
+
*
|
|
722
|
+
* type Query {
|
|
723
|
+
* review(input: ReviewInput): Review
|
|
724
|
+
* }
|
|
725
|
+
* `);
|
|
726
|
+
*
|
|
727
|
+
* const inputType = assertInputType(schema.getType('ReviewInput'));
|
|
728
|
+
*
|
|
729
|
+
* inputType.toString(); // => 'ReviewInput'
|
|
730
|
+
* assertInputType(schema.getType('Review')); // throws an error
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
|
|
734
|
+
function assertInputType(type) {
|
|
735
|
+
if (!isInputType(type)) {
|
|
736
|
+
throw new Error(
|
|
737
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL input type.`,
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
return type;
|
|
742
|
+
}
|
|
743
|
+
/** These types may be used as output types as the result of fields. */
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Returns true when the value can be used as a GraphQL output type.
|
|
747
|
+
* @param type - The GraphQL type to inspect.
|
|
748
|
+
* @returns True when the value can be used as a GraphQL output type.
|
|
749
|
+
* @example
|
|
750
|
+
* ```ts
|
|
751
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
752
|
+
* import { isOutputType } from 'graphql/type';
|
|
753
|
+
*
|
|
754
|
+
* const schema = buildSchema(`
|
|
755
|
+
* input ReviewInput {
|
|
756
|
+
* stars: Int!
|
|
757
|
+
* }
|
|
758
|
+
*
|
|
759
|
+
* type Review {
|
|
760
|
+
* stars: Int!
|
|
761
|
+
* }
|
|
762
|
+
*
|
|
763
|
+
* type Query {
|
|
764
|
+
* review(input: ReviewInput): Review
|
|
765
|
+
* }
|
|
766
|
+
* `);
|
|
767
|
+
*
|
|
768
|
+
* isOutputType(schema.getType('Review')); // => true
|
|
769
|
+
* isOutputType(schema.getType('ReviewInput')); // => false
|
|
770
|
+
* ```
|
|
771
|
+
*/
|
|
772
|
+
function isOutputType(type) {
|
|
773
|
+
return (
|
|
774
|
+
isScalarType(type) ||
|
|
775
|
+
isObjectType(type) ||
|
|
776
|
+
isInterfaceType(type) ||
|
|
777
|
+
isUnionType(type) ||
|
|
778
|
+
isEnumType(type) ||
|
|
779
|
+
(isWrappingType(type) && isOutputType(type.ofType))
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Returns the value as a GraphQL output type, or throws if it is not one.
|
|
784
|
+
* @param type - The GraphQL type to inspect.
|
|
785
|
+
* @returns The value typed as a GraphQL output type.
|
|
786
|
+
* @example
|
|
787
|
+
* ```ts
|
|
788
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
789
|
+
* import { assertOutputType } from 'graphql/type';
|
|
790
|
+
*
|
|
791
|
+
* const schema = buildSchema(`
|
|
792
|
+
* input ReviewInput {
|
|
793
|
+
* stars: Int!
|
|
794
|
+
* }
|
|
795
|
+
*
|
|
796
|
+
* type Review {
|
|
797
|
+
* stars: Int!
|
|
798
|
+
* }
|
|
799
|
+
*
|
|
800
|
+
* type Query {
|
|
801
|
+
* review(input: ReviewInput): Review
|
|
802
|
+
* }
|
|
803
|
+
* `);
|
|
804
|
+
*
|
|
805
|
+
* const outputType = assertOutputType(schema.getType('Review'));
|
|
806
|
+
*
|
|
807
|
+
* outputType.toString(); // => 'Review'
|
|
808
|
+
* assertOutputType(schema.getType('ReviewInput')); // throws an error
|
|
809
|
+
* ```
|
|
810
|
+
*/
|
|
811
|
+
|
|
812
|
+
function assertOutputType(type) {
|
|
813
|
+
if (!isOutputType(type)) {
|
|
814
|
+
throw new Error(
|
|
815
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL output type.`,
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
return type;
|
|
820
|
+
}
|
|
821
|
+
/** These types may describe types which may be leaf values. */
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Returns true when the value is a GraphQL scalar or enum type.
|
|
825
|
+
* @param type - The GraphQL type to inspect.
|
|
826
|
+
* @returns True when the value is a GraphQL scalar or enum type.
|
|
827
|
+
* @example
|
|
828
|
+
* ```ts
|
|
829
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
830
|
+
* import { isLeafType } from 'graphql/type';
|
|
831
|
+
*
|
|
832
|
+
* const schema = buildSchema(`
|
|
833
|
+
* enum Episode {
|
|
834
|
+
* NEW_HOPE
|
|
835
|
+
* }
|
|
836
|
+
*
|
|
837
|
+
* type Review {
|
|
838
|
+
* stars: Int!
|
|
839
|
+
* }
|
|
840
|
+
*
|
|
841
|
+
* type Query {
|
|
842
|
+
* episode: Episode
|
|
843
|
+
* review: Review
|
|
844
|
+
* }
|
|
845
|
+
* `);
|
|
846
|
+
*
|
|
847
|
+
* isLeafType(schema.getType('Episode')); // => true
|
|
848
|
+
* isLeafType(schema.getType('String')); // => true
|
|
849
|
+
* isLeafType(schema.getType('Review')); // => false
|
|
850
|
+
* ```
|
|
851
|
+
*/
|
|
852
|
+
function isLeafType(type) {
|
|
853
|
+
return isScalarType(type) || isEnumType(type);
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Returns the value as a GraphQL leaf type, or throws if it is not one.
|
|
857
|
+
* @param type - The GraphQL type to inspect.
|
|
858
|
+
* @returns The value typed as a GraphQL leaf type.
|
|
859
|
+
* @example
|
|
860
|
+
* ```ts
|
|
861
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
862
|
+
* import { assertLeafType } from 'graphql/type';
|
|
863
|
+
*
|
|
864
|
+
* const schema = buildSchema(`
|
|
865
|
+
* enum Episode {
|
|
866
|
+
* NEW_HOPE
|
|
867
|
+
* }
|
|
868
|
+
*
|
|
869
|
+
* type Review {
|
|
870
|
+
* stars: Int!
|
|
871
|
+
* }
|
|
872
|
+
*
|
|
873
|
+
* type Query {
|
|
874
|
+
* episode: Episode
|
|
875
|
+
* review: Review
|
|
876
|
+
* }
|
|
877
|
+
* `);
|
|
878
|
+
*
|
|
879
|
+
* const episodeType = assertLeafType(schema.getType('Episode'));
|
|
880
|
+
*
|
|
881
|
+
* episodeType.toString(); // => 'Episode'
|
|
882
|
+
* assertLeafType(schema.getType('Review')); // throws an error
|
|
883
|
+
* ```
|
|
884
|
+
*/
|
|
885
|
+
|
|
886
|
+
function assertLeafType(type) {
|
|
887
|
+
if (!isLeafType(type)) {
|
|
888
|
+
throw new Error(
|
|
889
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL leaf type.`,
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
return type;
|
|
894
|
+
}
|
|
895
|
+
/** These types may describe the parent context of a selection set. */
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Returns true when the value is a GraphQL object, interface, or union type.
|
|
899
|
+
* @param type - The GraphQL type to inspect.
|
|
900
|
+
* @returns True when the value is a GraphQL object, interface, or union type.
|
|
901
|
+
* @example
|
|
902
|
+
* ```ts
|
|
903
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
904
|
+
* import { isCompositeType } from 'graphql/type';
|
|
905
|
+
*
|
|
906
|
+
* const schema = buildSchema(`
|
|
907
|
+
* interface Node {
|
|
908
|
+
* id: ID!
|
|
909
|
+
* }
|
|
910
|
+
*
|
|
911
|
+
* type User implements Node {
|
|
912
|
+
* id: ID!
|
|
913
|
+
* }
|
|
914
|
+
*
|
|
915
|
+
* union SearchResult = User
|
|
916
|
+
*
|
|
917
|
+
* type Query {
|
|
918
|
+
* node: Node
|
|
919
|
+
* search: [SearchResult]
|
|
920
|
+
* }
|
|
921
|
+
* `);
|
|
922
|
+
*
|
|
923
|
+
* isCompositeType(schema.getType('User')); // => true
|
|
924
|
+
* isCompositeType(schema.getType('Node')); // => true
|
|
925
|
+
* isCompositeType(schema.getType('SearchResult')); // => true
|
|
926
|
+
* isCompositeType(schema.getType('String')); // => false
|
|
927
|
+
* ```
|
|
928
|
+
*/
|
|
929
|
+
function isCompositeType(type) {
|
|
930
|
+
return isObjectType(type) || isInterfaceType(type) || isUnionType(type);
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Returns the value as a GraphQL composite type, or throws if it is not one.
|
|
934
|
+
* @param type - The GraphQL type to inspect.
|
|
935
|
+
* @returns The value typed as a GraphQL composite type.
|
|
936
|
+
* @example
|
|
937
|
+
* ```ts
|
|
938
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
939
|
+
* import { assertCompositeType } from 'graphql/type';
|
|
940
|
+
*
|
|
941
|
+
* const schema = buildSchema(`
|
|
942
|
+
* interface Node {
|
|
943
|
+
* id: ID!
|
|
944
|
+
* }
|
|
945
|
+
*
|
|
946
|
+
* type User implements Node {
|
|
947
|
+
* id: ID!
|
|
948
|
+
* }
|
|
949
|
+
*
|
|
950
|
+
* type Query {
|
|
951
|
+
* node: Node
|
|
952
|
+
* }
|
|
953
|
+
* `);
|
|
954
|
+
*
|
|
955
|
+
* const userType = assertCompositeType(schema.getType('User'));
|
|
956
|
+
*
|
|
957
|
+
* userType.toString(); // => 'User'
|
|
958
|
+
* assertCompositeType(schema.getType('String')); // throws an error
|
|
959
|
+
* ```
|
|
960
|
+
*/
|
|
961
|
+
|
|
962
|
+
function assertCompositeType(type) {
|
|
963
|
+
if (!isCompositeType(type)) {
|
|
964
|
+
throw new Error(
|
|
965
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL composite type.`,
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
return type;
|
|
970
|
+
}
|
|
971
|
+
/** These types may describe the parent context of a selection set. */
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Returns true when the value is a GraphQL interface or union type.
|
|
975
|
+
* @param type - The GraphQL type to inspect.
|
|
976
|
+
* @returns True when the value is a GraphQL interface or union type.
|
|
977
|
+
* @example
|
|
978
|
+
* ```ts
|
|
979
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
980
|
+
* import { isAbstractType } from 'graphql/type';
|
|
981
|
+
*
|
|
982
|
+
* const schema = buildSchema(`
|
|
983
|
+
* interface Node {
|
|
984
|
+
* id: ID!
|
|
985
|
+
* }
|
|
986
|
+
*
|
|
987
|
+
* type User implements Node {
|
|
988
|
+
* id: ID!
|
|
989
|
+
* }
|
|
990
|
+
*
|
|
991
|
+
* union SearchResult = User
|
|
992
|
+
*
|
|
993
|
+
* type Query {
|
|
994
|
+
* node: Node
|
|
995
|
+
* search: [SearchResult]
|
|
996
|
+
* }
|
|
997
|
+
* `);
|
|
998
|
+
*
|
|
999
|
+
* isAbstractType(schema.getType('Node')); // => true
|
|
1000
|
+
* isAbstractType(schema.getType('SearchResult')); // => true
|
|
1001
|
+
* isAbstractType(schema.getType('User')); // => false
|
|
1002
|
+
* ```
|
|
1003
|
+
*/
|
|
1004
|
+
function isAbstractType(type) {
|
|
1005
|
+
return isInterfaceType(type) || isUnionType(type);
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Returns the value as a GraphQL abstract type, or throws if it is not one.
|
|
1009
|
+
* @param type - The GraphQL type to inspect.
|
|
1010
|
+
* @returns The value typed as a GraphQL abstract type.
|
|
1011
|
+
* @example
|
|
1012
|
+
* ```ts
|
|
1013
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
1014
|
+
* import { assertAbstractType } from 'graphql/type';
|
|
1015
|
+
*
|
|
1016
|
+
* const schema = buildSchema(`
|
|
1017
|
+
* interface Node {
|
|
1018
|
+
* id: ID!
|
|
1019
|
+
* }
|
|
1020
|
+
*
|
|
1021
|
+
* type User implements Node {
|
|
1022
|
+
* id: ID!
|
|
1023
|
+
* }
|
|
1024
|
+
*
|
|
1025
|
+
* type Query {
|
|
1026
|
+
* node: Node
|
|
1027
|
+
* }
|
|
1028
|
+
* `);
|
|
1029
|
+
*
|
|
1030
|
+
* const nodeType = assertAbstractType(schema.getType('Node'));
|
|
1031
|
+
*
|
|
1032
|
+
* nodeType.toString(); // => 'Node'
|
|
1033
|
+
* assertAbstractType(schema.getType('User')); // throws an error
|
|
1034
|
+
* ```
|
|
1035
|
+
*/
|
|
1036
|
+
|
|
1037
|
+
function assertAbstractType(type) {
|
|
1038
|
+
if (!isAbstractType(type)) {
|
|
1039
|
+
throw new Error(
|
|
1040
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL abstract type.`,
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
return type;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* List Type Wrapper
|
|
1048
|
+
*
|
|
1049
|
+
* A list is a wrapping type which points to another type.
|
|
1050
|
+
* Lists are often created within the context of defining the fields of
|
|
1051
|
+
* an object type.
|
|
1052
|
+
* @typeParam T - The GraphQL type wrapped by this list type.
|
|
1053
|
+
* @example
|
|
1054
|
+
* ```ts
|
|
1055
|
+
* const PersonType = new GraphQLObjectType({
|
|
1056
|
+
* name: 'Person',
|
|
1057
|
+
* fields: () => ({
|
|
1058
|
+
* parents: { type: new GraphQLList(PersonType) },
|
|
1059
|
+
* children: { type: new GraphQLList(PersonType) },
|
|
1060
|
+
* })
|
|
1061
|
+
* })
|
|
1062
|
+
* ```
|
|
1063
|
+
*/
|
|
1064
|
+
|
|
1065
|
+
class GraphQLList {
|
|
1066
|
+
/** The type wrapped by this list or non-null type. */
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Creates a GraphQLList instance.
|
|
1070
|
+
* @param ofType - The type to wrap.
|
|
1071
|
+
* @example
|
|
1072
|
+
* ```ts
|
|
1073
|
+
* import { GraphQLList, GraphQLString } from 'graphql/type';
|
|
1074
|
+
*
|
|
1075
|
+
* const stringList = new GraphQLList(GraphQLString);
|
|
1076
|
+
*
|
|
1077
|
+
* stringList.ofType; // => GraphQLString
|
|
1078
|
+
* String(stringList); // => '[String]'
|
|
1079
|
+
* ```
|
|
1080
|
+
*/
|
|
1081
|
+
constructor(ofType) {
|
|
1082
|
+
isType(ofType) ||
|
|
1083
|
+
(0, _devAssert.devAssert)(
|
|
1084
|
+
false,
|
|
1085
|
+
`Expected ${(0, _inspect.inspect)(ofType)} to be a GraphQL type.`,
|
|
1086
|
+
);
|
|
1087
|
+
this.ofType = ofType;
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
1091
|
+
* @returns The built-in string tag for this object.
|
|
1092
|
+
*/
|
|
1093
|
+
|
|
1094
|
+
get [Symbol.toStringTag]() {
|
|
1095
|
+
return 'GraphQLList';
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Returns this wrapping type as a GraphQL type-reference string.
|
|
1099
|
+
* @returns The GraphQL type-reference string.
|
|
1100
|
+
* @example
|
|
1101
|
+
* ```ts
|
|
1102
|
+
* import { GraphQLList, GraphQLNonNull, GraphQLString } from 'graphql/type';
|
|
1103
|
+
*
|
|
1104
|
+
* const stringList = new GraphQLList(GraphQLString);
|
|
1105
|
+
* const requiredStringList = new GraphQLList(new GraphQLNonNull(GraphQLString));
|
|
1106
|
+
*
|
|
1107
|
+
* stringList.toString(); // => '[String]'
|
|
1108
|
+
* requiredStringList.toString(); // => '[String!]'
|
|
1109
|
+
* ```
|
|
1110
|
+
*/
|
|
1111
|
+
|
|
1112
|
+
toString() {
|
|
1113
|
+
return '[' + String(this.ofType) + ']';
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Returns the JSON representation used when this object is serialized.
|
|
1117
|
+
* @returns The JSON-serializable representation.
|
|
1118
|
+
* @example
|
|
1119
|
+
* ```ts
|
|
1120
|
+
* import { GraphQLList, GraphQLString } from 'graphql/type';
|
|
1121
|
+
*
|
|
1122
|
+
* const stringList = new GraphQLList(GraphQLString);
|
|
1123
|
+
*
|
|
1124
|
+
* stringList.toJSON(); // => '[String]'
|
|
1125
|
+
* JSON.stringify({ type: stringList }); // => '{"type":"[String]"}'
|
|
1126
|
+
* ```
|
|
1127
|
+
*/
|
|
1128
|
+
|
|
1129
|
+
toJSON() {
|
|
1130
|
+
return this.toString();
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Non-Null Type Wrapper
|
|
1135
|
+
*
|
|
1136
|
+
* A non-null is a wrapping type which points to another type.
|
|
1137
|
+
* Non-null types enforce that their values are never null and can ensure
|
|
1138
|
+
* an error is raised if this ever occurs during a request. It is useful for
|
|
1139
|
+
* fields which you can make a strong guarantee on non-nullability, for example
|
|
1140
|
+
* usually the id field of a database row will never be null.
|
|
1141
|
+
* @typeParam T - The nullable GraphQL type wrapped by this non-null type.
|
|
1142
|
+
* @example
|
|
1143
|
+
* ```ts
|
|
1144
|
+
* const RowType = new GraphQLObjectType({
|
|
1145
|
+
* name: 'Row',
|
|
1146
|
+
* fields: () => ({
|
|
1147
|
+
* id: { type: new GraphQLNonNull(GraphQLString) },
|
|
1148
|
+
* })
|
|
1149
|
+
* })
|
|
1150
|
+
* ```
|
|
1151
|
+
*
|
|
1152
|
+
* Note: the enforcement of non-nullability occurs within the executor.
|
|
1153
|
+
*/
|
|
1154
|
+
|
|
1155
|
+
exports.GraphQLList = GraphQLList;
|
|
1156
|
+
|
|
1157
|
+
class GraphQLNonNull {
|
|
1158
|
+
/** The type wrapped by this list or non-null type. */
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* Creates a GraphQLNonNull instance.
|
|
1162
|
+
* @param ofType - The type to wrap.
|
|
1163
|
+
* @example
|
|
1164
|
+
* ```ts
|
|
1165
|
+
* import { GraphQLNonNull, GraphQLString } from 'graphql/type';
|
|
1166
|
+
*
|
|
1167
|
+
* const requiredString = new GraphQLNonNull(GraphQLString);
|
|
1168
|
+
*
|
|
1169
|
+
* requiredString.ofType; // => GraphQLString
|
|
1170
|
+
* String(requiredString); // => 'String!'
|
|
1171
|
+
* ```
|
|
1172
|
+
*/
|
|
1173
|
+
constructor(ofType) {
|
|
1174
|
+
isNullableType(ofType) ||
|
|
1175
|
+
(0, _devAssert.devAssert)(
|
|
1176
|
+
false,
|
|
1177
|
+
`Expected ${(0, _inspect.inspect)(
|
|
1178
|
+
ofType,
|
|
1179
|
+
)} to be a GraphQL nullable type.`,
|
|
1180
|
+
);
|
|
1181
|
+
this.ofType = ofType;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
1185
|
+
* @returns The built-in string tag for this object.
|
|
1186
|
+
*/
|
|
1187
|
+
|
|
1188
|
+
get [Symbol.toStringTag]() {
|
|
1189
|
+
return 'GraphQLNonNull';
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Returns this wrapping type as a GraphQL type-reference string.
|
|
1193
|
+
* @returns The GraphQL type-reference string.
|
|
1194
|
+
* @example
|
|
1195
|
+
* ```ts
|
|
1196
|
+
* import { GraphQLList, GraphQLNonNull, GraphQLString } from 'graphql/type';
|
|
1197
|
+
*
|
|
1198
|
+
* const requiredString = new GraphQLNonNull(GraphQLString);
|
|
1199
|
+
* const requiredStringList = new GraphQLNonNull(
|
|
1200
|
+
* new GraphQLList(GraphQLString),
|
|
1201
|
+
* );
|
|
1202
|
+
*
|
|
1203
|
+
* requiredString.toString(); // => 'String!'
|
|
1204
|
+
* requiredStringList.toString(); // => '[String]!'
|
|
1205
|
+
* ```
|
|
1206
|
+
*/
|
|
1207
|
+
|
|
1208
|
+
toString() {
|
|
1209
|
+
return String(this.ofType) + '!';
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Returns the JSON representation used when this object is serialized.
|
|
1213
|
+
* @returns The JSON-serializable representation.
|
|
1214
|
+
* @example
|
|
1215
|
+
* ```ts
|
|
1216
|
+
* import { GraphQLNonNull, GraphQLString } from 'graphql/type';
|
|
1217
|
+
*
|
|
1218
|
+
* const requiredString = new GraphQLNonNull(GraphQLString);
|
|
1219
|
+
*
|
|
1220
|
+
* requiredString.toJSON(); // => 'String!'
|
|
1221
|
+
* JSON.stringify({ type: requiredString }); // => '{"type":"String!"}'
|
|
1222
|
+
* ```
|
|
1223
|
+
*/
|
|
1224
|
+
|
|
1225
|
+
toJSON() {
|
|
1226
|
+
return this.toString();
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
/** These types wrap and modify other types */
|
|
1230
|
+
|
|
1231
|
+
exports.GraphQLNonNull = GraphQLNonNull;
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Returns true when the value is a GraphQL list or non-null wrapper type.
|
|
1235
|
+
* @param type - The GraphQL type to inspect.
|
|
1236
|
+
* @returns True when the value is a GraphQL list or non-null wrapper type.
|
|
1237
|
+
* @example
|
|
1238
|
+
* ```ts
|
|
1239
|
+
* import {
|
|
1240
|
+
* GraphQLList,
|
|
1241
|
+
* GraphQLNonNull,
|
|
1242
|
+
* GraphQLString,
|
|
1243
|
+
* isWrappingType,
|
|
1244
|
+
* } from 'graphql/type';
|
|
1245
|
+
*
|
|
1246
|
+
* isWrappingType(new GraphQLList(GraphQLString)); // => true
|
|
1247
|
+
* isWrappingType(new GraphQLNonNull(GraphQLString)); // => true
|
|
1248
|
+
* isWrappingType(GraphQLString); // => false
|
|
1249
|
+
* ```
|
|
1250
|
+
*/
|
|
1251
|
+
function isWrappingType(type) {
|
|
1252
|
+
return isListType(type) || isNonNullType(type);
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Returns the value as a GraphQL wrapping type, or throws if it is not one.
|
|
1256
|
+
* @param type - The GraphQL type to inspect.
|
|
1257
|
+
* @returns The value typed as a GraphQL wrapping type.
|
|
1258
|
+
* @example
|
|
1259
|
+
* ```ts
|
|
1260
|
+
* import { GraphQLList, GraphQLString, assertWrappingType } from 'graphql/type';
|
|
1261
|
+
*
|
|
1262
|
+
* const wrappingType = assertWrappingType(new GraphQLList(GraphQLString));
|
|
1263
|
+
*
|
|
1264
|
+
* wrappingType.toString(); // => '[String]'
|
|
1265
|
+
* assertWrappingType(GraphQLString); // throws an error
|
|
1266
|
+
* ```
|
|
1267
|
+
*/
|
|
1268
|
+
|
|
1269
|
+
function assertWrappingType(type) {
|
|
1270
|
+
if (!isWrappingType(type)) {
|
|
1271
|
+
throw new Error(
|
|
1272
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL wrapping type.`,
|
|
1273
|
+
);
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
return type;
|
|
1277
|
+
}
|
|
1278
|
+
/** These types can all accept null as a value. */
|
|
1279
|
+
|
|
1280
|
+
/**
|
|
1281
|
+
* Returns true when the value is a GraphQL type that can accept null.
|
|
1282
|
+
* @param type - The GraphQL type to inspect.
|
|
1283
|
+
* @returns True when the value is a GraphQL type that can accept null.
|
|
1284
|
+
* @example
|
|
1285
|
+
* ```ts
|
|
1286
|
+
* import { GraphQLNonNull, GraphQLString, isNullableType } from 'graphql/type';
|
|
1287
|
+
*
|
|
1288
|
+
* isNullableType(GraphQLString); // => true
|
|
1289
|
+
* isNullableType(new GraphQLNonNull(GraphQLString)); // => false
|
|
1290
|
+
* isNullableType(null); // => false
|
|
1291
|
+
* ```
|
|
1292
|
+
*/
|
|
1293
|
+
function isNullableType(type) {
|
|
1294
|
+
return isType(type) && !isNonNullType(type);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Returns the value as a nullable GraphQL type, or throws if it is not one.
|
|
1298
|
+
* @param type - The GraphQL type to inspect.
|
|
1299
|
+
* @returns The value typed as a nullable GraphQL type.
|
|
1300
|
+
* @example
|
|
1301
|
+
* ```ts
|
|
1302
|
+
* import {
|
|
1303
|
+
* GraphQLNonNull,
|
|
1304
|
+
* GraphQLString,
|
|
1305
|
+
* assertNullableType,
|
|
1306
|
+
* } from 'graphql/type';
|
|
1307
|
+
*
|
|
1308
|
+
* const nullableType = assertNullableType(GraphQLString);
|
|
1309
|
+
*
|
|
1310
|
+
* nullableType; // => GraphQLString
|
|
1311
|
+
* assertNullableType(new GraphQLNonNull(GraphQLString)); // throws an error
|
|
1312
|
+
* ```
|
|
1313
|
+
*/
|
|
1314
|
+
|
|
1315
|
+
function assertNullableType(type) {
|
|
1316
|
+
if (!isNullableType(type)) {
|
|
1317
|
+
throw new Error(
|
|
1318
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL nullable type.`,
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
return type;
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* Returns the nullable type.
|
|
1326
|
+
* @param type - The GraphQL type to inspect.
|
|
1327
|
+
* @returns The nullable type after removing one non-null wrapper, if present.
|
|
1328
|
+
* @example
|
|
1329
|
+
* ```ts
|
|
1330
|
+
* import { getNullableType } from 'graphql/type';
|
|
1331
|
+
*
|
|
1332
|
+
* getNullableType(null); // => undefined
|
|
1333
|
+
* getNullableType(undefined); // => undefined
|
|
1334
|
+
* ```
|
|
1335
|
+
*/
|
|
1336
|
+
|
|
1337
|
+
/** @internal */
|
|
1338
|
+
function getNullableType(type) {
|
|
1339
|
+
if (type) {
|
|
1340
|
+
return isNonNullType(type) ? type.ofType : type;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
/** These named types do not include modifiers like List or NonNull. */
|
|
1344
|
+
|
|
1345
|
+
/**
|
|
1346
|
+
* Returns true when the value is a GraphQL named type.
|
|
1347
|
+
* @param type - The GraphQL type to inspect.
|
|
1348
|
+
* @returns True when the value is a GraphQL named type.
|
|
1349
|
+
* @example
|
|
1350
|
+
* ```ts
|
|
1351
|
+
* import { GraphQLList, GraphQLString, isNamedType } from 'graphql/type';
|
|
1352
|
+
*
|
|
1353
|
+
* isNamedType(GraphQLString); // => true
|
|
1354
|
+
* isNamedType(new GraphQLList(GraphQLString)); // => false
|
|
1355
|
+
* isNamedType(null); // => false
|
|
1356
|
+
* ```
|
|
1357
|
+
*/
|
|
1358
|
+
function isNamedType(type) {
|
|
1359
|
+
return (
|
|
1360
|
+
isScalarType(type) ||
|
|
1361
|
+
isObjectType(type) ||
|
|
1362
|
+
isInterfaceType(type) ||
|
|
1363
|
+
isUnionType(type) ||
|
|
1364
|
+
isEnumType(type) ||
|
|
1365
|
+
isInputObjectType(type)
|
|
1366
|
+
);
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Returns the value as a GraphQL named type, or throws if it is not one.
|
|
1370
|
+
* @param type - The GraphQL type to inspect.
|
|
1371
|
+
* @returns The value typed as a GraphQL named type.
|
|
1372
|
+
* @example
|
|
1373
|
+
* ```ts
|
|
1374
|
+
* import { GraphQLList, GraphQLString, assertNamedType } from 'graphql/type';
|
|
1375
|
+
*
|
|
1376
|
+
* const namedType = assertNamedType(GraphQLString);
|
|
1377
|
+
*
|
|
1378
|
+
* namedType.name; // => 'String'
|
|
1379
|
+
* assertNamedType(new GraphQLList(GraphQLString)); // throws an error
|
|
1380
|
+
* ```
|
|
1381
|
+
*/
|
|
1382
|
+
|
|
1383
|
+
function assertNamedType(type) {
|
|
1384
|
+
if (!isNamedType(type)) {
|
|
1385
|
+
throw new Error(
|
|
1386
|
+
`Expected ${(0, _inspect.inspect)(type)} to be a GraphQL named type.`,
|
|
1387
|
+
);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
return type;
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* Returns the named type.
|
|
1394
|
+
* @param type - The GraphQL type to inspect.
|
|
1395
|
+
* @returns The named type after unwrapping all list and non-null wrappers.
|
|
1396
|
+
* @example
|
|
1397
|
+
* ```ts
|
|
1398
|
+
* import { getNamedType } from 'graphql/type';
|
|
1399
|
+
*
|
|
1400
|
+
* getNamedType(null); // => undefined
|
|
1401
|
+
* getNamedType(undefined); // => undefined
|
|
1402
|
+
* ```
|
|
1403
|
+
*/
|
|
1404
|
+
|
|
1405
|
+
/** @internal */
|
|
1406
|
+
function getNamedType(type) {
|
|
1407
|
+
if (type) {
|
|
1408
|
+
let unwrappedType = type;
|
|
1409
|
+
|
|
1410
|
+
while (isWrappingType(unwrappedType)) {
|
|
1411
|
+
unwrappedType = unwrappedType.ofType;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
return unwrappedType;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Used while defining GraphQL types to allow for circular references in
|
|
1419
|
+
* otherwise immutable type definitions.
|
|
1420
|
+
* @typeParam T - The element type returned by the thunk or array.
|
|
1421
|
+
*/
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* Resolves a thunked readonly array.
|
|
1425
|
+
* @param thunk - The thunk or value to resolve.
|
|
1426
|
+
* @returns The resolved readonly array.
|
|
1427
|
+
* @typeParam T - The element type resolved from the thunk or array.
|
|
1428
|
+
* @example
|
|
1429
|
+
* ```ts
|
|
1430
|
+
* import { GraphQLString, resolveReadonlyArrayThunk } from 'graphql/type';
|
|
1431
|
+
*
|
|
1432
|
+
* const lazyFields = resolveReadonlyArrayThunk(() => [GraphQLString]);
|
|
1433
|
+
* const fields = resolveReadonlyArrayThunk([GraphQLString]);
|
|
1434
|
+
*
|
|
1435
|
+
* lazyFields; // => [GraphQLString]
|
|
1436
|
+
* fields; // => [GraphQLString]
|
|
1437
|
+
* ```
|
|
1438
|
+
*/
|
|
1439
|
+
function resolveReadonlyArrayThunk(thunk) {
|
|
1440
|
+
return typeof thunk === 'function' ? thunk() : thunk;
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Resolves a thunked object map.
|
|
1444
|
+
* @param thunk - The thunk or value to resolve.
|
|
1445
|
+
* @returns The resolved object map.
|
|
1446
|
+
* @typeParam T - The object-map value type resolved from the thunk or map.
|
|
1447
|
+
* @example
|
|
1448
|
+
* ```ts
|
|
1449
|
+
* import { GraphQLString, resolveObjMapThunk } from 'graphql/type';
|
|
1450
|
+
*
|
|
1451
|
+
* const lazyFields = resolveObjMapThunk(() => ({ name: GraphQLString }));
|
|
1452
|
+
* const fields = resolveObjMapThunk({ name: GraphQLString });
|
|
1453
|
+
*
|
|
1454
|
+
* lazyFields.name; // => GraphQLString
|
|
1455
|
+
* fields.name; // => GraphQLString
|
|
1456
|
+
* ```
|
|
1457
|
+
*/
|
|
1458
|
+
|
|
1459
|
+
function resolveObjMapThunk(thunk) {
|
|
1460
|
+
return typeof thunk === 'function' ? thunk() : thunk;
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Custom extensions
|
|
1464
|
+
* @remarks
|
|
1465
|
+
* Use a unique identifier name for your extension, for example the name of
|
|
1466
|
+
* your library or project. Do not use a shortened identifier as this increases
|
|
1467
|
+
* the risk of conflicts. We recommend you add at most one extension field,
|
|
1468
|
+
* an object which can contain all the values you need.
|
|
1469
|
+
*/
|
|
1470
|
+
|
|
1471
|
+
/**
|
|
1472
|
+
* Scalar Type Definition
|
|
1473
|
+
*
|
|
1474
|
+
* Scalar types define the leaf values of a GraphQL response and the input
|
|
1475
|
+
* values accepted by arguments and input object fields. A scalar type has a
|
|
1476
|
+
* name and coercion functions that validate and convert runtime values and
|
|
1477
|
+
* GraphQL literals.
|
|
1478
|
+
*
|
|
1479
|
+
* If a type's serialize function returns `null` or does not return a value
|
|
1480
|
+
* (i.e. it returns `undefined`) then an error will be raised and a `null`
|
|
1481
|
+
* value will be returned in the response. Prefer validating inputs before
|
|
1482
|
+
* execution so clients receive input diagnostics before result coercion fails.
|
|
1483
|
+
* @typeParam TInternal - The internal runtime representation accepted by this scalar.
|
|
1484
|
+
* @typeParam TExternal - The serialized representation exposed in GraphQL results.
|
|
1485
|
+
* @example
|
|
1486
|
+
* ```ts
|
|
1487
|
+
* const OddType = new GraphQLScalarType({
|
|
1488
|
+
* name: 'Odd',
|
|
1489
|
+
* serialize: (value) => {
|
|
1490
|
+
* if (!Number.isFinite(value)) {
|
|
1491
|
+
* throw new Error(
|
|
1492
|
+
* `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`,
|
|
1493
|
+
* );
|
|
1494
|
+
* }
|
|
1495
|
+
*
|
|
1496
|
+
* if (value % 2 === 0) {
|
|
1497
|
+
* throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`);
|
|
1498
|
+
* }
|
|
1499
|
+
* return value;
|
|
1500
|
+
* }
|
|
1501
|
+
* });
|
|
1502
|
+
* ```
|
|
1503
|
+
*/
|
|
1504
|
+
class GraphQLScalarType {
|
|
1505
|
+
/** The GraphQL name for this schema element. */
|
|
1506
|
+
|
|
1507
|
+
/** Human-readable description for this schema element, if provided. */
|
|
1508
|
+
|
|
1509
|
+
/** URL identifying the behavior specified for this custom scalar. */
|
|
1510
|
+
|
|
1511
|
+
/** Function that converts internal values to externally visible scalar values. */
|
|
1512
|
+
|
|
1513
|
+
/** Function that converts variable input into this scalar's internal value. */
|
|
1514
|
+
|
|
1515
|
+
/** Function that converts AST input literals into this scalar's internal value. */
|
|
1516
|
+
|
|
1517
|
+
/** Custom extension fields reserved for users. */
|
|
1518
|
+
|
|
1519
|
+
/** AST node from which this schema element was built, if available. */
|
|
1520
|
+
|
|
1521
|
+
/** AST extension nodes applied to this schema element. */
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* Creates a GraphQLScalarType instance.
|
|
1525
|
+
* @param config - Configuration describing this object.
|
|
1526
|
+
* @example
|
|
1527
|
+
* ```ts
|
|
1528
|
+
* import { Kind, parse } from 'graphql/language';
|
|
1529
|
+
* import { GraphQLScalarType } from 'graphql/type';
|
|
1530
|
+
*
|
|
1531
|
+
* const document = parse(`
|
|
1532
|
+
* "Odd integer values."
|
|
1533
|
+
* scalar Odd @specifiedBy(url: "https://example.com/odd")
|
|
1534
|
+
*
|
|
1535
|
+
* extend scalar Odd @specifiedBy(url: "https://example.com/odd-v2")
|
|
1536
|
+
* `);
|
|
1537
|
+
*
|
|
1538
|
+
* const Odd = new GraphQLScalarType({
|
|
1539
|
+
* name: 'Odd',
|
|
1540
|
+
* description: 'Odd integer values.',
|
|
1541
|
+
* specifiedByURL: 'https://example.com/odd',
|
|
1542
|
+
* serialize: (value) => {
|
|
1543
|
+
* if (typeof value !== 'number' || value % 2 === 0) {
|
|
1544
|
+
* throw new TypeError('Odd can only serialize odd numbers.');
|
|
1545
|
+
* }
|
|
1546
|
+
* return value;
|
|
1547
|
+
* },
|
|
1548
|
+
* parseValue: (value) => {
|
|
1549
|
+
* if (typeof value !== 'number' || value % 2 === 0) {
|
|
1550
|
+
* throw new TypeError('Odd can only parse odd numbers.');
|
|
1551
|
+
* }
|
|
1552
|
+
* return value;
|
|
1553
|
+
* },
|
|
1554
|
+
* parseLiteral: (ast) => {
|
|
1555
|
+
* if (ast.kind !== Kind.INT) {
|
|
1556
|
+
* throw new TypeError('Odd can only parse integer literals.');
|
|
1557
|
+
* }
|
|
1558
|
+
* const value = Number(ast.value);
|
|
1559
|
+
* if (value % 2 === 0) {
|
|
1560
|
+
* throw new TypeError('Odd can only parse odd integer literals.');
|
|
1561
|
+
* }
|
|
1562
|
+
* return value;
|
|
1563
|
+
* },
|
|
1564
|
+
* extensions: { numeric: true },
|
|
1565
|
+
* astNode: document.definitions[0],
|
|
1566
|
+
* extensionASTNodes: [ document.definitions[1] ],
|
|
1567
|
+
* });
|
|
1568
|
+
*
|
|
1569
|
+
* Odd.description; // => 'Odd integer values.'
|
|
1570
|
+
* Odd.specifiedByURL; // => 'https://example.com/odd'
|
|
1571
|
+
* Odd.serialize(3); // => 3
|
|
1572
|
+
* Odd.parseValue(5); // => 5
|
|
1573
|
+
* Odd.extensions; // => { numeric: true }
|
|
1574
|
+
* ```
|
|
1575
|
+
*/
|
|
1576
|
+
constructor(config) {
|
|
1577
|
+
var _config$parseValue,
|
|
1578
|
+
_config$serialize,
|
|
1579
|
+
_config$parseLiteral,
|
|
1580
|
+
_config$extensionASTN;
|
|
1581
|
+
|
|
1582
|
+
const parseValue =
|
|
1583
|
+
(_config$parseValue = config.parseValue) !== null &&
|
|
1584
|
+
_config$parseValue !== void 0
|
|
1585
|
+
? _config$parseValue
|
|
1586
|
+
: _identityFunc.identityFunc;
|
|
1587
|
+
this.name = (0, _assertName.assertName)(config.name);
|
|
1588
|
+
this.description = config.description;
|
|
1589
|
+
this.specifiedByURL = config.specifiedByURL;
|
|
1590
|
+
this.serialize =
|
|
1591
|
+
(_config$serialize = config.serialize) !== null &&
|
|
1592
|
+
_config$serialize !== void 0
|
|
1593
|
+
? _config$serialize
|
|
1594
|
+
: _identityFunc.identityFunc;
|
|
1595
|
+
this.parseValue = parseValue;
|
|
1596
|
+
this.parseLiteral =
|
|
1597
|
+
(_config$parseLiteral = config.parseLiteral) !== null &&
|
|
1598
|
+
_config$parseLiteral !== void 0
|
|
1599
|
+
? _config$parseLiteral
|
|
1600
|
+
: (node, variables) =>
|
|
1601
|
+
parseValue(
|
|
1602
|
+
(0, _valueFromASTUntyped.valueFromASTUntyped)(node, variables),
|
|
1603
|
+
);
|
|
1604
|
+
this.extensions = (0, _toObjMap.toObjMap)(config.extensions);
|
|
1605
|
+
this.astNode = config.astNode;
|
|
1606
|
+
this.extensionASTNodes =
|
|
1607
|
+
(_config$extensionASTN = config.extensionASTNodes) !== null &&
|
|
1608
|
+
_config$extensionASTN !== void 0
|
|
1609
|
+
? _config$extensionASTN
|
|
1610
|
+
: [];
|
|
1611
|
+
config.specifiedByURL == null ||
|
|
1612
|
+
typeof config.specifiedByURL === 'string' ||
|
|
1613
|
+
(0, _devAssert.devAssert)(
|
|
1614
|
+
false,
|
|
1615
|
+
`${this.name} must provide "specifiedByURL" as a string, ` +
|
|
1616
|
+
`but got: ${(0, _inspect.inspect)(config.specifiedByURL)}.`,
|
|
1617
|
+
);
|
|
1618
|
+
config.serialize == null ||
|
|
1619
|
+
typeof config.serialize === 'function' ||
|
|
1620
|
+
(0, _devAssert.devAssert)(
|
|
1621
|
+
false,
|
|
1622
|
+
`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`,
|
|
1623
|
+
);
|
|
1624
|
+
|
|
1625
|
+
if (config.parseLiteral) {
|
|
1626
|
+
(typeof config.parseValue === 'function' &&
|
|
1627
|
+
typeof config.parseLiteral === 'function') ||
|
|
1628
|
+
(0, _devAssert.devAssert)(
|
|
1629
|
+
false,
|
|
1630
|
+
`${this.name} must provide both "parseValue" and "parseLiteral" functions.`,
|
|
1631
|
+
);
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
1636
|
+
* @returns The built-in string tag for this object.
|
|
1637
|
+
*/
|
|
1638
|
+
|
|
1639
|
+
get [Symbol.toStringTag]() {
|
|
1640
|
+
return 'GraphQLScalarType';
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Returns a normalized configuration object for this object.
|
|
1644
|
+
* @returns A configuration object that can be used to recreate this object.
|
|
1645
|
+
* @example
|
|
1646
|
+
* ```ts
|
|
1647
|
+
* import { GraphQLScalarType } from 'graphql/type';
|
|
1648
|
+
*
|
|
1649
|
+
* const Url = new GraphQLScalarType({
|
|
1650
|
+
* name: 'Url',
|
|
1651
|
+
* description: 'An absolute URL string.',
|
|
1652
|
+
* specifiedByURL: 'https://url.spec.whatwg.org/',
|
|
1653
|
+
* });
|
|
1654
|
+
*
|
|
1655
|
+
* const config = Url.toConfig();
|
|
1656
|
+
* const UrlCopy = new GraphQLScalarType(config);
|
|
1657
|
+
*
|
|
1658
|
+
* config.name; // => 'Url'
|
|
1659
|
+
* config.specifiedByURL; // => 'https://url.spec.whatwg.org/'
|
|
1660
|
+
* UrlCopy.name; // => Url.name
|
|
1661
|
+
* ```
|
|
1662
|
+
*/
|
|
1663
|
+
|
|
1664
|
+
toConfig() {
|
|
1665
|
+
return {
|
|
1666
|
+
name: this.name,
|
|
1667
|
+
description: this.description,
|
|
1668
|
+
specifiedByURL: this.specifiedByURL,
|
|
1669
|
+
serialize: this.serialize,
|
|
1670
|
+
parseValue: this.parseValue,
|
|
1671
|
+
parseLiteral: this.parseLiteral,
|
|
1672
|
+
extensions: this.extensions,
|
|
1673
|
+
astNode: this.astNode,
|
|
1674
|
+
extensionASTNodes: this.extensionASTNodes,
|
|
1675
|
+
};
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Returns the schema coordinate identifying this scalar type.
|
|
1679
|
+
* @returns The schema coordinate for this scalar type.
|
|
1680
|
+
* @example
|
|
1681
|
+
* ```ts
|
|
1682
|
+
* import { GraphQLScalarType } from 'graphql/type';
|
|
1683
|
+
*
|
|
1684
|
+
* const DateTime = new GraphQLScalarType({ name: 'DateTime' });
|
|
1685
|
+
*
|
|
1686
|
+
* DateTime.toString(); // => 'DateTime'
|
|
1687
|
+
* String(DateTime); // => 'DateTime'
|
|
1688
|
+
* ```
|
|
1689
|
+
*/
|
|
1690
|
+
|
|
1691
|
+
toString() {
|
|
1692
|
+
return this.name;
|
|
1693
|
+
}
|
|
1694
|
+
/**
|
|
1695
|
+
* Returns the JSON representation used when this object is serialized.
|
|
1696
|
+
* @returns The JSON-serializable representation.
|
|
1697
|
+
* @example
|
|
1698
|
+
* ```ts
|
|
1699
|
+
* import { GraphQLScalarType } from 'graphql/type';
|
|
1700
|
+
*
|
|
1701
|
+
* const DateTime = new GraphQLScalarType({ name: 'DateTime' });
|
|
1702
|
+
*
|
|
1703
|
+
* DateTime.toJSON(); // => 'DateTime'
|
|
1704
|
+
* JSON.stringify({ type: DateTime }); // => '{"type":"DateTime"}'
|
|
1705
|
+
* ```
|
|
1706
|
+
*/
|
|
1707
|
+
|
|
1708
|
+
toJSON() {
|
|
1709
|
+
return this.toString();
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* Serializes a runtime value as a scalar output value.
|
|
1714
|
+
* @typeParam TExternal - The serialized representation returned for GraphQL results.
|
|
1715
|
+
*/
|
|
1716
|
+
|
|
1717
|
+
exports.GraphQLScalarType = GraphQLScalarType;
|
|
1718
|
+
|
|
1719
|
+
/**
|
|
1720
|
+
* Object Type Definition
|
|
1721
|
+
*
|
|
1722
|
+
* Almost all of the GraphQL types you define will be object types. Object types
|
|
1723
|
+
* have a name, but most importantly describe their fields.
|
|
1724
|
+
* @typeParam TSource - Source object type passed to resolvers.
|
|
1725
|
+
* @typeParam TContext - Context object type passed to resolvers.
|
|
1726
|
+
* @example
|
|
1727
|
+
* ```ts
|
|
1728
|
+
* const AddressType = new GraphQLObjectType({
|
|
1729
|
+
* name: 'Address',
|
|
1730
|
+
* fields: {
|
|
1731
|
+
* street: { type: GraphQLString },
|
|
1732
|
+
* number: { type: GraphQLInt },
|
|
1733
|
+
* formatted: {
|
|
1734
|
+
* type: GraphQLString,
|
|
1735
|
+
* resolve: (obj) => {
|
|
1736
|
+
* return obj.number + ' ' + obj.street
|
|
1737
|
+
* }
|
|
1738
|
+
* }
|
|
1739
|
+
* }
|
|
1740
|
+
* });
|
|
1741
|
+
* ```
|
|
1742
|
+
* @example
|
|
1743
|
+
* When two types need to refer to each other, or a type needs to refer to
|
|
1744
|
+
* itself in a field, you can use a function expression (aka a closure or a
|
|
1745
|
+
* thunk) to supply the fields lazily.
|
|
1746
|
+
*
|
|
1747
|
+
* ```ts
|
|
1748
|
+
* const PersonType = new GraphQLObjectType({
|
|
1749
|
+
* name: 'Person',
|
|
1750
|
+
* fields: () => ({
|
|
1751
|
+
* name: { type: GraphQLString },
|
|
1752
|
+
* bestFriend: { type: PersonType },
|
|
1753
|
+
* })
|
|
1754
|
+
* });
|
|
1755
|
+
* ```
|
|
1756
|
+
*/
|
|
1757
|
+
class GraphQLObjectType {
|
|
1758
|
+
/** The GraphQL name for this schema element. */
|
|
1759
|
+
|
|
1760
|
+
/** Human-readable description for this schema element, if provided. */
|
|
1761
|
+
|
|
1762
|
+
/** Predicate used to determine whether a runtime value belongs to this object type. */
|
|
1763
|
+
|
|
1764
|
+
/** Custom extension fields reserved for users. */
|
|
1765
|
+
|
|
1766
|
+
/** AST node from which this schema element was built, if available. */
|
|
1767
|
+
|
|
1768
|
+
/** AST extension nodes applied to this schema element. */
|
|
1769
|
+
|
|
1770
|
+
/**
|
|
1771
|
+
* Creates a GraphQLObjectType instance.
|
|
1772
|
+
* @param config - Configuration describing this object.
|
|
1773
|
+
* @example
|
|
1774
|
+
* ```ts
|
|
1775
|
+
* // Configure an object type with interfaces, fields, arguments, and metadata.
|
|
1776
|
+
* import { parse } from 'graphql/language';
|
|
1777
|
+
* import {
|
|
1778
|
+
* GraphQLID,
|
|
1779
|
+
* GraphQLInterfaceType,
|
|
1780
|
+
* GraphQLNonNull,
|
|
1781
|
+
* GraphQLObjectType,
|
|
1782
|
+
* GraphQLString,
|
|
1783
|
+
* } from 'graphql/type';
|
|
1784
|
+
*
|
|
1785
|
+
* const document = parse(`
|
|
1786
|
+
* type User implements Node {
|
|
1787
|
+
* id: ID!
|
|
1788
|
+
* name(format: String = "short"): String
|
|
1789
|
+
* }
|
|
1790
|
+
*
|
|
1791
|
+
* extend type User {
|
|
1792
|
+
* displayName: String
|
|
1793
|
+
* }
|
|
1794
|
+
* `);
|
|
1795
|
+
* const definition = document.definitions[0];
|
|
1796
|
+
* const nameField = definition.fields[1];
|
|
1797
|
+
* const formatArg = nameField.arguments[0];
|
|
1798
|
+
*
|
|
1799
|
+
* const Node = new GraphQLInterfaceType({
|
|
1800
|
+
* name: 'Node',
|
|
1801
|
+
* fields: {
|
|
1802
|
+
* id: { type: new GraphQLNonNull(GraphQLID) },
|
|
1803
|
+
* },
|
|
1804
|
+
* });
|
|
1805
|
+
*
|
|
1806
|
+
* const User = new GraphQLObjectType({
|
|
1807
|
+
* name: 'User',
|
|
1808
|
+
* description: 'A registered user.',
|
|
1809
|
+
* interfaces: [Node],
|
|
1810
|
+
* fields: {
|
|
1811
|
+
* id: { type: new GraphQLNonNull(GraphQLID) },
|
|
1812
|
+
* name: {
|
|
1813
|
+
* description: 'The formatted user name.',
|
|
1814
|
+
* type: GraphQLString,
|
|
1815
|
+
* args: {
|
|
1816
|
+
* format: {
|
|
1817
|
+
* description: 'Controls the name format.',
|
|
1818
|
+
* type: GraphQLString,
|
|
1819
|
+
* defaultValue: 'short',
|
|
1820
|
+
* deprecationReason: 'Use locale instead.',
|
|
1821
|
+
* extensions: { public: true },
|
|
1822
|
+
* astNode: formatArg,
|
|
1823
|
+
* },
|
|
1824
|
+
* },
|
|
1825
|
+
* resolve: (user, { format }) => {
|
|
1826
|
+
* return format === 'long' ? user.fullName : user.name;
|
|
1827
|
+
* },
|
|
1828
|
+
* deprecationReason: 'Use displayName.',
|
|
1829
|
+
* extensions: { cacheSeconds: 60 },
|
|
1830
|
+
* astNode: nameField,
|
|
1831
|
+
* },
|
|
1832
|
+
* },
|
|
1833
|
+
* isTypeOf: (value) => {
|
|
1834
|
+
* return typeof value === 'object' && value != null && 'id' in value;
|
|
1835
|
+
* },
|
|
1836
|
+
* extensions: { entity: 'User' },
|
|
1837
|
+
* astNode: definition,
|
|
1838
|
+
* extensionASTNodes: [ document.definitions[1] ],
|
|
1839
|
+
* });
|
|
1840
|
+
*
|
|
1841
|
+
* User.name; // => 'User'
|
|
1842
|
+
* User.getInterfaces(); // => [Node]
|
|
1843
|
+
* Object.keys(User.getFields()); // => ['id', 'name']
|
|
1844
|
+
* User.getFields().name.args[0].defaultValue; // => 'short'
|
|
1845
|
+
* User.extensions; // => { entity: 'User' }
|
|
1846
|
+
* ```
|
|
1847
|
+
* @example
|
|
1848
|
+
* ```ts
|
|
1849
|
+
* // This variant configures a subscription field with subscribe and resolve functions.
|
|
1850
|
+
* import { GraphQLObjectType, GraphQLString } from 'graphql/type';
|
|
1851
|
+
*
|
|
1852
|
+
* const Subscription = new GraphQLObjectType({
|
|
1853
|
+
* name: 'Subscription',
|
|
1854
|
+
* fields: {
|
|
1855
|
+
* greeting: {
|
|
1856
|
+
* type: GraphQLString,
|
|
1857
|
+
* subscribe: async function* () {
|
|
1858
|
+
* yield { greeting: 'Hello!' };
|
|
1859
|
+
* },
|
|
1860
|
+
* resolve: (event) => {
|
|
1861
|
+
* return event.greeting;
|
|
1862
|
+
* },
|
|
1863
|
+
* },
|
|
1864
|
+
* },
|
|
1865
|
+
* });
|
|
1866
|
+
*
|
|
1867
|
+
* typeof Subscription.getFields().greeting.subscribe; // => 'function'
|
|
1868
|
+
* ```
|
|
1869
|
+
*/
|
|
1870
|
+
constructor(config) {
|
|
1871
|
+
var _config$extensionASTN2;
|
|
1872
|
+
|
|
1873
|
+
this.name = (0, _assertName.assertName)(config.name);
|
|
1874
|
+
this.description = config.description;
|
|
1875
|
+
this.isTypeOf = config.isTypeOf;
|
|
1876
|
+
this.extensions = (0, _toObjMap.toObjMap)(config.extensions);
|
|
1877
|
+
this.astNode = config.astNode;
|
|
1878
|
+
this.extensionASTNodes =
|
|
1879
|
+
(_config$extensionASTN2 = config.extensionASTNodes) !== null &&
|
|
1880
|
+
_config$extensionASTN2 !== void 0
|
|
1881
|
+
? _config$extensionASTN2
|
|
1882
|
+
: [];
|
|
1883
|
+
|
|
1884
|
+
this._fields = () => defineFieldMap(config);
|
|
1885
|
+
|
|
1886
|
+
this._interfaces = () => defineInterfaces(config);
|
|
1887
|
+
|
|
1888
|
+
config.isTypeOf == null ||
|
|
1889
|
+
typeof config.isTypeOf === 'function' ||
|
|
1890
|
+
(0, _devAssert.devAssert)(
|
|
1891
|
+
false,
|
|
1892
|
+
`${this.name} must provide "isTypeOf" as a function, ` +
|
|
1893
|
+
`but got: ${(0, _inspect.inspect)(config.isTypeOf)}.`,
|
|
1894
|
+
);
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
1898
|
+
* @returns The built-in string tag for this object.
|
|
1899
|
+
*/
|
|
1900
|
+
|
|
1901
|
+
get [Symbol.toStringTag]() {
|
|
1902
|
+
return 'GraphQLObjectType';
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Returns the fields defined by this type.
|
|
1906
|
+
* @returns The fields keyed by field name.
|
|
1907
|
+
* @example
|
|
1908
|
+
* ```ts
|
|
1909
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
1910
|
+
* import { assertObjectType } from 'graphql/type';
|
|
1911
|
+
*
|
|
1912
|
+
* const schema = buildSchema(`
|
|
1913
|
+
* type User {
|
|
1914
|
+
* id: ID!
|
|
1915
|
+
* name: String
|
|
1916
|
+
* }
|
|
1917
|
+
*
|
|
1918
|
+
* type Query {
|
|
1919
|
+
* viewer: User
|
|
1920
|
+
* }
|
|
1921
|
+
* `);
|
|
1922
|
+
*
|
|
1923
|
+
* const User = assertObjectType(schema.getType('User'));
|
|
1924
|
+
* const fields = User.getFields();
|
|
1925
|
+
*
|
|
1926
|
+
* Object.keys(fields); // => ['id', 'name']
|
|
1927
|
+
* String(fields.id.type); // => 'ID!'
|
|
1928
|
+
* ```
|
|
1929
|
+
*/
|
|
1930
|
+
|
|
1931
|
+
getFields() {
|
|
1932
|
+
if (typeof this._fields === 'function') {
|
|
1933
|
+
this._fields = this._fields();
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
return this._fields;
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Returns the interfaces implemented by this type.
|
|
1940
|
+
* @returns The implemented interfaces.
|
|
1941
|
+
* @example
|
|
1942
|
+
* ```ts
|
|
1943
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
1944
|
+
* import { assertObjectType } from 'graphql/type';
|
|
1945
|
+
*
|
|
1946
|
+
* const schema = buildSchema(`
|
|
1947
|
+
* interface Node {
|
|
1948
|
+
* id: ID!
|
|
1949
|
+
* }
|
|
1950
|
+
*
|
|
1951
|
+
* type User implements Node {
|
|
1952
|
+
* id: ID!
|
|
1953
|
+
* }
|
|
1954
|
+
*
|
|
1955
|
+
* type Query {
|
|
1956
|
+
* viewer: User
|
|
1957
|
+
* }
|
|
1958
|
+
* `);
|
|
1959
|
+
*
|
|
1960
|
+
* const User = assertObjectType(schema.getType('User'));
|
|
1961
|
+
*
|
|
1962
|
+
* User.getInterfaces().map((type) => type.name); // => ['Node']
|
|
1963
|
+
* ```
|
|
1964
|
+
*/
|
|
1965
|
+
|
|
1966
|
+
getInterfaces() {
|
|
1967
|
+
if (typeof this._interfaces === 'function') {
|
|
1968
|
+
this._interfaces = this._interfaces();
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
return this._interfaces;
|
|
1972
|
+
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Returns a normalized configuration object for this object.
|
|
1975
|
+
* @returns A configuration object that can be used to recreate this object.
|
|
1976
|
+
* @example
|
|
1977
|
+
* ```ts
|
|
1978
|
+
* import { GraphQLObjectType, GraphQLString } from 'graphql/type';
|
|
1979
|
+
*
|
|
1980
|
+
* const User = new GraphQLObjectType({
|
|
1981
|
+
* name: 'User',
|
|
1982
|
+
* fields: {
|
|
1983
|
+
* name: { type: GraphQLString },
|
|
1984
|
+
* },
|
|
1985
|
+
* });
|
|
1986
|
+
*
|
|
1987
|
+
* const config = User.toConfig();
|
|
1988
|
+
* const UserCopy = new GraphQLObjectType(config);
|
|
1989
|
+
*
|
|
1990
|
+
* config.fields.name.type; // => GraphQLString
|
|
1991
|
+
* UserCopy.getFields().name.type; // => GraphQLString
|
|
1992
|
+
* ```
|
|
1993
|
+
*/
|
|
1994
|
+
|
|
1995
|
+
toConfig() {
|
|
1996
|
+
return {
|
|
1997
|
+
name: this.name,
|
|
1998
|
+
description: this.description,
|
|
1999
|
+
interfaces: this.getInterfaces(),
|
|
2000
|
+
fields: fieldsToFieldsConfig(this.getFields()),
|
|
2001
|
+
isTypeOf: this.isTypeOf,
|
|
2002
|
+
extensions: this.extensions,
|
|
2003
|
+
astNode: this.astNode,
|
|
2004
|
+
extensionASTNodes: this.extensionASTNodes,
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* Returns the schema coordinate identifying this object type.
|
|
2009
|
+
* @returns The schema coordinate for this object type.
|
|
2010
|
+
* @example
|
|
2011
|
+
* ```ts
|
|
2012
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
2013
|
+
* import { assertObjectType } from 'graphql/type';
|
|
2014
|
+
*
|
|
2015
|
+
* const schema = buildSchema(`
|
|
2016
|
+
* type User {
|
|
2017
|
+
* name: String
|
|
2018
|
+
* }
|
|
2019
|
+
*
|
|
2020
|
+
* type Query {
|
|
2021
|
+
* viewer: User
|
|
2022
|
+
* }
|
|
2023
|
+
* `);
|
|
2024
|
+
*
|
|
2025
|
+
* const User = assertObjectType(schema.getType('User'));
|
|
2026
|
+
*
|
|
2027
|
+
* User.toString(); // => 'User'
|
|
2028
|
+
* ```
|
|
2029
|
+
*/
|
|
2030
|
+
|
|
2031
|
+
toString() {
|
|
2032
|
+
return this.name;
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* Returns the JSON representation used when this object is serialized.
|
|
2036
|
+
* @returns The JSON-serializable representation.
|
|
2037
|
+
* @example
|
|
2038
|
+
* ```ts
|
|
2039
|
+
* import { GraphQLObjectType, GraphQLString } from 'graphql/type';
|
|
2040
|
+
*
|
|
2041
|
+
* const User = new GraphQLObjectType({
|
|
2042
|
+
* name: 'User',
|
|
2043
|
+
* fields: { name: { type: GraphQLString } },
|
|
2044
|
+
* });
|
|
2045
|
+
*
|
|
2046
|
+
* User.toJSON(); // => 'User'
|
|
2047
|
+
* JSON.stringify({ type: User }); // => '{"type":"User"}'
|
|
2048
|
+
* ```
|
|
2049
|
+
*/
|
|
2050
|
+
|
|
2051
|
+
toJSON() {
|
|
2052
|
+
return this.toString();
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
exports.GraphQLObjectType = GraphQLObjectType;
|
|
2057
|
+
|
|
2058
|
+
function defineInterfaces(config) {
|
|
2059
|
+
var _config$interfaces;
|
|
2060
|
+
|
|
2061
|
+
const interfaces = resolveReadonlyArrayThunk(
|
|
2062
|
+
(_config$interfaces = config.interfaces) !== null &&
|
|
2063
|
+
_config$interfaces !== void 0
|
|
2064
|
+
? _config$interfaces
|
|
2065
|
+
: [],
|
|
2066
|
+
);
|
|
2067
|
+
Array.isArray(interfaces) ||
|
|
2068
|
+
(0, _devAssert.devAssert)(
|
|
2069
|
+
false,
|
|
2070
|
+
`${config.name} interfaces must be an Array or a function which returns an Array.`,
|
|
2071
|
+
);
|
|
2072
|
+
return interfaces;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
function defineFieldMap(config) {
|
|
2076
|
+
const fieldMap = resolveObjMapThunk(config.fields);
|
|
2077
|
+
isPlainObj(fieldMap) ||
|
|
2078
|
+
(0, _devAssert.devAssert)(
|
|
2079
|
+
false,
|
|
2080
|
+
`${config.name} fields must be an object with field names as keys or a function which returns such an object.`,
|
|
2081
|
+
);
|
|
2082
|
+
return (0, _mapValue.mapValue)(fieldMap, (fieldConfig, fieldName) => {
|
|
2083
|
+
var _fieldConfig$args;
|
|
2084
|
+
|
|
2085
|
+
isPlainObj(fieldConfig) ||
|
|
2086
|
+
(0, _devAssert.devAssert)(
|
|
2087
|
+
false,
|
|
2088
|
+
`${config.name}.${fieldName} field config must be an object.`,
|
|
2089
|
+
);
|
|
2090
|
+
fieldConfig.resolve == null ||
|
|
2091
|
+
typeof fieldConfig.resolve === 'function' ||
|
|
2092
|
+
(0, _devAssert.devAssert)(
|
|
2093
|
+
false,
|
|
2094
|
+
`${config.name}.${fieldName} field resolver must be a function if ` +
|
|
2095
|
+
`provided, but got: ${(0, _inspect.inspect)(fieldConfig.resolve)}.`,
|
|
2096
|
+
);
|
|
2097
|
+
const argsConfig =
|
|
2098
|
+
(_fieldConfig$args = fieldConfig.args) !== null &&
|
|
2099
|
+
_fieldConfig$args !== void 0
|
|
2100
|
+
? _fieldConfig$args
|
|
2101
|
+
: {};
|
|
2102
|
+
isPlainObj(argsConfig) ||
|
|
2103
|
+
(0, _devAssert.devAssert)(
|
|
2104
|
+
false,
|
|
2105
|
+
`${config.name}.${fieldName} args must be an object with argument names as keys.`,
|
|
2106
|
+
);
|
|
2107
|
+
return {
|
|
2108
|
+
name: (0, _assertName.assertName)(fieldName),
|
|
2109
|
+
description: fieldConfig.description,
|
|
2110
|
+
type: fieldConfig.type,
|
|
2111
|
+
args: defineArguments(argsConfig),
|
|
2112
|
+
resolve: fieldConfig.resolve,
|
|
2113
|
+
subscribe: fieldConfig.subscribe,
|
|
2114
|
+
deprecationReason: fieldConfig.deprecationReason,
|
|
2115
|
+
extensions: (0, _toObjMap.toObjMap)(fieldConfig.extensions),
|
|
2116
|
+
astNode: fieldConfig.astNode,
|
|
2117
|
+
};
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
/** @internal */
|
|
2121
|
+
|
|
2122
|
+
function defineArguments(config) {
|
|
2123
|
+
return Object.entries(config).map(([argName, argConfig]) => ({
|
|
2124
|
+
name: (0, _assertName.assertName)(argName),
|
|
2125
|
+
description: argConfig.description,
|
|
2126
|
+
type: argConfig.type,
|
|
2127
|
+
defaultValue: argConfig.defaultValue,
|
|
2128
|
+
deprecationReason: argConfig.deprecationReason,
|
|
2129
|
+
extensions: (0, _toObjMap.toObjMap)(argConfig.extensions),
|
|
2130
|
+
astNode: argConfig.astNode,
|
|
2131
|
+
}));
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
function isPlainObj(obj) {
|
|
2135
|
+
return (0, _isObjectLike.isObjectLike)(obj) && !Array.isArray(obj);
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
function fieldsToFieldsConfig(fields) {
|
|
2139
|
+
return (0, _mapValue.mapValue)(fields, (field) => ({
|
|
2140
|
+
description: field.description,
|
|
2141
|
+
type: field.type,
|
|
2142
|
+
args: argsToArgsConfig(field.args),
|
|
2143
|
+
resolve: field.resolve,
|
|
2144
|
+
subscribe: field.subscribe,
|
|
2145
|
+
deprecationReason: field.deprecationReason,
|
|
2146
|
+
extensions: field.extensions,
|
|
2147
|
+
astNode: field.astNode,
|
|
2148
|
+
}));
|
|
2149
|
+
}
|
|
2150
|
+
/** @internal */
|
|
2151
|
+
|
|
2152
|
+
function argsToArgsConfig(args) {
|
|
2153
|
+
return (0, _keyValMap.keyValMap)(
|
|
2154
|
+
args,
|
|
2155
|
+
(arg) => arg.name,
|
|
2156
|
+
(arg) => ({
|
|
2157
|
+
description: arg.description,
|
|
2158
|
+
type: arg.type,
|
|
2159
|
+
defaultValue: arg.defaultValue,
|
|
2160
|
+
deprecationReason: arg.deprecationReason,
|
|
2161
|
+
extensions: arg.extensions,
|
|
2162
|
+
astNode: arg.astNode,
|
|
2163
|
+
}),
|
|
2164
|
+
);
|
|
2165
|
+
}
|
|
2166
|
+
/**
|
|
2167
|
+
* Configuration used to construct a GraphQLObjectType.
|
|
2168
|
+
* @typeParam TSource - Source object type passed to resolvers.
|
|
2169
|
+
* @typeParam TContext - Context object type passed to resolvers.
|
|
2170
|
+
*/
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* Returns true when the argument is non-null and has no default value.
|
|
2174
|
+
* @param arg - The argument definition to inspect.
|
|
2175
|
+
* @returns True when the argument is non-null and has no default value.
|
|
2176
|
+
* @example
|
|
2177
|
+
* ```ts
|
|
2178
|
+
* import {
|
|
2179
|
+
* GraphQLInt,
|
|
2180
|
+
* GraphQLNonNull,
|
|
2181
|
+
* GraphQLString,
|
|
2182
|
+
* isRequiredArgument,
|
|
2183
|
+
* } from 'graphql/type';
|
|
2184
|
+
*
|
|
2185
|
+
* const requiredArgument = { name: 'id', type: new GraphQLNonNull(GraphQLInt) };
|
|
2186
|
+
* const optionalArgument = { name: 'name', type: GraphQLString };
|
|
2187
|
+
* const argumentWithDefault = {
|
|
2188
|
+
* name: 'limit',
|
|
2189
|
+
* type: new GraphQLNonNull(GraphQLInt),
|
|
2190
|
+
* defaultValue: 10,
|
|
2191
|
+
* };
|
|
2192
|
+
*
|
|
2193
|
+
* isRequiredArgument(requiredArgument); // => true
|
|
2194
|
+
* isRequiredArgument(optionalArgument); // => false
|
|
2195
|
+
* isRequiredArgument(argumentWithDefault); // => false
|
|
2196
|
+
* ```
|
|
2197
|
+
*/
|
|
2198
|
+
function isRequiredArgument(arg) {
|
|
2199
|
+
return isNonNullType(arg.type) && arg.defaultValue === undefined;
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* A map of field names to resolved field definitions.
|
|
2203
|
+
* @typeParam TSource - Source object type passed to resolvers.
|
|
2204
|
+
* @typeParam TContext - Context object type passed to resolvers.
|
|
2205
|
+
*/
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
* Interface Type Definition
|
|
2209
|
+
*
|
|
2210
|
+
* When a field can return one of a heterogeneous set of types, a Interface type
|
|
2211
|
+
* is used to describe what types are possible, what fields are in common across
|
|
2212
|
+
* all types, as well as a function to determine which type is actually used
|
|
2213
|
+
* when the field is resolved.
|
|
2214
|
+
* @example
|
|
2215
|
+
* ```ts
|
|
2216
|
+
* const EntityType = new GraphQLInterfaceType({
|
|
2217
|
+
* name: 'Entity',
|
|
2218
|
+
* fields: {
|
|
2219
|
+
* name: { type: GraphQLString }
|
|
2220
|
+
* }
|
|
2221
|
+
* });
|
|
2222
|
+
* ```
|
|
2223
|
+
*/
|
|
2224
|
+
class GraphQLInterfaceType {
|
|
2225
|
+
/** The GraphQL name for this schema element. */
|
|
2226
|
+
|
|
2227
|
+
/** Human-readable description for this schema element, if provided. */
|
|
2228
|
+
|
|
2229
|
+
/** Function that resolves the concrete object type for this abstract type. */
|
|
2230
|
+
|
|
2231
|
+
/** Custom extension fields reserved for users. */
|
|
2232
|
+
|
|
2233
|
+
/** AST node from which this schema element was built, if available. */
|
|
2234
|
+
|
|
2235
|
+
/** AST extension nodes applied to this schema element. */
|
|
2236
|
+
|
|
2237
|
+
/**
|
|
2238
|
+
* Creates a GraphQLInterfaceType instance.
|
|
2239
|
+
* @param config - Configuration describing this object.
|
|
2240
|
+
* @example
|
|
2241
|
+
* ```ts
|
|
2242
|
+
* import { parse } from 'graphql/language';
|
|
2243
|
+
* import { GraphQLID, GraphQLInterfaceType, GraphQLNonNull } from 'graphql/type';
|
|
2244
|
+
*
|
|
2245
|
+
* const document = parse(`
|
|
2246
|
+
* interface Node {
|
|
2247
|
+
* id: ID!
|
|
2248
|
+
* }
|
|
2249
|
+
*
|
|
2250
|
+
* interface Resource implements Node {
|
|
2251
|
+
* id: ID!
|
|
2252
|
+
* }
|
|
2253
|
+
*
|
|
2254
|
+
* extend interface Resource {
|
|
2255
|
+
* url: String
|
|
2256
|
+
* }
|
|
2257
|
+
* `);
|
|
2258
|
+
*
|
|
2259
|
+
* const Node = new GraphQLInterfaceType({
|
|
2260
|
+
* name: 'Node',
|
|
2261
|
+
* fields: {
|
|
2262
|
+
* id: { type: new GraphQLNonNull(GraphQLID) },
|
|
2263
|
+
* },
|
|
2264
|
+
* });
|
|
2265
|
+
*
|
|
2266
|
+
* const Resource = new GraphQLInterfaceType({
|
|
2267
|
+
* name: 'Resource',
|
|
2268
|
+
* description: 'An addressable resource.',
|
|
2269
|
+
* interfaces: [Node],
|
|
2270
|
+
* fields: {
|
|
2271
|
+
* id: { type: new GraphQLNonNull(GraphQLID) },
|
|
2272
|
+
* },
|
|
2273
|
+
* resolveType: (value) => {
|
|
2274
|
+
* return typeof value === 'object' && value != null && 'url' in value
|
|
2275
|
+
* ? 'WebPage'
|
|
2276
|
+
* : null;
|
|
2277
|
+
* },
|
|
2278
|
+
* extensions: { abstract: true },
|
|
2279
|
+
* astNode: document.definitions[1],
|
|
2280
|
+
* extensionASTNodes: [ document.definitions[2] ],
|
|
2281
|
+
* });
|
|
2282
|
+
*
|
|
2283
|
+
* Resource.name; // => 'Resource'
|
|
2284
|
+
* Resource.getInterfaces(); // => [Node]
|
|
2285
|
+
* Object.keys(Resource.getFields()); // => ['id']
|
|
2286
|
+
* Resource.extensions; // => { abstract: true }
|
|
2287
|
+
* ```
|
|
2288
|
+
*/
|
|
2289
|
+
constructor(config) {
|
|
2290
|
+
var _config$extensionASTN3;
|
|
2291
|
+
|
|
2292
|
+
this.name = (0, _assertName.assertName)(config.name);
|
|
2293
|
+
this.description = config.description;
|
|
2294
|
+
this.resolveType = config.resolveType;
|
|
2295
|
+
this.extensions = (0, _toObjMap.toObjMap)(config.extensions);
|
|
2296
|
+
this.astNode = config.astNode;
|
|
2297
|
+
this.extensionASTNodes =
|
|
2298
|
+
(_config$extensionASTN3 = config.extensionASTNodes) !== null &&
|
|
2299
|
+
_config$extensionASTN3 !== void 0
|
|
2300
|
+
? _config$extensionASTN3
|
|
2301
|
+
: [];
|
|
2302
|
+
this._fields = defineFieldMap.bind(undefined, config);
|
|
2303
|
+
this._interfaces = defineInterfaces.bind(undefined, config);
|
|
2304
|
+
config.resolveType == null ||
|
|
2305
|
+
typeof config.resolveType === 'function' ||
|
|
2306
|
+
(0, _devAssert.devAssert)(
|
|
2307
|
+
false,
|
|
2308
|
+
`${this.name} must provide "resolveType" as a function, ` +
|
|
2309
|
+
`but got: ${(0, _inspect.inspect)(config.resolveType)}.`,
|
|
2310
|
+
);
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
2314
|
+
* @returns The built-in string tag for this object.
|
|
2315
|
+
*/
|
|
2316
|
+
|
|
2317
|
+
get [Symbol.toStringTag]() {
|
|
2318
|
+
return 'GraphQLInterfaceType';
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Returns the fields defined by this type.
|
|
2322
|
+
* @returns The fields keyed by field name.
|
|
2323
|
+
* @example
|
|
2324
|
+
* ```ts
|
|
2325
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
2326
|
+
* import { assertInterfaceType } from 'graphql/type';
|
|
2327
|
+
*
|
|
2328
|
+
* const schema = buildSchema(`
|
|
2329
|
+
* interface Node {
|
|
2330
|
+
* id: ID!
|
|
2331
|
+
* }
|
|
2332
|
+
*
|
|
2333
|
+
* type User implements Node {
|
|
2334
|
+
* id: ID!
|
|
2335
|
+
* }
|
|
2336
|
+
*
|
|
2337
|
+
* type Query {
|
|
2338
|
+
* node: Node
|
|
2339
|
+
* }
|
|
2340
|
+
* `);
|
|
2341
|
+
*
|
|
2342
|
+
* const Node = assertInterfaceType(schema.getType('Node'));
|
|
2343
|
+
* const fields = Node.getFields();
|
|
2344
|
+
*
|
|
2345
|
+
* Object.keys(fields); // => ['id']
|
|
2346
|
+
* String(fields.id.type); // => 'ID!'
|
|
2347
|
+
* ```
|
|
2348
|
+
*/
|
|
2349
|
+
|
|
2350
|
+
getFields() {
|
|
2351
|
+
if (typeof this._fields === 'function') {
|
|
2352
|
+
this._fields = this._fields();
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
return this._fields;
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Returns the interfaces implemented by this type.
|
|
2359
|
+
* @returns The implemented interfaces.
|
|
2360
|
+
* @example
|
|
2361
|
+
* ```ts
|
|
2362
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
2363
|
+
* import { assertInterfaceType } from 'graphql/type';
|
|
2364
|
+
*
|
|
2365
|
+
* const schema = buildSchema(`
|
|
2366
|
+
* interface Resource {
|
|
2367
|
+
* url: String!
|
|
2368
|
+
* }
|
|
2369
|
+
*
|
|
2370
|
+
* interface Image implements Resource {
|
|
2371
|
+
* url: String!
|
|
2372
|
+
* width: Int
|
|
2373
|
+
* }
|
|
2374
|
+
*
|
|
2375
|
+
* type Photo implements Resource & Image {
|
|
2376
|
+
* url: String!
|
|
2377
|
+
* width: Int
|
|
2378
|
+
* }
|
|
2379
|
+
*
|
|
2380
|
+
* type Query {
|
|
2381
|
+
* image: Image
|
|
2382
|
+
* }
|
|
2383
|
+
* `);
|
|
2384
|
+
*
|
|
2385
|
+
* const Image = assertInterfaceType(schema.getType('Image'));
|
|
2386
|
+
*
|
|
2387
|
+
* Image.getInterfaces().map((type) => type.name); // => ['Resource']
|
|
2388
|
+
* ```
|
|
2389
|
+
*/
|
|
2390
|
+
|
|
2391
|
+
getInterfaces() {
|
|
2392
|
+
if (typeof this._interfaces === 'function') {
|
|
2393
|
+
this._interfaces = this._interfaces();
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
return this._interfaces;
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Returns a normalized configuration object for this object.
|
|
2400
|
+
* @returns A configuration object that can be used to recreate this object.
|
|
2401
|
+
* @example
|
|
2402
|
+
* ```ts
|
|
2403
|
+
* import { GraphQLID, GraphQLInterfaceType, GraphQLNonNull } from 'graphql/type';
|
|
2404
|
+
*
|
|
2405
|
+
* const Node = new GraphQLInterfaceType({
|
|
2406
|
+
* name: 'Node',
|
|
2407
|
+
* fields: {
|
|
2408
|
+
* id: { type: new GraphQLNonNull(GraphQLID) },
|
|
2409
|
+
* },
|
|
2410
|
+
* });
|
|
2411
|
+
*
|
|
2412
|
+
* const config = Node.toConfig();
|
|
2413
|
+
* const NodeCopy = new GraphQLInterfaceType(config);
|
|
2414
|
+
*
|
|
2415
|
+
* String(config.fields.id.type); // => 'ID!'
|
|
2416
|
+
* String(NodeCopy.getFields().id.type); // => 'ID!'
|
|
2417
|
+
* ```
|
|
2418
|
+
*/
|
|
2419
|
+
|
|
2420
|
+
toConfig() {
|
|
2421
|
+
return {
|
|
2422
|
+
name: this.name,
|
|
2423
|
+
description: this.description,
|
|
2424
|
+
interfaces: this.getInterfaces(),
|
|
2425
|
+
fields: fieldsToFieldsConfig(this.getFields()),
|
|
2426
|
+
resolveType: this.resolveType,
|
|
2427
|
+
extensions: this.extensions,
|
|
2428
|
+
astNode: this.astNode,
|
|
2429
|
+
extensionASTNodes: this.extensionASTNodes,
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
/**
|
|
2433
|
+
* Returns the schema coordinate identifying this interface type.
|
|
2434
|
+
* @returns The schema coordinate for this interface type.
|
|
2435
|
+
* @example
|
|
2436
|
+
* ```ts
|
|
2437
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
2438
|
+
* import { assertInterfaceType } from 'graphql/type';
|
|
2439
|
+
*
|
|
2440
|
+
* const schema = buildSchema(`
|
|
2441
|
+
* interface Node {
|
|
2442
|
+
* id: ID!
|
|
2443
|
+
* }
|
|
2444
|
+
*
|
|
2445
|
+
* type User implements Node {
|
|
2446
|
+
* id: ID!
|
|
2447
|
+
* }
|
|
2448
|
+
*
|
|
2449
|
+
* type Query {
|
|
2450
|
+
* node: Node
|
|
2451
|
+
* }
|
|
2452
|
+
* `);
|
|
2453
|
+
*
|
|
2454
|
+
* const Node = assertInterfaceType(schema.getType('Node'));
|
|
2455
|
+
*
|
|
2456
|
+
* Node.toString(); // => 'Node'
|
|
2457
|
+
* ```
|
|
2458
|
+
*/
|
|
2459
|
+
|
|
2460
|
+
toString() {
|
|
2461
|
+
return this.name;
|
|
2462
|
+
}
|
|
2463
|
+
/**
|
|
2464
|
+
* Returns the JSON representation used when this object is serialized.
|
|
2465
|
+
* @returns The JSON-serializable representation.
|
|
2466
|
+
* @example
|
|
2467
|
+
* ```ts
|
|
2468
|
+
* import { GraphQLInterfaceType, GraphQLString } from 'graphql/type';
|
|
2469
|
+
*
|
|
2470
|
+
* const Named = new GraphQLInterfaceType({
|
|
2471
|
+
* name: 'Named',
|
|
2472
|
+
* fields: { name: { type: GraphQLString } },
|
|
2473
|
+
* });
|
|
2474
|
+
*
|
|
2475
|
+
* Named.toJSON(); // => 'Named'
|
|
2476
|
+
* JSON.stringify({ type: Named }); // => '{"type":"Named"}'
|
|
2477
|
+
* ```
|
|
2478
|
+
*/
|
|
2479
|
+
|
|
2480
|
+
toJSON() {
|
|
2481
|
+
return this.toString();
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
/**
|
|
2485
|
+
* Configuration used to construct a GraphQLInterfaceType.
|
|
2486
|
+
* @typeParam TSource - Source object type passed to resolvers.
|
|
2487
|
+
* @typeParam TContext - Context object type passed to resolvers.
|
|
2488
|
+
*/
|
|
2489
|
+
|
|
2490
|
+
exports.GraphQLInterfaceType = GraphQLInterfaceType;
|
|
2491
|
+
|
|
2492
|
+
/**
|
|
2493
|
+
* Union Type Definition
|
|
2494
|
+
*
|
|
2495
|
+
* When a field can return one of a heterogeneous set of types, a Union type
|
|
2496
|
+
* is used to describe what types are possible as well as providing a function
|
|
2497
|
+
* to determine which type is actually used when the field is resolved.
|
|
2498
|
+
* @example
|
|
2499
|
+
* ```ts
|
|
2500
|
+
* const PetType = new GraphQLUnionType({
|
|
2501
|
+
* name: 'Pet',
|
|
2502
|
+
* types: [DogType, CatType],
|
|
2503
|
+
* resolveType: (value) => {
|
|
2504
|
+
* if (value instanceof Dog) {
|
|
2505
|
+
* return DogType;
|
|
2506
|
+
* }
|
|
2507
|
+
* if (value instanceof Cat) {
|
|
2508
|
+
* return CatType;
|
|
2509
|
+
* }
|
|
2510
|
+
* }
|
|
2511
|
+
* });
|
|
2512
|
+
* ```
|
|
2513
|
+
*/
|
|
2514
|
+
class GraphQLUnionType {
|
|
2515
|
+
/** The GraphQL name for this schema element. */
|
|
2516
|
+
|
|
2517
|
+
/** Human-readable description for this schema element, if provided. */
|
|
2518
|
+
|
|
2519
|
+
/** Function that resolves the concrete object type for this abstract type. */
|
|
2520
|
+
|
|
2521
|
+
/** Custom extension fields reserved for users. */
|
|
2522
|
+
|
|
2523
|
+
/** AST node from which this schema element was built, if available. */
|
|
2524
|
+
|
|
2525
|
+
/** AST extension nodes applied to this schema element. */
|
|
2526
|
+
|
|
2527
|
+
/**
|
|
2528
|
+
* Creates a GraphQLUnionType instance.
|
|
2529
|
+
* @param config - Configuration describing this object.
|
|
2530
|
+
* @example
|
|
2531
|
+
* ```ts
|
|
2532
|
+
* import { parse } from 'graphql/language';
|
|
2533
|
+
* import { GraphQLObjectType, GraphQLString, GraphQLUnionType } from 'graphql/type';
|
|
2534
|
+
*
|
|
2535
|
+
* const document = parse(`
|
|
2536
|
+
* union Media = Photo | Video
|
|
2537
|
+
*
|
|
2538
|
+
* extend union Media = Audio
|
|
2539
|
+
* `);
|
|
2540
|
+
*
|
|
2541
|
+
* const Photo = new GraphQLObjectType({
|
|
2542
|
+
* name: 'Photo',
|
|
2543
|
+
* fields: { url: { type: GraphQLString } },
|
|
2544
|
+
* });
|
|
2545
|
+
* const Video = new GraphQLObjectType({
|
|
2546
|
+
* name: 'Video',
|
|
2547
|
+
* fields: { url: { type: GraphQLString } },
|
|
2548
|
+
* });
|
|
2549
|
+
*
|
|
2550
|
+
* const Media = new GraphQLUnionType({
|
|
2551
|
+
* name: 'Media',
|
|
2552
|
+
* description: 'Media that can appear in a search result.',
|
|
2553
|
+
* types: [Photo, Video],
|
|
2554
|
+
* resolveType: (value) => {
|
|
2555
|
+
* return typeof value === 'object' && value != null && 'duration' in value
|
|
2556
|
+
* ? 'Video'
|
|
2557
|
+
* : 'Photo';
|
|
2558
|
+
* },
|
|
2559
|
+
* extensions: { searchable: true },
|
|
2560
|
+
* astNode: document.definitions[0],
|
|
2561
|
+
* extensionASTNodes: [ document.definitions[1] ],
|
|
2562
|
+
* });
|
|
2563
|
+
*
|
|
2564
|
+
* Media.description; // => 'Media that can appear in a search result.'
|
|
2565
|
+
* Media.getTypes().map((type) => type.name); // => ['Photo', 'Video']
|
|
2566
|
+
* Media.extensions; // => { searchable: true }
|
|
2567
|
+
* ```
|
|
2568
|
+
*/
|
|
2569
|
+
constructor(config) {
|
|
2570
|
+
var _config$extensionASTN4;
|
|
2571
|
+
|
|
2572
|
+
this.name = (0, _assertName.assertName)(config.name);
|
|
2573
|
+
this.description = config.description;
|
|
2574
|
+
this.resolveType = config.resolveType;
|
|
2575
|
+
this.extensions = (0, _toObjMap.toObjMap)(config.extensions);
|
|
2576
|
+
this.astNode = config.astNode;
|
|
2577
|
+
this.extensionASTNodes =
|
|
2578
|
+
(_config$extensionASTN4 = config.extensionASTNodes) !== null &&
|
|
2579
|
+
_config$extensionASTN4 !== void 0
|
|
2580
|
+
? _config$extensionASTN4
|
|
2581
|
+
: [];
|
|
2582
|
+
this._types = defineTypes.bind(undefined, config);
|
|
2583
|
+
config.resolveType == null ||
|
|
2584
|
+
typeof config.resolveType === 'function' ||
|
|
2585
|
+
(0, _devAssert.devAssert)(
|
|
2586
|
+
false,
|
|
2587
|
+
`${this.name} must provide "resolveType" as a function, ` +
|
|
2588
|
+
`but got: ${(0, _inspect.inspect)(config.resolveType)}.`,
|
|
2589
|
+
);
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
2593
|
+
* @returns The built-in string tag for this object.
|
|
2594
|
+
*/
|
|
2595
|
+
|
|
2596
|
+
get [Symbol.toStringTag]() {
|
|
2597
|
+
return 'GraphQLUnionType';
|
|
2598
|
+
}
|
|
2599
|
+
/**
|
|
2600
|
+
* Returns the object types included in this union.
|
|
2601
|
+
* @returns The union member object types.
|
|
2602
|
+
* @example
|
|
2603
|
+
* ```ts
|
|
2604
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
2605
|
+
* import { assertUnionType } from 'graphql/type';
|
|
2606
|
+
*
|
|
2607
|
+
* const schema = buildSchema(`
|
|
2608
|
+
* type Photo {
|
|
2609
|
+
* url: String!
|
|
2610
|
+
* }
|
|
2611
|
+
*
|
|
2612
|
+
* type Video {
|
|
2613
|
+
* url: String!
|
|
2614
|
+
* }
|
|
2615
|
+
*
|
|
2616
|
+
* union Media = Photo | Video
|
|
2617
|
+
*
|
|
2618
|
+
* type Query {
|
|
2619
|
+
* media: [Media]
|
|
2620
|
+
* }
|
|
2621
|
+
* `);
|
|
2622
|
+
*
|
|
2623
|
+
* const Media = assertUnionType(schema.getType('Media'));
|
|
2624
|
+
*
|
|
2625
|
+
* Media.getTypes().map((type) => type.name); // => ['Photo', 'Video']
|
|
2626
|
+
* ```
|
|
2627
|
+
*/
|
|
2628
|
+
|
|
2629
|
+
getTypes() {
|
|
2630
|
+
if (typeof this._types === 'function') {
|
|
2631
|
+
this._types = this._types();
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
return this._types;
|
|
2635
|
+
}
|
|
2636
|
+
/**
|
|
2637
|
+
* Returns a normalized configuration object for this object.
|
|
2638
|
+
* @returns A configuration object that can be used to recreate this object.
|
|
2639
|
+
* @example
|
|
2640
|
+
* ```ts
|
|
2641
|
+
* import { GraphQLObjectType, GraphQLString, GraphQLUnionType } from 'graphql/type';
|
|
2642
|
+
*
|
|
2643
|
+
* const Photo = new GraphQLObjectType({
|
|
2644
|
+
* name: 'Photo',
|
|
2645
|
+
* fields: { url: { type: GraphQLString } },
|
|
2646
|
+
* });
|
|
2647
|
+
* const Video = new GraphQLObjectType({
|
|
2648
|
+
* name: 'Video',
|
|
2649
|
+
* fields: { url: { type: GraphQLString } },
|
|
2650
|
+
* });
|
|
2651
|
+
* const Media = new GraphQLUnionType({
|
|
2652
|
+
* name: 'Media',
|
|
2653
|
+
* types: [Photo, Video],
|
|
2654
|
+
* });
|
|
2655
|
+
*
|
|
2656
|
+
* const config = Media.toConfig();
|
|
2657
|
+
* const MediaCopy = new GraphQLUnionType(config);
|
|
2658
|
+
*
|
|
2659
|
+
* MediaCopy.getTypes().map((type) => type.name); // => ['Photo', 'Video']
|
|
2660
|
+
* ```
|
|
2661
|
+
*/
|
|
2662
|
+
|
|
2663
|
+
toConfig() {
|
|
2664
|
+
return {
|
|
2665
|
+
name: this.name,
|
|
2666
|
+
description: this.description,
|
|
2667
|
+
types: this.getTypes(),
|
|
2668
|
+
resolveType: this.resolveType,
|
|
2669
|
+
extensions: this.extensions,
|
|
2670
|
+
astNode: this.astNode,
|
|
2671
|
+
extensionASTNodes: this.extensionASTNodes,
|
|
2672
|
+
};
|
|
2673
|
+
}
|
|
2674
|
+
/**
|
|
2675
|
+
* Returns the schema coordinate identifying this union type.
|
|
2676
|
+
* @returns The schema coordinate for this union type.
|
|
2677
|
+
* @example
|
|
2678
|
+
* ```ts
|
|
2679
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
2680
|
+
* import { assertUnionType } from 'graphql/type';
|
|
2681
|
+
*
|
|
2682
|
+
* const schema = buildSchema(`
|
|
2683
|
+
* type Photo {
|
|
2684
|
+
* url: String!
|
|
2685
|
+
* }
|
|
2686
|
+
*
|
|
2687
|
+
* union SearchResult = Photo
|
|
2688
|
+
*
|
|
2689
|
+
* type Query {
|
|
2690
|
+
* search: [SearchResult]
|
|
2691
|
+
* }
|
|
2692
|
+
* `);
|
|
2693
|
+
*
|
|
2694
|
+
* const SearchResult = assertUnionType(schema.getType('SearchResult'));
|
|
2695
|
+
*
|
|
2696
|
+
* SearchResult.toString(); // => 'SearchResult'
|
|
2697
|
+
* ```
|
|
2698
|
+
*/
|
|
2699
|
+
|
|
2700
|
+
toString() {
|
|
2701
|
+
return this.name;
|
|
2702
|
+
}
|
|
2703
|
+
/**
|
|
2704
|
+
* Returns the JSON representation used when this object is serialized.
|
|
2705
|
+
* @returns The JSON-serializable representation.
|
|
2706
|
+
* @example
|
|
2707
|
+
* ```ts
|
|
2708
|
+
* import { GraphQLObjectType, GraphQLString, GraphQLUnionType } from 'graphql/type';
|
|
2709
|
+
*
|
|
2710
|
+
* const Photo = new GraphQLObjectType({
|
|
2711
|
+
* name: 'Photo',
|
|
2712
|
+
* fields: { url: { type: GraphQLString } },
|
|
2713
|
+
* });
|
|
2714
|
+
* const SearchResult = new GraphQLUnionType({
|
|
2715
|
+
* name: 'SearchResult',
|
|
2716
|
+
* types: [Photo],
|
|
2717
|
+
* });
|
|
2718
|
+
*
|
|
2719
|
+
* SearchResult.toJSON(); // => 'SearchResult'
|
|
2720
|
+
* JSON.stringify({ type: SearchResult }); // => '{"type":"SearchResult"}'
|
|
2721
|
+
* ```
|
|
2722
|
+
*/
|
|
2723
|
+
|
|
2724
|
+
toJSON() {
|
|
2725
|
+
return this.toString();
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
exports.GraphQLUnionType = GraphQLUnionType;
|
|
2730
|
+
|
|
2731
|
+
function defineTypes(config) {
|
|
2732
|
+
const types = resolveReadonlyArrayThunk(config.types);
|
|
2733
|
+
Array.isArray(types) ||
|
|
2734
|
+
(0, _devAssert.devAssert)(
|
|
2735
|
+
false,
|
|
2736
|
+
`Must provide Array of types or a function which returns such an array for Union ${config.name}.`,
|
|
2737
|
+
);
|
|
2738
|
+
return types;
|
|
2739
|
+
}
|
|
2740
|
+
/**
|
|
2741
|
+
* Configuration used to construct a GraphQLUnionType.
|
|
2742
|
+
* @typeParam TSource - Source object type passed to resolvers.
|
|
2743
|
+
* @typeParam TContext - Context object type passed to resolvers.
|
|
2744
|
+
*/
|
|
2745
|
+
|
|
2746
|
+
/**
|
|
2747
|
+
* Enum Type Definition
|
|
2748
|
+
*
|
|
2749
|
+
* Enum types define leaf values whose serialized form is one of a fixed set
|
|
2750
|
+
* of GraphQL enum names. Internally, enum values can map to any runtime value,
|
|
2751
|
+
* often integers.
|
|
2752
|
+
* @example
|
|
2753
|
+
* ```ts
|
|
2754
|
+
* import { GraphQLEnumType } from 'graphql/type';
|
|
2755
|
+
*
|
|
2756
|
+
* const RGBType = new GraphQLEnumType({
|
|
2757
|
+
* name: 'RGB',
|
|
2758
|
+
* values: {
|
|
2759
|
+
* RED: { value: 0 },
|
|
2760
|
+
* GREEN: { value: 1 },
|
|
2761
|
+
* BLUE: { value: 2 },
|
|
2762
|
+
* },
|
|
2763
|
+
* });
|
|
2764
|
+
*
|
|
2765
|
+
* RGBType.getValue('GREEN')?.value; // => 1
|
|
2766
|
+
* ```
|
|
2767
|
+
*
|
|
2768
|
+
* Note: If a value is not provided in a definition, the name of the enum value
|
|
2769
|
+
* will be used as its internal value.
|
|
2770
|
+
*/
|
|
2771
|
+
class GraphQLEnumType {
|
|
2772
|
+
/* <T> */
|
|
2773
|
+
/** The GraphQL name for this schema element. */
|
|
2774
|
+
|
|
2775
|
+
/** Human-readable description for this schema element, if provided. */
|
|
2776
|
+
|
|
2777
|
+
/** Custom extension fields reserved for users. */
|
|
2778
|
+
|
|
2779
|
+
/** AST node from which this schema element was built, if available. */
|
|
2780
|
+
|
|
2781
|
+
/** AST extension nodes applied to this schema element. */
|
|
2782
|
+
|
|
2783
|
+
/**
|
|
2784
|
+
* Creates a GraphQLEnumType instance.
|
|
2785
|
+
* @param config - Configuration describing this object.
|
|
2786
|
+
* @example
|
|
2787
|
+
* ```ts
|
|
2788
|
+
* import { parse } from 'graphql/language';
|
|
2789
|
+
* import { GraphQLEnumType } from 'graphql/type';
|
|
2790
|
+
*
|
|
2791
|
+
* const document = parse(`
|
|
2792
|
+
* enum Episode {
|
|
2793
|
+
* NEW_HOPE
|
|
2794
|
+
* EMPIRE
|
|
2795
|
+
* JEDI
|
|
2796
|
+
* }
|
|
2797
|
+
*
|
|
2798
|
+
* extend enum Episode {
|
|
2799
|
+
* FORCE_AWAKENS
|
|
2800
|
+
* }
|
|
2801
|
+
* `);
|
|
2802
|
+
* const definition = document.definitions[0];
|
|
2803
|
+
*
|
|
2804
|
+
* const Episode = new GraphQLEnumType({
|
|
2805
|
+
* name: 'Episode',
|
|
2806
|
+
* description: 'A Star Wars film episode.',
|
|
2807
|
+
* values: {
|
|
2808
|
+
* NEW_HOPE: {
|
|
2809
|
+
* value: 4,
|
|
2810
|
+
* description: 'Released in 1977.',
|
|
2811
|
+
* extensions: { trilogy: 'original' },
|
|
2812
|
+
* astNode: definition.values[0],
|
|
2813
|
+
* },
|
|
2814
|
+
* EMPIRE: { value: 5, astNode: definition.values[1] },
|
|
2815
|
+
* JEDI: {
|
|
2816
|
+
* value: 6,
|
|
2817
|
+
* deprecationReason: 'Use RETURN_OF_THE_JEDI.',
|
|
2818
|
+
* astNode: definition.values[2],
|
|
2819
|
+
* },
|
|
2820
|
+
* },
|
|
2821
|
+
* extensions: { catalog: 'films' },
|
|
2822
|
+
* astNode: definition,
|
|
2823
|
+
* extensionASTNodes: [ document.definitions[1] ],
|
|
2824
|
+
* });
|
|
2825
|
+
*
|
|
2826
|
+
* Episode.description; // => 'A Star Wars film episode.'
|
|
2827
|
+
* Episode.serialize(5); // => 'EMPIRE'
|
|
2828
|
+
* Episode.parseValue('JEDI'); // => 6
|
|
2829
|
+
* Episode.getValue('JEDI').deprecationReason; // => 'Use RETURN_OF_THE_JEDI.'
|
|
2830
|
+
* Episode.extensions; // => { catalog: 'films' }
|
|
2831
|
+
* ```
|
|
2832
|
+
*/
|
|
2833
|
+
constructor(config) {
|
|
2834
|
+
var _config$extensionASTN5;
|
|
2835
|
+
|
|
2836
|
+
this.name = (0, _assertName.assertName)(config.name);
|
|
2837
|
+
this.description = config.description;
|
|
2838
|
+
this.extensions = (0, _toObjMap.toObjMap)(config.extensions);
|
|
2839
|
+
this.astNode = config.astNode;
|
|
2840
|
+
this.extensionASTNodes =
|
|
2841
|
+
(_config$extensionASTN5 = config.extensionASTNodes) !== null &&
|
|
2842
|
+
_config$extensionASTN5 !== void 0
|
|
2843
|
+
? _config$extensionASTN5
|
|
2844
|
+
: [];
|
|
2845
|
+
this._values =
|
|
2846
|
+
typeof config.values === 'function'
|
|
2847
|
+
? config.values
|
|
2848
|
+
: defineEnumValues(this.name, config.values);
|
|
2849
|
+
this._valueLookup = null;
|
|
2850
|
+
this._nameLookup = null;
|
|
2851
|
+
}
|
|
2852
|
+
/**
|
|
2853
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
2854
|
+
* @returns The built-in string tag for this object.
|
|
2855
|
+
*/
|
|
2856
|
+
|
|
2857
|
+
get [Symbol.toStringTag]() {
|
|
2858
|
+
return 'GraphQLEnumType';
|
|
2859
|
+
}
|
|
2860
|
+
/**
|
|
2861
|
+
* Returns the values defined by this enum type.
|
|
2862
|
+
* @returns Enum value definitions in schema order.
|
|
2863
|
+
* @example
|
|
2864
|
+
* ```ts
|
|
2865
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
2866
|
+
* import { assertEnumType } from 'graphql/type';
|
|
2867
|
+
*
|
|
2868
|
+
* const schema = buildSchema(`
|
|
2869
|
+
* enum Episode {
|
|
2870
|
+
* NEW_HOPE
|
|
2871
|
+
* EMPIRE
|
|
2872
|
+
* JEDI
|
|
2873
|
+
* }
|
|
2874
|
+
*
|
|
2875
|
+
* type Query {
|
|
2876
|
+
* episode: Episode
|
|
2877
|
+
* }
|
|
2878
|
+
* `);
|
|
2879
|
+
*
|
|
2880
|
+
* const Episode = assertEnumType(schema.getType('Episode'));
|
|
2881
|
+
*
|
|
2882
|
+
* Episode.getValues().map((value) => value.name); // => ['NEW_HOPE', 'EMPIRE', 'JEDI']
|
|
2883
|
+
* ```
|
|
2884
|
+
*/
|
|
2885
|
+
|
|
2886
|
+
getValues() {
|
|
2887
|
+
if (typeof this._values === 'function') {
|
|
2888
|
+
this._values = defineEnumValues(this.name, this._values());
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
return this._values;
|
|
2892
|
+
}
|
|
2893
|
+
/**
|
|
2894
|
+
* Returns the enum value definition for a value name.
|
|
2895
|
+
* @param name - The GraphQL name to look up.
|
|
2896
|
+
* @returns The matching enum value definition, if it exists.
|
|
2897
|
+
* @example
|
|
2898
|
+
* ```ts
|
|
2899
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
2900
|
+
* import { assertEnumType } from 'graphql/type';
|
|
2901
|
+
*
|
|
2902
|
+
* const schema = buildSchema(`
|
|
2903
|
+
* enum Episode {
|
|
2904
|
+
* NEW_HOPE
|
|
2905
|
+
* EMPIRE
|
|
2906
|
+
* }
|
|
2907
|
+
*
|
|
2908
|
+
* type Query {
|
|
2909
|
+
* episode: Episode
|
|
2910
|
+
* }
|
|
2911
|
+
* `);
|
|
2912
|
+
*
|
|
2913
|
+
* const Episode = assertEnumType(schema.getType('Episode'));
|
|
2914
|
+
*
|
|
2915
|
+
* Episode.getValue('EMPIRE')?.name; // => 'EMPIRE'
|
|
2916
|
+
* Episode.getValue('JEDI'); // => undefined
|
|
2917
|
+
* ```
|
|
2918
|
+
*/
|
|
2919
|
+
|
|
2920
|
+
getValue(name) {
|
|
2921
|
+
if (this._nameLookup === null) {
|
|
2922
|
+
this._nameLookup = (0, _keyMap.keyMap)(
|
|
2923
|
+
this.getValues(),
|
|
2924
|
+
(value) => value.name,
|
|
2925
|
+
);
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
return this._nameLookup[name];
|
|
2929
|
+
}
|
|
2930
|
+
/**
|
|
2931
|
+
* Serializes a runtime enum value as a GraphQL enum name.
|
|
2932
|
+
* @param outputValue - Runtime enum value to serialize.
|
|
2933
|
+
* @returns The GraphQL enum name for the runtime value.
|
|
2934
|
+
* @example
|
|
2935
|
+
* ```ts
|
|
2936
|
+
* import { GraphQLEnumType } from 'graphql/type';
|
|
2937
|
+
*
|
|
2938
|
+
* const RGB = new GraphQLEnumType({
|
|
2939
|
+
* name: 'RGB',
|
|
2940
|
+
* values: {
|
|
2941
|
+
* RED: { value: 0 },
|
|
2942
|
+
* GREEN: { value: 1 },
|
|
2943
|
+
* BLUE: { value: 2 },
|
|
2944
|
+
* },
|
|
2945
|
+
* });
|
|
2946
|
+
*
|
|
2947
|
+
* RGB.serialize(1); // => 'GREEN'
|
|
2948
|
+
* RGB.serialize(3); // throws an error
|
|
2949
|
+
* ```
|
|
2950
|
+
*/
|
|
2951
|
+
|
|
2952
|
+
serialize(outputValue) {
|
|
2953
|
+
if (this._valueLookup === null) {
|
|
2954
|
+
this._valueLookup = new Map(
|
|
2955
|
+
this.getValues().map((enumValue) => [enumValue.value, enumValue]),
|
|
2956
|
+
);
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
const enumValue = this._valueLookup.get(outputValue);
|
|
2960
|
+
|
|
2961
|
+
if (enumValue === undefined) {
|
|
2962
|
+
throw new _GraphQLError.GraphQLError(
|
|
2963
|
+
`Enum "${this.name}" cannot represent value: ${(0, _inspect.inspect)(
|
|
2964
|
+
outputValue,
|
|
2965
|
+
)}`,
|
|
2966
|
+
);
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
return enumValue.name;
|
|
2970
|
+
}
|
|
2971
|
+
/**
|
|
2972
|
+
* Parses a GraphQL enum name from variable input.
|
|
2973
|
+
* @param inputValue - Runtime input value to parse.
|
|
2974
|
+
* @returns The internal enum value represented by the input name.
|
|
2975
|
+
* @example
|
|
2976
|
+
* ```ts
|
|
2977
|
+
* import { GraphQLEnumType } from 'graphql/type';
|
|
2978
|
+
*
|
|
2979
|
+
* const RGB = new GraphQLEnumType({
|
|
2980
|
+
* name: 'RGB',
|
|
2981
|
+
* values: {
|
|
2982
|
+
* RED: { value: 0 },
|
|
2983
|
+
* GREEN: { value: 1 },
|
|
2984
|
+
* BLUE: { value: 2 },
|
|
2985
|
+
* },
|
|
2986
|
+
* });
|
|
2987
|
+
*
|
|
2988
|
+
* RGB.parseValue('BLUE'); // => 2
|
|
2989
|
+
* RGB.parseValue('PURPLE'); // throws an error
|
|
2990
|
+
* RGB.parseValue(2); // throws an error
|
|
2991
|
+
* ```
|
|
2992
|
+
*/
|
|
2993
|
+
|
|
2994
|
+
parseValue(inputValue) /* T */
|
|
2995
|
+
{
|
|
2996
|
+
if (typeof inputValue !== 'string') {
|
|
2997
|
+
const valueStr = (0, _inspect.inspect)(inputValue);
|
|
2998
|
+
throw new _GraphQLError.GraphQLError(
|
|
2999
|
+
`Enum "${this.name}" cannot represent non-string value: ${valueStr}.` +
|
|
3000
|
+
didYouMeanEnumValue(this, valueStr),
|
|
3001
|
+
);
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
const enumValue = this.getValue(inputValue);
|
|
3005
|
+
|
|
3006
|
+
if (enumValue == null) {
|
|
3007
|
+
throw new _GraphQLError.GraphQLError(
|
|
3008
|
+
`Value "${inputValue}" does not exist in "${this.name}" enum.` +
|
|
3009
|
+
didYouMeanEnumValue(this, inputValue),
|
|
3010
|
+
);
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
return enumValue.value;
|
|
3014
|
+
}
|
|
3015
|
+
/**
|
|
3016
|
+
* Parses a GraphQL enum name from an AST value literal.
|
|
3017
|
+
* @param valueNode - AST value literal to parse.
|
|
3018
|
+
* @param _variables - Runtime variable values; ignored because enum literals cannot contain variables.
|
|
3019
|
+
* @returns The internal enum value represented by the literal.
|
|
3020
|
+
* @example
|
|
3021
|
+
* ```ts
|
|
3022
|
+
* import { parseValue } from 'graphql/language';
|
|
3023
|
+
* import { GraphQLEnumType } from 'graphql/type';
|
|
3024
|
+
*
|
|
3025
|
+
* const RGB = new GraphQLEnumType({
|
|
3026
|
+
* name: 'RGB',
|
|
3027
|
+
* values: {
|
|
3028
|
+
* RED: { value: 0 },
|
|
3029
|
+
* GREEN: { value: 1 },
|
|
3030
|
+
* BLUE: { value: 2 },
|
|
3031
|
+
* },
|
|
3032
|
+
* });
|
|
3033
|
+
*
|
|
3034
|
+
* RGB.parseLiteral(parseValue('RED')); // => 0
|
|
3035
|
+
* RGB.parseLiteral(parseValue('"RED"')); // throws an error
|
|
3036
|
+
* ```
|
|
3037
|
+
*/
|
|
3038
|
+
|
|
3039
|
+
parseLiteral(valueNode, _variables) /* T */
|
|
3040
|
+
{
|
|
3041
|
+
// Note: variables will be resolved to a value before calling this function.
|
|
3042
|
+
if (valueNode.kind !== _kinds.Kind.ENUM) {
|
|
3043
|
+
const valueStr = (0, _printer.print)(valueNode);
|
|
3044
|
+
throw new _GraphQLError.GraphQLError(
|
|
3045
|
+
`Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` +
|
|
3046
|
+
didYouMeanEnumValue(this, valueStr),
|
|
3047
|
+
{
|
|
3048
|
+
nodes: valueNode,
|
|
3049
|
+
},
|
|
3050
|
+
);
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
const enumValue = this.getValue(valueNode.value);
|
|
3054
|
+
|
|
3055
|
+
if (enumValue == null) {
|
|
3056
|
+
const valueStr = (0, _printer.print)(valueNode);
|
|
3057
|
+
throw new _GraphQLError.GraphQLError(
|
|
3058
|
+
`Value "${valueStr}" does not exist in "${this.name}" enum.` +
|
|
3059
|
+
didYouMeanEnumValue(this, valueStr),
|
|
3060
|
+
{
|
|
3061
|
+
nodes: valueNode,
|
|
3062
|
+
},
|
|
3063
|
+
);
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
return enumValue.value;
|
|
3067
|
+
}
|
|
3068
|
+
/**
|
|
3069
|
+
* Returns a normalized configuration object for this object.
|
|
3070
|
+
* @returns A configuration object that can be used to recreate this object.
|
|
3071
|
+
* @example
|
|
3072
|
+
* ```ts
|
|
3073
|
+
* import { GraphQLEnumType } from 'graphql/type';
|
|
3074
|
+
*
|
|
3075
|
+
* const RGB = new GraphQLEnumType({
|
|
3076
|
+
* name: 'RGB',
|
|
3077
|
+
* values: {
|
|
3078
|
+
* RED: { value: 0 },
|
|
3079
|
+
* GREEN: { value: 1 },
|
|
3080
|
+
* BLUE: { value: 2 },
|
|
3081
|
+
* },
|
|
3082
|
+
* });
|
|
3083
|
+
*
|
|
3084
|
+
* const config = RGB.toConfig();
|
|
3085
|
+
* const RGBCopy = new GraphQLEnumType(config);
|
|
3086
|
+
*
|
|
3087
|
+
* config.values.GREEN.value; // => 1
|
|
3088
|
+
* RGBCopy.serialize(2); // => 'BLUE'
|
|
3089
|
+
* ```
|
|
3090
|
+
*/
|
|
3091
|
+
|
|
3092
|
+
toConfig() {
|
|
3093
|
+
const values = (0, _keyValMap.keyValMap)(
|
|
3094
|
+
this.getValues(),
|
|
3095
|
+
(value) => value.name,
|
|
3096
|
+
(value) => ({
|
|
3097
|
+
description: value.description,
|
|
3098
|
+
value: value.value,
|
|
3099
|
+
deprecationReason: value.deprecationReason,
|
|
3100
|
+
extensions: value.extensions,
|
|
3101
|
+
astNode: value.astNode,
|
|
3102
|
+
}),
|
|
3103
|
+
);
|
|
3104
|
+
return {
|
|
3105
|
+
name: this.name,
|
|
3106
|
+
description: this.description,
|
|
3107
|
+
values,
|
|
3108
|
+
extensions: this.extensions,
|
|
3109
|
+
astNode: this.astNode,
|
|
3110
|
+
extensionASTNodes: this.extensionASTNodes,
|
|
3111
|
+
};
|
|
3112
|
+
}
|
|
3113
|
+
/**
|
|
3114
|
+
* Returns the schema coordinate identifying this enum type.
|
|
3115
|
+
* @returns The schema coordinate for this enum type.
|
|
3116
|
+
* @example
|
|
3117
|
+
* ```ts
|
|
3118
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
3119
|
+
* import { assertEnumType } from 'graphql/type';
|
|
3120
|
+
*
|
|
3121
|
+
* const schema = buildSchema(`
|
|
3122
|
+
* enum Episode {
|
|
3123
|
+
* NEW_HOPE
|
|
3124
|
+
* }
|
|
3125
|
+
*
|
|
3126
|
+
* type Query {
|
|
3127
|
+
* episode: Episode
|
|
3128
|
+
* }
|
|
3129
|
+
* `);
|
|
3130
|
+
*
|
|
3131
|
+
* const Episode = assertEnumType(schema.getType('Episode'));
|
|
3132
|
+
*
|
|
3133
|
+
* Episode.toString(); // => 'Episode'
|
|
3134
|
+
* ```
|
|
3135
|
+
*/
|
|
3136
|
+
|
|
3137
|
+
toString() {
|
|
3138
|
+
return this.name;
|
|
3139
|
+
}
|
|
3140
|
+
/**
|
|
3141
|
+
* Returns the JSON representation used when this object is serialized.
|
|
3142
|
+
* @returns The JSON-serializable representation.
|
|
3143
|
+
* @example
|
|
3144
|
+
* ```ts
|
|
3145
|
+
* import { GraphQLEnumType } from 'graphql/type';
|
|
3146
|
+
*
|
|
3147
|
+
* const Episode = new GraphQLEnumType({
|
|
3148
|
+
* name: 'Episode',
|
|
3149
|
+
* values: {
|
|
3150
|
+
* NEW_HOPE: {},
|
|
3151
|
+
* },
|
|
3152
|
+
* });
|
|
3153
|
+
*
|
|
3154
|
+
* Episode.toJSON(); // => 'Episode'
|
|
3155
|
+
* JSON.stringify({ type: Episode }); // => '{"type":"Episode"}'
|
|
3156
|
+
* ```
|
|
3157
|
+
*/
|
|
3158
|
+
|
|
3159
|
+
toJSON() {
|
|
3160
|
+
return this.toString();
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
exports.GraphQLEnumType = GraphQLEnumType;
|
|
3165
|
+
|
|
3166
|
+
function didYouMeanEnumValue(enumType, unknownValueStr) {
|
|
3167
|
+
const allNames = enumType.getValues().map((value) => value.name);
|
|
3168
|
+
const suggestedValues = (0, _suggestionList.suggestionList)(
|
|
3169
|
+
unknownValueStr,
|
|
3170
|
+
allNames,
|
|
3171
|
+
);
|
|
3172
|
+
return (0, _didYouMean.didYouMean)('the enum value', suggestedValues);
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
function defineEnumValues(typeName, valueMap) {
|
|
3176
|
+
isPlainObj(valueMap) ||
|
|
3177
|
+
(0, _devAssert.devAssert)(
|
|
3178
|
+
false,
|
|
3179
|
+
`${typeName} values must be an object with value names as keys.`,
|
|
3180
|
+
);
|
|
3181
|
+
return Object.entries(valueMap).map(([valueName, valueConfig]) => {
|
|
3182
|
+
isPlainObj(valueConfig) ||
|
|
3183
|
+
(0, _devAssert.devAssert)(
|
|
3184
|
+
false,
|
|
3185
|
+
`${typeName}.${valueName} must refer to an object with a "value" key ` +
|
|
3186
|
+
`representing an internal value but got: ${(0, _inspect.inspect)(
|
|
3187
|
+
valueConfig,
|
|
3188
|
+
)}.`,
|
|
3189
|
+
);
|
|
3190
|
+
return {
|
|
3191
|
+
name: (0, _assertName.assertEnumValueName)(valueName),
|
|
3192
|
+
description: valueConfig.description,
|
|
3193
|
+
value: valueConfig.value !== undefined ? valueConfig.value : valueName,
|
|
3194
|
+
deprecationReason: valueConfig.deprecationReason,
|
|
3195
|
+
extensions: (0, _toObjMap.toObjMap)(valueConfig.extensions),
|
|
3196
|
+
astNode: valueConfig.astNode,
|
|
3197
|
+
};
|
|
3198
|
+
});
|
|
3199
|
+
}
|
|
3200
|
+
/** Configuration used to construct a GraphQLEnumType. */
|
|
3201
|
+
|
|
3202
|
+
/**
|
|
3203
|
+
* Input Object Type Definition
|
|
3204
|
+
*
|
|
3205
|
+
* An input object defines a structured collection of fields which may be
|
|
3206
|
+
* supplied to a field argument.
|
|
3207
|
+
*
|
|
3208
|
+
* Using `NonNull` will ensure that a value must be provided by the query
|
|
3209
|
+
* @example
|
|
3210
|
+
* ```ts
|
|
3211
|
+
* const GeoPoint = new GraphQLInputObjectType({
|
|
3212
|
+
* name: 'GeoPoint',
|
|
3213
|
+
* fields: {
|
|
3214
|
+
* lat: { type: new GraphQLNonNull(GraphQLFloat) },
|
|
3215
|
+
* lon: { type: new GraphQLNonNull(GraphQLFloat) },
|
|
3216
|
+
* alt: { type: GraphQLFloat, defaultValue: 0 },
|
|
3217
|
+
* }
|
|
3218
|
+
* });
|
|
3219
|
+
* ```
|
|
3220
|
+
*/
|
|
3221
|
+
class GraphQLInputObjectType {
|
|
3222
|
+
/** The GraphQL name for this schema element. */
|
|
3223
|
+
|
|
3224
|
+
/** Human-readable description for this schema element, if provided. */
|
|
3225
|
+
|
|
3226
|
+
/** Custom extension fields reserved for users. */
|
|
3227
|
+
|
|
3228
|
+
/** AST node from which this schema element was built, if available. */
|
|
3229
|
+
|
|
3230
|
+
/** AST extension nodes applied to this schema element. */
|
|
3231
|
+
|
|
3232
|
+
/** Whether this input object uses the experimental OneOf input object semantics. */
|
|
3233
|
+
|
|
3234
|
+
/**
|
|
3235
|
+
* Creates a GraphQLInputObjectType instance.
|
|
3236
|
+
* @param config - Configuration describing this object.
|
|
3237
|
+
* @example
|
|
3238
|
+
* ```ts
|
|
3239
|
+
* import { parse } from 'graphql/language';
|
|
3240
|
+
* import {
|
|
3241
|
+
* GraphQLID,
|
|
3242
|
+
* GraphQLInputObjectType,
|
|
3243
|
+
* GraphQLInt,
|
|
3244
|
+
* GraphQLNonNull,
|
|
3245
|
+
* GraphQLString,
|
|
3246
|
+
* } from 'graphql/type';
|
|
3247
|
+
*
|
|
3248
|
+
* const document = parse(`
|
|
3249
|
+
* input ReviewInput {
|
|
3250
|
+
* stars: Int!
|
|
3251
|
+
* commentary: String
|
|
3252
|
+
* }
|
|
3253
|
+
*
|
|
3254
|
+
* extend input ReviewInput {
|
|
3255
|
+
* body: String
|
|
3256
|
+
* }
|
|
3257
|
+
* `);
|
|
3258
|
+
* const definition = document.definitions[0];
|
|
3259
|
+
*
|
|
3260
|
+
* const ReviewInput = new GraphQLInputObjectType({
|
|
3261
|
+
* name: 'ReviewInput',
|
|
3262
|
+
* description: 'Input collected when reviewing a product.',
|
|
3263
|
+
* fields: {
|
|
3264
|
+
* stars: {
|
|
3265
|
+
* description: 'Star rating from one to five.',
|
|
3266
|
+
* type: new GraphQLNonNull(GraphQLInt),
|
|
3267
|
+
* extensions: { min: 1, max: 5 },
|
|
3268
|
+
* astNode: definition.fields[0],
|
|
3269
|
+
* },
|
|
3270
|
+
* commentary: {
|
|
3271
|
+
* type: GraphQLString,
|
|
3272
|
+
* defaultValue: '',
|
|
3273
|
+
* deprecationReason: 'Use body.',
|
|
3274
|
+
* astNode: definition.fields[1],
|
|
3275
|
+
* },
|
|
3276
|
+
* },
|
|
3277
|
+
* extensions: { form: 'review' },
|
|
3278
|
+
* astNode: definition,
|
|
3279
|
+
* extensionASTNodes: [ document.definitions[1] ],
|
|
3280
|
+
* isOneOf: false,
|
|
3281
|
+
* });
|
|
3282
|
+
* const SearchBy = new GraphQLInputObjectType({
|
|
3283
|
+
* name: 'SearchBy',
|
|
3284
|
+
* fields: {
|
|
3285
|
+
* id: { type: GraphQLID },
|
|
3286
|
+
* slug: { type: GraphQLString },
|
|
3287
|
+
* },
|
|
3288
|
+
* isOneOf: true,
|
|
3289
|
+
* });
|
|
3290
|
+
*
|
|
3291
|
+
* const fields = ReviewInput.getFields();
|
|
3292
|
+
*
|
|
3293
|
+
* ReviewInput.description; // => 'Input collected when reviewing a product.'
|
|
3294
|
+
* String(fields.stars.type); // => 'Int!'
|
|
3295
|
+
* fields.stars.extensions; // => { min: 1, max: 5 }
|
|
3296
|
+
* fields.commentary.defaultValue; // => ''
|
|
3297
|
+
* fields.commentary.deprecationReason; // => 'Use body.'
|
|
3298
|
+
* ReviewInput.isOneOf; // => false
|
|
3299
|
+
* SearchBy.isOneOf; // => true
|
|
3300
|
+
* ```
|
|
3301
|
+
*/
|
|
3302
|
+
constructor(config) {
|
|
3303
|
+
var _config$extensionASTN6, _config$isOneOf;
|
|
3304
|
+
|
|
3305
|
+
this.name = (0, _assertName.assertName)(config.name);
|
|
3306
|
+
this.description = config.description;
|
|
3307
|
+
this.extensions = (0, _toObjMap.toObjMap)(config.extensions);
|
|
3308
|
+
this.astNode = config.astNode;
|
|
3309
|
+
this.extensionASTNodes =
|
|
3310
|
+
(_config$extensionASTN6 = config.extensionASTNodes) !== null &&
|
|
3311
|
+
_config$extensionASTN6 !== void 0
|
|
3312
|
+
? _config$extensionASTN6
|
|
3313
|
+
: [];
|
|
3314
|
+
this.isOneOf =
|
|
3315
|
+
(_config$isOneOf = config.isOneOf) !== null && _config$isOneOf !== void 0
|
|
3316
|
+
? _config$isOneOf
|
|
3317
|
+
: false;
|
|
3318
|
+
this._fields = defineInputFieldMap.bind(undefined, config);
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* Returns the value used by `Object.prototype.toString`.
|
|
3322
|
+
* @returns The built-in string tag for this object.
|
|
3323
|
+
*/
|
|
3324
|
+
|
|
3325
|
+
get [Symbol.toStringTag]() {
|
|
3326
|
+
return 'GraphQLInputObjectType';
|
|
3327
|
+
}
|
|
3328
|
+
/**
|
|
3329
|
+
* Returns the fields defined by this type.
|
|
3330
|
+
* @returns The fields keyed by field name.
|
|
3331
|
+
* @example
|
|
3332
|
+
* ```ts
|
|
3333
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
3334
|
+
* import { assertInputObjectType } from 'graphql/type';
|
|
3335
|
+
*
|
|
3336
|
+
* const schema = buildSchema(`
|
|
3337
|
+
* input ReviewInput {
|
|
3338
|
+
* stars: Int!
|
|
3339
|
+
* commentary: String = ""
|
|
3340
|
+
* }
|
|
3341
|
+
*
|
|
3342
|
+
* type Query {
|
|
3343
|
+
* reviews(filter: ReviewInput): [String]
|
|
3344
|
+
* }
|
|
3345
|
+
* `);
|
|
3346
|
+
*
|
|
3347
|
+
* const ReviewInput = assertInputObjectType(schema.getType('ReviewInput'));
|
|
3348
|
+
* const fields = ReviewInput.getFields();
|
|
3349
|
+
*
|
|
3350
|
+
* Object.keys(fields); // => ['stars', 'commentary']
|
|
3351
|
+
* fields.commentary.defaultValue; // => ''
|
|
3352
|
+
* ```
|
|
3353
|
+
*/
|
|
3354
|
+
|
|
3355
|
+
getFields() {
|
|
3356
|
+
if (typeof this._fields === 'function') {
|
|
3357
|
+
this._fields = this._fields();
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3360
|
+
return this._fields;
|
|
3361
|
+
}
|
|
3362
|
+
/**
|
|
3363
|
+
* Returns a normalized configuration object for this object.
|
|
3364
|
+
* @returns A configuration object that can be used to recreate this object.
|
|
3365
|
+
* @example
|
|
3366
|
+
* ```ts
|
|
3367
|
+
* import {
|
|
3368
|
+
* GraphQLInputObjectType,
|
|
3369
|
+
* GraphQLInt,
|
|
3370
|
+
* GraphQLNonNull,
|
|
3371
|
+
* } from 'graphql/type';
|
|
3372
|
+
*
|
|
3373
|
+
* const ReviewInput = new GraphQLInputObjectType({
|
|
3374
|
+
* name: 'ReviewInput',
|
|
3375
|
+
* fields: {
|
|
3376
|
+
* stars: { type: new GraphQLNonNull(GraphQLInt) },
|
|
3377
|
+
* },
|
|
3378
|
+
* });
|
|
3379
|
+
*
|
|
3380
|
+
* const config = ReviewInput.toConfig();
|
|
3381
|
+
* const ReviewInputCopy = new GraphQLInputObjectType(config);
|
|
3382
|
+
*
|
|
3383
|
+
* String(config.fields.stars.type); // => 'Int!'
|
|
3384
|
+
* String(ReviewInputCopy.getFields().stars.type); // => 'Int!'
|
|
3385
|
+
* ```
|
|
3386
|
+
*/
|
|
3387
|
+
|
|
3388
|
+
toConfig() {
|
|
3389
|
+
const fields = (0, _mapValue.mapValue)(this.getFields(), (field) => ({
|
|
3390
|
+
description: field.description,
|
|
3391
|
+
type: field.type,
|
|
3392
|
+
defaultValue: field.defaultValue,
|
|
3393
|
+
deprecationReason: field.deprecationReason,
|
|
3394
|
+
extensions: field.extensions,
|
|
3395
|
+
astNode: field.astNode,
|
|
3396
|
+
}));
|
|
3397
|
+
return {
|
|
3398
|
+
name: this.name,
|
|
3399
|
+
description: this.description,
|
|
3400
|
+
fields,
|
|
3401
|
+
extensions: this.extensions,
|
|
3402
|
+
astNode: this.astNode,
|
|
3403
|
+
extensionASTNodes: this.extensionASTNodes,
|
|
3404
|
+
isOneOf: this.isOneOf,
|
|
3405
|
+
};
|
|
3406
|
+
}
|
|
3407
|
+
/**
|
|
3408
|
+
* Returns the schema coordinate identifying this input object type.
|
|
3409
|
+
* @returns The schema coordinate for this input object type.
|
|
3410
|
+
* @example
|
|
3411
|
+
* ```ts
|
|
3412
|
+
* import { buildSchema } from 'graphql/utilities';
|
|
3413
|
+
* import { assertInputObjectType } from 'graphql/type';
|
|
3414
|
+
*
|
|
3415
|
+
* const schema = buildSchema(`
|
|
3416
|
+
* input ReviewInput {
|
|
3417
|
+
* stars: Int!
|
|
3418
|
+
* }
|
|
3419
|
+
*
|
|
3420
|
+
* type Query {
|
|
3421
|
+
* reviews(filter: ReviewInput): [String]
|
|
3422
|
+
* }
|
|
3423
|
+
* `);
|
|
3424
|
+
*
|
|
3425
|
+
* const ReviewInput = assertInputObjectType(schema.getType('ReviewInput'));
|
|
3426
|
+
*
|
|
3427
|
+
* ReviewInput.toString(); // => 'ReviewInput'
|
|
3428
|
+
* ```
|
|
3429
|
+
*/
|
|
3430
|
+
|
|
3431
|
+
toString() {
|
|
3432
|
+
return this.name;
|
|
3433
|
+
}
|
|
3434
|
+
/**
|
|
3435
|
+
* Returns the JSON representation used when this object is serialized.
|
|
3436
|
+
* @returns The JSON-serializable representation.
|
|
3437
|
+
* @example
|
|
3438
|
+
* ```ts
|
|
3439
|
+
* import { GraphQLInputObjectType, GraphQLString } from 'graphql/type';
|
|
3440
|
+
*
|
|
3441
|
+
* const ReviewInput = new GraphQLInputObjectType({
|
|
3442
|
+
* name: 'ReviewInput',
|
|
3443
|
+
* fields: {
|
|
3444
|
+
* commentary: { type: GraphQLString },
|
|
3445
|
+
* },
|
|
3446
|
+
* });
|
|
3447
|
+
*
|
|
3448
|
+
* ReviewInput.toJSON(); // => 'ReviewInput'
|
|
3449
|
+
* JSON.stringify({ type: ReviewInput }); // => '{"type":"ReviewInput"}'
|
|
3450
|
+
* ```
|
|
3451
|
+
*/
|
|
3452
|
+
|
|
3453
|
+
toJSON() {
|
|
3454
|
+
return this.toString();
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
|
|
3458
|
+
exports.GraphQLInputObjectType = GraphQLInputObjectType;
|
|
3459
|
+
|
|
3460
|
+
function defineInputFieldMap(config) {
|
|
3461
|
+
const fieldMap = resolveObjMapThunk(config.fields);
|
|
3462
|
+
isPlainObj(fieldMap) ||
|
|
3463
|
+
(0, _devAssert.devAssert)(
|
|
3464
|
+
false,
|
|
3465
|
+
`${config.name} fields must be an object with field names as keys or a function which returns such an object.`,
|
|
3466
|
+
);
|
|
3467
|
+
return (0, _mapValue.mapValue)(fieldMap, (fieldConfig, fieldName) => {
|
|
3468
|
+
!('resolve' in fieldConfig) ||
|
|
3469
|
+
(0, _devAssert.devAssert)(
|
|
3470
|
+
false,
|
|
3471
|
+
`${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`,
|
|
3472
|
+
);
|
|
3473
|
+
return {
|
|
3474
|
+
name: (0, _assertName.assertName)(fieldName),
|
|
3475
|
+
description: fieldConfig.description,
|
|
3476
|
+
type: fieldConfig.type,
|
|
3477
|
+
defaultValue: fieldConfig.defaultValue,
|
|
3478
|
+
deprecationReason: fieldConfig.deprecationReason,
|
|
3479
|
+
extensions: (0, _toObjMap.toObjMap)(fieldConfig.extensions),
|
|
3480
|
+
astNode: fieldConfig.astNode,
|
|
3481
|
+
};
|
|
3482
|
+
});
|
|
3483
|
+
}
|
|
3484
|
+
/** Configuration used to construct a GraphQLInputObjectType. */
|
|
3485
|
+
|
|
3486
|
+
/**
|
|
3487
|
+
* Returns true when the input field is non-null and has no default value.
|
|
3488
|
+
* @param field - The input field definition to inspect.
|
|
3489
|
+
* @returns True when the input field is non-null and has no default value.
|
|
3490
|
+
* @example
|
|
3491
|
+
* ```ts
|
|
3492
|
+
* import {
|
|
3493
|
+
* GraphQLInt,
|
|
3494
|
+
* GraphQLNonNull,
|
|
3495
|
+
* GraphQLString,
|
|
3496
|
+
* isRequiredInputField,
|
|
3497
|
+
* } from 'graphql/type';
|
|
3498
|
+
*
|
|
3499
|
+
* const requiredField = { name: 'id', type: new GraphQLNonNull(GraphQLInt) };
|
|
3500
|
+
* const optionalField = { name: 'name', type: GraphQLString };
|
|
3501
|
+
* const fieldWithDefault = {
|
|
3502
|
+
* name: 'limit',
|
|
3503
|
+
* type: new GraphQLNonNull(GraphQLInt),
|
|
3504
|
+
* defaultValue: 10,
|
|
3505
|
+
* };
|
|
3506
|
+
*
|
|
3507
|
+
* isRequiredInputField(requiredField); // => true
|
|
3508
|
+
* isRequiredInputField(optionalField); // => false
|
|
3509
|
+
* isRequiredInputField(fieldWithDefault); // => false
|
|
3510
|
+
* ```
|
|
3511
|
+
*/
|
|
3512
|
+
function isRequiredInputField(field) {
|
|
3513
|
+
return isNonNullType(field.type) && field.defaultValue === undefined;
|
|
3514
|
+
}
|
|
3515
|
+
/** A map of input field names to resolved input field definitions. */
|