@nsxbet/react-relay-network-modern 1.0.0 → 1.0.1
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/RelayNetworkLayer.d.cts +4 -3
- package/dist/RelayNetworkLayer.d.ts +4 -3
- package/dist/RelayRequest.d.cts +4 -3
- package/dist/RelayRequest.d.ts +4 -3
- package/dist/definition.d.cts +6 -18
- package/dist/definition.d.ts +6 -18
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +6 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { FetchFunction, FetchHookFunction, Middleware, MiddlewareRaw, MiddlewareSync,
|
|
1
|
+
import { FetchFunction, FetchHookFunction, Middleware, MiddlewareRaw, MiddlewareSync, SubscribeFunction } from "./definition.cjs";
|
|
2
|
+
import { ExecuteFunction } from "relay-runtime";
|
|
2
3
|
|
|
3
4
|
//#region src/RelayNetworkLayer.d.ts
|
|
4
5
|
interface RelayNetworkLayerOpts {
|
|
@@ -9,8 +10,8 @@ interface RelayNetworkLayerOpts {
|
|
|
9
10
|
declare class RelayNetworkLayer {
|
|
10
11
|
_middlewares: Middleware[];
|
|
11
12
|
_rawMiddlewares: MiddlewareRaw[];
|
|
12
|
-
_middlewaresSync:
|
|
13
|
-
execute:
|
|
13
|
+
_middlewaresSync: MiddlewareSync['execute'][];
|
|
14
|
+
execute: ExecuteFunction;
|
|
14
15
|
executeWithEvents: any;
|
|
15
16
|
readonly fetchFn: FetchFunction;
|
|
16
17
|
readonly subscribeFn?: SubscribeFunction;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { FetchFunction, FetchHookFunction, Middleware, MiddlewareRaw, MiddlewareSync,
|
|
1
|
+
import { FetchFunction, FetchHookFunction, Middleware, MiddlewareRaw, MiddlewareSync, SubscribeFunction } from "./definition.js";
|
|
2
|
+
import { ExecuteFunction } from "relay-runtime";
|
|
2
3
|
|
|
3
4
|
//#region src/RelayNetworkLayer.d.ts
|
|
4
5
|
interface RelayNetworkLayerOpts {
|
|
@@ -9,8 +10,8 @@ interface RelayNetworkLayerOpts {
|
|
|
9
10
|
declare class RelayNetworkLayer {
|
|
10
11
|
_middlewares: Middleware[];
|
|
11
12
|
_rawMiddlewares: MiddlewareRaw[];
|
|
12
|
-
_middlewaresSync:
|
|
13
|
-
execute:
|
|
13
|
+
_middlewaresSync: MiddlewareSync['execute'][];
|
|
14
|
+
execute: ExecuteFunction;
|
|
14
15
|
executeWithEvents: any;
|
|
15
16
|
readonly fetchFn: FetchFunction;
|
|
16
17
|
readonly subscribeFn?: SubscribeFunction;
|
package/dist/RelayRequest.d.cts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { CacheConfig,
|
|
1
|
+
import { CacheConfig, FetchOpts, UploadableMap, Variables } from "./definition.cjs";
|
|
2
|
+
import { RequestParameters } from "relay-runtime";
|
|
2
3
|
|
|
3
4
|
//#region src/RelayRequest.d.ts
|
|
4
5
|
declare class RelayRequest {
|
|
5
6
|
static lastGenId: number;
|
|
6
7
|
id: string;
|
|
7
8
|
fetchOpts: FetchOpts;
|
|
8
|
-
operation:
|
|
9
|
+
operation: RequestParameters;
|
|
9
10
|
variables: Variables;
|
|
10
11
|
cacheConfig: CacheConfig;
|
|
11
12
|
uploadables?: UploadableMap | null;
|
|
12
13
|
controller: AbortController | null;
|
|
13
|
-
constructor(operation:
|
|
14
|
+
constructor(operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null);
|
|
14
15
|
getBody(): string | FormData;
|
|
15
16
|
prepareBody(): string | FormData;
|
|
16
17
|
getID(): string;
|
package/dist/RelayRequest.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { CacheConfig,
|
|
1
|
+
import { CacheConfig, FetchOpts, UploadableMap, Variables } from "./definition.js";
|
|
2
|
+
import { RequestParameters } from "relay-runtime";
|
|
2
3
|
|
|
3
4
|
//#region src/RelayRequest.d.ts
|
|
4
5
|
declare class RelayRequest {
|
|
5
6
|
static lastGenId: number;
|
|
6
7
|
id: string;
|
|
7
8
|
fetchOpts: FetchOpts;
|
|
8
|
-
operation:
|
|
9
|
+
operation: RequestParameters;
|
|
9
10
|
variables: Variables;
|
|
10
11
|
cacheConfig: CacheConfig;
|
|
11
12
|
uploadables?: UploadableMap | null;
|
|
12
13
|
controller: AbortController | null;
|
|
13
|
-
constructor(operation:
|
|
14
|
+
constructor(operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null);
|
|
14
15
|
getBody(): string | FormData;
|
|
15
16
|
prepareBody(): string | FormData;
|
|
16
17
|
getID(): string;
|
package/dist/definition.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RelayRequest } from "./RelayRequest.cjs";
|
|
2
2
|
import { RelayRequestBatch } from "./RelayRequestBatch.cjs";
|
|
3
3
|
import { RelayResponse } from "./RelayResponse.cjs";
|
|
4
|
+
import { RequestParameters } from "relay-runtime";
|
|
4
5
|
|
|
5
6
|
//#region src/definition.d.ts
|
|
6
7
|
type RelayRequestAny = RelayRequest | RelayRequestBatch;
|
|
@@ -12,7 +13,7 @@ interface MiddlewareRaw {
|
|
|
12
13
|
isRawMiddleware: true;
|
|
13
14
|
}
|
|
14
15
|
interface MiddlewareSync {
|
|
15
|
-
execute: (operation:
|
|
16
|
+
execute: (operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null) => ObservableFromValue<QueryPayload> | null | undefined;
|
|
16
17
|
}
|
|
17
18
|
interface FetchOpts {
|
|
18
19
|
url?: string;
|
|
@@ -41,22 +42,9 @@ interface GraphQLResponse {
|
|
|
41
42
|
data?: any;
|
|
42
43
|
errors?: GraphQLResponseErrors;
|
|
43
44
|
}
|
|
44
|
-
type RNLExecuteFunction = (operation: ConcreteBatch, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null) => RelayObservable<QueryPayload>;
|
|
45
45
|
interface Variables {
|
|
46
46
|
[name: string]: any;
|
|
47
47
|
}
|
|
48
|
-
interface ConcreteBatch {
|
|
49
|
-
kind: 'Batch';
|
|
50
|
-
fragment: any;
|
|
51
|
-
id: string | null;
|
|
52
|
-
metadata: {
|
|
53
|
-
[key: string]: unknown;
|
|
54
|
-
};
|
|
55
|
-
name: string;
|
|
56
|
-
query: any;
|
|
57
|
-
text: string | null;
|
|
58
|
-
operationKind: string;
|
|
59
|
-
}
|
|
60
48
|
interface CacheConfig {
|
|
61
49
|
force?: boolean | null;
|
|
62
50
|
poll?: number | null;
|
|
@@ -88,8 +76,8 @@ interface RelayObservable<T> {
|
|
|
88
76
|
subscribe: (sink: Sink<T>) => UnsubscribeFunction;
|
|
89
77
|
}
|
|
90
78
|
type ObservableFromValue<T> = RelayObservable<T> | Promise<T> | T;
|
|
91
|
-
type FetchFunction = (operation:
|
|
92
|
-
type FetchHookFunction = (operation:
|
|
93
|
-
type SubscribeFunction = (operation:
|
|
79
|
+
type FetchFunction = (operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null) => ObservableFromValue<QueryPayload>;
|
|
80
|
+
type FetchHookFunction = (operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null) => void | ObservableFromValue<QueryPayload>;
|
|
81
|
+
type SubscribeFunction = (operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, observer: any) => RelayObservable<QueryPayload> | Disposable;
|
|
94
82
|
//#endregion
|
|
95
|
-
export { CacheConfig,
|
|
83
|
+
export { CacheConfig, Disposable, FetchFunction, FetchHookFunction, FetchOpts, FetchResponse, GraphQLResponse, GraphQLResponseErrors, Middleware, MiddlewareNextFn, MiddlewareRaw, MiddlewareRawNextFn, MiddlewareSync, ObservableFromValue, PayloadData, QueryPayload, RelayObservable, RelayRequestAny, SubscribeFunction, Uploadable, UploadableMap, Variables };
|
package/dist/definition.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RelayRequest } from "./RelayRequest.js";
|
|
2
2
|
import { RelayRequestBatch } from "./RelayRequestBatch.js";
|
|
3
3
|
import { RelayResponse } from "./RelayResponse.js";
|
|
4
|
+
import { RequestParameters } from "relay-runtime";
|
|
4
5
|
|
|
5
6
|
//#region src/definition.d.ts
|
|
6
7
|
type RelayRequestAny = RelayRequest | RelayRequestBatch;
|
|
@@ -12,7 +13,7 @@ interface MiddlewareRaw {
|
|
|
12
13
|
isRawMiddleware: true;
|
|
13
14
|
}
|
|
14
15
|
interface MiddlewareSync {
|
|
15
|
-
execute: (operation:
|
|
16
|
+
execute: (operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null) => ObservableFromValue<QueryPayload> | null | undefined;
|
|
16
17
|
}
|
|
17
18
|
interface FetchOpts {
|
|
18
19
|
url?: string;
|
|
@@ -41,22 +42,9 @@ interface GraphQLResponse {
|
|
|
41
42
|
data?: any;
|
|
42
43
|
errors?: GraphQLResponseErrors;
|
|
43
44
|
}
|
|
44
|
-
type RNLExecuteFunction = (operation: ConcreteBatch, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null) => RelayObservable<QueryPayload>;
|
|
45
45
|
interface Variables {
|
|
46
46
|
[name: string]: any;
|
|
47
47
|
}
|
|
48
|
-
interface ConcreteBatch {
|
|
49
|
-
kind: 'Batch';
|
|
50
|
-
fragment: any;
|
|
51
|
-
id: string | null;
|
|
52
|
-
metadata: {
|
|
53
|
-
[key: string]: unknown;
|
|
54
|
-
};
|
|
55
|
-
name: string;
|
|
56
|
-
query: any;
|
|
57
|
-
text: string | null;
|
|
58
|
-
operationKind: string;
|
|
59
|
-
}
|
|
60
48
|
interface CacheConfig {
|
|
61
49
|
force?: boolean | null;
|
|
62
50
|
poll?: number | null;
|
|
@@ -88,8 +76,8 @@ interface RelayObservable<T> {
|
|
|
88
76
|
subscribe: (sink: Sink<T>) => UnsubscribeFunction;
|
|
89
77
|
}
|
|
90
78
|
type ObservableFromValue<T> = RelayObservable<T> | Promise<T> | T;
|
|
91
|
-
type FetchFunction = (operation:
|
|
92
|
-
type FetchHookFunction = (operation:
|
|
93
|
-
type SubscribeFunction = (operation:
|
|
79
|
+
type FetchFunction = (operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null) => ObservableFromValue<QueryPayload>;
|
|
80
|
+
type FetchHookFunction = (operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap | null) => void | ObservableFromValue<QueryPayload>;
|
|
81
|
+
type SubscribeFunction = (operation: RequestParameters, variables: Variables, cacheConfig: CacheConfig, observer: any) => RelayObservable<QueryPayload> | Disposable;
|
|
94
82
|
//#endregion
|
|
95
|
-
export { CacheConfig,
|
|
83
|
+
export { CacheConfig, Disposable, FetchFunction, FetchHookFunction, FetchOpts, FetchResponse, GraphQLResponse, GraphQLResponseErrors, Middleware, MiddlewareNextFn, MiddlewareRaw, MiddlewareRawNextFn, MiddlewareSync, ObservableFromValue, PayloadData, QueryPayload, RelayObservable, RelayRequestAny, SubscribeFunction, Uploadable, UploadableMap, Variables };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RelayRequest } from "./RelayRequest.cjs";
|
|
2
2
|
import { RelayRequestBatch } from "./RelayRequestBatch.cjs";
|
|
3
3
|
import { RelayResponse } from "./RelayResponse.cjs";
|
|
4
|
-
import { CacheConfig,
|
|
4
|
+
import { CacheConfig, Disposable, FetchFunction, FetchHookFunction, FetchOpts, FetchResponse, GraphQLResponse, GraphQLResponseErrors, Middleware, MiddlewareNextFn, MiddlewareRaw, MiddlewareRawNextFn, MiddlewareSync, ObservableFromValue, PayloadData, QueryPayload, RelayObservable, RelayRequestAny, SubscribeFunction, Uploadable, UploadableMap, Variables } from "./definition.cjs";
|
|
5
5
|
import { RelayNetworkLayer, RelayNetworkLayerOpts } from "./RelayNetworkLayer.cjs";
|
|
6
6
|
import { RRNLError } from "./RRNLError.cjs";
|
|
7
7
|
import { BatchMiddlewareOpts, RRNLBatchMiddlewareError, RequestWrapper, batchMiddleware } from "./middlewares/batch.cjs";
|
|
@@ -18,4 +18,4 @@ import { uploadMiddleware } from "./middlewares/upload.cjs";
|
|
|
18
18
|
import { export_default } from "./express-middleware/graphqlBatchHTTPWrapper.cjs";
|
|
19
19
|
import { RRNLRequestError, createRequestError, formatGraphQLErrors } from "./createRequestError.cjs";
|
|
20
20
|
import { QueryResponseCache } from "relay-runtime";
|
|
21
|
-
export { type AbortFn, type AuthMiddlewareOpts, type BatchMiddlewareOpts, type BeforeRetryCb, type CacheConfig, type CacheMiddlewareOpts, type
|
|
21
|
+
export { type AbortFn, type AuthMiddlewareOpts, type BatchMiddlewareOpts, type BeforeRetryCb, type CacheConfig, type CacheMiddlewareOpts, type Disposable, type FetchFunction, type FetchHookFunction, type FetchOpts, type FetchResponse, type ForceRetryFn, type GqlErrorMiddlewareOpts, type GraphQLResponse, type GraphQLResponseErrors, type LoggerMiddlewareOpts, type Middleware, type MiddlewareNextFn, type MiddlewareRaw, type MiddlewareRawNextFn, type MiddlewareSync, type ObservableFromValue, type PayloadData, type PerfMiddlewareOpts, type PersistedQueriesMiddlewareOpts, type ProgressOpts, type QueryPayload, QueryResponseCache, RRNLAuthMiddlewareError, RRNLBatchMiddlewareError, RRNLError, RRNLRequestError, RRNLRetryMiddlewareError, RelayNetworkLayer, type RelayNetworkLayerOpts, RelayRequest as RelayNetworkLayerRequest, RelayRequestBatch as RelayNetworkLayerRequestBatch, RelayResponse as RelayNetworkLayerResponse, type RelayObservable, type RelayRequestAny, type RequestWrapper, type RetryAfterFn, type RetryMiddlewareOpts, type StatusCheckFn, type SubscribeFunction, type Uploadable, type UploadableMap, type UrlMiddlewareOpts, type Variables, authMiddleware, batchMiddleware, cacheMiddleware, createRequestError, errorMiddleware, formatGraphQLErrors, export_default as graphqlBatchHTTPWrapper, loggerMiddleware, performanceMiddleware as perfMiddleware, persistedQueriesMiddleware, progressMiddleware, retryMiddleware, uploadMiddleware, urlMiddleware };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RelayRequest } from "./RelayRequest.js";
|
|
2
2
|
import { RelayRequestBatch } from "./RelayRequestBatch.js";
|
|
3
3
|
import { RelayResponse } from "./RelayResponse.js";
|
|
4
|
-
import { CacheConfig,
|
|
4
|
+
import { CacheConfig, Disposable, FetchFunction, FetchHookFunction, FetchOpts, FetchResponse, GraphQLResponse, GraphQLResponseErrors, Middleware, MiddlewareNextFn, MiddlewareRaw, MiddlewareRawNextFn, MiddlewareSync, ObservableFromValue, PayloadData, QueryPayload, RelayObservable, RelayRequestAny, SubscribeFunction, Uploadable, UploadableMap, Variables } from "./definition.js";
|
|
5
5
|
import { RelayNetworkLayer, RelayNetworkLayerOpts } from "./RelayNetworkLayer.js";
|
|
6
6
|
import { RRNLError } from "./RRNLError.js";
|
|
7
7
|
import { BatchMiddlewareOpts, RRNLBatchMiddlewareError, RequestWrapper, batchMiddleware } from "./middlewares/batch.js";
|
|
@@ -18,4 +18,4 @@ import { uploadMiddleware } from "./middlewares/upload.js";
|
|
|
18
18
|
import { export_default } from "./express-middleware/graphqlBatchHTTPWrapper.js";
|
|
19
19
|
import { RRNLRequestError, createRequestError, formatGraphQLErrors } from "./createRequestError.js";
|
|
20
20
|
import { QueryResponseCache } from "relay-runtime";
|
|
21
|
-
export { type AbortFn, type AuthMiddlewareOpts, type BatchMiddlewareOpts, type BeforeRetryCb, type CacheConfig, type CacheMiddlewareOpts, type
|
|
21
|
+
export { type AbortFn, type AuthMiddlewareOpts, type BatchMiddlewareOpts, type BeforeRetryCb, type CacheConfig, type CacheMiddlewareOpts, type Disposable, type FetchFunction, type FetchHookFunction, type FetchOpts, type FetchResponse, type ForceRetryFn, type GqlErrorMiddlewareOpts, type GraphQLResponse, type GraphQLResponseErrors, type LoggerMiddlewareOpts, type Middleware, type MiddlewareNextFn, type MiddlewareRaw, type MiddlewareRawNextFn, type MiddlewareSync, type ObservableFromValue, type PayloadData, type PerfMiddlewareOpts, type PersistedQueriesMiddlewareOpts, type ProgressOpts, type QueryPayload, QueryResponseCache, RRNLAuthMiddlewareError, RRNLBatchMiddlewareError, RRNLError, RRNLRequestError, RRNLRetryMiddlewareError, RelayNetworkLayer, type RelayNetworkLayerOpts, RelayRequest as RelayNetworkLayerRequest, RelayRequestBatch as RelayNetworkLayerRequestBatch, RelayResponse as RelayNetworkLayerResponse, type RelayObservable, type RelayRequestAny, type RequestWrapper, type RetryAfterFn, type RetryMiddlewareOpts, type StatusCheckFn, type SubscribeFunction, type Uploadable, type UploadableMap, type UrlMiddlewareOpts, type Variables, authMiddleware, batchMiddleware, cacheMiddleware, createRequestError, errorMiddleware, formatGraphQLErrors, export_default as graphqlBatchHTTPWrapper, loggerMiddleware, performanceMiddleware as perfMiddleware, persistedQueriesMiddleware, progressMiddleware, retryMiddleware, uploadMiddleware, urlMiddleware };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nsxbet/react-relay-network-modern",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Network Layer for React Relay and Express (Batch Queries, AuthToken, Logging, Retry)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -59,12 +59,16 @@
|
|
|
59
59
|
"relay-runtime": ">=14.0.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
+
"@commitlint/cli": "^21",
|
|
63
|
+
"@commitlint/config-conventional": "^21",
|
|
62
64
|
"@size-limit/preset-small-lib": "^12.1.0",
|
|
63
65
|
"@types/node": "^22",
|
|
66
|
+
"@types/relay-runtime": "^18.2.5",
|
|
64
67
|
"@vitest/coverage-v8": "^3.2.6",
|
|
65
68
|
"fetch-mock": "^9",
|
|
66
69
|
"form-data": "^4.0.5",
|
|
67
70
|
"jsdom": "^29.1.1",
|
|
71
|
+
"lefthook": "^2",
|
|
68
72
|
"oxlint": "^1.68.0",
|
|
69
73
|
"relay-runtime": "^18.2.0",
|
|
70
74
|
"semantic-release": "^25.0.3",
|
|
@@ -75,6 +79,7 @@
|
|
|
75
79
|
"vitest": "^3.2.6"
|
|
76
80
|
},
|
|
77
81
|
"scripts": {
|
|
82
|
+
"prepare": "lefthook install || true",
|
|
78
83
|
"build": "tsdown",
|
|
79
84
|
"test": "vitest run",
|
|
80
85
|
"test:watch": "vitest",
|