@sudobility/sudojo_client 0.0.104 → 0.0.105

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.
@@ -6,12 +6,14 @@ export declare const solverQueryKeys: {
6
6
  autoPencilmarks?: boolean | undefined;
7
7
  pencilmarks?: string | undefined;
8
8
  filters?: string | undefined;
9
+ techniques?: string | undefined;
9
10
  }) => readonly ["sudojo", "solver", "solve", {
10
11
  original: string;
11
12
  user: string;
12
13
  autoPencilmarks?: boolean | undefined;
13
14
  pencilmarks?: string | undefined;
14
15
  filters?: string | undefined;
16
+ techniques?: string | undefined;
15
17
  }];
16
18
  readonly validate: (original: string) => readonly ["sudojo", "solver", "validate", string];
17
19
  readonly generate: (options?: {
@@ -1 +1 @@
1
- {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../../../src/solver/hooks/query-keys.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,eAAe;wBAHL,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;8BAWjC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACtC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACjC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC9B;kBALW,MAAM;cACV,MAAM;0BACM,OAAO,GAAG,SAAS;sBACvB,MAAM,GAAG,SAAS;kBACtB,MAAM,GAAG,SAAS;;kCAOT,MAAM;kCAON;QAAE,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE;sBAArB,OAAO,GAAG,SAAS;;CAEhD,CAAC;AAaX,eAAO,MAAM,oBAAoB,QAAO,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAEnE,CAAC"}
1
+ {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../../../src/solver/hooks/query-keys.ts"],"names":[],"mappings":"A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M,CAAC,MAAM,oBAAoB,GAAG,GAAkC,EAAE;IACtE,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["/**\n * Query Key Factory for Sudojo Solver TanStack Query\n *\n * Provides type-safe, consistent query keys for Solver API endpoints.\n * Following TanStack Query best practices for key structure.\n *\n * ## Key Hierarchy\n *\n * All solver keys start with `[\"sudojo\", \"solver\"]` as the root:\n * - `[\"sudojo\", \"solver\", \"solve\", { original, user, ... }]` - solve hints\n * - `[\"sudojo\", \"solver\", \"validate\", originalPuzzle]` - validation\n * - `[\"sudojo\", \"solver\", \"generate\", { symmetrical }]` - generation\n *\n * ## Invalidation\n *\n * Use `getSolverServiceKeys()` to invalidate all solver queries at once.\n * Individual solve/validate/generate keys include their parameters so\n * different inputs produce distinct cache entries.\n */\n\nconst solverBase = (): readonly [\"sudojo\", \"solver\"] =>\n [\"sudojo\", \"solver\"] as const;\n\nexport const solverQueryKeys = {\n /** Root key for all solver queries. Use for bulk invalidation. */\n all: solverBase,\n\n /**\n * Key for a solve hints query. Includes all puzzle state parameters\n * so different board states produce separate cache entries.\n */\n solve: (options: {\n original: string;\n user: string;\n autoPencilmarks?: boolean | undefined;\n pencilmarks?: string | undefined;\n filters?: string | undefined;\n }) => [...solverBase(), \"solve\", options] as const,\n\n /**\n * Key for a puzzle validation query. Since validation is deterministic\n * for a given original puzzle string, only the puzzle string is needed.\n */\n validate: (original: string) =>\n [...solverBase(), \"validate\", original] as const,\n\n /**\n * Key for a puzzle generation query. Includes symmetry preference\n * as different options may produce different puzzle types.\n */\n generate: (options?: { symmetrical?: boolean | undefined }) =>\n [...solverBase(), \"generate\", options] as const,\n} as const;\n\n/**\n * Helper to get the root key for all solver service queries.\n * Useful for bulk invalidation of the entire solver cache.\n *\n * @returns The root query key `[\"sudojo\", \"solver\"]`\n *\n * @example\n * ```ts\n * queryClient.invalidateQueries({ queryKey: getSolverServiceKeys() });\n * ```\n */\nexport const getSolverServiceKeys = (): readonly [\"sudojo\", \"solver\"] => {\n return solverQueryKeys.all();\n};\n"]}
1
+ {"version":3,"file":"query-keys.js","sourceRoot":"","sources":["../../../src/solver/hooks/query-keys.ts"],"names":[],"mappings":"AAoBA,MAAM,UAAU,GAAG,GAAkC,EAAE,CACrD,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAEhC,MAAM,CAAC,MAAM,eAAe,GAAG;IAE7B,GAAG,EAAE,UAAU;IAMf,KAAK,EAAE,CAAC,OAOP,EAAE,EAAE,CAAC,CAAC,GAAG,UAAU,EAAE,EAAE,OAAO,EAAE,OAAO,CAAU;IAMlD,QAAQ,EAAE,CAAC,QAAgB,EAAE,EAAE,CAC7B,CAAC,GAAG,UAAU,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAU;IAMlD,QAAQ,EAAE,CAAC,OAA+C,EAAE,EAAE,CAC5D,CAAC,GAAG,UAAU,EAAE,EAAE,UAAU,EAAE,OAAO,CAAU;CACzC,CAAC;AAaX,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAkC,EAAE;IACtE,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["/**\n * Query Key Factory for Sudojo Solver TanStack Query\n *\n * Provides type-safe, consistent query keys for Solver API endpoints.\n * Following TanStack Query best practices for key structure.\n *\n * ## Key Hierarchy\n *\n * All solver keys start with `[\"sudojo\", \"solver\"]` as the root:\n * - `[\"sudojo\", \"solver\", \"solve\", { original, user, ... }]` - solve hints\n * - `[\"sudojo\", \"solver\", \"validate\", originalPuzzle]` - validation\n * - `[\"sudojo\", \"solver\", \"generate\", { symmetrical }]` - generation\n *\n * ## Invalidation\n *\n * Use `getSolverServiceKeys()` to invalidate all solver queries at once.\n * Individual solve/validate/generate keys include their parameters so\n * different inputs produce distinct cache entries.\n */\n\nconst solverBase = (): readonly [\"sudojo\", \"solver\"] =>\n [\"sudojo\", \"solver\"] as const;\n\nexport const solverQueryKeys = {\n /** Root key for all solver queries. Use for bulk invalidation. */\n all: solverBase,\n\n /**\n * Key for a solve hints query. Includes all puzzle state parameters\n * so different board states produce separate cache entries.\n */\n solve: (options: {\n original: string;\n user: string;\n autoPencilmarks?: boolean | undefined;\n pencilmarks?: string | undefined;\n filters?: string | undefined;\n techniques?: string | undefined;\n }) => [...solverBase(), \"solve\", options] as const,\n\n /**\n * Key for a puzzle validation query. Since validation is deterministic\n * for a given original puzzle string, only the puzzle string is needed.\n */\n validate: (original: string) =>\n [...solverBase(), \"validate\", original] as const,\n\n /**\n * Key for a puzzle generation query. Includes symmetry preference\n * as different options may produce different puzzle types.\n */\n generate: (options?: { symmetrical?: boolean | undefined }) =>\n [...solverBase(), \"generate\", options] as const,\n} as const;\n\n/**\n * Helper to get the root key for all solver service queries.\n * Useful for bulk invalidation of the entire solver cache.\n *\n * @returns The root query key `[\"sudojo\", \"solver\"]`\n *\n * @example\n * ```ts\n * queryClient.invalidateQueries({ queryKey: getSolverServiceKeys() });\n * ```\n */\nexport const getSolverServiceKeys = (): readonly [\"sudojo\", \"solver\"] => {\n return solverQueryKeys.all();\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-solver.d.ts","sourceRoot":"","sources":["../../../src/solver/hooks/use-solver.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,eAAe,EACf,cAAc,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,YAAY,EACb,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,eAAe,EAChB,MAAM,6BAA6B,CAAC;AAerC,eAAO,MAAM,cAAc,GACzB,eAAe,aAAa,EAC5B,SAAS,MAAM,EACf,OAAO,MAAM,EACb,SAAS,YAAY,EACrB,eAAe,IAAI,CACjB,eAAe,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,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iB,GAC5B,eAAe,aAAa,EAC5B,SAAS,MAAM,EACf,OAAO,MAAM,EACb,SAAS,eAAe,EACxB,eAAe,IAAI,CACjB,eAAe,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,EAC3C,UAAU,GAAG,SAAS,CACvB,KACA,cAAc,CAAC,YAAY,CAAC,YAAY,CAAC,CAqB3C,CAAC;AAeF,eAAO,MAAM,iBAAiB,GAC5B,eAAe,aAAa,EAC5B,SAAS,MAAM,EACf,OAAO,MAAM,EACb,UAAS,eAAoB,EAC7B,eAAe,IAAI,CACjB,eAAe,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,EAC3C,UAAU,GAAG,SAAS,CACvB,KACA,cAAc,CAAC,YAAY,CAAC,YAAY,CAAC,CAqB3C,CAAC"}
@@ -17,6 +17,7 @@ export const useSolverSolve = (networkClient, baseUrl, token, options, queryOpti
17
17
  autoPencilmarks: options.autoPencilmarks,
18
18
  pencilmarks: options.pencilmarks,
19
19
  filters: options.filters,
20
+ techniques: options.techniques,
20
21
  }),
21
22
  queryFn,
22
23
  staleTime: SOLVER_STALE_TIMES.SOLVE,
@@ -1 +1 @@
1
- {"version":3,"file":"use-solver.js","sourceRoot":"","sources":["../../../src/solver/hooks/use-solver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EACL,QAAQ,GAGT,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAoB3D,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,aAA4B,EAC5B,OAAe,EACf,KAAa,EACb,OAAqB,EACrB,YAGC,EACwC,EAAE;IAC3C,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CAAC,IAAI,Y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CAAC;AACL,CAAC,CAAC","sourcesContent":["/**\n * React hooks for Sudojo Solver API\n */\n\nimport { useCallback, useMemo } from \"react\";\nimport {\n useQuery,\n UseQueryOptions,\n UseQueryResult,\n} from \"@tanstack/react-query\";\nimport type { NetworkClient } from \"@sudobility/types\";\nimport type {\n BaseResponse,\n GenerateData,\n SolveData,\n ValidateData,\n} from \"@sudobility/sudojo_types\";\nimport { solverQueryKeys } from \"./query-keys\";\nimport { SOLVER_STALE_TIMES } from \"./query-config\";\nimport { SudojoClient } from \"../../network/sudojo-client\";\nimport type {\n GenerateOptions,\n SolveOptions,\n ValidateOptions,\n} from \"../../network/sudojo-client\";\n\n// =============================================================================\n// Solve Hook\n// =============================================================================\n\n/**\n * Hook to get solving hints for a Sudoku puzzle\n *\n * @param networkClient - Network client for API calls\n * @param baseUrl - Base URL for the API\n * @param token - Firebase access token\n * @param options - Solve options (original puzzle, user input, etc.)\n * @param queryOptions - React Query options\n */\nexport const useSolverSolve = (\n networkClient: NetworkClient,\n baseUrl: string,\n token: string,\n options: SolveOptions,\n queryOptions?: Omit<\n UseQueryOptions<BaseResponse<SolveData>>,\n \"queryKey\" | \"queryFn\"\n >,\n): UseQueryResult<BaseResponse<SolveData>> => {\n const client = useMemo(\n () => new SudojoClient(networkClient, baseUrl),\n [networkClient, baseUrl],\n );\n\n const queryFn = useCallback(async (): Promise<BaseResponse<SolveData>> => {\n return client.solverSolve(token, options);\n }, [client, token, options]);\n\n const isEnabled =\n !!token &&\n (queryOptions?.enabled !== undefined ? queryOptions.enabled : true);\n\n return useQuery({\n queryKey: solverQueryKeys.solve({\n original: options.original,\n user: options.user,\n autoPencilmarks: options.autoPencilmarks,\n pencilmarks: options.pencilmarks,\n filters: options.filters,\n }),\n queryFn,\n staleTime: SOLVER_STALE_TIMES.SOLVE,\n ...queryOptions,\n enabled: isEnabled,\n });\n};\n\n// =============================================================================\n// Validate Hook\n// =============================================================================\n\n/**\n * Hook to validate a Sudoku puzzle has a unique solution\n *\n * @param networkClient - Network client for API calls\n * @param baseUrl - Base URL for the API\n * @param token - Firebase access token\n * @param options - Validate options (original puzzle)\n * @param queryOptions - React Query options\n */\nexport const useSolverValidate = (\n networkClient: NetworkClient,\n baseUrl: string,\n token: string,\n options: ValidateOptions,\n queryOptions?: Omit<\n UseQueryOptions<BaseResponse<ValidateData>>,\n \"queryKey\" | \"queryFn\"\n >,\n): UseQueryResult<BaseResponse<ValidateData>> => {\n const client = useMemo(\n () => new SudojoClient(networkClient, baseUrl),\n [networkClient, baseUrl],\n );\n\n const queryFn = useCallback(async (): Promise<BaseResponse<ValidateData>> => {\n return client.solverValidate(token, options);\n }, [client, token, options]);\n\n // Validate endpoint does not require authentication\n const isEnabled =\n queryOptions?.enabled !== undefined ? queryOptions.enabled : true;\n\n return useQuery({\n queryKey: solverQueryKeys.validate(options.original),\n queryFn,\n staleTime: SOLVER_STALE_TIMES.VALIDATE,\n ...queryOptions,\n enabled: isEnabled,\n });\n};\n\n// =============================================================================\n// Generate Hook\n// =============================================================================\n\n/**\n * Hook to generate a new random Sudoku puzzle\n *\n * @param networkClient - Network client for API calls\n * @param baseUrl - Base URL for the API\n * @param token - Firebase access token\n * @param options - Generate options (symmetrical, etc.)\n * @param queryOptions - React Query options\n */\nexport const useSolverGenerate = (\n networkClient: NetworkClient,\n baseUrl: string,\n token: string,\n options: GenerateOptions = {},\n queryOptions?: Omit<\n UseQueryOptions<BaseResponse<GenerateData>>,\n \"queryKey\" | \"queryFn\"\n >,\n): UseQueryResult<BaseResponse<GenerateData>> => {\n const client = useMemo(\n () => new SudojoClient(networkClient, baseUrl),\n [networkClient, baseUrl],\n );\n\n const queryFn = useCallback(async (): Promise<BaseResponse<GenerateData>> => {\n return client.solverGenerate(token, options);\n }, [client, token, options]);\n\n const isEnabled =\n !!token &&\n (queryOptions?.enabled !== undefined ? queryOptions.enabled : true);\n\n return useQuery({\n queryKey: solverQueryKeys.generate({ symmetrical: options.symmetrical }),\n queryFn,\n staleTime: SOLVER_STAL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,CAAC,aAAa,EAAE,OAAO,CAAC,CACzB,CAAC;IAEF,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,IAAyC,EAAE;QAC1E,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7B,MAAM,SAAS,GACb,CAAC,CAAC,KAAK;QACP,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEtE,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;QACxE,OAAO;QACP,SAAS,EAAE,kBAAkB,CAAC,QAAQ;QACtC,GAAG,YAAY;QACf,OAAO,EAAE,SAAS;KACnB,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["/**\n * React hooks for Sudojo Solver API\n */\n\nimport { useCallback, useMemo } from \"react\";\nimport {\n useQuery,\n UseQueryOptions,\n UseQueryResult,\n} from \"@tanstack/react-query\";\nimport type { NetworkClient } from \"@sudobility/types\";\nimport type {\n BaseResponse,\n GenerateData,\n SolveData,\n ValidateData,\n} from \"@sudobility/sudojo_types\";\nimport { solverQueryKeys } from \"./query-keys\";\nimport { SOLVER_STALE_TIMES } from \"./query-config\";\nimport { SudojoClient } from \"../../network/sudojo-client\";\nimport type {\n GenerateOptions,\n SolveOptions,\n ValidateOptions,\n} from \"../../network/sudojo-client\";\n\n// =============================================================================\n// Solve Hook\n// =============================================================================\n\n/**\n * Hook to get solving hints for a Sudoku puzzle\n *\n * @param networkClient - Network client for API calls\n * @param baseUrl - Base URL for the API\n * @param token - Firebase access token\n * @param options - Solve options (original puzzle, user input, etc.)\n * @param queryOptions - React Query options\n */\nexport const useSolverSolve = (\n networkClient: NetworkClient,\n baseUrl: string,\n token: string,\n options: SolveOptions,\n queryOptions?: Omit<\n UseQueryOptions<BaseResponse<SolveData>>,\n \"queryKey\" | \"queryFn\"\n >,\n): UseQueryResult<BaseResponse<SolveData>> => {\n const client = useMemo(\n () => new SudojoClient(networkClient, baseUrl),\n [networkClient, baseUrl],\n );\n\n const queryFn = useCallback(async (): Promise<BaseResponse<SolveData>> => {\n return client.solverSolve(token, options);\n }, [client, token, options]);\n\n const isEnabled =\n !!token &&\n (queryOptions?.enabled !== undefined ? queryOptions.enabled : true);\n\n return useQuery({\n queryKey: solverQueryKeys.solve({\n original: options.original,\n user: options.user,\n autoPencilmarks: options.autoPencilmarks,\n pencilmarks: options.pencilmarks,\n filters: options.filters,\n techniques: options.techniques,\n }),\n queryFn,\n staleTime: SOLVER_STALE_TIMES.SOLVE,\n ...queryOptions,\n enabled: isEnabled,\n });\n};\n\n// =============================================================================\n// Validate Hook\n// =============================================================================\n\n/**\n * Hook to validate a Sudoku puzzle has a unique solution\n *\n * @param networkClient - Network client for API calls\n * @param baseUrl - Base URL for the API\n * @param token - Firebase access token\n * @param options - Validate options (original puzzle)\n * @param queryOptions - React Query options\n */\nexport const useSolverValidate = (\n networkClient: NetworkClient,\n baseUrl: string,\n token: string,\n options: ValidateOptions,\n queryOptions?: Omit<\n UseQueryOptions<BaseResponse<ValidateData>>,\n \"queryKey\" | \"queryFn\"\n >,\n): UseQueryResult<BaseResponse<ValidateData>> => {\n const client = useMemo(\n () => new SudojoClient(networkClient, baseUrl),\n [networkClient, baseUrl],\n );\n\n const queryFn = useCallback(async (): Promise<BaseResponse<ValidateData>> => {\n return client.solverValidate(token, options);\n }, [client, token, options]);\n\n // Validate endpoint does not require authentication\n const isEnabled =\n queryOptions?.enabled !== undefined ? queryOptions.enabled : true;\n\n return useQuery({\n queryKey: solverQueryKeys.validate(options.original),\n queryFn,\n staleTime: SOLVER_STALE_TIMES.VALIDATE,\n ...queryOptions,\n enabled: isEnabled,\n });\n};\n\n// =============================================================================\n// Generate Hook\n// =============================================================================\n\n/**\n * Hook to generate a new random Sudoku puzzle\n *\n * @param networkClient - Network client for API calls\n * @param baseUrl - Base URL for the API\n * @param token - Firebase access token\n * @param options - Generate options (symmetrical, etc.)\n * @param queryOptions - React Query options\n */\nexport const useSolverGenerate = (\n networkClient: NetworkClient,\n baseUrl: string,\n token: string,\n options: GenerateOptions = {},\n queryOptions?: Omit<\n UseQueryOptions<BaseResponse<GenerateData>>,\n \"queryKey\" | \"queryFn\"\n >,\n): UseQueryResult<BaseResponse<GenerateData>> => {\n const client = useMemo(\n () => new SudojoClient(networkClient, baseUrl),\n [networkClient, baseUrl],\n );\n\n const queryFn = useCallback(async (): Promise<BaseResponse<GenerateData>> => {\n return client.solverGenerate(token, options);\n }, [client, token, options]);\n\n const isEnabled =\n !!token &&\n (queryOptions?.enabled !== undefined ? queryOptions.enabled : true);\n\n return useQuery({\n queryKey: solverQueryKeys.generate({ symmetrical: options.symmetrical }),\n queryFn,\n staleTime: SOLVER_STALE_TIMES.GENERATE,\n ...queryOptions,\n enabled: isEnabled,\n });\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/sudojo_client",
3
- "version": "0.0.104",
3
+ "version": "0.0.105",
4
4
  "description": "TypeScript client library for Sudojo API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",