houdini 1.2.44 → 1.2.46
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/cmd-cjs/index.js +664 -848
- package/build/cmd-esm/index.js +514 -698
- package/build/codegen/generators/comments/jsdoc.d.ts +2 -0
- package/build/codegen-cjs/index.js +662 -846
- package/build/codegen-esm/index.js +512 -696
- package/build/lib/graphql.d.ts +1 -1
- package/build/lib/index.d.ts +1 -0
- package/build/lib/typescript.d.ts +19 -0
- package/build/lib-cjs/index.js +726 -467
- package/build/lib-esm/index.js +720 -467
- package/build/runtime/client/index.d.ts +7 -1
- package/build/runtime/client/plugins/fragment.d.ts +2 -2
- package/build/runtime/client/plugins/mutation.d.ts +2 -1
- package/build/runtime/client/plugins/query.d.ts +2 -2
- package/build/runtime/lib/scalars.d.ts +1 -1
- package/build/runtime/lib/types.d.ts +13 -2
- package/build/runtime/router/match.d.ts +3 -2
- package/build/runtime/router/types.d.ts +3 -1
- package/build/runtime-cjs/client/index.d.ts +7 -1
- package/build/runtime-cjs/client/index.js +26 -11
- package/build/runtime-cjs/client/plugins/fragment.d.ts +2 -2
- package/build/runtime-cjs/client/plugins/fragment.js +4 -11
- package/build/runtime-cjs/client/plugins/mutation.d.ts +2 -1
- package/build/runtime-cjs/client/plugins/mutation.js +8 -15
- package/build/runtime-cjs/client/plugins/query.d.ts +2 -2
- package/build/runtime-cjs/client/plugins/query.js +4 -11
- package/build/runtime-cjs/lib/scalars.d.ts +1 -1
- package/build/runtime-cjs/lib/scalars.js +4 -0
- package/build/runtime-cjs/lib/types.d.ts +13 -2
- package/build/runtime-cjs/router/match.d.ts +3 -2
- package/build/runtime-cjs/router/match.js +11 -2
- package/build/runtime-cjs/router/server.js +1 -1
- package/build/runtime-cjs/router/types.d.ts +3 -1
- package/build/runtime-esm/client/index.d.ts +7 -1
- package/build/runtime-esm/client/index.js +26 -11
- package/build/runtime-esm/client/plugins/fragment.d.ts +2 -2
- package/build/runtime-esm/client/plugins/fragment.js +1 -2
- package/build/runtime-esm/client/plugins/mutation.d.ts +2 -1
- package/build/runtime-esm/client/plugins/mutation.js +1 -2
- package/build/runtime-esm/client/plugins/query.d.ts +2 -2
- package/build/runtime-esm/client/plugins/query.js +1 -2
- package/build/runtime-esm/lib/scalars.d.ts +1 -1
- package/build/runtime-esm/lib/scalars.js +6 -0
- package/build/runtime-esm/lib/types.d.ts +13 -2
- package/build/runtime-esm/router/match.d.ts +3 -2
- package/build/runtime-esm/router/match.js +11 -2
- package/build/runtime-esm/router/server.js +1 -1
- package/build/runtime-esm/router/types.d.ts +3 -1
- package/build/test-cjs/index.js +677 -844
- package/build/test-esm/index.js +527 -694
- package/build/vite-cjs/index.js +786 -857
- package/build/vite-esm/index.js +636 -707
- package/package.json +1 -1
- package/build/codegen/generators/typescript/typeReference.d.ts +0 -8
- package/build/codegen/generators/typescript/types.d.ts +0 -10
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import cache from "../../cache";
|
|
2
1
|
import { marshalSelection } from "../../lib/scalars";
|
|
3
2
|
import { ArtifactKind } from "../../lib/types";
|
|
4
3
|
import { documentPlugin } from "../utils";
|
|
5
|
-
const mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
4
|
+
const mutation = (cache) => documentPlugin(ArtifactKind.Mutation, () => {
|
|
6
5
|
return {
|
|
7
6
|
async start(ctx, { next, marshalVariables }) {
|
|
8
7
|
const layerOptimistic = cache._internal_unstable.storage.createLayer(true);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const query: ClientPlugin;
|
|
1
|
+
import type { Cache } from '../../cache/cache';
|
|
2
|
+
export declare const query: (cache: Cache) => import("..").ClientPlugin;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import cache from "../../cache";
|
|
2
1
|
import { ArtifactKind, DataSource } from "../../lib/types";
|
|
3
2
|
import { documentPlugin } from "../utils";
|
|
4
|
-
const query = documentPlugin(ArtifactKind.Query, function() {
|
|
3
|
+
const query = (cache) => documentPlugin(ArtifactKind.Query, function() {
|
|
5
4
|
let subscriptionSpec = null;
|
|
6
5
|
let lastVariables = null;
|
|
7
6
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfigFile } from './config';
|
|
2
|
-
import type
|
|
2
|
+
import { type FragmentArtifact, type MutationArtifact, type QueryArtifact, type SubscriptionArtifact, type SubscriptionSelection } from './types';
|
|
3
3
|
export declare function marshalSelection({ selection, data, }: {
|
|
4
4
|
selection: SubscriptionSelection;
|
|
5
5
|
data: any;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { getCurrentConfig } from "./config";
|
|
2
2
|
import { getFieldsForType } from "./selection";
|
|
3
|
+
import {
|
|
4
|
+
fragmentKey
|
|
5
|
+
} from "./types";
|
|
3
6
|
async function marshalSelection({
|
|
4
7
|
selection,
|
|
5
8
|
data
|
|
@@ -15,6 +18,9 @@ async function marshalSelection({
|
|
|
15
18
|
return Object.fromEntries(
|
|
16
19
|
await Promise.all(
|
|
17
20
|
Object.entries(data).map(async ([fieldName, value]) => {
|
|
21
|
+
if (fieldName === fragmentKey) {
|
|
22
|
+
return [fieldName, value];
|
|
23
|
+
}
|
|
18
24
|
const { type, selection: selection2 } = targetSelection[fieldName];
|
|
19
25
|
if (!type) {
|
|
20
26
|
return [fieldName, value];
|
|
@@ -367,6 +367,14 @@ export type PageManifest = {
|
|
|
367
367
|
layouts: string[];
|
|
368
368
|
/** The filepath of the unit */
|
|
369
369
|
path: string;
|
|
370
|
+
/**
|
|
371
|
+
* The name and type of every route paramter that this page can use.
|
|
372
|
+
* null indicates the type is unknown (not constrained by a query)
|
|
373
|
+
**/
|
|
374
|
+
params: Record<string, {
|
|
375
|
+
type: string;
|
|
376
|
+
wrappers: string[];
|
|
377
|
+
} | null>;
|
|
370
378
|
};
|
|
371
379
|
export type QueryManifest = {
|
|
372
380
|
/** the name of the query */
|
|
@@ -377,6 +385,9 @@ export type QueryManifest = {
|
|
|
377
385
|
loading: boolean;
|
|
378
386
|
/** The filepath of the unit */
|
|
379
387
|
path: string;
|
|
380
|
-
/** The
|
|
381
|
-
variables: string
|
|
388
|
+
/** The name and GraphQL type for the variables that this query cares about */
|
|
389
|
+
variables: Record<string, {
|
|
390
|
+
wrappers: string[];
|
|
391
|
+
type: string;
|
|
392
|
+
}>;
|
|
382
393
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GraphQLVariables } from '$houdini/runtime/lib/types';
|
|
2
|
+
import { type ConfigFile } from '../lib';
|
|
2
3
|
import type { RouterManifest, RouterPageManifest } from './types';
|
|
3
4
|
export type RouteParam = {
|
|
4
5
|
name: string;
|
|
@@ -10,8 +11,8 @@ export type RouteParam = {
|
|
|
10
11
|
export interface ParamMatcher {
|
|
11
12
|
(param: string): boolean;
|
|
12
13
|
}
|
|
13
|
-
export declare function find_match<_ComponentType>(manifest: RouterManifest<_ComponentType>, current: string, allowNull: true): [RouterPageManifest<_ComponentType> | null, GraphQLVariables];
|
|
14
|
-
export declare function find_match<_ComponentType>(manifest: RouterManifest<_ComponentType>, current: string, allowNull?: false): [RouterPageManifest<_ComponentType>, GraphQLVariables];
|
|
14
|
+
export declare function find_match<_ComponentType>(config: ConfigFile, manifest: RouterManifest<_ComponentType>, current: string, allowNull: true): [RouterPageManifest<_ComponentType> | null, GraphQLVariables];
|
|
15
|
+
export declare function find_match<_ComponentType>(config: ConfigFile, manifest: RouterManifest<_ComponentType>, current: string, allowNull?: false): [RouterPageManifest<_ComponentType>, GraphQLVariables];
|
|
15
16
|
/**
|
|
16
17
|
* Creates the regex pattern, extracts parameter names, and generates types for a route
|
|
17
18
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { parseScalar } from "../lib";
|
|
1
2
|
const param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
|
|
2
|
-
function find_match(manifest, current, allowNull = true) {
|
|
3
|
+
function find_match(config, manifest, current, allowNull = true) {
|
|
3
4
|
let match = null;
|
|
4
5
|
let matchVariables = null;
|
|
5
6
|
for (const page of Object.values(manifest.pages)) {
|
|
@@ -14,7 +15,15 @@ function find_match(manifest, current, allowNull = true) {
|
|
|
14
15
|
if (!match && !allowNull) {
|
|
15
16
|
throw new Error("404");
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
let variables = {};
|
|
19
|
+
for (const document of Object.values(match?.documents ?? {})) {
|
|
20
|
+
for (const [variable, { type }] of Object.entries(document.variables)) {
|
|
21
|
+
if (matchVariables?.[variable]) {
|
|
22
|
+
variables[variable] = parseScalar(config, type, matchVariables[variable]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return [match, variables];
|
|
18
27
|
}
|
|
19
28
|
function parse_page_pattern(id) {
|
|
20
29
|
const params = [];
|
|
@@ -16,7 +16,9 @@ export type RouterPageManifest<_ComponentType> = {
|
|
|
16
16
|
default: QueryArtifact;
|
|
17
17
|
}>;
|
|
18
18
|
loading: boolean;
|
|
19
|
-
variables: string
|
|
19
|
+
variables: Record<string, {
|
|
20
|
+
type: string;
|
|
21
|
+
}>;
|
|
20
22
|
}>;
|
|
21
23
|
component: () => Promise<{
|
|
22
24
|
default: (props: any) => _ComponentType;
|