@gqloom/core 0.12.1 → 0.13.0
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/{chunk-CTAAG5j7.js → chunk-Bp6m_JJh.js} +1 -1
- package/dist/context.cjs +9 -9
- package/dist/context.d.cts +5 -6
- package/dist/context.d.ts +5 -6
- package/dist/context.js +1 -1
- package/dist/{index-BxqR3YsC.d.cts → index-DBqGrLn7.d.cts} +313 -297
- package/dist/{index-sGKC4BRu.d.ts → index-DWjUYc0-.d.ts} +314 -297
- package/dist/index.cjs +440 -429
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +409 -399
- package/dist/{context-BxqO4Eg9.js → parse-resolving-fields-BS_BL7I_.js} +67 -62
- package/dist/{context-DshDoxiE.cjs → parse-resolving-fields-BXQG_2Z-.cjs} +71 -60
- package/package.json +1 -1
package/dist/context.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_parse_resolving_fields = require('./parse-resolving-fields-BXQG_2Z-.cjs');
|
|
2
2
|
let node_async_hooks = require("node:async_hooks");
|
|
3
|
-
node_async_hooks =
|
|
3
|
+
node_async_hooks = require_parse_resolving_fields.__toESM(node_async_hooks);
|
|
4
4
|
|
|
5
5
|
//#region src/context/async-iterator.ts
|
|
6
6
|
function bindAsyncIterator(storage, generator) {
|
|
@@ -28,7 +28,7 @@ const resolverPayloadStorage = new node_async_hooks.AsyncLocalStorage();
|
|
|
28
28
|
*/
|
|
29
29
|
function useResolverPayload() {
|
|
30
30
|
const payload = resolverPayloadStorage.getStore();
|
|
31
|
-
if (payload === void 0 ||
|
|
31
|
+
if (payload === void 0 || require_parse_resolving_fields.isOnlyMemoryPayload(payload)) return;
|
|
32
32
|
return payload;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
@@ -44,7 +44,7 @@ function useContext() {
|
|
|
44
44
|
function useMemoizationMap() {
|
|
45
45
|
const payload = resolverPayloadStorage.getStore();
|
|
46
46
|
if (payload == null) return;
|
|
47
|
-
return
|
|
47
|
+
return require_parse_resolving_fields.getMemoizationMap(payload);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* A class that provides dependency injection and context sharing capabilities.
|
|
@@ -199,8 +199,8 @@ function createMemoization(...args) {
|
|
|
199
199
|
}
|
|
200
200
|
const createProvider = (...keyValues) => {
|
|
201
201
|
return ({ next, payload, operation }) => {
|
|
202
|
-
const store = payload ??
|
|
203
|
-
const map =
|
|
202
|
+
const store = payload ?? require_parse_resolving_fields.onlyMemoization();
|
|
203
|
+
const map = require_parse_resolving_fields.getMemoizationMap(store);
|
|
204
204
|
if (map) for (const [key, value] of keyValues) map.set(key, value);
|
|
205
205
|
if (operation === "subscription.subscribe") return resolverPayloadStorage.run(store, async () => {
|
|
206
206
|
let result = await next();
|
|
@@ -223,8 +223,8 @@ const asyncContextProvider = Object.assign(createProvider(), {
|
|
|
223
223
|
return createProvider(...keyValues);
|
|
224
224
|
},
|
|
225
225
|
run: async (resolve, ...keyValues) => {
|
|
226
|
-
const store =
|
|
227
|
-
const map =
|
|
226
|
+
const store = require_parse_resolving_fields.onlyMemoization();
|
|
227
|
+
const map = require_parse_resolving_fields.getMemoizationMap(store);
|
|
228
228
|
for (const [key, value] of keyValues) map.set(key, value);
|
|
229
229
|
return resolverPayloadStorage.run(store, resolve);
|
|
230
230
|
}
|
|
@@ -241,7 +241,7 @@ const asyncContextProvider = Object.assign(createProvider(), {
|
|
|
241
241
|
const useResolvingFields = createContext(() => {
|
|
242
242
|
const payload = useResolverPayload();
|
|
243
243
|
if (!payload) return;
|
|
244
|
-
return
|
|
244
|
+
return require_parse_resolving_fields.getResolvingFields(payload);
|
|
245
245
|
});
|
|
246
246
|
|
|
247
247
|
//#endregion
|
package/dist/context.d.cts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Lt as OnlyMemoizationPayload, dn as ResolverPayload, gn as BaseField, lt as ResolvingFields, yt as Middleware } from "./index-DBqGrLn7.cjs";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
|
+
//#region src/context/async-iterator.d.ts
|
|
5
|
+
declare function bindAsyncIterator<TAsyncLocalStorage extends AsyncLocalStorage<unknown>, TAsyncIterator extends AsyncIterator<unknown, unknown, unknown>>(storage: TAsyncLocalStorage, generator: TAsyncIterator): TAsyncIterator;
|
|
6
|
+
declare function isAsyncIterator(value: unknown): value is AsyncIterator<unknown, unknown, unknown>;
|
|
7
|
+
//#endregion
|
|
4
8
|
//#region src/context/context.d.ts
|
|
5
|
-
|
|
6
9
|
/**
|
|
7
10
|
* the AsyncLocalStorage instance to store the resolver payload
|
|
8
11
|
*/
|
|
@@ -170,8 +173,4 @@ declare const asyncContextProvider: AsyncContextProvider;
|
|
|
170
173
|
*/
|
|
171
174
|
declare const useResolvingFields: CallableContext<ResolvingFields | undefined>;
|
|
172
175
|
//#endregion
|
|
173
|
-
//#region src/context/async-iterator.d.ts
|
|
174
|
-
declare function bindAsyncIterator<TAsyncLocalStorage extends AsyncLocalStorage<unknown>, TAsyncIterator extends AsyncIterator<unknown, unknown, unknown>>(storage: TAsyncLocalStorage, generator: TAsyncIterator): TAsyncIterator;
|
|
175
|
-
declare function isAsyncIterator(value: unknown): value is AsyncIterator<unknown, unknown, unknown>;
|
|
176
|
-
//#endregion
|
|
177
176
|
export { AsyncContextProvider, CallableContext, CallableContextMemoization, ContextMemoization, InjectableContext, asyncContextProvider, bindAsyncIterator, createContext, createMemoization, isAsyncIterator, resolverPayloadStorage, useContext, useMemoizationMap, useResolverPayload, useResolvingFields };
|
package/dist/context.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Lt as OnlyMemoizationPayload, dn as ResolverPayload, gn as BaseField, lt as ResolvingFields, yt as Middleware } from "./index-DWjUYc0-.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
|
+
//#region src/context/async-iterator.d.ts
|
|
5
|
+
declare function bindAsyncIterator<TAsyncLocalStorage extends AsyncLocalStorage<unknown>, TAsyncIterator extends AsyncIterator<unknown, unknown, unknown>>(storage: TAsyncLocalStorage, generator: TAsyncIterator): TAsyncIterator;
|
|
6
|
+
declare function isAsyncIterator(value: unknown): value is AsyncIterator<unknown, unknown, unknown>;
|
|
7
|
+
//#endregion
|
|
4
8
|
//#region src/context/context.d.ts
|
|
5
|
-
|
|
6
9
|
/**
|
|
7
10
|
* the AsyncLocalStorage instance to store the resolver payload
|
|
8
11
|
*/
|
|
@@ -170,8 +173,4 @@ declare const asyncContextProvider: AsyncContextProvider;
|
|
|
170
173
|
*/
|
|
171
174
|
declare const useResolvingFields: CallableContext<ResolvingFields | undefined>;
|
|
172
175
|
//#endregion
|
|
173
|
-
//#region src/context/async-iterator.d.ts
|
|
174
|
-
declare function bindAsyncIterator<TAsyncLocalStorage extends AsyncLocalStorage<unknown>, TAsyncIterator extends AsyncIterator<unknown, unknown, unknown>>(storage: TAsyncLocalStorage, generator: TAsyncIterator): TAsyncIterator;
|
|
175
|
-
declare function isAsyncIterator(value: unknown): value is AsyncIterator<unknown, unknown, unknown>;
|
|
176
|
-
//#endregion
|
|
177
176
|
export { AsyncContextProvider, CallableContext, CallableContextMemoization, ContextMemoization, InjectableContext, asyncContextProvider, bindAsyncIterator, createContext, createMemoization, isAsyncIterator, resolverPayloadStorage, useContext, useMemoizationMap, useResolverPayload, useResolvingFields };
|
package/dist/context.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getMemoizationMap, getResolvingFields, isOnlyMemoryPayload, onlyMemoization } from "./
|
|
1
|
+
import { a as getMemoizationMap, n as getResolvingFields, o as isOnlyMemoryPayload, s as onlyMemoization } from "./parse-resolving-fields-BS_BL7I_.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
4
|
//#region src/context/async-iterator.ts
|