@blockless/gateway-core
Advanced tools
Comparing version
@@ -15,3 +15,3 @@ export interface BaseError extends Error { | ||
statusCode?: number; | ||
}, T extends unknown[] = [any?, any?, any?]> { | ||
}, T extends unknown[] = [unknown?, unknown?, unknown?]> { | ||
new (...args: T): BaseError & E; | ||
@@ -18,0 +18,0 @@ (...args: T): BaseError & E; |
@@ -21,2 +21,3 @@ "use strict"; | ||
*/ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
function createErrorClasses(errorCodesConfig) { | ||
@@ -39,2 +40,3 @@ const errorCodes = {}; | ||
exports.createErrorClasses = createErrorClasses; | ||
/* eslint-enable @typescript-eslint/no-explicit-any */ | ||
//# sourceMappingURL=base.js.map |
export declare const BaseErrors: { | ||
ERR_INVALID_DB_CONNECTION: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_FUNCTION_NOT_FOUND: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_FUNCTION_NOT_DEPLOYED: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_FUNCTION_MANIFEST_NOT_FOUND: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_FUNCTION_ENVVARS_NOT_FOUND: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_FUNCTION_MANIFEST_INVALID: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_FUNCTION_NAME_EXISTS: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_FUNCTION_DEPLOY_FAILED: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_FUNCTION_UPDATE_FAILED: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_FUNCTION_DELETE_FAILED: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_HEAD_FAILED_TO_EXECUTE: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_HEAD_FAILED_TO_INSTALL: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_USER_NONCE_NOT_GENERATED: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_USER_NOT_FOUND: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_USER_WALLET_NOT_FOUND: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_USER_SIGNATURE_MISMATCH: import("./base").BaseErrorConstructor<any, [any?, any?, any?]>; | ||
ERR_INVALID_DB_CONNECTION: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_FUNCTION_NOT_FOUND: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_FUNCTION_NOT_DEPLOYED: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_FUNCTION_MANIFEST_NOT_FOUND: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_FUNCTION_ENVVARS_NOT_FOUND: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_FUNCTION_MANIFEST_INVALID: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_FUNCTION_NAME_EXISTS: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_FUNCTION_DEPLOY_FAILED: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_FUNCTION_UPDATE_FAILED: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_FUNCTION_DELETE_FAILED: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_HEAD_FAILED_TO_EXECUTE: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_HEAD_FAILED_TO_INSTALL: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_USER_NONCE_NOT_GENERATED: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_USER_NOT_FOUND: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_USER_WALLET_NOT_FOUND: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
ERR_USER_SIGNATURE_MISMATCH: import("./base").BaseErrorConstructor<any, [unknown?, unknown?, unknown?]>; | ||
}; |
@@ -28,3 +28,3 @@ import { INameValueArray } from '../interfaces/generic'; | ||
type: string; | ||
body: any; | ||
body: unknown; | ||
}; | ||
@@ -31,0 +31,0 @@ /** |
@@ -33,3 +33,3 @@ "use strict"; | ||
function parseFunctionRequestVars(requestData) { | ||
let requestVars = []; | ||
const requestVars = []; | ||
requestVars.push({ | ||
@@ -36,0 +36,0 @@ name: 'BLS_REQUEST_METHOD', |
export interface IHeadNodePayload { | ||
function_id: string; | ||
method: string; | ||
parameters: any; | ||
parameters: unknown; | ||
config: { | ||
@@ -6,0 +6,0 @@ permissions: string[]; |
@@ -32,3 +32,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let userLookupQuery = {}; | ||
const userLookupQuery = {}; | ||
userLookupQuery[userWallet.walletKey] = { $regex: new RegExp(userWallet.walletAddress, 'i') }; | ||
@@ -51,4 +51,4 @@ const user = yield user_1.default.findOne(userLookupQuery); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let nonce = crypto_1.default.randomBytes(16).toString('base64'); | ||
let userLookupQuery = {}; | ||
const nonce = crypto_1.default.randomBytes(16).toString('base64'); | ||
const userLookupQuery = {}; | ||
userLookupQuery[walletKey] = walletAddress; | ||
@@ -55,0 +55,0 @@ const user = yield user_1.default.findOneAndUpdate(userLookupQuery, { nonce }, { upsert: true, new: true }); |
@@ -207,3 +207,3 @@ "use strict"; | ||
// Build a new function object | ||
let newFunction = new function_1.default({ | ||
const newFunction = new function_1.default({ | ||
userId, | ||
@@ -231,3 +231,3 @@ type, | ||
const updateObj = {}; | ||
if (!!data.functionName) { | ||
if (data.functionName) { | ||
// Validate function name | ||
@@ -248,7 +248,7 @@ const functionName = (0, functions_1.validateFunctionName)(data.functionName); | ||
// TODO: Validate function status here | ||
if (!!data.status) { | ||
if (data.status) { | ||
updateObj.status = data.status; | ||
} | ||
// Update deployment function ID, used by the CLI deployment command | ||
if (!!data.functionId) { | ||
if (data.functionId) { | ||
updateObj.functionId = data.functionId; | ||
@@ -298,3 +298,3 @@ } | ||
} | ||
else if (!!envVars[key]) { | ||
else if (envVars[key]) { | ||
if (encryptionKey) { | ||
@@ -301,0 +301,0 @@ const { value, iv } = (0, encryption_1.encryptValue)(envVars[key], encryptionKey); |
@@ -37,4 +37,5 @@ "use strict"; | ||
} | ||
catch (error) { } | ||
i++; | ||
catch (_a) { | ||
i++; | ||
} | ||
} | ||
@@ -41,0 +42,0 @@ throw new errors_1.BaseErrors.ERR_HEAD_FAILED_TO_EXECUTE(); |
@@ -14,3 +14,3 @@ import { IFunctionRequestData } from '../models/function'; | ||
type: string; | ||
body: any; | ||
body: unknown; | ||
}>; |
{ | ||
"name": "@blockless/gateway-core", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
118888
1.31%80
1.27%2237
0.13%1
-50%51
Infinity%