@graphql-tools/utils 8.2.3 → 9.0.0-alpha-881b29e4.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 +74 -18
- package/index.mjs +73 -19
- package/memoize.d.ts +2 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -484,24 +484,24 @@ function astFromValueUntyped(value) {
|
|
|
484
484
|
const integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
|
|
485
485
|
|
|
486
486
|
function memoize1(fn) {
|
|
487
|
-
const
|
|
487
|
+
const cache1 = new WeakMap();
|
|
488
488
|
return function memoized(a1) {
|
|
489
|
-
const cachedValue =
|
|
489
|
+
const cachedValue = cache1.get(a1);
|
|
490
490
|
if (cachedValue === undefined) {
|
|
491
491
|
const newValue = fn(a1);
|
|
492
|
-
|
|
492
|
+
cache1.set(a1, newValue);
|
|
493
493
|
return newValue;
|
|
494
494
|
}
|
|
495
495
|
return cachedValue;
|
|
496
496
|
};
|
|
497
497
|
}
|
|
498
498
|
function memoize2(fn) {
|
|
499
|
-
const
|
|
499
|
+
const cache1 = new WeakMap();
|
|
500
500
|
return function memoized(a1, a2) {
|
|
501
|
-
let cache2 =
|
|
501
|
+
let cache2 = cache1.get(a1);
|
|
502
502
|
if (!cache2) {
|
|
503
503
|
cache2 = new WeakMap();
|
|
504
|
-
|
|
504
|
+
cache1.set(a1, cache2);
|
|
505
505
|
const newValue = fn(a1, a2);
|
|
506
506
|
cache2.set(a2, newValue);
|
|
507
507
|
return newValue;
|
|
@@ -516,12 +516,12 @@ function memoize2(fn) {
|
|
|
516
516
|
};
|
|
517
517
|
}
|
|
518
518
|
function memoize3(fn) {
|
|
519
|
-
const
|
|
519
|
+
const cache1 = new WeakMap();
|
|
520
520
|
return function memoized(a1, a2, a3) {
|
|
521
|
-
let cache2 =
|
|
521
|
+
let cache2 = cache1.get(a1);
|
|
522
522
|
if (!cache2) {
|
|
523
523
|
cache2 = new WeakMap();
|
|
524
|
-
|
|
524
|
+
cache1.set(a1, cache2);
|
|
525
525
|
const cache3 = new WeakMap();
|
|
526
526
|
cache2.set(a2, cache3);
|
|
527
527
|
const newValue = fn(a1, a2, a3);
|
|
@@ -546,12 +546,12 @@ function memoize3(fn) {
|
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
548
|
function memoize4(fn) {
|
|
549
|
-
const
|
|
549
|
+
const cache1 = new WeakMap();
|
|
550
550
|
return function memoized(a1, a2, a3, a4) {
|
|
551
|
-
let cache2 =
|
|
551
|
+
let cache2 = cache1.get(a1);
|
|
552
552
|
if (!cache2) {
|
|
553
553
|
cache2 = new WeakMap();
|
|
554
|
-
|
|
554
|
+
cache1.set(a1, cache2);
|
|
555
555
|
const cache3 = new WeakMap();
|
|
556
556
|
cache2.set(a2, cache3);
|
|
557
557
|
const cache4 = new WeakMap();
|
|
@@ -588,12 +588,12 @@ function memoize4(fn) {
|
|
|
588
588
|
};
|
|
589
589
|
}
|
|
590
590
|
function memoize5(fn) {
|
|
591
|
-
const
|
|
591
|
+
const cache1 = new WeakMap();
|
|
592
592
|
return function memoized(a1, a2, a3, a4, a5) {
|
|
593
|
-
let cache2 =
|
|
593
|
+
let cache2 = cache1.get(a1);
|
|
594
594
|
if (!cache2) {
|
|
595
595
|
cache2 = new WeakMap();
|
|
596
|
-
|
|
596
|
+
cache1.set(a1, cache2);
|
|
597
597
|
const cache3 = new WeakMap();
|
|
598
598
|
cache2.set(a2, cache3);
|
|
599
599
|
const cache4 = new WeakMap();
|
|
@@ -643,13 +643,25 @@ function memoize5(fn) {
|
|
|
643
643
|
return cachedValue;
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
|
-
|
|
646
|
+
function memoize1of2(fn) {
|
|
647
|
+
const cache1 = new WeakMap();
|
|
648
|
+
return function memoized(a1, a2) {
|
|
649
|
+
const cachedValue = cache1.get(a1);
|
|
650
|
+
if (cachedValue === undefined) {
|
|
651
|
+
const newValue = fn(a1, a2);
|
|
652
|
+
cache1.set(a1, newValue);
|
|
653
|
+
return newValue;
|
|
654
|
+
}
|
|
655
|
+
return cachedValue;
|
|
656
|
+
};
|
|
657
|
+
}
|
|
647
658
|
function memoize2of4(fn) {
|
|
659
|
+
const cache1 = new WeakMap();
|
|
648
660
|
return function memoized(a1, a2, a3, a4) {
|
|
649
|
-
let cache2 =
|
|
661
|
+
let cache2 = cache1.get(a1);
|
|
650
662
|
if (!cache2) {
|
|
651
663
|
cache2 = new WeakMap();
|
|
652
|
-
|
|
664
|
+
cache1.set(a1, cache2);
|
|
653
665
|
const newValue = fn(a1, a2, a3, a4);
|
|
654
666
|
cache2.set(a2, newValue);
|
|
655
667
|
return newValue;
|
|
@@ -663,6 +675,48 @@ function memoize2of4(fn) {
|
|
|
663
675
|
return cachedValue;
|
|
664
676
|
};
|
|
665
677
|
}
|
|
678
|
+
function memoize4ofMany(fn) {
|
|
679
|
+
const cache1 = new WeakMap();
|
|
680
|
+
return function memoized(a1, a2, a3, a4, ...args) {
|
|
681
|
+
let cache2 = cache1.get(a1);
|
|
682
|
+
if (!cache2) {
|
|
683
|
+
cache2 = new WeakMap();
|
|
684
|
+
cache1.set(a1, cache2);
|
|
685
|
+
const cache3 = new WeakMap();
|
|
686
|
+
cache2.set(a2, cache3);
|
|
687
|
+
const cache4 = new WeakMap();
|
|
688
|
+
cache3.set(a3, cache4);
|
|
689
|
+
const newValue = fn(a1, a2, a3, a4, ...args);
|
|
690
|
+
cache4.set(a4, newValue);
|
|
691
|
+
return newValue;
|
|
692
|
+
}
|
|
693
|
+
let cache3 = cache2.get(a2);
|
|
694
|
+
if (!cache3) {
|
|
695
|
+
cache3 = new WeakMap();
|
|
696
|
+
cache2.set(a2, cache3);
|
|
697
|
+
const cache4 = new WeakMap();
|
|
698
|
+
cache3.set(a3, cache4);
|
|
699
|
+
const newValue = fn(a1, a2, a3, a4, ...args);
|
|
700
|
+
cache4.set(a4, newValue);
|
|
701
|
+
return newValue;
|
|
702
|
+
}
|
|
703
|
+
const cache4 = cache3.get(a3);
|
|
704
|
+
if (!cache4) {
|
|
705
|
+
const cache4 = new WeakMap();
|
|
706
|
+
cache3.set(a3, cache4);
|
|
707
|
+
const newValue = fn(a1, a2, a3, a4, ...args);
|
|
708
|
+
cache4.set(a4, newValue);
|
|
709
|
+
return newValue;
|
|
710
|
+
}
|
|
711
|
+
const cachedValue = cache4.get(a4);
|
|
712
|
+
if (cachedValue === undefined) {
|
|
713
|
+
const newValue = fn(a1, a2, a3, a4, ...args);
|
|
714
|
+
cache4.set(a4, newValue);
|
|
715
|
+
return newValue;
|
|
716
|
+
}
|
|
717
|
+
return cachedValue;
|
|
718
|
+
};
|
|
719
|
+
}
|
|
666
720
|
|
|
667
721
|
function getDefinedRootType(schema, operation) {
|
|
668
722
|
const rootTypeMap = getRootTypeMap(schema);
|
|
@@ -4252,10 +4306,12 @@ exports.makeDirectiveNodes = makeDirectiveNodes;
|
|
|
4252
4306
|
exports.mapAsyncIterator = mapAsyncIterator;
|
|
4253
4307
|
exports.mapSchema = mapSchema;
|
|
4254
4308
|
exports.memoize1 = memoize1;
|
|
4309
|
+
exports.memoize1of2 = memoize1of2;
|
|
4255
4310
|
exports.memoize2 = memoize2;
|
|
4256
4311
|
exports.memoize2of4 = memoize2of4;
|
|
4257
4312
|
exports.memoize3 = memoize3;
|
|
4258
4313
|
exports.memoize4 = memoize4;
|
|
4314
|
+
exports.memoize4ofMany = memoize4ofMany;
|
|
4259
4315
|
exports.memoize5 = memoize5;
|
|
4260
4316
|
exports.mergeDeep = mergeDeep;
|
|
4261
4317
|
exports.modifyObjectFields = modifyObjectFields;
|
package/index.mjs
CHANGED
|
@@ -480,24 +480,24 @@ function astFromValueUntyped(value) {
|
|
|
480
480
|
const integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/;
|
|
481
481
|
|
|
482
482
|
function memoize1(fn) {
|
|
483
|
-
const
|
|
483
|
+
const cache1 = new WeakMap();
|
|
484
484
|
return function memoized(a1) {
|
|
485
|
-
const cachedValue =
|
|
485
|
+
const cachedValue = cache1.get(a1);
|
|
486
486
|
if (cachedValue === undefined) {
|
|
487
487
|
const newValue = fn(a1);
|
|
488
|
-
|
|
488
|
+
cache1.set(a1, newValue);
|
|
489
489
|
return newValue;
|
|
490
490
|
}
|
|
491
491
|
return cachedValue;
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
494
|
function memoize2(fn) {
|
|
495
|
-
const
|
|
495
|
+
const cache1 = new WeakMap();
|
|
496
496
|
return function memoized(a1, a2) {
|
|
497
|
-
let cache2 =
|
|
497
|
+
let cache2 = cache1.get(a1);
|
|
498
498
|
if (!cache2) {
|
|
499
499
|
cache2 = new WeakMap();
|
|
500
|
-
|
|
500
|
+
cache1.set(a1, cache2);
|
|
501
501
|
const newValue = fn(a1, a2);
|
|
502
502
|
cache2.set(a2, newValue);
|
|
503
503
|
return newValue;
|
|
@@ -512,12 +512,12 @@ function memoize2(fn) {
|
|
|
512
512
|
};
|
|
513
513
|
}
|
|
514
514
|
function memoize3(fn) {
|
|
515
|
-
const
|
|
515
|
+
const cache1 = new WeakMap();
|
|
516
516
|
return function memoized(a1, a2, a3) {
|
|
517
|
-
let cache2 =
|
|
517
|
+
let cache2 = cache1.get(a1);
|
|
518
518
|
if (!cache2) {
|
|
519
519
|
cache2 = new WeakMap();
|
|
520
|
-
|
|
520
|
+
cache1.set(a1, cache2);
|
|
521
521
|
const cache3 = new WeakMap();
|
|
522
522
|
cache2.set(a2, cache3);
|
|
523
523
|
const newValue = fn(a1, a2, a3);
|
|
@@ -542,12 +542,12 @@ function memoize3(fn) {
|
|
|
542
542
|
};
|
|
543
543
|
}
|
|
544
544
|
function memoize4(fn) {
|
|
545
|
-
const
|
|
545
|
+
const cache1 = new WeakMap();
|
|
546
546
|
return function memoized(a1, a2, a3, a4) {
|
|
547
|
-
let cache2 =
|
|
547
|
+
let cache2 = cache1.get(a1);
|
|
548
548
|
if (!cache2) {
|
|
549
549
|
cache2 = new WeakMap();
|
|
550
|
-
|
|
550
|
+
cache1.set(a1, cache2);
|
|
551
551
|
const cache3 = new WeakMap();
|
|
552
552
|
cache2.set(a2, cache3);
|
|
553
553
|
const cache4 = new WeakMap();
|
|
@@ -584,12 +584,12 @@ function memoize4(fn) {
|
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
586
|
function memoize5(fn) {
|
|
587
|
-
const
|
|
587
|
+
const cache1 = new WeakMap();
|
|
588
588
|
return function memoized(a1, a2, a3, a4, a5) {
|
|
589
|
-
let cache2 =
|
|
589
|
+
let cache2 = cache1.get(a1);
|
|
590
590
|
if (!cache2) {
|
|
591
591
|
cache2 = new WeakMap();
|
|
592
|
-
|
|
592
|
+
cache1.set(a1, cache2);
|
|
593
593
|
const cache3 = new WeakMap();
|
|
594
594
|
cache2.set(a2, cache3);
|
|
595
595
|
const cache4 = new WeakMap();
|
|
@@ -639,13 +639,25 @@ function memoize5(fn) {
|
|
|
639
639
|
return cachedValue;
|
|
640
640
|
};
|
|
641
641
|
}
|
|
642
|
-
|
|
642
|
+
function memoize1of2(fn) {
|
|
643
|
+
const cache1 = new WeakMap();
|
|
644
|
+
return function memoized(a1, a2) {
|
|
645
|
+
const cachedValue = cache1.get(a1);
|
|
646
|
+
if (cachedValue === undefined) {
|
|
647
|
+
const newValue = fn(a1, a2);
|
|
648
|
+
cache1.set(a1, newValue);
|
|
649
|
+
return newValue;
|
|
650
|
+
}
|
|
651
|
+
return cachedValue;
|
|
652
|
+
};
|
|
653
|
+
}
|
|
643
654
|
function memoize2of4(fn) {
|
|
655
|
+
const cache1 = new WeakMap();
|
|
644
656
|
return function memoized(a1, a2, a3, a4) {
|
|
645
|
-
let cache2 =
|
|
657
|
+
let cache2 = cache1.get(a1);
|
|
646
658
|
if (!cache2) {
|
|
647
659
|
cache2 = new WeakMap();
|
|
648
|
-
|
|
660
|
+
cache1.set(a1, cache2);
|
|
649
661
|
const newValue = fn(a1, a2, a3, a4);
|
|
650
662
|
cache2.set(a2, newValue);
|
|
651
663
|
return newValue;
|
|
@@ -659,6 +671,48 @@ function memoize2of4(fn) {
|
|
|
659
671
|
return cachedValue;
|
|
660
672
|
};
|
|
661
673
|
}
|
|
674
|
+
function memoize4ofMany(fn) {
|
|
675
|
+
const cache1 = new WeakMap();
|
|
676
|
+
return function memoized(a1, a2, a3, a4, ...args) {
|
|
677
|
+
let cache2 = cache1.get(a1);
|
|
678
|
+
if (!cache2) {
|
|
679
|
+
cache2 = new WeakMap();
|
|
680
|
+
cache1.set(a1, cache2);
|
|
681
|
+
const cache3 = new WeakMap();
|
|
682
|
+
cache2.set(a2, cache3);
|
|
683
|
+
const cache4 = new WeakMap();
|
|
684
|
+
cache3.set(a3, cache4);
|
|
685
|
+
const newValue = fn(a1, a2, a3, a4, ...args);
|
|
686
|
+
cache4.set(a4, newValue);
|
|
687
|
+
return newValue;
|
|
688
|
+
}
|
|
689
|
+
let cache3 = cache2.get(a2);
|
|
690
|
+
if (!cache3) {
|
|
691
|
+
cache3 = new WeakMap();
|
|
692
|
+
cache2.set(a2, cache3);
|
|
693
|
+
const cache4 = new WeakMap();
|
|
694
|
+
cache3.set(a3, cache4);
|
|
695
|
+
const newValue = fn(a1, a2, a3, a4, ...args);
|
|
696
|
+
cache4.set(a4, newValue);
|
|
697
|
+
return newValue;
|
|
698
|
+
}
|
|
699
|
+
const cache4 = cache3.get(a3);
|
|
700
|
+
if (!cache4) {
|
|
701
|
+
const cache4 = new WeakMap();
|
|
702
|
+
cache3.set(a3, cache4);
|
|
703
|
+
const newValue = fn(a1, a2, a3, a4, ...args);
|
|
704
|
+
cache4.set(a4, newValue);
|
|
705
|
+
return newValue;
|
|
706
|
+
}
|
|
707
|
+
const cachedValue = cache4.get(a4);
|
|
708
|
+
if (cachedValue === undefined) {
|
|
709
|
+
const newValue = fn(a1, a2, a3, a4, ...args);
|
|
710
|
+
cache4.set(a4, newValue);
|
|
711
|
+
return newValue;
|
|
712
|
+
}
|
|
713
|
+
return cachedValue;
|
|
714
|
+
};
|
|
715
|
+
}
|
|
662
716
|
|
|
663
717
|
function getDefinedRootType(schema, operation) {
|
|
664
718
|
const rootTypeMap = getRootTypeMap(schema);
|
|
@@ -4178,4 +4232,4 @@ function fixSchemaAst(schema, options) {
|
|
|
4178
4232
|
return schema;
|
|
4179
4233
|
}
|
|
4180
4234
|
|
|
4181
|
-
export { AggregateErrorImpl as AggregateError, MapperKind, addTypes, appendObjectFields, asArray, assertSome, astFromArg, astFromDirective, astFromEnumType, astFromEnumValue, astFromField, astFromInputField, astFromInputObjectType, astFromInterfaceType, astFromObjectType, astFromScalarType, astFromSchema, astFromUnionType, astFromValueUntyped, buildOperationNodeForField, checkValidationErrors, collectComment, collectFields, collectSubFields, compareNodes, compareStrings, correctASTNodes, createNamedStub, createStub, createVariableNameGenerator, dedentBlockStringValue, filterSchema, fixSchemaAst, forEachDefaultValue, forEachField, getArgumentValues, getBlockStringIndentation, getBuiltInForStub, getComment, getDefinedRootType, getDeprecatableDirectiveNodes, getDescription, getDirective, getDirectiveInExtensions, getDirectiveNodes, getDirectives, getDirectivesInExtensions, getDocumentNodeFromSchema, getFieldsWithDirectives, getImplementingTypes, getLeadingCommentBlock, getResolversFromSchema, getResponseKeyFromInfo, getRootTypeMap, getRootTypeNames, getRootTypes, healSchema, healTypes, implementsAbstractType, inspect, isAsyncIterable, isDescribable, isDocumentNode, isDocumentString, isNamedStub, isSome, isValidPath, makeDeprecatedDirective, makeDirectiveNode, makeDirectiveNodes, mapAsyncIterator, mapSchema, memoize1, memoize2, memoize2of4, memoize3, memoize4, memoize5, mergeDeep, modifyObjectFields, nodeToString, observableToAsyncIterable, parseGraphQLJSON, parseGraphQLSDL, parseInputValue, parseInputValueLiteral, parseSelectionSet, printComment, printSchemaWithDirectives, printWithComments, pruneSchema, pushComment, relocatedError, removeObjectFields, renameType, resetComments, rewireTypes, selectObjectFields, serializeInputValue, transformCommentsToDescriptions, transformInputValue, updateArgument, validateGraphQlDocuments, valueMatchesCriteria, visitData, visitErrors, visitResult, withCancel };
|
|
4235
|
+
export { AggregateErrorImpl as AggregateError, MapperKind, addTypes, appendObjectFields, asArray, assertSome, astFromArg, astFromDirective, astFromEnumType, astFromEnumValue, astFromField, astFromInputField, astFromInputObjectType, astFromInterfaceType, astFromObjectType, astFromScalarType, astFromSchema, astFromUnionType, astFromValueUntyped, buildOperationNodeForField, checkValidationErrors, collectComment, collectFields, collectSubFields, compareNodes, compareStrings, correctASTNodes, createNamedStub, createStub, createVariableNameGenerator, dedentBlockStringValue, filterSchema, fixSchemaAst, forEachDefaultValue, forEachField, getArgumentValues, getBlockStringIndentation, getBuiltInForStub, getComment, getDefinedRootType, getDeprecatableDirectiveNodes, getDescription, getDirective, getDirectiveInExtensions, getDirectiveNodes, getDirectives, getDirectivesInExtensions, getDocumentNodeFromSchema, getFieldsWithDirectives, getImplementingTypes, getLeadingCommentBlock, getResolversFromSchema, getResponseKeyFromInfo, getRootTypeMap, getRootTypeNames, getRootTypes, healSchema, healTypes, implementsAbstractType, inspect, isAsyncIterable, isDescribable, isDocumentNode, isDocumentString, isNamedStub, isSome, isValidPath, makeDeprecatedDirective, makeDirectiveNode, makeDirectiveNodes, mapAsyncIterator, mapSchema, memoize1, memoize1of2, memoize2, memoize2of4, memoize3, memoize4, memoize4ofMany, memoize5, mergeDeep, modifyObjectFields, nodeToString, observableToAsyncIterable, parseGraphQLJSON, parseGraphQLSDL, parseInputValue, parseInputValueLiteral, parseSelectionSet, printComment, printSchemaWithDirectives, printWithComments, pruneSchema, pushComment, relocatedError, removeObjectFields, renameType, resetComments, rewireTypes, selectObjectFields, serializeInputValue, transformCommentsToDescriptions, transformInputValue, updateArgument, validateGraphQlDocuments, valueMatchesCriteria, visitData, visitErrors, visitResult, withCancel };
|
package/memoize.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ export declare function memoize2<F extends (a1: any, a2: any) => any>(fn: F): F;
|
|
|
3
3
|
export declare function memoize3<F extends (a1: any, a2: any, a3: any) => any>(fn: F): F;
|
|
4
4
|
export declare function memoize4<F extends (a1: any, a2: any, a3: any, a4: any) => any>(fn: F): F;
|
|
5
5
|
export declare function memoize5<F extends (a1: any, a2: any, a3: any, a4: any, a5: any) => any>(fn: F): F;
|
|
6
|
+
export declare function memoize1of2<F extends (a1: any, a2: any) => any>(fn: F): F;
|
|
6
7
|
export declare function memoize2of4<F extends (a1: any, a2: any, a3: any, a4: any) => any>(fn: F): F;
|
|
8
|
+
export declare function memoize4ofMany<F extends (a1: any, a2: any, a3: any, a4: any, ...args: Array<any>) => any>(fn: F): F;
|