houdini 2.0.0-next.8 → 2.0.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/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 +617 -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 +1 -2
- package/build/lib/parse.js +32 -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} +102 -101
- package/build/{runtime-esm/lib → runtime}/types.js +9 -14
- 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 +431 -0
- package/build/vite/houdini.d.ts +4 -10
- package/build/vite/houdini.js +134 -0
- package/build/vite/index.d.ts +13 -7
- package/build/vite/index.js +104 -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 -89304
- package/build/cmd-cjs/package.json +0 -1
- package/build/cmd-esm/index.js +0 -89308
- 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 -74661
- package/build/codegen-cjs/package.json +0 -1
- package/build/codegen-esm/index.js +0 -74660
- 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 -79736
- package/build/lib-cjs/package.json +0 -1
- package/build/lib-esm/index.js +0 -79645
- 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 -43
- 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-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 -43
- package/build/runtime-cjs/public/cache.js +0 -112
- 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 -112
- package/build/runtime-cjs/router/session.d.ts +0 -22
- package/build/runtime-cjs/router/session.js +0 -97
- package/build/runtime-cjs/router/types.d.ts +0 -26
- package/build/runtime-cjs/router/types.js +0 -16
- 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 -43
- package/build/runtime-esm/public/cache.js +0 -88
- 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 -87
- package/build/runtime-esm/router/session.d.ts +0 -22
- package/build/runtime-esm/router/session.js +0 -71
- package/build/runtime-esm/router/types.d.ts +0 -26
- package/build/runtime-esm/router/types.js +0 -0
- package/build/test-cjs/index.js +0 -75254
- package/build/test-cjs/package.json +0 -1
- package/build/test-esm/index.js +0 -75249
- package/build/vite/imports.d.ts +0 -40
- package/build/vite-cjs/index.js +0 -86271
- package/build/vite-cjs/package.json +0 -1
- package/build/vite-esm/index.js +0 -86263
- /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
package/build/lib/db.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import initSqlJs from "sql.js";
|
|
4
|
+
class SqlJsDb {
|
|
5
|
+
_db;
|
|
6
|
+
_SQL;
|
|
7
|
+
filepath;
|
|
8
|
+
_lastRowsModified = 0;
|
|
9
|
+
constructor(db, SQL, filepath) {
|
|
10
|
+
this._db = db;
|
|
11
|
+
this._SQL = SQL;
|
|
12
|
+
this.filepath = filepath;
|
|
13
|
+
}
|
|
14
|
+
exec(sql) {
|
|
15
|
+
this._db.exec(sql);
|
|
16
|
+
}
|
|
17
|
+
run(sql, params) {
|
|
18
|
+
this._db.run(sql, params);
|
|
19
|
+
this._lastRowsModified = this._db.getRowsModified();
|
|
20
|
+
}
|
|
21
|
+
get(sql, params) {
|
|
22
|
+
const stmt = this._db.prepare(sql);
|
|
23
|
+
if (params !== void 0) stmt.bind(params);
|
|
24
|
+
const row = stmt.step() ? stmt.getAsObject() : void 0;
|
|
25
|
+
stmt.free();
|
|
26
|
+
return row;
|
|
27
|
+
}
|
|
28
|
+
all(sql, params) {
|
|
29
|
+
const stmt = this._db.prepare(sql);
|
|
30
|
+
if (params !== void 0) stmt.bind(params);
|
|
31
|
+
const rows = [];
|
|
32
|
+
while (stmt.step()) rows.push(stmt.getAsObject());
|
|
33
|
+
stmt.free();
|
|
34
|
+
return rows;
|
|
35
|
+
}
|
|
36
|
+
rowsModified() {
|
|
37
|
+
return this._lastRowsModified;
|
|
38
|
+
}
|
|
39
|
+
flush() {
|
|
40
|
+
if (!this.filepath || this.filepath === ":memory:") return;
|
|
41
|
+
const data = this._db.export();
|
|
42
|
+
mkdirSync(dirname(this.filepath), { recursive: true });
|
|
43
|
+
writeFileSync(this.filepath, Buffer.from(data));
|
|
44
|
+
}
|
|
45
|
+
reload() {
|
|
46
|
+
if (!this.filepath || this.filepath === ":memory:") return;
|
|
47
|
+
this._db.close();
|
|
48
|
+
this._db = existsSync(this.filepath) ? new this._SQL.Database(new Uint8Array(readFileSync(this.filepath))) : new this._SQL.Database();
|
|
49
|
+
this._db.run("PRAGMA journal_mode = DELETE");
|
|
50
|
+
this._db.run("PRAGMA foreign_keys = ON");
|
|
51
|
+
this._db.run("PRAGMA defer_foreign_keys = ON");
|
|
52
|
+
}
|
|
53
|
+
close() {
|
|
54
|
+
this._db.close();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
class NativeDb {
|
|
58
|
+
_conn;
|
|
59
|
+
_lastChanges = 0;
|
|
60
|
+
filepath;
|
|
61
|
+
constructor(conn, filepath) {
|
|
62
|
+
this._conn = conn;
|
|
63
|
+
this.filepath = filepath;
|
|
64
|
+
}
|
|
65
|
+
exec(sql) {
|
|
66
|
+
this._conn.exec(sql);
|
|
67
|
+
}
|
|
68
|
+
run(sql, params) {
|
|
69
|
+
const stmt = this._conn.prepare(sql);
|
|
70
|
+
const result = params === void 0 ? stmt.run() : Array.isArray(params) ? stmt.run(...params) : stmt.run(this._norm(params));
|
|
71
|
+
this._lastChanges = result?.changes ?? 0;
|
|
72
|
+
}
|
|
73
|
+
get(sql, params) {
|
|
74
|
+
const stmt = this._conn.prepare(sql);
|
|
75
|
+
return params === void 0 ? stmt.get() : Array.isArray(params) ? stmt.get(...params) : stmt.get(this._norm(params));
|
|
76
|
+
}
|
|
77
|
+
all(sql, params) {
|
|
78
|
+
const stmt = this._conn.prepare(sql);
|
|
79
|
+
return params === void 0 ? stmt.all() : Array.isArray(params) ? stmt.all(...params) : stmt.all(this._norm(params));
|
|
80
|
+
}
|
|
81
|
+
rowsModified() {
|
|
82
|
+
return this._lastChanges;
|
|
83
|
+
}
|
|
84
|
+
// WAL-mode file connection is always current — no need to flush or reload.
|
|
85
|
+
flush() {
|
|
86
|
+
}
|
|
87
|
+
reload() {
|
|
88
|
+
}
|
|
89
|
+
close() {
|
|
90
|
+
this._conn.close();
|
|
91
|
+
}
|
|
92
|
+
// node:sqlite and bun:sqlite expect named params without the leading $ prefix,
|
|
93
|
+
// e.g. { name: val } for SQL $name. Strip it so callers can use { $name: val }
|
|
94
|
+
// consistently across both sql.js and native backends.
|
|
95
|
+
_norm(params) {
|
|
96
|
+
if (Array.isArray(params)) return params;
|
|
97
|
+
const out = {};
|
|
98
|
+
for (const [k, v] of Object.entries(params)) {
|
|
99
|
+
out[k.startsWith("$") ? k.slice(1) : k] = v;
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function openDb(filepath) {
|
|
105
|
+
if (process.env.HOUDINI_PLATFORM === "wasm") {
|
|
106
|
+
const SQL = await initSqlJs();
|
|
107
|
+
let db;
|
|
108
|
+
if (filepath !== ":memory:" && existsSync(filepath)) {
|
|
109
|
+
db = new SQL.Database(new Uint8Array(readFileSync(filepath)));
|
|
110
|
+
} else {
|
|
111
|
+
db = new SQL.Database();
|
|
112
|
+
}
|
|
113
|
+
db.run("PRAGMA journal_mode = DELETE");
|
|
114
|
+
db.run("PRAGMA foreign_keys = ON");
|
|
115
|
+
db.run("PRAGMA defer_foreign_keys = ON");
|
|
116
|
+
return new SqlJsDb(db, SQL, filepath);
|
|
117
|
+
}
|
|
118
|
+
let conn;
|
|
119
|
+
if (process.versions?.bun) {
|
|
120
|
+
const { Database } = await import("bun:sqlite");
|
|
121
|
+
conn = new Database(filepath, { create: true });
|
|
122
|
+
} else {
|
|
123
|
+
const { DatabaseSync } = await import("node:sqlite");
|
|
124
|
+
conn = new DatabaseSync(filepath);
|
|
125
|
+
}
|
|
126
|
+
conn.exec("PRAGMA journal_mode = WAL");
|
|
127
|
+
conn.exec("PRAGMA busy_timeout = 5000");
|
|
128
|
+
conn.exec("PRAGMA synchronous = off");
|
|
129
|
+
conn.exec("PRAGMA foreign_keys = ON");
|
|
130
|
+
conn.exec("PRAGMA defer_foreign_keys = ON");
|
|
131
|
+
return new NativeDb(conn, filepath);
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
openDb
|
|
135
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import merge from "deepmerge";
|
|
2
|
+
import { HoudiniError } from "./error.js";
|
|
3
|
+
function deepMerge(filepath, ...targets) {
|
|
4
|
+
try {
|
|
5
|
+
if (targets.length === 1) {
|
|
6
|
+
return targets[0];
|
|
7
|
+
} else if (targets.length === 2) {
|
|
8
|
+
return merge(targets[0], targets[1], {
|
|
9
|
+
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw new HoudiniError({
|
|
15
|
+
filepath,
|
|
16
|
+
message: `could not merge: ${JSON.stringify(targets, null, 4)}`,
|
|
17
|
+
description: e.message
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
deepMerge
|
|
23
|
+
};
|
package/build/lib/error.d.ts
CHANGED
|
@@ -7,3 +7,19 @@ export declare class HoudiniError extends Error {
|
|
|
7
7
|
description?: string | null;
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
+
export declare function format_error(e: unknown, after?: (e: Error) => void): void;
|
|
11
|
+
export type HookError = {
|
|
12
|
+
message: string;
|
|
13
|
+
detail: string;
|
|
14
|
+
locations: HookErrorLocation[];
|
|
15
|
+
kind: string;
|
|
16
|
+
};
|
|
17
|
+
type HookErrorLocation = {
|
|
18
|
+
filepath: string;
|
|
19
|
+
line: number;
|
|
20
|
+
column: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function format_hook_error(rootDir: string, error: HookError, plugin: string, hook: string): void;
|
|
23
|
+
export declare function format_codeblock(code: string[], lineNrStart: number): string;
|
|
24
|
+
export declare function formatErrors(e: unknown, afterError?: (e: Error) => void): void;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { styleText } from "node:util";
|
|
2
|
+
import { readFileSync } from "./fs.js";
|
|
3
|
+
import * as path from "./path.js";
|
|
4
|
+
class HoudiniError extends Error {
|
|
5
|
+
filepath = null;
|
|
6
|
+
description = null;
|
|
7
|
+
constructor({
|
|
8
|
+
filepath,
|
|
9
|
+
message,
|
|
10
|
+
description
|
|
11
|
+
}) {
|
|
12
|
+
super(message);
|
|
13
|
+
if (filepath) {
|
|
14
|
+
this.filepath = filepath;
|
|
15
|
+
}
|
|
16
|
+
if (description) {
|
|
17
|
+
this.description = description;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function format_error(e, after) {
|
|
22
|
+
const errors = Array.isArray(e) ? e : [e];
|
|
23
|
+
for (const error of errors) {
|
|
24
|
+
if ("filepath" in error && error.filepath) {
|
|
25
|
+
const relative = path.relative(process.cwd(), error.filepath);
|
|
26
|
+
console.error(`\u274C Encountered error in ${relative}`);
|
|
27
|
+
if (error.message) {
|
|
28
|
+
console.error(error.message);
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
console.error(`\u274C ${error.message}`);
|
|
32
|
+
if ("description" in error && error.description) {
|
|
33
|
+
console.error(`${error.description}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
after?.(e);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function format_hook_error(rootDir, error, plugin, hook) {
|
|
40
|
+
let message = `-- ${styleText(
|
|
41
|
+
"red",
|
|
42
|
+
`${error.kind ?? "internal"} error during ${hook.toLowerCase()} @ ${plugin}`
|
|
43
|
+
)} -----------------------------
|
|
44
|
+
`;
|
|
45
|
+
message += `${error.message}
|
|
46
|
+
`;
|
|
47
|
+
message += "\n";
|
|
48
|
+
try {
|
|
49
|
+
if (error.locations) {
|
|
50
|
+
error.locations.forEach((location) => {
|
|
51
|
+
const filepath = location.filepath.includes(rootDir) ? location.filepath : path.join(rootDir, location.filepath);
|
|
52
|
+
const contents = readFileSync(filepath);
|
|
53
|
+
if (!contents) {
|
|
54
|
+
message += `${location.filepath}`;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const lines = contents.split("\n");
|
|
58
|
+
message += `${location.filepath}:${location.line}:${location.column}
|
|
59
|
+
`;
|
|
60
|
+
const extraLines = 3;
|
|
61
|
+
const startLine = Math.max(location.line - extraLines, 0);
|
|
62
|
+
const code = lines.slice(startLine - 1, location.line);
|
|
63
|
+
message += format_codeblock(code, startLine);
|
|
64
|
+
const gutterOffset = ` ${location.line} | `.length;
|
|
65
|
+
message += " ".repeat(gutterOffset);
|
|
66
|
+
message += " ".repeat(Math.max(location.column - 1, 0));
|
|
67
|
+
message += styleText("red", "^---- error reported here");
|
|
68
|
+
message += "\n";
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
} finally {
|
|
72
|
+
}
|
|
73
|
+
if (error.detail) {
|
|
74
|
+
message += `
|
|
75
|
+
${error.detail}`;
|
|
76
|
+
}
|
|
77
|
+
console.error(message);
|
|
78
|
+
}
|
|
79
|
+
function format_codeblock(code, lineNrStart) {
|
|
80
|
+
let output = "";
|
|
81
|
+
const maxLineNrWidth = (lineNrStart + code.length).toString().length;
|
|
82
|
+
for (let i = 0; i < code.length; i++) {
|
|
83
|
+
const normalized = code[i].replaceAll(" ", " ");
|
|
84
|
+
const lineNr = (lineNrStart + i).toString();
|
|
85
|
+
const spacing = " ".repeat(maxLineNrWidth - lineNr.length);
|
|
86
|
+
output += ` ${spacing}${lineNr} | ${normalized}
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
return output;
|
|
90
|
+
}
|
|
91
|
+
function formatErrors(e, afterError) {
|
|
92
|
+
const errors = Array.isArray(e) ? e : [e];
|
|
93
|
+
for (const error of errors) {
|
|
94
|
+
if ("filepath" in error && error.filepath) {
|
|
95
|
+
const relative = path.relative(process.cwd(), error.filepath);
|
|
96
|
+
console.error(`\u274C Encountered error in ${relative}`);
|
|
97
|
+
if (error.message) {
|
|
98
|
+
console.error(error.message);
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
console.error(`\u274C ${error.message}`);
|
|
102
|
+
if ("description" in error && error.description) {
|
|
103
|
+
console.error(`${error.description}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
afterError?.(e);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
HoudiniError,
|
|
111
|
+
formatErrors,
|
|
112
|
+
format_codeblock,
|
|
113
|
+
format_error,
|
|
114
|
+
format_hook_error
|
|
115
|
+
};
|
package/build/lib/fs.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import fsExtra from 'fs-extra';
|
|
4
|
-
import type { Dirent } from 'node:fs';
|
|
5
|
-
export declare function copyFileSync(src: string, dest: string):
|
|
6
|
-
export declare function copyFile(src: string, dest: string): Promise<
|
|
2
|
+
import type { Dirent, Stats } from 'node:fs';
|
|
3
|
+
export declare function copyFileSync(src: string, dest: string): undefined | null;
|
|
4
|
+
export declare function copyFile(src: string, dest: string): Promise<undefined | null>;
|
|
7
5
|
export declare function readFile(filepath: string, encoding?: BufferEncoding): Promise<string | null>;
|
|
8
6
|
export declare function readFileSync(filepath: string): string | null;
|
|
9
7
|
export declare function writeFile(filepath: string, data: string): Promise<void>;
|
|
10
|
-
export declare function access(filepath: string): Promise<void
|
|
11
|
-
export declare function mkdirp(filepath: string): Promise<void>;
|
|
12
|
-
export declare function mkdirpSync(filepath: string): Promise<void>;
|
|
8
|
+
export declare function access(filepath: string): Promise<void>;
|
|
9
|
+
export declare function mkdirp(filepath: string): Promise<string | void>;
|
|
10
|
+
export declare function mkdirpSync(filepath: string): Promise<string | void>;
|
|
13
11
|
export declare function mkdir(filepath: string): Promise<void>;
|
|
14
12
|
export declare function rmdir(filepath: string): Promise<unknown>;
|
|
15
|
-
export declare function stat(filepath: string): Promise<
|
|
13
|
+
export declare function stat(filepath: string): Promise<Stats>;
|
|
14
|
+
export declare function statSync(filepath: string): Stats;
|
|
16
15
|
export declare function existsSync(dirPath: string): boolean;
|
|
17
16
|
export declare function readdir(path: string, options?: never): Promise<string[]>;
|
|
18
17
|
export declare function readdir(path: string, options?: fsExtra.ObjectEncodingOptions & {
|
|
@@ -29,7 +28,6 @@ export declare function snapshot(base?: string): {
|
|
|
29
28
|
};
|
|
30
29
|
export declare function glob(pattern: string): Promise<string[]>;
|
|
31
30
|
export declare namespace glob {
|
|
32
|
-
var hasMagic: (pattern: string | string[], options?: import("glob").GlobOptions
|
|
31
|
+
var hasMagic: (pattern: string | string[], options?: import("glob/raw").GlobOptions) => boolean;
|
|
33
32
|
}
|
|
34
|
-
export declare function walk(dir: string): AsyncGenerator<string>;
|
|
35
33
|
export {};
|
package/build/lib/fs.js
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import fsExtra from "fs-extra";
|
|
2
|
+
import { glob as G } from "glob";
|
|
3
|
+
import { fs as memfs, vol } from "memfs";
|
|
4
|
+
import fsSync from "node:fs";
|
|
5
|
+
import fs from "node:fs/promises";
|
|
6
|
+
import { promisify } from "node:util";
|
|
7
|
+
import { houdini_mode } from "./constants.js";
|
|
8
|
+
import * as path from "./path.js";
|
|
9
|
+
function copyFileSync(src, dest) {
|
|
10
|
+
if (houdini_mode.is_testing) {
|
|
11
|
+
try {
|
|
12
|
+
if (src.includes("build/runtime") || dest.includes("build/runtime")) {
|
|
13
|
+
fsExtra.copyFileSync(src, dest);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
memfs.copyFileSync(src, dest);
|
|
17
|
+
return;
|
|
18
|
+
} catch (_e) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
fsExtra.copyFileSync(src, dest);
|
|
24
|
+
return;
|
|
25
|
+
} catch (_e) {
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
async function copyFile(src, dest) {
|
|
30
|
+
if (houdini_mode.is_testing) {
|
|
31
|
+
try {
|
|
32
|
+
if (src.includes("build/runtime") || dest.includes("build/runtime")) {
|
|
33
|
+
await fs.copyFile(src, dest);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
await memfs.copyFile(src, dest, (err) => {
|
|
37
|
+
throw err;
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
} catch (_e) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
await fs.copyFile(src, dest);
|
|
46
|
+
return;
|
|
47
|
+
} catch (_e) {
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
async function readFile(filepath, encoding) {
|
|
52
|
+
if (houdini_mode.is_testing) {
|
|
53
|
+
try {
|
|
54
|
+
if (filepath.includes("build/runtime")) {
|
|
55
|
+
return await fs.readFile(filepath, encoding ?? "utf-8");
|
|
56
|
+
}
|
|
57
|
+
return memfs.readFileSync(filepath, encoding ?? "utf-8").toString();
|
|
58
|
+
} catch (_e) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
return await fs.readFile(filepath, "utf8");
|
|
64
|
+
} catch (_error) {
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
function readFileSync(filepath) {
|
|
69
|
+
if (houdini_mode.is_testing) {
|
|
70
|
+
try {
|
|
71
|
+
if (filepath.includes("build/runtime")) {
|
|
72
|
+
return fsExtra.readFileSync(filepath, "utf-8");
|
|
73
|
+
}
|
|
74
|
+
return memfs.readFileSync(filepath, "utf-8").toString();
|
|
75
|
+
} catch (_e) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
return fsExtra.readFileSync(filepath, "utf-8");
|
|
81
|
+
} catch (_error) {
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
async function writeFile(filepath, data) {
|
|
86
|
+
const existingFileData = await readFile(filepath);
|
|
87
|
+
if (data === existingFileData) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (houdini_mode.is_testing) {
|
|
91
|
+
memfs.mkdirSync(path.dirname(filepath), { recursive: true });
|
|
92
|
+
return memfs.writeFileSync(filepath, data);
|
|
93
|
+
}
|
|
94
|
+
return await fs.writeFile(filepath, data, "utf8");
|
|
95
|
+
}
|
|
96
|
+
async function access(filepath) {
|
|
97
|
+
if (!houdini_mode.is_testing) {
|
|
98
|
+
return await fs.access(filepath);
|
|
99
|
+
}
|
|
100
|
+
if (filepath.includes("build/runtime")) {
|
|
101
|
+
return await fs.access(filepath);
|
|
102
|
+
}
|
|
103
|
+
memfs.statSync(filepath);
|
|
104
|
+
}
|
|
105
|
+
async function mkdirp(filepath) {
|
|
106
|
+
if (!houdini_mode.is_testing) {
|
|
107
|
+
return await fsExtra.mkdirp(filepath);
|
|
108
|
+
}
|
|
109
|
+
return memfs.mkdirSync(filepath, { recursive: true });
|
|
110
|
+
}
|
|
111
|
+
async function mkdirpSync(filepath) {
|
|
112
|
+
if (!houdini_mode.is_testing) {
|
|
113
|
+
return fsExtra.mkdirpSync(filepath);
|
|
114
|
+
}
|
|
115
|
+
return memfs.mkdirSync(filepath, { recursive: true });
|
|
116
|
+
}
|
|
117
|
+
async function mkdir(filepath) {
|
|
118
|
+
if (!houdini_mode.is_testing) {
|
|
119
|
+
return await fs.mkdir(filepath);
|
|
120
|
+
}
|
|
121
|
+
return memfs.mkdirSync(filepath);
|
|
122
|
+
}
|
|
123
|
+
async function rmdir(filepath) {
|
|
124
|
+
if (!houdini_mode.is_testing) {
|
|
125
|
+
return await fs.rm(filepath, {
|
|
126
|
+
recursive: true
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return await promisify(memfs.rmdir)(filepath);
|
|
130
|
+
}
|
|
131
|
+
async function stat(filepath) {
|
|
132
|
+
if (!houdini_mode.is_testing) {
|
|
133
|
+
return await fs.stat(filepath);
|
|
134
|
+
}
|
|
135
|
+
if (filepath.includes("build/runtime")) {
|
|
136
|
+
return await fs.stat(filepath);
|
|
137
|
+
}
|
|
138
|
+
return memfs.statSync(filepath);
|
|
139
|
+
}
|
|
140
|
+
function statSync(filepath) {
|
|
141
|
+
if (!houdini_mode.is_testing) {
|
|
142
|
+
return fsSync.statSync(filepath);
|
|
143
|
+
}
|
|
144
|
+
return memfs.statSync(filepath);
|
|
145
|
+
}
|
|
146
|
+
function existsSync(dirPath) {
|
|
147
|
+
if (!houdini_mode.is_testing) {
|
|
148
|
+
return fsExtra.existsSync(dirPath);
|
|
149
|
+
}
|
|
150
|
+
return memfs.existsSync(dirPath);
|
|
151
|
+
}
|
|
152
|
+
async function readdir(filepath, opts) {
|
|
153
|
+
if (!houdini_mode.is_testing) {
|
|
154
|
+
return await fs.readdir(filepath, opts);
|
|
155
|
+
}
|
|
156
|
+
if (filepath.includes("build/runtime")) {
|
|
157
|
+
return await fs.readdir(filepath, opts);
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
return memfs.readdirSync(filepath, opts);
|
|
161
|
+
} catch {
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
async function remove(filepath) {
|
|
166
|
+
if (!houdini_mode.is_testing) {
|
|
167
|
+
return await fs.rm(filepath);
|
|
168
|
+
}
|
|
169
|
+
return vol.rmSync(filepath);
|
|
170
|
+
}
|
|
171
|
+
async function mock(target, filepath = "") {
|
|
172
|
+
await Promise.all(
|
|
173
|
+
Object.entries(target).map(async ([key, value]) => {
|
|
174
|
+
const childPath = path.join(filepath, key);
|
|
175
|
+
if (typeof value === "string") {
|
|
176
|
+
await writeFile(childPath, value);
|
|
177
|
+
} else {
|
|
178
|
+
await mkdirp(childPath);
|
|
179
|
+
return await mock(value, childPath);
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
async function recursiveCopy(source, target, transforms, notRoot) {
|
|
185
|
+
let parentDir = path.join(target, path.basename(source));
|
|
186
|
+
if (!notRoot) {
|
|
187
|
+
parentDir = path.join(parentDir, "..");
|
|
188
|
+
}
|
|
189
|
+
try {
|
|
190
|
+
await access(parentDir);
|
|
191
|
+
} catch (_e) {
|
|
192
|
+
await mkdirp(parentDir);
|
|
193
|
+
}
|
|
194
|
+
if ((await stat(source)).isDirectory()) {
|
|
195
|
+
await Promise.all(
|
|
196
|
+
(await readdir(source)).map(async (child) => {
|
|
197
|
+
const childPath = path.join(source, child);
|
|
198
|
+
if ((await stat(childPath)).isDirectory()) {
|
|
199
|
+
await recursiveCopy(childPath, parentDir, transforms, true);
|
|
200
|
+
} else {
|
|
201
|
+
const targetPath = path.join(parentDir, child);
|
|
202
|
+
if (transforms?.[childPath]) {
|
|
203
|
+
const original = await readFile(childPath) || "";
|
|
204
|
+
await writeFile(
|
|
205
|
+
targetPath,
|
|
206
|
+
await transforms[childPath](original, childPath)
|
|
207
|
+
);
|
|
208
|
+
} else {
|
|
209
|
+
await copyFile(childPath, targetPath);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function snapshot(base) {
|
|
217
|
+
return Object.fromEntries(
|
|
218
|
+
Object.entries(vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value]) => [!base ? key : key.substring(base.length), value])
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
async function glob(pattern) {
|
|
222
|
+
return await G(path.posixify(pattern));
|
|
223
|
+
}
|
|
224
|
+
glob.hasMagic = G.hasMagic;
|
|
225
|
+
export {
|
|
226
|
+
access,
|
|
227
|
+
copyFile,
|
|
228
|
+
copyFileSync,
|
|
229
|
+
existsSync,
|
|
230
|
+
glob,
|
|
231
|
+
mkdir,
|
|
232
|
+
mkdirp,
|
|
233
|
+
mkdirpSync,
|
|
234
|
+
mock,
|
|
235
|
+
readFile,
|
|
236
|
+
readFileSync,
|
|
237
|
+
readdir,
|
|
238
|
+
recursiveCopy,
|
|
239
|
+
remove,
|
|
240
|
+
rmdir,
|
|
241
|
+
snapshot,
|
|
242
|
+
stat,
|
|
243
|
+
statSync,
|
|
244
|
+
writeFile
|
|
245
|
+
};
|
package/build/lib/graphql.d.ts
CHANGED
|
@@ -1,38 +1,11 @@
|
|
|
1
1
|
import * as graphql from 'graphql';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function getRootType(type: graphql.GraphQLType): graphql.GraphQLType;
|
|
4
|
-
export declare function processComponentFieldDirective(directive: graphql.DirectiveNode): {
|
|
5
|
-
field: string;
|
|
6
|
-
prop: string;
|
|
7
|
-
export?: string;
|
|
8
|
-
raw?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function hashOriginal({ document }: {
|
|
11
|
-
document: Document;
|
|
12
|
-
}): string;
|
|
13
|
-
export declare function hashRaw({ document }: {
|
|
14
|
-
document: Document;
|
|
15
|
-
}): string;
|
|
16
|
-
type GraphQLParentType = graphql.GraphQLObjectType | graphql.GraphQLInputObjectType | graphql.GraphQLInterfaceType;
|
|
17
|
-
export declare function parentField(ancestors: readonly any[]): graphql.FieldNode | graphql.InlineFragmentNode | graphql.OperationDefinitionNode | graphql.FragmentDefinitionNode | null;
|
|
18
|
-
export declare function parentTypeFromAncestors(schema: graphql.GraphQLSchema, filepath: string, ancestors: readonly any[]): GraphQLParentType;
|
|
19
|
-
export declare function definitionFromAncestors(ancestors: readonly any[]): {
|
|
20
|
-
parents: (graphql.FieldNode | graphql.InlineFragmentNode | graphql.FragmentDefinitionNode | graphql.SelectionSetNode | graphql.OperationDefinitionNode)[];
|
|
21
|
-
definition: graphql.FragmentDefinitionNode | graphql.OperationDefinitionNode;
|
|
22
|
-
};
|
|
23
|
-
export declare function formatErrors(e: unknown, afterError?: (e: Error) => void): void;
|
|
24
|
-
export declare function operation_requires_variables(operation: graphql.OperationDefinitionNode): boolean;
|
|
25
|
-
export declare function unwrapType(config: Config, type: any, wrappers?: TypeWrapper[], convertRuntimeScalars?: boolean): {
|
|
26
|
-
type: graphql.GraphQLNamedType;
|
|
27
|
-
wrappers: TypeWrapper[];
|
|
28
|
-
};
|
|
29
|
-
export declare function wrapType({ type, wrappers, }: {
|
|
30
|
-
type: graphql.GraphQLNamedType;
|
|
31
|
-
wrappers: TypeWrapper[];
|
|
32
|
-
}): graphql.TypeNode;
|
|
2
|
+
import type { Config } from './config.js';
|
|
33
3
|
export declare enum TypeWrapper {
|
|
34
4
|
Nullable = "Nullable",
|
|
35
5
|
List = "List",
|
|
36
6
|
NonNull = "NonNull"
|
|
37
7
|
}
|
|
38
|
-
export {
|
|
8
|
+
export declare function unwrapType(config: Config, type: any, wrappers?: TypeWrapper[], convertRuntimeScalars?: boolean): {
|
|
9
|
+
type: graphql.GraphQLNamedType;
|
|
10
|
+
wrappers: TypeWrapper[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as graphql from "graphql";
|
|
2
|
+
var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
3
|
+
TypeWrapper2["Nullable"] = "Nullable";
|
|
4
|
+
TypeWrapper2["List"] = "List";
|
|
5
|
+
TypeWrapper2["NonNull"] = "NonNull";
|
|
6
|
+
return TypeWrapper2;
|
|
7
|
+
})(TypeWrapper || {});
|
|
8
|
+
function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
|
|
9
|
+
if (type.kind === "NonNullType") {
|
|
10
|
+
return unwrapType(config, type.type, ["NonNull" /* NonNull */, ...wrappers]);
|
|
11
|
+
}
|
|
12
|
+
if (type instanceof graphql.GraphQLNonNull) {
|
|
13
|
+
return unwrapType(config, type.ofType, ["NonNull" /* NonNull */, ...wrappers]);
|
|
14
|
+
}
|
|
15
|
+
if (wrappers[0] !== "NonNull" /* NonNull */) {
|
|
16
|
+
wrappers.unshift("Nullable" /* Nullable */);
|
|
17
|
+
}
|
|
18
|
+
if (type.kind === "ListType") {
|
|
19
|
+
return unwrapType(config, type.type, ["List" /* List */, ...wrappers]);
|
|
20
|
+
}
|
|
21
|
+
if (type instanceof graphql.GraphQLList) {
|
|
22
|
+
return unwrapType(config, type.ofType, ["List" /* List */, ...wrappers]);
|
|
23
|
+
}
|
|
24
|
+
if (convertRuntimeScalars && config.config_file.runtimeScalars?.[type.name.value]) {
|
|
25
|
+
type = config.schema.getType(config.config_file.runtimeScalars?.[type.name.value].type);
|
|
26
|
+
}
|
|
27
|
+
const namedType = config.schema.getType(type.name.value || type.name);
|
|
28
|
+
if (!namedType) {
|
|
29
|
+
throw new Error(`Unknown type: ${type.name.value}` || type.name);
|
|
30
|
+
}
|
|
31
|
+
return { type: namedType, wrappers };
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
TypeWrapper,
|
|
35
|
+
unwrapType
|
|
36
|
+
};
|