Comparing version 2.2.0 to 2.3.0-alpha-2198a71.0
@@ -6,8 +6,4 @@ 'use strict'; | ||
const object = require('../Utils/object.js'); | ||
const mergeWith = require('lodash/mergeWith.js'); | ||
const mergeWith = require('@gqty/utils/mergeWith'); | ||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
const mergeWith__default = /*#__PURE__*/_interopDefault(mergeWith); | ||
function createCache(normalization) { | ||
@@ -33,3 +29,3 @@ const cache = {}; | ||
normalization == null ? void 0 : normalization.scanNormalizedObjects(data); | ||
mergeWith__default["default"](cache, { [prefix]: data }, onObjectMergeConflict); | ||
mergeWith.mergeWith(cache, { [prefix]: data }, onObjectMergeConflict); | ||
} | ||
@@ -36,0 +32,0 @@ return { |
@@ -7,3 +7,3 @@ 'use strict'; | ||
const cycle = require('../Utils/cycle.js'); | ||
require('lodash/mergeWith.js'); | ||
require('@gqty/utils/mergeWith'); | ||
@@ -10,0 +10,0 @@ function createPersistenceHelpers(clientCache, selectionManager) { |
@@ -11,3 +11,3 @@ 'use strict'; | ||
const object = require('../Utils/object.js'); | ||
require('lodash/mergeWith.js'); | ||
require('@gqty/utils/mergeWith'); | ||
const promise = require('../Utils/promise.js'); | ||
@@ -14,0 +14,0 @@ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
const object = require('../Utils/object.js'); | ||
require('lodash/mergeWith.js'); | ||
require('@gqty/utils/mergeWith'); | ||
@@ -9,0 +9,0 @@ function getFields(accessor, ...keys) { |
@@ -6,3 +6,3 @@ 'use strict'; | ||
const object = require('../Utils/object.js'); | ||
require('lodash/mergeWith.js'); | ||
require('@gqty/utils/mergeWith'); | ||
@@ -9,0 +9,0 @@ function getFirstNonNullValue(list) { |
@@ -6,3 +6,3 @@ 'use strict'; | ||
const object = require('../Utils/object.js'); | ||
require('lodash/mergeWith.js'); | ||
require('@gqty/utils/mergeWith'); | ||
@@ -9,0 +9,0 @@ function selectFields(accessor, fields = "*", recursionDepth = 1) { |
@@ -65,3 +65,3 @@ 'use strict'; | ||
}), | ||
selections: selections[0].length || selections[1].length ? selections : void 0 | ||
selections: selections[0].length ? selections : void 0 | ||
}) | ||
@@ -68,0 +68,0 @@ }; |
@@ -7,8 +7,4 @@ 'use strict'; | ||
const object = require('../Utils/object.js'); | ||
const mergeWith = require('lodash/mergeWith.js'); | ||
const mergeWith = require('@gqty/utils/mergeWith'); | ||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
const mergeWith__default = /*#__PURE__*/_interopDefault(mergeWith); | ||
function toString(v) { | ||
@@ -162,3 +158,3 @@ switch (typeof v) { | ||
if (currentObject !== incomingValue) { | ||
return normalizedCache[idNewValue] = mergeWith__default["default"]({}, currentObject, incomingValue, onObjectMergeConflict); | ||
return normalizedCache[idNewValue] = mergeWith.mergeWith({}, currentObject, incomingValue, onObjectMergeConflict); | ||
} | ||
@@ -165,0 +161,0 @@ return incomingValue; |
{ | ||
"name": "gqty", | ||
"version": "2.2.0", | ||
"version": "2.3.0-alpha-2198a71.0", | ||
"description": "gqty client without queries", | ||
@@ -15,3 +15,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"lodash": "^4.17.21" | ||
"@gqty/utils": "^0.1.0-alpha-2198a71.0" | ||
}, | ||
@@ -30,3 +30,2 @@ "repository": { | ||
"module": "index.mjs", | ||
"types": "index.d.ts", | ||
"exports": { | ||
@@ -42,4 +41,3 @@ ".": { | ||
"./package.json": "./package.json" | ||
}, | ||
"readme": "# [GQty](https://gqty.dev) [![Documentation](https://img.shields.io/badge/documentation-documentation?color=C00B84)](https://gqty.dev)\n\n> GQty is a fully-featured GraphQL client, which lowers the barrier of entry towards using GraphQL.\n\nData requirements within your application are picked up automatically, freeing you from having to maintain GraphQL queries by-hand. It offers a first-class TypeScript experience. See API documentation at all times within autocomplete.\n\nMake breaking changes to your API, and see type-errors exactly where things are breaking, in realtime. No more running a separate validation step.\n\n**More documentation is available at [gqty.dev/docs/getting-started](https://gqty.dev/docs/getting-started).**\n\n<a href=\"https://gqty.dev\">\n <img alt=\"Example usage\" src=\"https://user-images.githubusercontent.com/13242392/112103674-fddc4980-8ba1-11eb-8c83-b527dcb0243d.PNG\" />\n</a>\n" | ||
} | ||
} |
@@ -9,3 +9,3 @@ import type { Selection } from '../Selection'; | ||
type: 'query' | 'mutation' | 'subscription'; | ||
}, normalization?: boolean | undefined, isGlobalCache?: boolean | undefined) => BuiltQuery; | ||
}, normalization?: boolean, isGlobalCache?: boolean) => BuiltQuery; | ||
export {}; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
const object = require('../Utils/object.js'); | ||
require('lodash/mergeWith.js'); | ||
require('@gqty/utils/mergeWith'); | ||
const cachedJSON = require('../Utils/cachedJSON.js'); | ||
@@ -9,0 +9,0 @@ |
@@ -7,3 +7,3 @@ 'use strict'; | ||
const debounce = require('../Utils/debounce.js'); | ||
require('lodash/mergeWith.js'); | ||
require('@gqty/utils/mergeWith'); | ||
const promise = require('../Utils/promise.js'); | ||
@@ -10,0 +10,0 @@ |
@@ -15,14 +15,7 @@ import { Selection, SelectionConstructorArgs } from './selection'; | ||
} | ||
export declare type AliasBackupTuple = [aliasKey: string, alias: string]; | ||
export declare type VariableHashTuple = [ | ||
serializedVariables: string, | ||
incVariablesStringId: number | ||
variablesStringId: string | ||
]; | ||
export declare type AliasIncTuple = [key: string | number, incId: number]; | ||
export declare type SelectionsBackup = [ | ||
AliasBackupTuple[], | ||
VariableHashTuple[], | ||
AliasIncTuple[], | ||
string | ||
]; | ||
export declare type SelectionsBackup = [VariableHashTuple[], string]; | ||
export declare function createSelectionManager(): SelectionManager; |
@@ -5,2 +5,3 @@ 'use strict'; | ||
const sha1 = require('@gqty/utils/sha1'); | ||
const cachedJSON = require('../Utils/cachedJSON.js'); | ||
@@ -38,5 +39,5 @@ const selection = require('./selection.js'); | ||
} | ||
const selectionsBackupVersion = "v0"; | ||
const selectionsBackupVersion = "v1"; | ||
function isSelectionsBackup(selectionsBackup) { | ||
return Array.isArray(selectionsBackup) && Array.isArray(selectionsBackup[0]) && Array.isArray(selectionsBackup[1]) && Array.isArray(selectionsBackup[2]) && selectionsBackup[3] === selectionsBackupVersion; | ||
return Array.isArray(selectionsBackup) && Array.isArray(selectionsBackup[0]) && selectionsBackup[1] === selectionsBackupVersion; | ||
} | ||
@@ -46,5 +47,2 @@ let uniqueSelectionId = 0; | ||
const selectionCache = /* @__PURE__ */ new Map(); | ||
const incIds = {}; | ||
const aliasMap = /* @__PURE__ */ new Map(); | ||
let incHashId = -1; | ||
const stringsHash = {}; | ||
@@ -56,17 +54,8 @@ let restoredBackup; | ||
if ((hashId = stringsHash[serializedVariables]) === void 0) { | ||
hashId = stringsHash[serializedVariables] = ++incHashId; | ||
hashId = stringsHash[serializedVariables] = sha1.sha1(serializedVariables).slice(0, 5); | ||
if (restoredBackup) | ||
restoredBackup[1].push([serializedVariables, hashId]); | ||
restoredBackup[0].push([serializedVariables, hashId]); | ||
} | ||
return hashId; | ||
} | ||
function getKeyHashId(key) { | ||
let hashId; | ||
if ((hashId = stringsHash[key]) === void 0) { | ||
hashId = stringsHash[key] = ++incHashId; | ||
if (restoredBackup) | ||
restoredBackup[1].push([key, hashId]); | ||
} | ||
return hashId; | ||
} | ||
function restore(backup2) { | ||
@@ -76,44 +65,19 @@ if (!isSelectionsBackup(backup2)) | ||
restoredBackup = backup2; | ||
for (const [aliasKey, alias] of backup2[0]) { | ||
aliasMap.set(aliasKey, alias); | ||
for (const [stringKey, hashIdValue] of backup2[0]) { | ||
stringsHash[stringKey] = hashIdValue; | ||
} | ||
for (const [stringKey, incHashIdValue] of backup2[1]) { | ||
stringsHash[stringKey] = incHashIdValue; | ||
incHashId = incHashIdValue; | ||
} | ||
for (const [key, incId] of backup2[2]) { | ||
incIds[key] = incId; | ||
} | ||
} | ||
function backup() { | ||
if (restoredBackup) { | ||
restoredBackup[2] = []; | ||
for (const key in incIds) | ||
restoredBackup[2].push([~~key, incIds[key]]); | ||
restoredBackup[0] = []; | ||
return restoredBackup; | ||
} | ||
const backup2 = [[], [], [], selectionsBackupVersion]; | ||
for (const [aliasKey, alias] of aliasMap.entries()) { | ||
backup2[0].push([aliasKey, alias]); | ||
} | ||
const backup2 = [[], selectionsBackupVersion]; | ||
for (const serializedVariables in stringsHash) { | ||
backup2[1].push([serializedVariables, stringsHash[serializedVariables]]); | ||
backup2[0].push([serializedVariables, stringsHash[serializedVariables]]); | ||
} | ||
for (const key in incIds) | ||
backup2[2].push([~~key, incIds[key]]); | ||
return restoredBackup = backup2; | ||
} | ||
function getVariableAlias(key, variables, variableTypes) { | ||
var _a; | ||
const hashedKey = typeof key === "string" ? getKeyHashId(key) : key; | ||
const aliasKey = `${hashedKey}-${getSerializedVariablesId(variables)}-${getSerializedVariablesId(variableTypes)}`; | ||
let alias = aliasMap.get(aliasKey); | ||
if (alias == null) { | ||
(_a = incIds[hashedKey]) != null ? _a : incIds[hashedKey] = -1; | ||
alias = `${key}${++incIds[hashedKey]}`; | ||
aliasMap.set(aliasKey, alias); | ||
if (restoredBackup) | ||
restoredBackup[0].push([aliasKey, alias]); | ||
} | ||
return alias; | ||
return key + "_" + getSerializedVariablesId(variableTypes) + "_" + getSerializedVariablesId(variables); | ||
} | ||
@@ -120,0 +84,0 @@ function getSelection({ |
@@ -6,4 +6,4 @@ export declare const isInteger: (v: any) => v is number; | ||
export * from './cycle'; | ||
export { default as mergeWith } from 'lodash/mergeWith.js'; | ||
export { mergeWith } from '@gqty/utils/mergeWith'; | ||
export * from './selectionsInclude'; | ||
export * from './promise'; |
@@ -8,10 +8,6 @@ 'use strict'; | ||
const cycle = require('./cycle.js'); | ||
const mergeWith = require('lodash/mergeWith.js'); | ||
const mergeWith = require('@gqty/utils/mergeWith'); | ||
const selectionsInclude = require('./selectionsInclude.js'); | ||
const promise = require('./promise.js'); | ||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
const mergeWith__default = /*#__PURE__*/_interopDefault(mergeWith); | ||
const isInteger = (v) => Number.isInteger(v); | ||
@@ -35,3 +31,3 @@ function isEmptyObject(obj) { | ||
enumerable: true, | ||
get: function () { return mergeWith__default["default"]; } | ||
get: function () { return mergeWith.mergeWith; } | ||
}); | ||
@@ -38,0 +34,0 @@ exports.isAnySelectionIncluded = selectionsInclude.isAnySelectionIncluded; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
239158
6641
1
+ Added@gqty/utils@0.1.0-alpha-f8099f3.0(transitive)
- Removedlodash@^4.17.21
- Removedlodash@4.17.21(transitive)