@8base/file-server-sdk
Advanced tools
Comparing version 0.0.22 to 0.0.23
import { ApolloLink, Observable, Operation, NextLink } from 'apollo-link-core'; | ||
export declare const MAXIMUM_OBJECT_DEEP = 10; | ||
export declare const mutateOperationVariablesDeep: <T extends Object>(partialObject: T, handler: (object: T, fieldName: keyof T) => void, counter: any) => void; | ||
export declare const mutateOperationVariables: <T extends Object>(partialObject: T, handler: (object: T, fieldName: keyof T) => void) => void; | ||
export default class FileUploadLink extends ApolloLink { | ||
@@ -3,0 +6,0 @@ private url; |
@@ -14,2 +14,19 @@ var __extends = (this && this.__extends) || (function () { | ||
var isObject = function (value) { return value !== null && typeof value === 'object'; }; | ||
export var MAXIMUM_OBJECT_DEEP = 10; | ||
export var mutateOperationVariablesDeep = function (partialObject, handler, counter) { | ||
if (counter > MAXIMUM_OBJECT_DEEP) | ||
return; | ||
for (var fieldName in partialObject) { | ||
var currentField = partialObject[fieldName]; | ||
if (currentField instanceof File) { | ||
handler(partialObject, fieldName); | ||
} | ||
else if (isObject(currentField)) { | ||
mutateOperationVariablesDeep(currentField, handler, ++counter); | ||
} | ||
} | ||
}; | ||
export var mutateOperationVariables = function (partialObject, handler) { | ||
return mutateOperationVariablesDeep(partialObject, handler, 0); | ||
}; | ||
var FileUploadLink = (function (_super) { | ||
@@ -40,14 +57,3 @@ __extends(FileUploadLink, _super); | ||
}; | ||
var mutateOperationVariables = function (partialObject) { | ||
for (var fieldName in partialObject) { | ||
var currentField = partialObject[fieldName]; | ||
if (currentField instanceof File) { | ||
handleFile(partialObject, fieldName); | ||
} | ||
else if (isObject(currentField)) { | ||
mutateOperationVariables(currentField); | ||
} | ||
} | ||
}; | ||
mutateOperationVariables(operation.variables || {}); | ||
mutateOperationVariables(operation.variables || {}, handleFile); | ||
return new Observable(function (observer) { | ||
@@ -54,0 +60,0 @@ Promise.all(promises) |
{ | ||
"name": "@8base/file-server-sdk", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"description": "JavaScript SDK for working with files at 8base", | ||
@@ -8,4 +8,5 @@ "main": "./lib/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "jest", | ||
"build": "tsc", | ||
"start": "npm run build -- --watch", | ||
"tslint": "tslint -c tslint.json -p tsconfig.json --type-check", | ||
@@ -20,2 +21,3 @@ "preversion": "npm run tslint", | ||
"apollo-link-core": "0.5.4", | ||
"fast-memoize": "^2.2.8", | ||
"graphql": "^0.10.5", | ||
@@ -28,2 +30,3 @@ "typed-graphql": "^1.0.2" | ||
"@types/graphql": "^0.11.5", | ||
"@types/jest": "^21.1.6", | ||
"@types/node": "^8.0.34", | ||
@@ -33,5 +36,10 @@ "@types/ws": "^3.2.0", | ||
"graphql-tag": "^2.4.2", | ||
"jest": "^21.2.1", | ||
"ts-jest": "^21.2.2", | ||
"tslint": "^5.7.0", | ||
"typescript": "^2.5.1" | ||
}, | ||
"peerDependencies": { | ||
"apollo-link-core": "0.5.4" | ||
}, | ||
"repository": { | ||
@@ -44,3 +52,16 @@ "type": "git", | ||
}, | ||
"homepage": "https://gitlab.com/8base-shared/file-server-sdk#README" | ||
"homepage": "https://gitlab.com/8base-shared/file-server-sdk#README", | ||
"jest": { | ||
"transform": { | ||
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
}, | ||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json" | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
2713
1
106584
6
12
+ Addedfast-memoize@^2.2.8
+ Addedfast-memoize@2.5.2(transitive)