@envelop/core 2.4.0-alpha-3936561.0 → 2.4.0-alpha-c0cc559.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/index.js +6 -3
- package/index.mjs +6 -4
- package/package.json +1 -1
- package/utils.d.ts +8 -4
package/index.js
CHANGED
|
@@ -299,7 +299,6 @@ function errorAsyncIterator(source, onError) {
|
|
|
299
299
|
};
|
|
300
300
|
return stream;
|
|
301
301
|
}
|
|
302
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
303
302
|
function getInMemoryLRUCache({ max = 1000, onDelete = () => { }, } = {}) {
|
|
304
303
|
let storage = {};
|
|
305
304
|
let keys = [];
|
|
@@ -342,6 +341,10 @@ function getInMemoryLRUCache({ max = 1000, onDelete = () => { }, } = {}) {
|
|
|
342
341
|
},
|
|
343
342
|
};
|
|
344
343
|
}
|
|
344
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
345
|
+
function isSourceObject(maybeSource) {
|
|
346
|
+
return maybeSource != null && maybeSource.body != null;
|
|
347
|
+
}
|
|
345
348
|
|
|
346
349
|
function createEnvelopOrchestrator(plugins) {
|
|
347
350
|
let schema = null;
|
|
@@ -788,8 +791,7 @@ function createEnvelopOrchestrator(plugins) {
|
|
|
788
791
|
};
|
|
789
792
|
}
|
|
790
793
|
|
|
791
|
-
|
|
792
|
-
const getTimestamp = typeof globalThis !== 'undefined' && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.performance) === null || _a === void 0 ? void 0 : _a.now) ? () => performance.now() : () => Date.now();
|
|
794
|
+
const getTimestamp = typeof performance !== 'undefined' && performance.now ? () => performance.now() : () => Date.now();
|
|
793
795
|
const measure = () => {
|
|
794
796
|
const start = getTimestamp();
|
|
795
797
|
return () => {
|
|
@@ -1340,6 +1342,7 @@ exports.isIntrospectionOperation = isIntrospectionOperation;
|
|
|
1340
1342
|
exports.isIntrospectionOperationString = isIntrospectionOperationString;
|
|
1341
1343
|
exports.isOperationDefinition = isOperationDefinition;
|
|
1342
1344
|
exports.isPluginEnabled = isPluginEnabled;
|
|
1345
|
+
exports.isSourceObject = isSourceObject;
|
|
1343
1346
|
exports.makeExecute = makeExecute;
|
|
1344
1347
|
exports.makeSubscribe = makeSubscribe;
|
|
1345
1348
|
exports.mapAsyncIterator = mapAsyncIterator;
|
package/index.mjs
CHANGED
|
@@ -295,7 +295,6 @@ function errorAsyncIterator(source, onError) {
|
|
|
295
295
|
};
|
|
296
296
|
return stream;
|
|
297
297
|
}
|
|
298
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
299
298
|
function getInMemoryLRUCache({ max = 1000, onDelete = () => { }, } = {}) {
|
|
300
299
|
let storage = {};
|
|
301
300
|
let keys = [];
|
|
@@ -338,6 +337,10 @@ function getInMemoryLRUCache({ max = 1000, onDelete = () => { }, } = {}) {
|
|
|
338
337
|
},
|
|
339
338
|
};
|
|
340
339
|
}
|
|
340
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
341
|
+
function isSourceObject(maybeSource) {
|
|
342
|
+
return maybeSource != null && maybeSource.body != null;
|
|
343
|
+
}
|
|
341
344
|
|
|
342
345
|
function createEnvelopOrchestrator(plugins) {
|
|
343
346
|
let schema = null;
|
|
@@ -784,8 +787,7 @@ function createEnvelopOrchestrator(plugins) {
|
|
|
784
787
|
};
|
|
785
788
|
}
|
|
786
789
|
|
|
787
|
-
|
|
788
|
-
const getTimestamp = typeof globalThis !== 'undefined' && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.performance) === null || _a === void 0 ? void 0 : _a.now) ? () => performance.now() : () => Date.now();
|
|
790
|
+
const getTimestamp = typeof performance !== 'undefined' && performance.now ? () => performance.now() : () => Date.now();
|
|
789
791
|
const measure = () => {
|
|
790
792
|
const start = getTimestamp();
|
|
791
793
|
return () => {
|
|
@@ -1312,4 +1314,4 @@ const useImmediateIntrospection = () => {
|
|
|
1312
1314
|
};
|
|
1313
1315
|
};
|
|
1314
1316
|
|
|
1315
|
-
export { DEFAULT_ERROR_MESSAGE, EnvelopError, enableIf, envelop, envelopIsIntrospectionSymbol, errorAsyncIterator, finalAsyncIterator, formatError, getInMemoryLRUCache, handleStreamOrSingleExecutionResult, isAsyncIterable, isIntrospectionDocument, isIntrospectionOperation, isIntrospectionOperationString, isOperationDefinition, isPluginEnabled, makeExecute, makeSubscribe, mapAsyncIterator, useAsyncSchema, useEnvelop, useErrorHandler, useExtendContext, useImmediateIntrospection, useLazyLoadedSchema, useLogger, useMaskedErrors, usePayloadFormatter, useSchema, useTiming };
|
|
1317
|
+
export { DEFAULT_ERROR_MESSAGE, EnvelopError, enableIf, envelop, envelopIsIntrospectionSymbol, errorAsyncIterator, finalAsyncIterator, formatError, getInMemoryLRUCache, handleStreamOrSingleExecutionResult, isAsyncIterable, isIntrospectionDocument, isIntrospectionOperation, isIntrospectionOperationString, isOperationDefinition, isPluginEnabled, isSourceObject, makeExecute, makeSubscribe, mapAsyncIterator, useAsyncSchema, useEnvelop, useErrorHandler, useExtendContext, useImmediateIntrospection, useLazyLoadedSchema, useLogger, useMaskedErrors, usePayloadFormatter, useSchema, useTiming };
|
package/package.json
CHANGED
package/utils.d.ts
CHANGED
|
@@ -31,12 +31,16 @@ export declare function isAsyncIterable<TType>(maybeAsyncIterable: unknown): may
|
|
|
31
31
|
export declare function handleStreamOrSingleExecutionResult<ContextType = DefaultContext>(payload: OnExecuteDoneEventPayload<ContextType>, fn: OnExecuteDoneHookResultOnNextHook<ContextType>): void | OnExecuteDoneHookResult<ContextType>;
|
|
32
32
|
export declare function finalAsyncIterator<TInput>(source: AsyncIterable<TInput>, onFinal: () => void): AsyncGenerator<TInput>;
|
|
33
33
|
export declare function errorAsyncIterator<TInput>(source: AsyncIterable<TInput>, onError: (err: unknown) => void): AsyncGenerator<TInput>;
|
|
34
|
-
export
|
|
35
|
-
max?: number;
|
|
36
|
-
onDelete?: (key: string, value: V) => void;
|
|
37
|
-
}): {
|
|
34
|
+
export interface BasicCache<V> {
|
|
38
35
|
get(key: string): V | undefined;
|
|
39
36
|
set(key: string, value: V): void;
|
|
40
37
|
delete(key: string): void;
|
|
38
|
+
clear?: () => void;
|
|
39
|
+
}
|
|
40
|
+
export declare function getInMemoryLRUCache<V>({ max, onDelete, }?: {
|
|
41
|
+
max?: number;
|
|
42
|
+
onDelete?: (key: string, value: V) => void;
|
|
43
|
+
}): BasicCache<V> & {
|
|
41
44
|
clear(): void;
|
|
42
45
|
};
|
|
46
|
+
export declare function isSourceObject(maybeSource: any): maybeSource is Source;
|