@orpc/react 0.0.0-next.571d5d7 → 0.0.0-next.5725903

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/dist/index.mjs ADDED
@@ -0,0 +1,57 @@
1
+ import { ORPCError, createORPCErrorFromJson } from '@orpc/client';
2
+ import { StandardBracketNotationSerializer } from '@orpc/openapi-client/standard';
3
+ export { getIssueMessage, parseFormData } from '@orpc/openapi-client/standard';
4
+ import { createProcedureClient } from '@orpc/server';
5
+ import { onError, resolveMaybeOptionalOptions, toArray, onStart, onSuccess, onFinish } from '@orpc/shared';
6
+
7
+ const orpcErrorToNextHttpFallbackInterceptor = onError((error) => {
8
+ if (error instanceof ORPCError && [401, 403, 404].includes(error.status)) {
9
+ const nextError = createORPCErrorFromJson(error.toJSON());
10
+ nextError.cause = error;
11
+ nextError.digest = `NEXT_HTTP_ERROR_FALLBACK;${error.status}`;
12
+ throw nextError;
13
+ }
14
+ });
15
+ function createFormAction(lazyableProcedure, ...rest) {
16
+ const options = resolveMaybeOptionalOptions(rest);
17
+ const client = createProcedureClient(lazyableProcedure, {
18
+ ...options,
19
+ interceptors: [orpcErrorToNextHttpFallbackInterceptor, ...toArray(options.interceptors)]
20
+ });
21
+ const bracketNotation = new StandardBracketNotationSerializer();
22
+ return async (form) => {
23
+ const input = bracketNotation.deserialize([...form]);
24
+ await client(input);
25
+ };
26
+ }
27
+
28
+ const onStartDeferred = (callback, ...rest) => {
29
+ return onStart((...args) => {
30
+ setTimeout(() => {
31
+ callback(...args);
32
+ }, 6);
33
+ }, ...rest);
34
+ };
35
+ const onSuccessDeferred = (callback, ...rest) => {
36
+ return onSuccess((...args) => {
37
+ setTimeout(() => {
38
+ callback(...args);
39
+ }, 6);
40
+ }, ...rest);
41
+ };
42
+ const onErrorDeferred = (callback, ...rest) => {
43
+ return onError((...args) => {
44
+ setTimeout(() => {
45
+ callback(...args);
46
+ }, 6);
47
+ }, ...rest);
48
+ };
49
+ const onFinishDeferred = (callback, ...rest) => {
50
+ return onFinish((...args) => {
51
+ setTimeout(() => {
52
+ callback(...args);
53
+ }, 6);
54
+ }, ...rest);
55
+ };
56
+
57
+ export { createFormAction, onErrorDeferred, onFinishDeferred, onStartDeferred, onSuccessDeferred, orpcErrorToNextHttpFallbackInterceptor };
package/package.json CHANGED
@@ -1,48 +1,50 @@
1
1
  {
2
2
  "name": "@orpc/react",
3
3
  "type": "module",
4
- "version": "0.0.0-next.571d5d7",
4
+ "version": "0.0.0-next.5725903",
5
5
  "license": "MIT",
6
- "homepage": "https://orpc.unnoq.com",
6
+ "homepage": "https://orpc.dev",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/unnoq/orpc.git",
9
+ "url": "git+https://github.com/middleapi/orpc.git",
10
10
  "directory": "packages/react"
11
11
  },
12
12
  "keywords": [
13
- "unnoq",
14
- "orpc"
13
+ "orpc",
14
+ "react",
15
+ "nextjs"
15
16
  ],
16
17
  "exports": {
17
18
  ".": {
18
- "types": "./dist/src/index.d.ts",
19
- "import": "./dist/index.js",
20
- "default": "./dist/index.js"
19
+ "types": "./dist/index.d.mts",
20
+ "import": "./dist/index.mjs",
21
+ "default": "./dist/index.mjs"
21
22
  },
22
- "./🔒/*": {
23
- "types": "./dist/src/*.d.ts"
23
+ "./hooks": {
24
+ "types": "./dist/hooks/index.d.mts",
25
+ "import": "./dist/hooks/index.mjs",
26
+ "default": "./dist/hooks/index.mjs"
24
27
  }
25
28
  },
26
29
  "files": [
27
- "!**/*.map",
28
- "!**/*.tsbuildinfo",
29
30
  "dist"
30
31
  ],
31
32
  "peerDependencies": {
32
- "@tanstack/react-query": ">=5.55.0",
33
- "react": ">=18.3.0",
34
- "@orpc/client": "0.0.0-next.571d5d7",
35
- "@orpc/server": "0.0.0-next.571d5d7",
36
- "@orpc/contract": "0.0.0-next.571d5d7"
33
+ "react": ">=18.0.0"
37
34
  },
38
35
  "dependencies": {
39
- "@orpc/shared": "0.0.0-next.571d5d7"
36
+ "@orpc/client": "0.0.0-next.5725903",
37
+ "@orpc/openapi-client": "0.0.0-next.5725903",
38
+ "@orpc/shared": "0.0.0-next.5725903",
39
+ "@orpc/server": "0.0.0-next.5725903",
40
+ "@orpc/contract": "0.0.0-next.5725903"
40
41
  },
41
42
  "devDependencies": {
42
- "zod": "^3.24.1"
43
+ "react": "^19.2.4",
44
+ "zod": "^4.3.6"
43
45
  },
44
46
  "scripts": {
45
- "build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
47
+ "build": "unbuild",
46
48
  "build:watch": "pnpm run build --watch",
47
49
  "type:check": "tsc -b"
48
50
  }