houdini 2.0.0-next.9 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/adapter/index.d.ts +2 -2
- package/build/adapter/index.js +6 -0
- package/build/cmd/generate.d.ts +5 -0
- package/build/cmd/generate.js +77 -0
- package/build/cmd/index.js +32 -0
- package/build/cmd/init.js +565 -0
- package/build/cmd/pullSchema.js +26 -0
- package/build/lib/ast.js +71 -0
- package/build/lib/codegen.d.ts +57 -0
- package/build/lib/codegen.js +627 -0
- package/build/lib/config.d.ts +240 -177
- package/build/lib/config.js +143 -0
- package/build/lib/constants.js +14 -0
- package/build/lib/database.d.ts +7 -0
- package/build/lib/database.js +624 -0
- package/build/lib/db.d.ts +13 -0
- package/build/lib/db.js +135 -0
- package/build/lib/deepMerge.js +23 -0
- package/build/lib/error.d.ts +16 -0
- package/build/lib/error.js +115 -0
- package/build/lib/fs.d.ts +9 -11
- package/build/lib/fs.js +245 -0
- package/build/lib/graphql.d.ts +5 -32
- package/build/lib/graphql.js +36 -0
- package/build/lib/imports.d.ts +29 -14
- package/build/lib/imports.js +66 -0
- package/build/lib/index.d.ts +17 -24
- package/build/lib/index.js +21 -0
- package/build/lib/logger.d.ts +12 -0
- package/build/lib/logger.js +45 -0
- package/build/lib/parse.d.ts +2 -3
- package/build/lib/parse.js +33 -0
- package/build/lib/path.d.ts +0 -1
- package/build/lib/path.js +44 -0
- package/build/lib/pipeline.d.ts +1 -1
- package/build/lib/pipeline.js +8 -0
- package/build/lib/plugins.d.ts +4 -0
- package/build/lib/plugins.js +88 -0
- package/build/lib/project.d.ts +19 -0
- package/build/lib/project.js +296 -0
- package/build/lib/schema.d.ts +1 -0
- package/build/lib/schema.js +61 -0
- package/build/lib/sleep.d.ts +1 -0
- package/build/lib/sleep.js +8 -0
- package/build/lib/types.d.ts +92 -303
- package/build/lib/types.js +37 -0
- package/build/lib/walk.d.ts +11 -6
- package/build/lib/walk.js +138 -0
- package/build/node/index.d.ts +44 -0
- package/build/node/index.js +402 -0
- package/build/oauth/index.d.ts +41 -0
- package/build/oauth/index.js +108 -0
- package/build/package.json +212 -0
- package/build/router/auth-token.d.ts +29 -0
- package/build/router/auth-token.js +168 -0
- package/build/{lib/router → router}/conventions.d.ts +10 -1
- package/build/router/conventions.js +165 -0
- package/build/{runtime-esm/router → router}/cookies.js +21 -21
- package/build/{runtime-esm/router → router}/jwt.js +8 -6
- package/build/{lib/router → router}/manifest.d.ts +2 -2
- package/build/router/manifest.js +279 -0
- package/build/{runtime/router → router}/match.d.ts +10 -10
- package/build/router/match.js +219 -0
- package/build/router/server.d.ts +57 -0
- package/build/router/server.js +500 -0
- package/build/{runtime/router → router}/session.d.ts +8 -3
- package/build/router/session.js +338 -0
- package/build/router/types.d.ts +44 -0
- package/build/runtime/cache/benchmarks/cache.bench.d.ts +1 -0
- package/build/runtime/cache/benchmarks/cache.bench.js +943 -0
- package/build/runtime/cache/gc.d.ts +2 -1
- package/build/{runtime-esm → runtime}/cache/gc.js +4 -1
- package/build/runtime/cache/index.d.ts +173 -3
- package/build/{runtime-esm/cache/cache.js → runtime/cache/index.js} +197 -70
- package/build/runtime/cache/lists.d.ts +9 -4
- package/build/{runtime-esm → runtime}/cache/lists.js +116 -27
- package/build/runtime/cache/staleManager.d.ts +2 -1
- package/build/{runtime-esm → runtime}/cache/staleManager.js +6 -2
- package/build/runtime/cache/storage.d.ts +5 -2
- package/build/{runtime-esm → runtime}/cache/storage.js +126 -54
- package/build/{runtime-esm → runtime}/cache/stuff.js +4 -3
- package/build/runtime/cache/subscription.d.ts +23 -9
- package/build/{runtime-esm → runtime}/cache/subscription.js +103 -65
- package/build/runtime/{client/index.d.ts → client.d.ts} +15 -22
- package/build/runtime/client.js +86 -0
- package/build/runtime/coerce.d.ts +4 -0
- package/build/runtime/coerce.js +31 -0
- package/build/runtime/config.d.ts +20 -0
- package/build/runtime/config.js +88 -0
- package/build/runtime/{lib/constants.d.ts → constants.d.ts} +1 -1
- package/build/runtime/{client/documentStore.d.ts → documentStore.d.ts} +18 -11
- package/build/{runtime-esm/client → runtime}/documentStore.js +53 -56
- package/build/runtime/endpoint.d.ts +14 -0
- package/build/runtime/endpoint.js +29 -0
- package/build/{runtime-cjs/lib → runtime}/flatten.d.ts +1 -1
- package/build/runtime/formData.d.ts +24 -0
- package/build/runtime/formData.js +93 -0
- package/build/runtime/index.d.ts +16 -8
- package/build/runtime/index.js +54 -0
- package/build/{runtime-cjs/lib → runtime}/key.d.ts +1 -1
- package/build/{runtime-esm/lib → runtime}/key.js +4 -4
- package/build/{runtime-esm/lib → runtime}/log.js +3 -3
- package/build/runtime/multipart.d.ts +8 -0
- package/build/runtime/multipart.js +49 -0
- package/build/{runtime-cjs/lib → runtime}/pageInfo.d.ts +3 -3
- package/build/{runtime-esm/lib → runtime}/pageInfo.js +2 -2
- package/build/{runtime-cjs/lib → runtime}/pagination.d.ts +12 -8
- package/build/{runtime-esm/lib → runtime}/pagination.js +157 -21
- package/build/{runtime-cjs/lib → runtime}/scalars.d.ts +6 -6
- package/build/{runtime-esm/lib → runtime}/scalars.js +10 -43
- package/build/{runtime-cjs/lib → runtime}/selection.d.ts +1 -1
- package/build/{runtime-esm/lib → runtime}/selection.js +17 -2
- package/build/runtime/{lib/store.d.ts → store.d.ts} +1 -1
- package/build/{runtime-esm/lib → runtime}/store.js +2 -3
- package/build/runtime/{lib/types.d.ts → types.d.ts} +107 -102
- package/build/{runtime-esm/lib → runtime}/types.js +37 -15
- package/build/test/index.d.ts +6 -25
- package/build/test/index.js +329 -0
- package/build/test/package.json +1 -0
- package/build/vite/hmr.d.ts +26 -3
- package/build/vite/hmr.js +433 -0
- package/build/vite/houdini.d.ts +4 -10
- package/build/vite/houdini.js +144 -0
- package/build/vite/index.d.ts +13 -7
- package/build/vite/index.js +106 -0
- package/build/vite/package.json +1 -0
- package/build/vite/schema.d.ts +5 -3
- package/build/vite/schema.js +193 -0
- package/package.json +148 -57
- package/build/adapter-cjs/index.js +0 -33
- package/build/adapter-cjs/package.json +0 -1
- package/build/adapter-esm/index.js +0 -9
- package/build/cmd-cjs/index.js +0 -89299
- package/build/cmd-cjs/package.json +0 -1
- package/build/cmd-esm/index.js +0 -89303
- package/build/codegen/generators/artifacts/fieldKey.d.ts +0 -3
- package/build/codegen/generators/artifacts/index.d.ts +0 -17
- package/build/codegen/generators/artifacts/indexFile.d.ts +0 -2
- package/build/codegen/generators/artifacts/inputs.d.ts +0 -4
- package/build/codegen/generators/artifacts/operations.d.ts +0 -11
- package/build/codegen/generators/artifacts/selection.d.ts +0 -20
- package/build/codegen/generators/artifacts/utils.d.ts +0 -8
- package/build/codegen/generators/comments/jsdoc.d.ts +0 -2
- package/build/codegen/generators/definitions/enums.d.ts +0 -2
- package/build/codegen/generators/definitions/index.d.ts +0 -2
- package/build/codegen/generators/index.d.ts +0 -6
- package/build/codegen/generators/indexFile/index.d.ts +0 -2
- package/build/codegen/generators/persistedQueries/index.d.ts +0 -2
- package/build/codegen/generators/runtime/graphqlFunction.d.ts +0 -2
- package/build/codegen/generators/runtime/index.d.ts +0 -3
- package/build/codegen/generators/runtime/injectPlugins.d.ts +0 -7
- package/build/codegen/generators/runtime/pluginIndex.d.ts +0 -5
- package/build/codegen/generators/runtime/pluginRuntime.d.ts +0 -15
- package/build/codegen/generators/runtime/runtimeConfig.d.ts +0 -7
- package/build/codegen/generators/typescript/addReferencedInputTypes.d.ts +0 -4
- package/build/codegen/generators/typescript/documentTypes.d.ts +0 -2
- package/build/codegen/generators/typescript/imperativeTypeDef.d.ts +0 -2
- package/build/codegen/generators/typescript/index.d.ts +0 -2
- package/build/codegen/generators/typescript/inlineType.d.ts +0 -29
- package/build/codegen/generators/typescript/loadingState.d.ts +0 -8
- package/build/codegen/index.d.ts +0 -8
- package/build/codegen/transforms/addFields.d.ts +0 -2
- package/build/codegen/transforms/collectDefinitions.d.ts +0 -9
- package/build/codegen/transforms/componentFields.d.ts +0 -8
- package/build/codegen/transforms/fragmentVariables.d.ts +0 -17
- package/build/codegen/transforms/index.d.ts +0 -9
- package/build/codegen/transforms/list.d.ts +0 -9
- package/build/codegen/transforms/paginate.d.ts +0 -4
- package/build/codegen/transforms/runtimeScalars.d.ts +0 -2
- package/build/codegen/transforms/schema.d.ts +0 -2
- package/build/codegen/transforms/typename.d.ts +0 -2
- package/build/codegen/utils/commonjs.d.ts +0 -5
- package/build/codegen/utils/flattenSelections.d.ts +0 -11
- package/build/codegen/utils/index.d.ts +0 -4
- package/build/codegen/utils/moduleExport.d.ts +0 -4
- package/build/codegen/utils/murmur.d.ts +0 -9
- package/build/codegen/utils/objectIdentificationSelection.d.ts +0 -3
- package/build/codegen/utils/stripLoc.d.ts +0 -3
- package/build/codegen/validators/componentFields.d.ts +0 -2
- package/build/codegen/validators/index.d.ts +0 -5
- package/build/codegen/validators/noIDAlias.d.ts +0 -2
- package/build/codegen/validators/plugins.d.ts +0 -3
- package/build/codegen/validators/typeCheck.d.ts +0 -5
- package/build/codegen/validators/uniqueNames.d.ts +0 -2
- package/build/codegen-cjs/index.js +0 -74656
- package/build/codegen-cjs/package.json +0 -1
- package/build/codegen-esm/index.js +0 -74655
- package/build/lib/cleanupFiles.d.ts +0 -1
- package/build/lib/detectTools.d.ts +0 -16
- package/build/lib/introspection.d.ts +0 -3
- package/build/lib/plugin.d.ts +0 -2
- package/build/lib/router/index.d.ts +0 -9
- package/build/lib/router/server.d.ts +0 -7
- package/build/lib/router/types.d.ts +0 -23
- package/build/lib/typescript.d.ts +0 -20
- package/build/lib/watchAndRun.d.ts +0 -61
- package/build/lib-cjs/index.js +0 -79739
- package/build/lib-cjs/package.json +0 -1
- package/build/lib-esm/index.js +0 -79648
- package/build/runtime/cache/cache.d.ts +0 -169
- package/build/runtime/client/plugins/cache.d.ts +0 -9
- package/build/runtime/client/plugins/fetch.d.ts +0 -38
- package/build/runtime/client/plugins/fetchParams.d.ts +0 -9
- package/build/runtime/client/plugins/fragment.d.ts +0 -2
- package/build/runtime/client/plugins/index.d.ts +0 -9
- package/build/runtime/client/plugins/injectedPlugins.d.ts +0 -4
- package/build/runtime/client/plugins/mutation.d.ts +0 -2
- package/build/runtime/client/plugins/optimisticKeys.d.ts +0 -7
- package/build/runtime/client/plugins/query.d.ts +0 -2
- package/build/runtime/client/plugins/subscription.d.ts +0 -20
- package/build/runtime/client/plugins/test.d.ts +0 -15
- package/build/runtime/client/plugins/throwOnError.d.ts +0 -8
- package/build/runtime/client/utils/documentPlugins.d.ts +0 -3
- package/build/runtime/client/utils/index.d.ts +0 -1
- package/build/runtime/generated.d.ts +0 -5
- package/build/runtime/imports/config.d.ts +0 -3
- package/build/runtime/imports/pluginConfig.d.ts +0 -3
- package/build/runtime/lib/config.d.ts +0 -216
- package/build/runtime/lib/deepEquals.d.ts +0 -1
- package/build/runtime/lib/flatten.d.ts +0 -2
- package/build/runtime/lib/index.d.ts +0 -10
- package/build/runtime/lib/key.d.ts +0 -6
- package/build/runtime/lib/log.d.ts +0 -6
- package/build/runtime/lib/lru.d.ts +0 -52
- package/build/runtime/lib/pageInfo.d.ts +0 -7
- package/build/runtime/lib/pagination.d.ts +0 -27
- package/build/runtime/lib/scalars.d.ts +0 -14
- package/build/runtime/lib/selection.d.ts +0 -2
- package/build/runtime/public/cache.d.ts +0 -42
- package/build/runtime/public/index.d.ts +0 -1
- package/build/runtime/public/list.d.ts +0 -18
- package/build/runtime/public/record.d.ts +0 -40
- package/build/runtime/public/tests/test.d.ts +0 -156
- package/build/runtime/public/types.d.ts +0 -62
- package/build/runtime/router/cookies.d.ts +0 -41
- package/build/runtime/router/jwt.d.ts +0 -117
- package/build/runtime/router/server.d.ts +0 -24
- package/build/runtime/router/types.d.ts +0 -26
- package/build/runtime/server/index.d.ts +0 -17
- package/build/runtime-cjs/cache/cache.d.ts +0 -169
- package/build/runtime-cjs/cache/cache.js +0 -1077
- package/build/runtime-cjs/cache/constants.d.ts +0 -1
- package/build/runtime-cjs/cache/constants.js +0 -28
- package/build/runtime-cjs/cache/gc.d.ts +0 -10
- package/build/runtime-cjs/cache/gc.js +0 -74
- package/build/runtime-cjs/cache/index.d.ts +0 -3
- package/build/runtime-cjs/cache/index.js +0 -25
- package/build/runtime-cjs/cache/lists.d.ts +0 -89
- package/build/runtime-cjs/cache/lists.js +0 -467
- package/build/runtime-cjs/cache/staleManager.d.ts +0 -31
- package/build/runtime-cjs/cache/staleManager.js +0 -123
- package/build/runtime-cjs/cache/storage.d.ts +0 -110
- package/build/runtime-cjs/cache/storage.js +0 -451
- package/build/runtime-cjs/cache/stuff.d.ts +0 -2
- package/build/runtime-cjs/cache/stuff.js +0 -56
- package/build/runtime-cjs/cache/subscription.d.ts +0 -52
- package/build/runtime-cjs/cache/subscription.js +0 -349
- package/build/runtime-cjs/client/documentStore.d.ts +0 -107
- package/build/runtime-cjs/client/documentStore.js +0 -487
- package/build/runtime-cjs/client/index.d.ts +0 -50
- package/build/runtime-cjs/client/index.js +0 -162
- package/build/runtime-cjs/client/plugins/cache.d.ts +0 -9
- package/build/runtime-cjs/client/plugins/cache.js +0 -138
- package/build/runtime-cjs/client/plugins/fetch.d.ts +0 -38
- package/build/runtime-cjs/client/plugins/fetch.js +0 -210
- package/build/runtime-cjs/client/plugins/fetchParams.d.ts +0 -9
- package/build/runtime-cjs/client/plugins/fetchParams.js +0 -47
- package/build/runtime-cjs/client/plugins/fragment.d.ts +0 -2
- package/build/runtime-cjs/client/plugins/fragment.js +0 -77
- package/build/runtime-cjs/client/plugins/index.d.ts +0 -9
- package/build/runtime-cjs/client/plugins/index.js +0 -45
- package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +0 -4
- package/build/runtime-cjs/client/plugins/injectedPlugins.js +0 -25
- package/build/runtime-cjs/client/plugins/mutation.d.ts +0 -2
- package/build/runtime-cjs/client/plugins/mutation.js +0 -89
- package/build/runtime-cjs/client/plugins/optimisticKeys.d.ts +0 -7
- package/build/runtime-cjs/client/plugins/optimisticKeys.js +0 -324
- package/build/runtime-cjs/client/plugins/query.d.ts +0 -2
- package/build/runtime-cjs/client/plugins/query.js +0 -93
- package/build/runtime-cjs/client/plugins/subscription.d.ts +0 -20
- package/build/runtime-cjs/client/plugins/subscription.js +0 -114
- package/build/runtime-cjs/client/plugins/test.d.ts +0 -15
- package/build/runtime-cjs/client/plugins/test.js +0 -118
- package/build/runtime-cjs/client/plugins/throwOnError.d.ts +0 -8
- package/build/runtime-cjs/client/plugins/throwOnError.js +0 -47
- package/build/runtime-cjs/client/utils/documentPlugins.d.ts +0 -3
- package/build/runtime-cjs/client/utils/documentPlugins.js +0 -57
- package/build/runtime-cjs/client/utils/index.d.ts +0 -1
- package/build/runtime-cjs/client/utils/index.js +0 -22
- package/build/runtime-cjs/generated.d.ts +0 -5
- package/build/runtime-cjs/generated.js +0 -16
- package/build/runtime-cjs/imports/config.d.ts +0 -3
- package/build/runtime-cjs/imports/config.js +0 -24
- package/build/runtime-cjs/imports/pluginConfig.d.ts +0 -3
- package/build/runtime-cjs/imports/pluginConfig.js +0 -25
- package/build/runtime-cjs/index.d.ts +0 -8
- package/build/runtime-cjs/index.js +0 -61
- package/build/runtime-cjs/lib/config.d.ts +0 -216
- package/build/runtime-cjs/lib/config.js +0 -110
- package/build/runtime-cjs/lib/constants.d.ts +0 -6
- package/build/runtime-cjs/lib/constants.js +0 -38
- package/build/runtime-cjs/lib/deepEquals.js +0 -52
- package/build/runtime-cjs/lib/flatten.js +0 -41
- package/build/runtime-cjs/lib/index.d.ts +0 -10
- package/build/runtime-cjs/lib/index.js +0 -40
- package/build/runtime-cjs/lib/key.js +0 -41
- package/build/runtime-cjs/lib/log.js +0 -72
- package/build/runtime-cjs/lib/lru.js +0 -73
- package/build/runtime-cjs/lib/pageInfo.js +0 -79
- package/build/runtime-cjs/lib/pagination.js +0 -240
- package/build/runtime-cjs/lib/scalars.js +0 -147
- package/build/runtime-cjs/lib/selection.js +0 -66
- package/build/runtime-cjs/lib/store.d.ts +0 -19
- package/build/runtime-cjs/lib/store.js +0 -81
- package/build/runtime-cjs/lib/types.d.ts +0 -417
- package/build/runtime-cjs/lib/types.js +0 -104
- package/build/runtime-cjs/package.json +0 -1
- package/build/runtime-cjs/public/cache.d.ts +0 -42
- package/build/runtime-cjs/public/cache.js +0 -98
- package/build/runtime-cjs/public/index.d.ts +0 -1
- package/build/runtime-cjs/public/index.js +0 -28
- package/build/runtime-cjs/public/list.d.ts +0 -18
- package/build/runtime-cjs/public/list.js +0 -151
- package/build/runtime-cjs/public/record.d.ts +0 -40
- package/build/runtime-cjs/public/record.js +0 -94
- package/build/runtime-cjs/public/tests/test.d.ts +0 -156
- package/build/runtime-cjs/public/tests/test.js +0 -60
- package/build/runtime-cjs/public/types.d.ts +0 -62
- package/build/runtime-cjs/public/types.js +0 -16
- package/build/runtime-cjs/router/cookies.js +0 -168
- package/build/runtime-cjs/router/jwt.js +0 -168
- package/build/runtime-cjs/router/match.d.ts +0 -39
- package/build/runtime-cjs/router/match.js +0 -158
- package/build/runtime-cjs/router/server.d.ts +0 -24
- package/build/runtime-cjs/router/server.js +0 -117
- package/build/runtime-cjs/router/session.d.ts +0 -22
- package/build/runtime-cjs/router/session.js +0 -100
- package/build/runtime-cjs/router/types.d.ts +0 -26
- package/build/runtime-cjs/router/types.js +0 -16
- package/build/runtime-cjs/server/index.d.ts +0 -17
- package/build/runtime-cjs/server/index.js +0 -62
- package/build/runtime-esm/cache/cache.d.ts +0 -169
- package/build/runtime-esm/cache/constants.d.ts +0 -1
- package/build/runtime-esm/cache/gc.d.ts +0 -10
- package/build/runtime-esm/cache/index.d.ts +0 -3
- package/build/runtime-esm/cache/index.js +0 -5
- package/build/runtime-esm/cache/lists.d.ts +0 -89
- package/build/runtime-esm/cache/staleManager.d.ts +0 -31
- package/build/runtime-esm/cache/storage.d.ts +0 -110
- package/build/runtime-esm/cache/stuff.d.ts +0 -2
- package/build/runtime-esm/cache/subscription.d.ts +0 -52
- package/build/runtime-esm/client/documentStore.d.ts +0 -107
- package/build/runtime-esm/client/index.d.ts +0 -50
- package/build/runtime-esm/client/index.js +0 -130
- package/build/runtime-esm/client/plugins/cache.d.ts +0 -9
- package/build/runtime-esm/client/plugins/cache.js +0 -104
- package/build/runtime-esm/client/plugins/fetch.d.ts +0 -38
- package/build/runtime-esm/client/plugins/fetch.js +0 -184
- package/build/runtime-esm/client/plugins/fetchParams.d.ts +0 -9
- package/build/runtime-esm/client/plugins/fetchParams.js +0 -23
- package/build/runtime-esm/client/plugins/fragment.d.ts +0 -2
- package/build/runtime-esm/client/plugins/fragment.js +0 -53
- package/build/runtime-esm/client/plugins/index.d.ts +0 -9
- package/build/runtime-esm/client/plugins/index.js +0 -12
- package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +0 -4
- package/build/runtime-esm/client/plugins/injectedPlugins.js +0 -5
- package/build/runtime-esm/client/plugins/mutation.d.ts +0 -2
- package/build/runtime-esm/client/plugins/mutation.js +0 -65
- package/build/runtime-esm/client/plugins/optimisticKeys.d.ts +0 -7
- package/build/runtime-esm/client/plugins/optimisticKeys.js +0 -290
- package/build/runtime-esm/client/plugins/query.d.ts +0 -2
- package/build/runtime-esm/client/plugins/query.js +0 -69
- package/build/runtime-esm/client/plugins/subscription.d.ts +0 -20
- package/build/runtime-esm/client/plugins/subscription.js +0 -90
- package/build/runtime-esm/client/plugins/test.d.ts +0 -15
- package/build/runtime-esm/client/plugins/test.js +0 -93
- package/build/runtime-esm/client/plugins/throwOnError.d.ts +0 -8
- package/build/runtime-esm/client/plugins/throwOnError.js +0 -23
- package/build/runtime-esm/client/utils/documentPlugins.d.ts +0 -3
- package/build/runtime-esm/client/utils/documentPlugins.js +0 -33
- package/build/runtime-esm/client/utils/index.d.ts +0 -1
- package/build/runtime-esm/client/utils/index.js +0 -1
- package/build/runtime-esm/generated.d.ts +0 -5
- package/build/runtime-esm/generated.js +0 -0
- package/build/runtime-esm/imports/config.d.ts +0 -3
- package/build/runtime-esm/imports/config.js +0 -4
- package/build/runtime-esm/imports/pluginConfig.d.ts +0 -3
- package/build/runtime-esm/imports/pluginConfig.js +0 -5
- package/build/runtime-esm/index.d.ts +0 -8
- package/build/runtime-esm/index.js +0 -22
- package/build/runtime-esm/lib/config.d.ts +0 -216
- package/build/runtime-esm/lib/config.js +0 -69
- package/build/runtime-esm/lib/constants.d.ts +0 -6
- package/build/runtime-esm/lib/deepEquals.d.ts +0 -1
- package/build/runtime-esm/lib/flatten.d.ts +0 -2
- package/build/runtime-esm/lib/index.d.ts +0 -10
- package/build/runtime-esm/lib/index.js +0 -10
- package/build/runtime-esm/lib/key.d.ts +0 -6
- package/build/runtime-esm/lib/log.d.ts +0 -6
- package/build/runtime-esm/lib/lru.d.ts +0 -52
- package/build/runtime-esm/lib/pageInfo.d.ts +0 -7
- package/build/runtime-esm/lib/pagination.d.ts +0 -27
- package/build/runtime-esm/lib/scalars.d.ts +0 -14
- package/build/runtime-esm/lib/selection.d.ts +0 -2
- package/build/runtime-esm/lib/store.d.ts +0 -19
- package/build/runtime-esm/lib/types.d.ts +0 -417
- package/build/runtime-esm/public/cache.d.ts +0 -42
- package/build/runtime-esm/public/cache.js +0 -74
- package/build/runtime-esm/public/index.d.ts +0 -1
- package/build/runtime-esm/public/index.js +0 -4
- package/build/runtime-esm/public/list.d.ts +0 -18
- package/build/runtime-esm/public/list.js +0 -127
- package/build/runtime-esm/public/record.d.ts +0 -40
- package/build/runtime-esm/public/record.js +0 -70
- package/build/runtime-esm/public/tests/test.d.ts +0 -156
- package/build/runtime-esm/public/tests/test.js +0 -36
- package/build/runtime-esm/public/types.d.ts +0 -62
- package/build/runtime-esm/router/cookies.d.ts +0 -41
- package/build/runtime-esm/router/jwt.d.ts +0 -117
- package/build/runtime-esm/router/match.d.ts +0 -39
- package/build/runtime-esm/router/match.js +0 -131
- package/build/runtime-esm/router/server.d.ts +0 -24
- package/build/runtime-esm/router/server.js +0 -92
- package/build/runtime-esm/router/session.d.ts +0 -22
- package/build/runtime-esm/router/session.js +0 -74
- package/build/runtime-esm/router/types.d.ts +0 -26
- package/build/runtime-esm/router/types.js +0 -0
- package/build/runtime-esm/server/index.d.ts +0 -17
- package/build/runtime-esm/server/index.js +0 -38
- package/build/test-cjs/index.js +0 -75249
- package/build/test-cjs/package.json +0 -1
- package/build/test-esm/index.js +0 -75244
- package/build/vite/imports.d.ts +0 -40
- package/build/vite-cjs/index.js +0 -86272
- package/build/vite-cjs/package.json +0 -1
- package/build/vite-esm/index.js +0 -86264
- /package/build/{adapter-esm → adapter}/package.json +0 -0
- /package/build/{cmd-esm → cmd}/package.json +0 -0
- /package/build/{vite → lib}/ast.d.ts +0 -0
- /package/build/{codegen-esm → lib}/package.json +0 -0
- /package/build/{lib-esm → node}/package.json +0 -0
- /package/build/{runtime-esm → oauth}/package.json +0 -0
- /package/build/{runtime-cjs/router → router}/cookies.d.ts +0 -0
- /package/build/{runtime-cjs/router → router}/jwt.d.ts +0 -0
- /package/build/{test-esm → router}/package.json +0 -0
- /package/build/{runtime-esm/public → router}/types.js +0 -0
- /package/build/{runtime-esm → runtime}/cache/constants.js +0 -0
- /package/build/{runtime-esm/lib → runtime}/constants.js +0 -0
- /package/build/{runtime-cjs/lib → runtime}/deepEquals.d.ts +0 -0
- /package/build/{runtime-esm/lib → runtime}/deepEquals.js +0 -0
- /package/build/{runtime-esm/lib → runtime}/flatten.js +0 -0
- /package/build/{runtime-cjs/lib → runtime}/log.d.ts +0 -0
- /package/build/{runtime-cjs/lib → runtime}/lru.d.ts +0 -0
- /package/build/{runtime-esm/lib → runtime}/lru.js +0 -0
- /package/build/{vite-esm → runtime}/package.json +0 -0
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { Logger } from "./logger.js";
|
|
4
|
+
import { default_config } from "./project.js";
|
|
5
|
+
import { LogLevel } from "./types.js";
|
|
6
|
+
const create_schema = `
|
|
7
|
+
CREATE TABLE IF NOT EXISTS plugins (
|
|
8
|
+
name TEXT NOT NULL PRIMARY KEY UNIQUE,
|
|
9
|
+
port INTEGER NOT NULL,
|
|
10
|
+
hooks JSON NOT NULL,
|
|
11
|
+
plugin_order TEXT CHECK (plugin_order IS NULL OR plugin_order IN ('before', 'after', 'core')),
|
|
12
|
+
include_runtime TEXT,
|
|
13
|
+
include_static_runtime TEXT,
|
|
14
|
+
config JSON,
|
|
15
|
+
config_module TEXT,
|
|
16
|
+
client_plugins JSON
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
-- Watch Schema Config
|
|
20
|
+
CREATE TABLE IF NOT EXISTS watch_schema_config (
|
|
21
|
+
url TEXT NOT NULL,
|
|
22
|
+
headers JSON,
|
|
23
|
+
interval INTEGER,
|
|
24
|
+
timeout INTEGER
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
-- Router Config
|
|
28
|
+
CREATE TABLE IF NOT EXISTS router_config (
|
|
29
|
+
api_endpoint TEXT,
|
|
30
|
+
redirect TEXT UNIQUE,
|
|
31
|
+
session_keys TEXT NOT NULL UNIQUE,
|
|
32
|
+
url TEXT,
|
|
33
|
+
mutation TEXT UNIQUE,
|
|
34
|
+
providers TEXT
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
-- Runtime Scalar Definition
|
|
38
|
+
CREATE TABLE IF NOT EXISTS runtime_scalar_definitions (
|
|
39
|
+
name TEXT NOT NULL PRIMARY KEY UNIQUE,
|
|
40
|
+
type TEXT NOT NULL
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
CREATE TABLE IF NOT EXISTS component_fields (
|
|
44
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
45
|
+
document INTEGER NOT NULL,
|
|
46
|
+
type TEXT,
|
|
47
|
+
prop TEXT,
|
|
48
|
+
field TEXT,
|
|
49
|
+
inline BOOLEAN default false,
|
|
50
|
+
type_field TEXT,
|
|
51
|
+
fragment TEXT,
|
|
52
|
+
UNIQUE (document),
|
|
53
|
+
FOREIGN KEY (document) REFERENCES raw_documents(id) ON DELETE CASCADE
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
-- Static Config (main config table)
|
|
57
|
+
CREATE TABLE IF NOT EXISTS config (
|
|
58
|
+
include JSON NOT NULL,
|
|
59
|
+
exclude JSON NOT NULL,
|
|
60
|
+
schema_path TEXT NOT NULL,
|
|
61
|
+
definitions_path TEXT,
|
|
62
|
+
cache_buffer_size INTEGER,
|
|
63
|
+
default_cache_policy TEXT,
|
|
64
|
+
default_partial BOOLEAN,
|
|
65
|
+
default_lifetime INTEGER,
|
|
66
|
+
default_list_position TEXT CHECK (default_list_position IN ('APPEND', 'PREPEND')),
|
|
67
|
+
default_list_target TEXT CHECK (default_list_target IN ('ALL', 'NULL')),
|
|
68
|
+
default_paginate_mode TEXT CHECK (default_paginate_mode IN ('Infinite', 'SinglePage')),
|
|
69
|
+
suppress_pagination_deduplication BOOLEAN,
|
|
70
|
+
log_level TEXT CHECK (log_level IN ('QUIET', 'FULL', 'SUMMARY', 'SHORT_SUMMARY')),
|
|
71
|
+
default_fragment_masking BOOLEAN,
|
|
72
|
+
default_keys JSON,
|
|
73
|
+
persisted_queries_path TEXT NOT NULL,
|
|
74
|
+
project_root TEXT,
|
|
75
|
+
runtime_dir TEXT,
|
|
76
|
+
path TEXT
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
CREATE TABLE IF NOT EXISTS scalar_config (
|
|
80
|
+
name TEXT NOT NULL PRIMARY KEY UNIQUE,
|
|
81
|
+
type TEXT NOT NULL,
|
|
82
|
+
input_types JSON,
|
|
83
|
+
module TEXT,
|
|
84
|
+
default_import BOOLEAN
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
-- Types configuration
|
|
88
|
+
CREATE TABLE IF NOT EXISTS type_configs (
|
|
89
|
+
name TEXT NOT NULL,
|
|
90
|
+
keys JSON NOT NULL,
|
|
91
|
+
resolve_query TEXT
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
-- A table of original document contents (to be populated by plugins)
|
|
95
|
+
CREATE TABLE IF NOT EXISTS raw_documents (
|
|
96
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
97
|
+
offset_line INTEGER,
|
|
98
|
+
offset_column INTEGER,
|
|
99
|
+
filepath TEXT NOT NULL,
|
|
100
|
+
content TEXT NOT NULL,
|
|
101
|
+
current_task TEXT,
|
|
102
|
+
loaded_with TEXT
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
-----------------------------------------------------------
|
|
106
|
+
-- Schema Definition Tables
|
|
107
|
+
-----------------------------------------------------------
|
|
108
|
+
|
|
109
|
+
CREATE TABLE IF NOT EXISTS types (
|
|
110
|
+
name TEXT NOT NULL PRIMARY KEY UNIQUE,
|
|
111
|
+
kind TEXT NOT NULL CHECK (kind IN ('OBJECT', 'INTERFACE', 'UNION', 'ENUM', 'SCALAR', 'INPUT')),
|
|
112
|
+
operation TEXT,
|
|
113
|
+
description TEXT,
|
|
114
|
+
internal BOOLEAN default false,
|
|
115
|
+
built_in BOOLEAN default false
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
CREATE TABLE IF NOT EXISTS type_fields (
|
|
119
|
+
id TEXT PRIMARY KEY, -- will be something like User.name so we don't have to look up the generated id
|
|
120
|
+
parent TEXT NOT NULL, -- will be User
|
|
121
|
+
name TEXT NOT NULL,
|
|
122
|
+
type TEXT NOT NULL,
|
|
123
|
+
type_modifiers TEXT,
|
|
124
|
+
default_value TEXT,
|
|
125
|
+
description TEXT,
|
|
126
|
+
internal BOOLEAN default false,
|
|
127
|
+
document INT,
|
|
128
|
+
|
|
129
|
+
FOREIGN KEY (document) REFERENCES raw_documents(id) ON DELETE CASCADE,
|
|
130
|
+
FOREIGN KEY (parent) REFERENCES types(name) ON DELETE CASCADE,
|
|
131
|
+
FOREIGN KEY (type) REFERENCES types(name) ON DELETE CASCADE,
|
|
132
|
+
UNIQUE (parent, name)
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
CREATE TABLE IF NOT EXISTS type_field_arguments (
|
|
136
|
+
id TEXT PRIMARY KEY,
|
|
137
|
+
field TEXT NOT NULL,
|
|
138
|
+
name TEXT NOT NULL,
|
|
139
|
+
type TEXT NOT NULL,
|
|
140
|
+
type_modifiers TEXT,
|
|
141
|
+
default_value TEXT,
|
|
142
|
+
FOREIGN KEY (field) REFERENCES type_fields(id) ON DELETE CASCADE,
|
|
143
|
+
UNIQUE (field, name)
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
CREATE TABLE IF NOT EXISTS enum_values (
|
|
148
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
149
|
+
parent TEXT NOT NULL,
|
|
150
|
+
value TEXT NOT NULL,
|
|
151
|
+
description TEXT,
|
|
152
|
+
FOREIGN KEY (parent) REFERENCES types(name) ON DELETE CASCADE,
|
|
153
|
+
UNIQUE (parent, value)
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
CREATE TABLE IF NOT EXISTS possible_types (
|
|
157
|
+
type TEXT NOT NULL,
|
|
158
|
+
member TEXT NOT NULL,
|
|
159
|
+
FOREIGN KEY (type) REFERENCES types(name) ON DELETE CASCADE,
|
|
160
|
+
FOREIGN KEY (member) REFERENCES types(name) ON DELETE CASCADE,
|
|
161
|
+
PRIMARY KEY (type, member)
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
CREATE TABLE IF NOT EXISTS directives (
|
|
165
|
+
name TEXT NOT NULL UNIQUE PRIMARY KEY,
|
|
166
|
+
internal BOOLEAN default false,
|
|
167
|
+
visible BOOLEAN default true,
|
|
168
|
+
repeatable BOOLEAN default false,
|
|
169
|
+
description TEXT
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
CREATE TABLE IF NOT EXISTS directive_arguments (
|
|
173
|
+
parent TEXT NOT NULL,
|
|
174
|
+
name TEXT NOT NULL,
|
|
175
|
+
type TEXT NOT NULL,
|
|
176
|
+
type_modifiers TEXT,
|
|
177
|
+
default_value TEXT,
|
|
178
|
+
FOREIGN KEY (parent) REFERENCES directives(name),
|
|
179
|
+
PRIMARY KEY (parent, name),
|
|
180
|
+
UNIQUE (parent, name)
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
CREATE TABLE IF NOT EXISTS directive_locations (
|
|
184
|
+
directive TEXT NOT NULL,
|
|
185
|
+
location TEXT NOT NULL CHECK (location IN ('QUERY', 'MUTATION', 'SUBSCRIPTION', 'FIELD', 'FRAGMENT_DEFINITION', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT', 'SCHEMA', 'SCALAR', 'OBJECT', 'FIELD_DEFINITION', 'ARGUMENT_DEFINITION', 'INTERFACE', 'UNION', 'ENUM', 'ENUM_VALUE', 'INPUT_OBJECT', 'INPUT_FIELD_DEFINITION')),
|
|
186
|
+
FOREIGN KEY (directive) REFERENCES directives(name),
|
|
187
|
+
PRIMARY KEY (directive, location)
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
CREATE TABLE IF NOT EXISTS document_variable_directives (
|
|
191
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
192
|
+
parent INTEGER NOT NULL,
|
|
193
|
+
directive TEXT NOT NULL,
|
|
194
|
+
row INTEGER NOT NULL,
|
|
195
|
+
column INTEGER NOT NULL,
|
|
196
|
+
FOREIGN KEY (parent) REFERENCES document_variables(id) ON DELETE CASCADE,
|
|
197
|
+
FOREIGN KEY (directive) REFERENCES directives(name) ON DELETE CASCADE
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
CREATE TABLE IF NOT EXISTS document_variable_directive_arguments (
|
|
201
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
202
|
+
parent INTEGER NOT NULL,
|
|
203
|
+
name TEXT NOT NULL,
|
|
204
|
+
value INTEGER NOT NULL,
|
|
205
|
+
|
|
206
|
+
FOREIGN KEY (value) REFERENCES argument_values(id) ON DELETE CASCADE,
|
|
207
|
+
FOREIGN KEY (parent) REFERENCES document_variable_directives(id) ON DELETE CASCADE
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
-----------------------------------------------------------
|
|
211
|
+
-- Document Tables
|
|
212
|
+
-----------------------------------------------------------
|
|
213
|
+
|
|
214
|
+
CREATE TABLE IF NOT EXISTS document_variables (
|
|
215
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
216
|
+
document TEXT NOT NULL,
|
|
217
|
+
name TEXT NOT NULL,
|
|
218
|
+
type TEXT NOT NULL,
|
|
219
|
+
type_modifiers TEXT,
|
|
220
|
+
default_value INT,
|
|
221
|
+
row INTEGER NOT NULL,
|
|
222
|
+
column INTEGER NOT NULL,
|
|
223
|
+
|
|
224
|
+
FOREIGN KEY (default_value) REFERENCES argument_values(id) ON DELETE CASCADE,
|
|
225
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE,
|
|
226
|
+
UNIQUE (document, name)
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
-- this is pulled out separately from operations and fragments so foreign keys can be used
|
|
230
|
+
CREATE TABLE IF NOT EXISTS documents (
|
|
231
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
232
|
+
name TEXT NOT NULL,
|
|
233
|
+
kind TEXT NOT NULL CHECK (kind IN ('query', 'mutation', 'subscription', 'fragment')),
|
|
234
|
+
raw_document INTEGER,
|
|
235
|
+
type_condition TEXT,
|
|
236
|
+
hash TEXT,
|
|
237
|
+
printed TEXT,
|
|
238
|
+
internal boolean default false,
|
|
239
|
+
visible boolean default true,
|
|
240
|
+
processed boolean default false,
|
|
241
|
+
FOREIGN KEY (type_condition) REFERENCES types(name) ON DELETE CASCADE,
|
|
242
|
+
FOREIGN KEY (raw_document) REFERENCES raw_documents(id) ON DELETE CASCADE
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
CREATE TABLE IF NOT EXISTS selections (
|
|
246
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
247
|
+
field_name TEXT NOT NULL,
|
|
248
|
+
kind TEXT NOT NULL CHECK (kind IN ('field', 'fragment', 'inline_fragment')),
|
|
249
|
+
alias TEXT,
|
|
250
|
+
type TEXT, -- should be something like User.Avatar
|
|
251
|
+
fragment_ref TEXT, -- used when fragment arguments cause a hash to be inlined (removing the ability to track what the original fragment is)
|
|
252
|
+
fragment_args JSON -- used to store the arguments that are used when fragment variables are expanded
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
CREATE TABLE IF NOT EXISTS selection_directives (
|
|
256
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
257
|
+
selection_id INTEGER NOT NULL,
|
|
258
|
+
directive TEXT NOT NULL,
|
|
259
|
+
row INTEGER NOT NULL,
|
|
260
|
+
column INTEGER NOT NULL,
|
|
261
|
+
FOREIGN KEY (selection_id) REFERENCES selections(id) ON DELETE CASCADE,
|
|
262
|
+
FOREIGN KEY (directive) REFERENCES directives(name) ON DELETE CASCADE
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
CREATE TABLE IF NOT EXISTS selection_directive_arguments (
|
|
266
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
267
|
+
parent INTEGER NOT NULL,
|
|
268
|
+
name TEXT NOT NULL,
|
|
269
|
+
value INTEGER NOT NULL,
|
|
270
|
+
document INTEGER NOT NULL,
|
|
271
|
+
|
|
272
|
+
FOREIGN KEY (value) REFERENCES argument_values(id) ON DELETE CASCADE,
|
|
273
|
+
FOREIGN KEY (parent) REFERENCES selection_directives(id) ON DELETE CASCADE,
|
|
274
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
CREATE TABLE IF NOT EXISTS document_directives (
|
|
278
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
279
|
+
document int NOT NULL,
|
|
280
|
+
directive TEXT NOT NULL,
|
|
281
|
+
row INTEGER NOT NULL,
|
|
282
|
+
column INTEGER NOT NULL,
|
|
283
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE,
|
|
284
|
+
FOREIGN KEY (directive) REFERENCES directives(name) ON DELETE CASCADE
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
CREATE TABLE IF NOT EXISTS document_directive_arguments (
|
|
288
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
289
|
+
parent INTEGER NOT NULL,
|
|
290
|
+
name TEXT NOT NULL,
|
|
291
|
+
value INTEGER NOT NULL,
|
|
292
|
+
|
|
293
|
+
FOREIGN KEY (value) REFERENCES argument_values(id) ON DELETE CASCADE,
|
|
294
|
+
FOREIGN KEY (parent) REFERENCES document_directives(id) ON DELETE CASCADE
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
CREATE TABLE IF NOT EXISTS selection_refs (
|
|
298
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
299
|
+
parent_id INTEGER,
|
|
300
|
+
child_id INTEGER NOT NULL,
|
|
301
|
+
path_index INTEGER NOT NULL,
|
|
302
|
+
document INTEGER NOT NULL,
|
|
303
|
+
row INTEGER NOT NULL,
|
|
304
|
+
column INTEGER NOT NULL,
|
|
305
|
+
internal BOOLEAN NOT NULL DEFAULT false,
|
|
306
|
+
FOREIGN KEY (parent_id) REFERENCES selections(id) ON DELETE CASCADE,
|
|
307
|
+
FOREIGN KEY (child_id) REFERENCES selections(id) ON DELETE CASCADE,
|
|
308
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
CREATE TABLE IF NOT EXISTS selection_arguments (
|
|
312
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
313
|
+
selection_id INTEGER NOT NULL,
|
|
314
|
+
document INTEGER NOT NULL,
|
|
315
|
+
name TEXT NOT NULL,
|
|
316
|
+
value INTEGER NOT NULL,
|
|
317
|
+
row INTEGER NOT NULL,
|
|
318
|
+
column INTEGER NOT NULL,
|
|
319
|
+
field_argument TEXT NOT NULL,
|
|
320
|
+
|
|
321
|
+
FOREIGN KEY (value) REFERENCES argument_values(id) ON DELETE CASCADE,
|
|
322
|
+
FOREIGN KEY (selection_id) REFERENCES selections(id) ON DELETE CASCADE,
|
|
323
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
CREATE TABLE IF NOT EXISTS argument_values (
|
|
328
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
329
|
+
kind TEXT NOT NULL CHECK (kind IN ('Variable', 'Int', 'Float', 'String', 'Block', 'Boolean', 'Null', 'Enum', 'List', 'Object')),
|
|
330
|
+
raw TEXT NOT NULL,
|
|
331
|
+
row INTEGER NOT NULL,
|
|
332
|
+
column INTEGER NOT NULL,
|
|
333
|
+
expected_type TEXT NOT NULL,
|
|
334
|
+
expected_type_modifiers TEXT,
|
|
335
|
+
document INTEGER NOT NULL,
|
|
336
|
+
|
|
337
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
CREATE TABLE IF NOT EXISTS argument_value_children (
|
|
341
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
342
|
+
name TEXT,
|
|
343
|
+
parent INTEGER NOT NULL,
|
|
344
|
+
value INTEGER NOT NULL,
|
|
345
|
+
row INTEGER NOT NULL,
|
|
346
|
+
column INTEGER NOT NULL,
|
|
347
|
+
document INTEGER NOT NULL,
|
|
348
|
+
|
|
349
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE,
|
|
350
|
+
FOREIGN KEY (parent) REFERENCES argument_values(id) ON DELETE CASCADE,
|
|
351
|
+
FOREIGN KEY (value) REFERENCES argument_values(id) ON DELETE CASCADE
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
CREATE TABLE IF NOT EXISTS discovered_lists (
|
|
355
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
356
|
+
name TEXT,
|
|
357
|
+
node_type TEXT NOT NULL,
|
|
358
|
+
edge_type TEXT,
|
|
359
|
+
connection_type TEXT NOT NULL,
|
|
360
|
+
node INTEGER NOT NULL,
|
|
361
|
+
page_size INTEGER NOT NULL,
|
|
362
|
+
document INTEGER NOT NULL,
|
|
363
|
+
mode TEXT NOT NULL,
|
|
364
|
+
embedded BOOLEAN NOT NULL,
|
|
365
|
+
target_type TEXT NOT NULL,
|
|
366
|
+
connection BOOLEAN default false,
|
|
367
|
+
list_field INTEGER NOT NULL,
|
|
368
|
+
paginate TEXT,
|
|
369
|
+
supports_forward BOOLEAN default false,
|
|
370
|
+
supports_backward BOOLEAN default false,
|
|
371
|
+
cursor_type TEXT,
|
|
372
|
+
|
|
373
|
+
FOREIGN KEY (list_field) REFERENCES selections(id) ON DELETE CASCADE,
|
|
374
|
+
FOREIGN KEY (node) REFERENCES selections(id) ON DELETE CASCADE,
|
|
375
|
+
FOREIGN KEY (node_type) REFERENCES types(name) ON DELETE CASCADE,
|
|
376
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
-- refetch_meta carries the "refetch" artifact-block metadata for documents that are
|
|
380
|
+
-- refetchable but are NOT lists (e.g. @refetchable fragments). Lists keep their refetch
|
|
381
|
+
-- metadata on discovered_lists since it is intrinsic to pagination; this table is for the
|
|
382
|
+
-- list-less case so we don't have to fake a discovered_lists row.
|
|
383
|
+
CREATE TABLE IF NOT EXISTS refetch_meta (
|
|
384
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
385
|
+
document INTEGER NOT NULL,
|
|
386
|
+
selection INTEGER NOT NULL,
|
|
387
|
+
target_type TEXT NOT NULL,
|
|
388
|
+
method TEXT NOT NULL DEFAULT 'offset',
|
|
389
|
+
mode TEXT NOT NULL DEFAULT 'Infinite',
|
|
390
|
+
page_size INTEGER NOT NULL DEFAULT 0,
|
|
391
|
+
embedded BOOLEAN NOT NULL DEFAULT false,
|
|
392
|
+
|
|
393
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE,
|
|
394
|
+
FOREIGN KEY (selection) REFERENCES selections(id) ON DELETE CASCADE
|
|
395
|
+
);
|
|
396
|
+
|
|
397
|
+
CREATE TABLE IF NOT EXISTS document_dependencies (
|
|
398
|
+
document INTEGER NOT NULL,
|
|
399
|
+
depends_on TEXT NOT NULL,
|
|
400
|
+
|
|
401
|
+
FOREIGN KEY (document) REFERENCES documents(id) ON DELETE CASCADE,
|
|
402
|
+
UNIQUE (document, depends_on)
|
|
403
|
+
);
|
|
404
|
+
|
|
405
|
+
-----------------------------------------------------------
|
|
406
|
+
-- Indices
|
|
407
|
+
-----------------------------------------------------------
|
|
408
|
+
|
|
409
|
+
-- component_fields
|
|
410
|
+
CREATE INDEX IF NOT EXISTS idx_component_fields_type_fields ON component_fields(type_field);
|
|
411
|
+
|
|
412
|
+
-- discovered_lists
|
|
413
|
+
CREATE INDEX IF NOT EXISTS idx_discovered_lists_document ON discovered_lists(document);
|
|
414
|
+
CREATE INDEX IF NOT EXISTS idx_discovered_lists_node ON discovered_lists(node);
|
|
415
|
+
CREATE INDEX IF NOT EXISTS idx_discovered_lists_list_field ON discovered_lists(list_field);
|
|
416
|
+
-- note: no index on discovered_lists(connection) \u2014 boolean column, ~2 distinct values
|
|
417
|
+
|
|
418
|
+
-- refetch_meta
|
|
419
|
+
CREATE INDEX IF NOT EXISTS idx_refetch_meta_selection ON refetch_meta(selection);
|
|
420
|
+
CREATE INDEX IF NOT EXISTS idx_refetch_meta_document ON refetch_meta(document);
|
|
421
|
+
|
|
422
|
+
-- types
|
|
423
|
+
CREATE INDEX IF NOT EXISTS idx_types_kind_operation ON types(kind, operation);
|
|
424
|
+
-- note: no index on types(name) \u2014 covered by PRIMARY KEY UNIQUE
|
|
425
|
+
|
|
426
|
+
-- documents
|
|
427
|
+
CREATE INDEX IF NOT EXISTS idx_documents_kind ON documents(kind);
|
|
428
|
+
CREATE INDEX IF NOT EXISTS idx_documents_type_condition ON documents(type_condition);
|
|
429
|
+
CREATE INDEX IF NOT EXISTS idx_documents_raw_document ON documents(raw_document);
|
|
430
|
+
CREATE INDEX IF NOT EXISTS idx_documents_name_kind ON documents(name, kind);
|
|
431
|
+
|
|
432
|
+
-- raw_documents
|
|
433
|
+
CREATE INDEX IF NOT EXISTS idx_raw_documents_current_task ON raw_documents(current_task);
|
|
434
|
+
CREATE INDEX IF NOT EXISTS idx_raw_documents_filepath ON raw_documents(filepath);
|
|
435
|
+
|
|
436
|
+
-- selections
|
|
437
|
+
CREATE INDEX IF NOT EXISTS idx_selections_type ON selections(type);
|
|
438
|
+
CREATE INDEX IF NOT EXISTS idx_selections_alias ON selections(alias);
|
|
439
|
+
CREATE INDEX IF NOT EXISTS idx_selections_field_name_kind ON selections(field_name, kind);
|
|
440
|
+
|
|
441
|
+
-- selection_refs: composite covers document-only lookups, so no separate single-column index needed
|
|
442
|
+
CREATE INDEX IF NOT EXISTS idx_selection_refs_parent_id ON selection_refs(parent_id);
|
|
443
|
+
|
|
444
|
+
CREATE INDEX IF NOT EXISTS idx_selection_refs_child_id ON selection_refs(child_id);
|
|
445
|
+
CREATE INDEX IF NOT EXISTS idx_selection_refs_document_parent_id ON selection_refs(document, parent_id);
|
|
446
|
+
|
|
447
|
+
-- selection_directives / selection_directive_arguments / selection_arguments
|
|
448
|
+
CREATE INDEX IF NOT EXISTS idx_selection_directives_selection ON selection_directives(selection_id);
|
|
449
|
+
CREATE INDEX IF NOT EXISTS idx_selection_directives_directive ON selection_directives(directive);
|
|
450
|
+
CREATE INDEX IF NOT EXISTS idx_selection_directive_arguments_parent_name ON selection_directive_arguments(parent, name);
|
|
451
|
+
-- note: no index on selection_directive_arguments(parent) alone \u2014 covered by (parent,name) composite
|
|
452
|
+
CREATE INDEX IF NOT EXISTS idx_selection_directive_arguments_value ON selection_directive_arguments(value);
|
|
453
|
+
-- document FK on selection_directive_arguments and selection_arguments: used in WHERE/JOIN in CollectDocuments
|
|
454
|
+
CREATE INDEX IF NOT EXISTS idx_selection_directive_arguments_document ON selection_directive_arguments(document);
|
|
455
|
+
CREATE INDEX IF NOT EXISTS idx_selection_arguments_document ON selection_arguments(document);
|
|
456
|
+
CREATE INDEX IF NOT EXISTS idx_selection_arguments_selection ON selection_arguments(selection_id);
|
|
457
|
+
CREATE INDEX IF NOT EXISTS idx_selection_arguments_value ON selection_arguments(value);
|
|
458
|
+
|
|
459
|
+
-- type_fields / type_field_arguments
|
|
460
|
+
-- note: no index on type_fields(id) or type_field_arguments(id) \u2014 covered by their TEXT PRIMARY KEYs
|
|
461
|
+
CREATE INDEX IF NOT EXISTS idx_type_fields_parent ON type_fields(parent);
|
|
462
|
+
CREATE INDEX IF NOT EXISTS idx_type_fields_name ON type_fields(name);
|
|
463
|
+
CREATE INDEX IF NOT EXISTS idx_type_configs_name ON type_configs(name);
|
|
464
|
+
|
|
465
|
+
-- possible_types
|
|
466
|
+
-- note: no index on possible_types(type) \u2014 covered by PRIMARY KEY(type,member) leading column
|
|
467
|
+
CREATE INDEX IF NOT EXISTS idx_possible_types_member ON possible_types(member);
|
|
468
|
+
|
|
469
|
+
-- type_fields: type and document FK columns have no implicit index
|
|
470
|
+
CREATE INDEX IF NOT EXISTS idx_type_fields_type ON type_fields(type);
|
|
471
|
+
CREATE INDEX IF NOT EXISTS idx_type_fields_document ON type_fields(document);
|
|
472
|
+
|
|
473
|
+
-- enum_values
|
|
474
|
+
-- note: no index on enum_values(parent) or (parent,value) \u2014 both covered by UNIQUE(parent,value)
|
|
475
|
+
|
|
476
|
+
-- document_directives / document_directive_arguments
|
|
477
|
+
CREATE INDEX IF NOT EXISTS idx_document_directives_document ON document_directives(document);
|
|
478
|
+
CREATE INDEX IF NOT EXISTS idx_document_directives_directive ON document_directives(directive);
|
|
479
|
+
CREATE INDEX IF NOT EXISTS idx_document_directive_arguments_parent_name ON document_directive_arguments(parent, name);
|
|
480
|
+
-- note: no index on document_directive_arguments(parent) alone \u2014 covered by (parent,name) composite
|
|
481
|
+
CREATE INDEX IF NOT EXISTS idx_document_directive_arguments_value on document_directive_arguments(value);
|
|
482
|
+
|
|
483
|
+
-- document_variables
|
|
484
|
+
-- note: no index on document_variables(document,name) \u2014 covered by UNIQUE(document,name)
|
|
485
|
+
-- default_value FK is used as a JOIN column in validate and fragmentArguments transforms
|
|
486
|
+
CREATE INDEX IF NOT EXISTS idx_document_variables_default_value ON document_variables(default_value);
|
|
487
|
+
CREATE INDEX IF NOT EXISTS idx_document_variables_document_id ON document_variables(document, id);
|
|
488
|
+
CREATE INDEX IF NOT EXISTS idx_document_variables_document_type_modifiers_default ON document_variables(document, type_modifiers, default_value);
|
|
489
|
+
|
|
490
|
+
-- document_variable_directives / document_variable_directive_arguments
|
|
491
|
+
CREATE INDEX IF NOT EXISTS idx_document_variable_directives_parent ON document_variable_directives(parent);
|
|
492
|
+
CREATE INDEX IF NOT EXISTS idx_document_variable_directives_directive ON document_variable_directives(directive);
|
|
493
|
+
CREATE INDEX IF NOT EXISTS idx_document_variable_directive_arguments_parent ON document_variable_directive_arguments(parent);
|
|
494
|
+
|
|
495
|
+
-- document_dependencies
|
|
496
|
+
-- note: no index on document_dependencies(document) \u2014 covered by UNIQUE(document,depends_on) leading column
|
|
497
|
+
CREATE INDEX IF NOT EXISTS idx_document_dependency_depends_on on document_dependencies(depends_on);
|
|
498
|
+
|
|
499
|
+
-- argument_values: composite (document,id) covers document-only lookups
|
|
500
|
+
-- note: no separate index on argument_values(document) alone
|
|
501
|
+
CREATE INDEX IF NOT EXISTS idx_argument_values_kind_raw ON argument_values(kind, raw);
|
|
502
|
+
CREATE INDEX IF NOT EXISTS idx_argument_values_document_id ON argument_values(document, id);
|
|
503
|
+
CREATE INDEX IF NOT EXISTS idx_argument_values_expected_type_document ON argument_values(expected_type, document);
|
|
504
|
+
|
|
505
|
+
-- argument_value_children: composite (parent,value) covers parent-only lookups
|
|
506
|
+
-- note: no separate index on argument_value_children(parent) alone
|
|
507
|
+
CREATE INDEX IF NOT EXISTS idx_argument_value_children_parent_value ON argument_value_children(parent, value);
|
|
508
|
+
CREATE INDEX IF NOT EXISTS idx_argument_value_children_value ON argument_value_children(value);
|
|
509
|
+
-- document FK: large table; index needed for efficient CASCADE DELETE from documents
|
|
510
|
+
CREATE INDEX IF NOT EXISTS idx_argument_value_children_document ON argument_value_children(document);
|
|
511
|
+
`;
|
|
512
|
+
const schema_version = parseInt(createHash("sha1").update(create_schema).digest("hex").slice(0, 8), 16) & 2147483647;
|
|
513
|
+
async function write_config(db, config, invoke_hook, plugins, mode, logger = new Logger(LogLevel.Summary)) {
|
|
514
|
+
const env = {};
|
|
515
|
+
logger.time("Environment");
|
|
516
|
+
await Promise.all(
|
|
517
|
+
plugins.map(async (plugin) => {
|
|
518
|
+
if (plugin.hooks.has("Environment")) {
|
|
519
|
+
Object.assign(env, await invoke_hook(plugin.name, "environment", { mode }));
|
|
520
|
+
}
|
|
521
|
+
})
|
|
522
|
+
);
|
|
523
|
+
logger.timeEnd("Environment", LogLevel.Summary);
|
|
524
|
+
const config_file = {
|
|
525
|
+
...default_config,
|
|
526
|
+
...config.config_file
|
|
527
|
+
};
|
|
528
|
+
db.run("DELETE FROM config");
|
|
529
|
+
db.run("DELETE FROM router_config");
|
|
530
|
+
db.run("DELETE FROM watch_schema_config");
|
|
531
|
+
db.run("DELETE FROM scalar_config");
|
|
532
|
+
db.run("DELETE FROM type_configs");
|
|
533
|
+
db.run(
|
|
534
|
+
`INSERT INTO config (
|
|
535
|
+
include, exclude, schema_path, definitions_path, cache_buffer_size,
|
|
536
|
+
default_cache_policy, default_partial, default_lifetime,
|
|
537
|
+
default_list_position, default_list_target, default_paginate_mode,
|
|
538
|
+
suppress_pagination_deduplication, log_level, default_fragment_masking,
|
|
539
|
+
default_keys, persisted_queries_path, project_root, runtime_dir, path
|
|
540
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
541
|
+
[
|
|
542
|
+
JSON.stringify(config.include),
|
|
543
|
+
JSON.stringify(config.exclude),
|
|
544
|
+
config_file.schemaPath,
|
|
545
|
+
config_file.definitionsPath ?? "",
|
|
546
|
+
config_file.cacheBufferSize ?? null,
|
|
547
|
+
config_file.defaultCachePolicy ?? null,
|
|
548
|
+
config_file.defaultPartial ? 1 : 0,
|
|
549
|
+
config_file.defaultLifetime ?? null,
|
|
550
|
+
config_file.defaultListPosition ?? null,
|
|
551
|
+
config_file.defaultListTarget ?? null,
|
|
552
|
+
config_file.defaultPaginateMode ?? "Infinite",
|
|
553
|
+
config_file.supressPaginationDeduplication ? 1 : 0,
|
|
554
|
+
config_file.logLevel?.toUpperCase().replace(/-/g, "_") ?? null,
|
|
555
|
+
config_file.defaultFragmentMasking === "enable" ? 1 : 0,
|
|
556
|
+
JSON.stringify(config_file.defaultKeys ?? []),
|
|
557
|
+
config_file.persistedQueriesPath ?? path.join(config_file.runtimeDir, "queries.json"),
|
|
558
|
+
config.root_dir ?? null,
|
|
559
|
+
config_file.runtimeDir ?? null,
|
|
560
|
+
config.filepath ?? null
|
|
561
|
+
]
|
|
562
|
+
);
|
|
563
|
+
for (const [name, { type }] of Object.entries(config.config_file.runtimeScalars ?? {})) {
|
|
564
|
+
db.run("INSERT INTO runtime_scalar_definitions (name, type) VALUES (?, ?)", [name, type]);
|
|
565
|
+
}
|
|
566
|
+
{
|
|
567
|
+
const auth = config.server_config.auth;
|
|
568
|
+
db.run(
|
|
569
|
+
`INSERT INTO router_config (api_endpoint, redirect, session_keys, url, mutation, providers)
|
|
570
|
+
VALUES (?, ?, ?, ?, ?, ?)`,
|
|
571
|
+
[
|
|
572
|
+
config.server_config.endpoint ?? null,
|
|
573
|
+
// the trusted redirect-login integration url (enables /login + the loginURL helper)
|
|
574
|
+
auth?.redirect?.url ?? null,
|
|
575
|
+
auth?.sessionKeys?.join(",") ?? "",
|
|
576
|
+
auth?.url ?? null,
|
|
577
|
+
null,
|
|
578
|
+
// the configured first-class OAuth provider names — codegen bakes these into the
|
|
579
|
+
// typed `provider` argument of loginURL, and /login gates on them too
|
|
580
|
+
auth?.providers ? Object.keys(auth.providers).join(",") : null
|
|
581
|
+
]
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
if (config.config_file.watchSchema) {
|
|
585
|
+
const configuredUrl = config.config_file.watchSchema.url ?? config.config_file.url;
|
|
586
|
+
const url = typeof configuredUrl === "function" ? configuredUrl(env) : configuredUrl ?? "";
|
|
587
|
+
const headers = !config.config_file.watchSchema.headers ? {} : typeof config.config_file.watchSchema.headers === "function" ? typeof config.config_file.watchSchema.headers(env) : typeof config.config_file.watchSchema.headers;
|
|
588
|
+
db.run(
|
|
589
|
+
`INSERT INTO watch_schema_config (url, headers, interval, timeout) VALUES (?, ?, ?, ?)`,
|
|
590
|
+
[
|
|
591
|
+
url,
|
|
592
|
+
JSON.stringify(headers),
|
|
593
|
+
config.config_file.watchSchema.interval ?? null,
|
|
594
|
+
config.config_file.watchSchema.timeout ?? null
|
|
595
|
+
]
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
for (const [name, { type, inputTypes, module, default: isDefault }] of Object.entries(
|
|
599
|
+
config.config_file.scalars ?? {}
|
|
600
|
+
)) {
|
|
601
|
+
db.run(
|
|
602
|
+
"INSERT INTO scalar_config (name, type, input_types, module, default_import) VALUES (?, ?, ?, ?, ?)",
|
|
603
|
+
[
|
|
604
|
+
name,
|
|
605
|
+
type,
|
|
606
|
+
JSON.stringify((inputTypes ?? []).concat(name)),
|
|
607
|
+
module ?? null,
|
|
608
|
+
isDefault ? 1 : null
|
|
609
|
+
]
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
for (const [name, { keys, resolve }] of Object.entries(config.config_file.types ?? {})) {
|
|
613
|
+
db.run("INSERT INTO type_configs (name, keys, resolve_query) VALUES (?, ?, ?)", [
|
|
614
|
+
name,
|
|
615
|
+
JSON.stringify(keys || config_file.defaultKeys || []),
|
|
616
|
+
resolve?.queryField || null
|
|
617
|
+
]);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
export {
|
|
621
|
+
create_schema,
|
|
622
|
+
schema_version,
|
|
623
|
+
write_config
|
|
624
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Params = Record<string, any> | any[];
|
|
2
|
+
export interface Db {
|
|
3
|
+
readonly filepath: string;
|
|
4
|
+
exec(sql: string): void;
|
|
5
|
+
run(sql: string, params?: Params): void;
|
|
6
|
+
get<T extends Record<string, any> = Record<string, any>>(sql: string, params?: Params): T | undefined;
|
|
7
|
+
all<T extends Record<string, any> = Record<string, any>>(sql: string, params?: Params): T[];
|
|
8
|
+
rowsModified(): number;
|
|
9
|
+
flush(): void;
|
|
10
|
+
reload(): void;
|
|
11
|
+
close(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function openDb(filepath: string): Promise<Db>;
|