Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-link-scalars

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link-scalars - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

.history/README_20210719135321.md

3

.codeclimate.json
{
"version": "2",
"exclude_patterns": [
".husky/",
"config/",

@@ -35,3 +36,3 @@ "db/",

"tsconfig.module.json",
"tslint.json",
".eslintrc",
"yarn.lock",

@@ -38,0 +39,0 @@ "package.json",

@@ -1,7 +0,6 @@

import { FieldNode, FragmentDefinitionNode, SelectionNode } from "graphql";
import { FragmentDefinitionNode, SelectionNode } from "graphql";
import { Dictionary } from "../types/dictionary";
import { MutOrRO } from "../types/mut-or-ro";
import { ReducedFieldNode } from "./node-types";
export declare function uniqueNodes<T extends FieldNode>(nodes: T[]): T[];
export declare function replaceFragmentsOn(selections: MutOrRO<SelectionNode[]>, fragmentMap: Dictionary<FragmentDefinitionNode | ReducedFieldNode[]>): ReducedFieldNode[];
export declare function fragmentMapFrom(fragments: FragmentDefinitionNode[]): Dictionary<ReducedFieldNode[]>;

@@ -17,3 +17,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.fragmentMapFrom = exports.replaceFragmentsOn = exports.uniqueNodes = void 0;
exports.fragmentMapFrom = exports.replaceFragmentsOn = void 0;
const lodash_every_1 = __importDefault(require("lodash.every"));

@@ -25,5 +25,20 @@ const lodash_flatmap_1 = __importDefault(require("lodash.flatmap"));

function uniqueNodes(nodes) {
return lodash_uniqby_1.default(nodes, (fn) => { var _a; return JSON.stringify([(_a = fn.alias) === null || _a === void 0 ? void 0 : _a.value, fn.name.value]); });
return lodash_uniqby_1.default(nodes, (fn) => JSON.stringify(fieldNodeKeyTuple(fn)));
}
exports.uniqueNodes = uniqueNodes;
function fieldNodeKeyTuple(fn) {
var _a, _b, _c;
const alias = (_a = fn.alias) === null || _a === void 0 ? void 0 : _a.value;
const name = fn.name.value;
const selections = (_c = (_b = fn.selectionSet) === null || _b === void 0 ? void 0 : _b.selections) !== null && _c !== void 0 ? _c : [];
const selectionKeys = selections.map((sn) => JSON.stringify(selectionKeyTuples(sn))).sort();
return [alias, name, selectionKeys];
}
function selectionKeyTuples(sn) {
if (node_types_1.isFieldNode(sn))
return { field: fieldNodeKeyTuple(sn) };
if (node_types_1.isInlineFragmentNode(sn)) {
return { inlineFragments: sn.selectionSet.selections.map((sn) => selectionKeyTuples(sn)) };
}
return { namedFragment: sn.name.value };
}
function getCleanedSelections(selections, fragmentMap) {

@@ -57,3 +72,4 @@ return lodash_flatmap_1.default(selections, (sn) => {

const resolved = getResolvedFieldNodes(cleaned, fragmentMap);
return uniqueNodes(resolved);
const uniqueList = uniqueNodes(resolved);
return uniqueList;
}

@@ -69,2 +85,2 @@ exports.replaceFragmentsOn = replaceFragmentsOn;

exports.fragmentMapFrom = fragmentMapFrom;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhZ21lbnQtdXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGliL2ZyYWdtZW50LXV0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQ0EsZ0VBQWlDO0FBQ2pDLG9FQUFxQztBQUNyQyx3RUFBeUM7QUFDekMsa0VBQW1DO0FBR25DLDZDQUFtRjtBQUVuRixTQUFnQixXQUFXLENBQXNCLEtBQVU7SUFDekQsT0FBTyx1QkFBTSxDQUFDLEtBQUssRUFBRSxDQUFDLEVBQUUsRUFBRSxFQUFFLFdBQUMsT0FBQSxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsTUFBQSxFQUFFLENBQUMsS0FBSywwQ0FBRSxLQUFLLEVBQUUsRUFBRSxDQUFDLElBQUksQ0FBQy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BQUMsVUFBVSxFQUFFLFdBQVcsQ0FBQyxDQUFDO0lBRTlELElBQUksQ0FBQyxzQkFBSyxDQUFDLE9BQU8sRUFBRSx3QkFBVyxDQUFDLEVBQUU7UUFDaEMsT0FBTyxrQkFBa0IsQ0FBQyxPQUFPLEVBQUUsV0FBVyxDQUFDLENBQUM7S0FDakQ7SUFFRCxNQUFNLFFBQVEsR0FBRyxxQkFBcUIsQ0FBQyxPQUFzQixFQUFFLFdBQVcsQ0FBQyxDQUFDO0lBQzVFLE1BQU0sVUFBVSxHQUFHLFdBQVcsQ0FBQyxRQUFRLENBQUMsQ0FBQztJQUN6QyxPQUFPLFVBQVUsQ0FBQztBQUNwQixDQUFDO0FBYkQsZ0RBYUM7QUFFRCxTQUFnQixlQUFlLENBQUMsU0FBbUM7SUFDakUsTUFBTSxVQUFVLEdBQUcsMEJBQVMsQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsS0FBSyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUN0RSxPQUFPLDBCQUFTLENBQ2QsU0FBUyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFO1FBQ2xCLE1BQU0sVUFBVSxHQUFHLGtCQUFrQixDQUFDLENBQUMsQ0FBQyxZQUFZLENBQUMsVUFBVSxFQUFFLFVBQVUsQ0FBQyxDQUFDO1FBQzdFLE9BQU8sQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxVQUFVLENBQUMsQ0FBQztJQUNwQyxDQUFDLENBQUMsQ0FDSCxDQUFDO0FBQ0osQ0FBQztBQVJELDBDQVFDIn0=
"use strict";
/* tslint:disable:interface-over-type-literal */
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVsbC1mdW5jdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHlwZXMvbnVsbC1mdW5jdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLGdEQUFnRCJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVsbC1mdW5jdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHlwZXMvbnVsbC1mdW5jdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9

@@ -1,7 +0,6 @@

import { FieldNode, FragmentDefinitionNode, SelectionNode } from "graphql";
import { FragmentDefinitionNode, SelectionNode } from "graphql";
import { Dictionary } from "../types/dictionary";
import { MutOrRO } from "../types/mut-or-ro";
import { ReducedFieldNode } from "./node-types";
export declare function uniqueNodes<T extends FieldNode>(nodes: T[]): T[];
export declare function replaceFragmentsOn(selections: MutOrRO<SelectionNode[]>, fragmentMap: Dictionary<FragmentDefinitionNode | ReducedFieldNode[]>): ReducedFieldNode[];
export declare function fragmentMapFrom(fragments: FragmentDefinitionNode[]): Dictionary<ReducedFieldNode[]>;

@@ -17,5 +17,21 @@ var __rest = (this && this.__rest) || function (s, e) {

import { isFieldNode, isInlineFragmentNode } from "./node-types";
export function uniqueNodes(nodes) {
return uniqBy(nodes, (fn) => { var _a; return JSON.stringify([(_a = fn.alias) === null || _a === void 0 ? void 0 : _a.value, fn.name.value]); });
function uniqueNodes(nodes) {
return uniqBy(nodes, (fn) => JSON.stringify(fieldNodeKeyTuple(fn)));
}
function fieldNodeKeyTuple(fn) {
var _a, _b, _c;
const alias = (_a = fn.alias) === null || _a === void 0 ? void 0 : _a.value;
const name = fn.name.value;
const selections = (_c = (_b = fn.selectionSet) === null || _b === void 0 ? void 0 : _b.selections) !== null && _c !== void 0 ? _c : [];
const selectionKeys = selections.map((sn) => JSON.stringify(selectionKeyTuples(sn))).sort();
return [alias, name, selectionKeys];
}
function selectionKeyTuples(sn) {
if (isFieldNode(sn))
return { field: fieldNodeKeyTuple(sn) };
if (isInlineFragmentNode(sn)) {
return { inlineFragments: sn.selectionSet.selections.map((sn) => selectionKeyTuples(sn)) };
}
return { namedFragment: sn.name.value };
}
function getCleanedSelections(selections, fragmentMap) {

@@ -49,3 +65,4 @@ return flatMap(selections, (sn) => {

const resolved = getResolvedFieldNodes(cleaned, fragmentMap);
return uniqueNodes(resolved);
const uniqueList = uniqueNodes(resolved);
return uniqueList;
}

@@ -59,2 +76,2 @@ export function fragmentMapFrom(fragments) {

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhZ21lbnQtdXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGliL2ZyYWdtZW50LXV0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBQ0EsT0FBTyxLQUFLLE1BQU0sY0FBYyxDQUFDO0FBQ2pDLE9BQU8sT0FBTyxNQUFNLGdCQUFnQixDQUFDO0FBQ3JDLE9BQU8sU0FBUyxNQUFNLGtCQUFrQixDQUFDO0FBQ3pDLE9BQU8sTUFBTSxNQUFNLGVBQWUsQ0FBQztBQUduQyxPQUFPLEVBQUUsV0FBVyxFQUFFLG9CQUFvQixFQUFvQixNQUFNLGNBQWMsQ0FBQztBQUVuRixNQUFNLFVBQVUsV0FBVyxDQUFzQixLQUFVO0lBQ3pELE9BQU8sTUFBTSxDQUFDLEtBQUssRUFBRSxDQUFDLEVBQUUsRUFBRSxFQUFFLFdBQUMsT0FBQSxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsTUFBQSxFQUFFLENBQUMsS0FBSywwQ0FBRSxLQUFLLEVBQUUsRUFBRSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ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-literal */
export {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVsbC1mdW5jdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHlwZXMvbnVsbC1mdW5jdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVsbC1mdW5jdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHlwZXMvbnVsbC1mdW5jdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9

@@ -5,2 +5,10 @@ # Changelog

### [2.1.4](https://github.com/eturino/apollo-link-scalars/compare/v2.1.3...v2.1.4) (2021-07-19)
### Bug Fixes
* **deps:** bump zen-observable-ts from 1.0.0 to 1.1.0 ([#367](https://github.com/eturino/apollo-link-scalars/issues/367)) ([457f558](https://github.com/eturino/apollo-link-scalars/commit/457f5583ec8ba576afd9969f7878fc9aac319ee9))
* fix: Scalars not parsed when fragment spreading causes a field to appear multiple times ([fe40256](https://github.com/eturino/apollo-link-scalars/commit/fe40256dffd1a22b53e1a82eb1174451b2f7d883)), closes [#370](https://github.com/eturino/apollo-link-scalars/issues/370)
### [2.1.3](https://github.com/eturino/apollo-link-scalars/compare/v2.1.2...v2.1.3) (2021-04-08)

@@ -7,0 +15,0 @@

{
"name": "apollo-link-scalars",
"version": "2.1.3",
"version": "2.1.4",
"author": "Eduardo Turiño <eturino@eturino.com>",

@@ -14,4 +14,11 @@ "description": "custom apollo link to allow to parse custom scalars",

"keywords": [],
"lint-staged": {
"src/**/*.ts": [
"eslint --fix",
"prettier --write"
]
},
"scripts": {
"prepare": "install-peers",
"lint-staged": "lint-staged",
"prepare": "install-peers && husky install",
"describe": "npm-scripts-info",

@@ -23,6 +30,7 @@ "build": "run-s clean && run-p build:*",

"fix:prettier": "prettier \"src/**/*.ts\" --write",
"fix:tslint": "tslint --fix --project .",
"fix:eslint": "eslint \"src/**/*.ts\" --fix",
"type-check": "tsc --noEmit",
"test": "run-s build test:* type-check",
"test:lint": "tslint --project . && prettier \"src/**/*.ts\" --list-different",
"test:eslint": "eslint \"src/**/*.ts\"",
"test:prettier": "prettier \"src/**/*.ts\" --list-different",
"test:unit": "jest --coverage --config=\"jest.config.js\"",

@@ -65,2 +73,3 @@ "cov": "run-s build cov:html && open-cli coverage/index.html",

"lodash.isnumber": "^3.0.3",
"lodash.isobject": "^3.0.2",
"lodash.isstring": "^4.0.1",

@@ -92,2 +101,3 @@ "lodash.isundefined": "^3.0.1",

"@types/lodash.isnumber": "^3.0.6",
"@types/lodash.isobject": "^3.0.6",
"@types/lodash.isstring": "^4.0.6",

@@ -101,13 +111,20 @@ "@types/lodash.isundefined": "^3.0.6",

"@types/react": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.27.0",
"@typescript-eslint/parser": "^4.27.0",
"cz-conventional-changelog": "^3.1.0",
"eslint": "^7.28.0",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.23.4",
"gh-pages": "^3.1.0",
"github-release-from-changelog": "^2.1.1",
"husky": "^4.2.5",
"husky": "^7.0.1",
"inquirer": "^8.0.0",
"install-peers-cli": "^2.2.0",
"jest": "^26.1.0",
"jest": "^27.0.0",
"lint-staged": "^11.0.0",
"npm-run-all": "^4.1.5",
"open-cli": "^6.0.1",
"open-cli": "^7.0.0",
"prettier": "^2.0.4",
"prettier-plugin-organize-imports": "^1.1.1",
"prettier-plugin-organize-imports": "^2.1.0",
"replace-in-file": "^6.1.0",

@@ -117,9 +134,6 @@ "standard-version": "^9.0.0",

"trash-cli": "^4.0.0",
"ts-jest": "^26.1.1",
"ts-loader": "^8.0.0",
"ts-node": "^9.0.0",
"tslint": "^6.1.1",
"tslint-config-prettier": "^1.18.0",
"tslint-immutable": "^6.0.1",
"typedoc": "^0.20.16",
"ts-jest": "^27.0.1",
"ts-loader": "^9.2.0",
"ts-node": "^10.0.0",
"typedoc": "^0.21.0",
"typedoc-themes-color": "^0.0.10",

@@ -132,8 +146,3 @@ "typescript": "^4.0.2"

}
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
# `apollo-link-scalars`
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

@@ -76,4 +76,6 @@

serialize: (parsed: CustomScalar) => parsed.toString(),
parseValue: (raw: string | number | null): CustomScalar | null => {
return raw ? new CustomScalar(raw) : null;
parseValue: (raw: string): CustomScalar | null => {
if (!raw) return null; // if for some reason we want to treat empty string as null, for example
return new CustomScalar(raw);
}

@@ -159,3 +161,3 @@ }

```yml
```yaml
---

@@ -186,3 +188,3 @@ generates:

#### Changing the behavior of nullable types
#### Changing the behaviour of nullable types

@@ -219,2 +221,24 @@ By passing the `nullFunctions` parameter to `withScalar`, you can change the way that nullable types are handled. The default implementation will leave them exactly as is, i.e. `null` => `null` and `value` => `value`. If instead, you e.g. wish to transform nulls into a Maybe monad, you can supply functions corresponding to the following type. The examples below are based on the Maybe monad from [Seidr](https://github.com/hojberg/seidr) but any implementation will do.

The `nullFunctions` are executed after the normal parsing/serializing. The normal parsing/serializing functions are not called for `null` values.
Both in parsing and serializing, we have the following logic (in pseudocode):
```ts
if (isNone(value)) {
return this.nullFunctions.serialize(value);
}
const serialized = serializeNonNullValue(value);
return this.nullFunctions.serialize(serialized);
```
```ts
if (isNone(value)) {
return this.nullFunctions.parseValue(value);
}
const parsed = parseNonNullValue(value);
return this.nullFunctions.parseValue(parsed);
```
## Acknowledgements

@@ -280,3 +304,3 @@

And finally push the new tags to github and publish the package to npm.
And finally push the new tags to Github and publish the package to `npm`.

@@ -297,3 +321,3 @@ ```sh

This will generate the docs and publish them in github pages.
This will generate the docs and publish them in Github pages.

@@ -333,3 +357,7 @@ ### Generate a version

<td align="center"><a href="https://github.com/nagirrab"><img src="https://avatars.githubusercontent.com/u/1761890?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hugh Barrigan</b></sub></a><br /><a href="https://github.com/eturino/apollo-link-scalars/commits?author=nagirrab" title="Tests">⚠️</a> <a href="https://github.com/eturino/apollo-link-scalars/commits?author=nagirrab" title="Code">💻</a> <a href="#ideas-nagirrab" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/UselessPickles"><img src="https://avatars.githubusercontent.com/u/22800095?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeff Lau</b></sub></a><br /><a href="https://github.com/eturino/apollo-link-scalars/commits?author=UselessPickles" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center"><a href="http://floriancargoet.com"><img src="https://avatars.githubusercontent.com/u/110431?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Florian Cargoët</b></sub></a><br /><a href="https://github.com/eturino/apollo-link-scalars/issues?q=author%3Afloriancargoet" title="Bug reports">🐛</a></td>
</tr>
</table>

@@ -336,0 +364,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc