-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V2: Introduce connect-query-core package (#357)
A dedicated connect-query-core package makes it much easier to integrate non-react integrations. The public API of `@connectrpc/connect-query` hasn't changed at all, all the same methods and types are exposed, we've just separated them into a distinct package that gets reexported from `@connectrpc/connect-query`. This change allows others to depend on connect-query without necessarily depending on react and react-query. Partially addresses #324 --------- Signed-off-by: Paul Sachs <[email protected]> Co-authored-by: Timo Stamm <[email protected]>
- Loading branch information
1 parent
0f315a5
commit b9b0b8f
Showing
61 changed files
with
1,191 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"git.enableCommitSigning": true, | ||
"git.alwaysSignOff": true, | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @connectrpc/connect-query-core | ||
|
||
This package provides the core functionality for the Connect-Query API. It exposes all the necessary functions to use with the different variants of the tanstack/query packages. Documentation for these APIs can be found in the main repo readme at https://github.com/connectrpc/connect-query-es and covers any non-hook functions (anything that doesn't start with `use`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"name": "@connectrpc/connect-query-core", | ||
"version": "2.0.0-rc.2", | ||
"description": "Core of Connect-Query, framework agnostic helpers for type-safe queries.", | ||
"license": "Apache-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/connectrpc/connect-query-es.git", | ||
"directory": "packages/connect-query-core" | ||
}, | ||
"scripts": { | ||
"clean": "rm -rf ./dist/*", | ||
"build": "npm run build:cjs && npm run build:esm", | ||
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --moduleResolution node10 --verbatimModuleSyntax false --outDir ./dist/cjs --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'", | ||
"build:esm": "tsc --project tsconfig.build.json", | ||
"test": "vitest --run", | ||
"test:watch": "vitest --watch", | ||
"format": "prettier . --write --ignore-path ./.eslintignore && eslint . --fix && license-header", | ||
"attw": "attw --pack" | ||
}, | ||
"type": "module", | ||
"sideEffects": false, | ||
"main": "./dist/cjs/index.js", | ||
"exports": { | ||
".": { | ||
"import": "./dist/esm/index.js", | ||
"require": "./dist/cjs/index.js" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "^0.15.2", | ||
"@bufbuild/buf": "1.43.0", | ||
"@bufbuild/jest-environment-jsdom": "^0.1.1", | ||
"@bufbuild/protobuf": "^2.2.0", | ||
"@bufbuild/protoc-gen-es": "^2.2.0", | ||
"@connectrpc/connect": "^2.0.0-rc.1", | ||
"@connectrpc/connect-web": "^2.0.0-rc.1", | ||
"test-utils": "workspace:*", | ||
"typescript": "^5.5.4" | ||
}, | ||
"peerDependencies": { | ||
"@bufbuild/protobuf": "2.x", | ||
"@connectrpc/connect": "^2.0.0-rc.1", | ||
"@tanstack/query-core": "5.x" | ||
}, | ||
"files": [ | ||
"dist/**" | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2021-2023 The Connect Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
export type { ConnectQueryKey } from "./connect-query-key.js"; | ||
export { createConnectQueryKey } from "./connect-query-key.js"; | ||
export { createProtobufSafeUpdater } from "./utils.js"; | ||
export type { ConnectUpdater } from "./utils.js"; | ||
export { callUnaryMethod } from "./call-unary-method.js"; | ||
export { createInfiniteQueryOptions } from "./create-infinite-query-options.js"; | ||
export type { ConnectInfiniteQueryOptions } from "./create-infinite-query-options.js"; | ||
export { createQueryOptions } from "./create-query-options.js"; | ||
export { addStaticKeyToTransport } from "./transport-key.js"; | ||
export type { SkipToken } from "@tanstack/query-core"; | ||
export { skipToken } from "@tanstack/query-core"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"skipLibCheck": true, | ||
"declaration": true, | ||
"declarationDir": "./dist/esm", | ||
"outDir": "./dist/esm" | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.tsx"], | ||
"exclude": ["**/*.test.ts", "**/*.test.tsx", "src/test/**"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "./tsconfig.build.json", | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"noUnusedLocals": false, // necessary for TypeScript type tests, but since this is not enabled for build, unused variables have no risk of leaking into the build output | ||
"lib": ["DOM", "ESNext"], | ||
"noEmit": true, | ||
"verbatimModuleSyntax": false | ||
}, | ||
"exclude": ["coverage", "dist"], | ||
"include": ["src", "./*.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2021-2023 The Connect Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import { defineConfig } from "vitest/config"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
test: { | ||
environment: "jsdom", | ||
typecheck: { | ||
enabled: true, | ||
// Modified to typecheck definition files as well as source files | ||
include: ["**/*.{test,spec}?(-d).?(c|m)[jt]s?(x)"], | ||
}, | ||
coverage: { | ||
provider: "istanbul", | ||
thresholds: { | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
statements: 100, | ||
}, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.