diff --git a/lib/basic-loader.js b/lib/basic-loader.js index f37573be..5dc8092c 100644 --- a/lib/basic-loader.js +++ b/lib/basic-loader.js @@ -33,7 +33,7 @@ function loadFile(callback, options) { const documentDescriptor = options.documentDescriptor; if (documentDescriptor === void 0 || documentDescriptor == null) { - throw new Error(`loadFile requires fileDescriptor option`); + throw new Error('loadFile requires fileDescriptor option'); } fs.readFile(filePath, 'utf8', (err, data) => { @@ -52,7 +52,7 @@ function loadFileStream(options) { const documentMetadata = options.documentMetadata; if (documentMetadata === void 0 || documentMetadata == null) { - throw new Error(`loadFileStream requires documentMetadata option`); + throw new Error('loadFileStream requires documentMetadata option'); } let uriPrefix = options.uriPrefix; diff --git a/lib/documents.js b/lib/documents.js index 12f05121..be280c32 100644 --- a/lib/documents.js +++ b/lib/documents.js @@ -526,7 +526,7 @@ Documents.prototype.advanceLsqt = function temporalAdvanceLsqt() { /** @ignore */ function readStatusValidator(statusCode) { return (statusCode < 400 || statusCode === 404) ? - null : "response with invalid "+statusCode+" status"; + null : 'response with invalid '+statusCode+' status'; } /** @ignore */ function singleReadOutputTransform(headers, data) { diff --git a/lib/endpoint-proxy.js b/lib/endpoint-proxy.js index 36afb095..949e0512 100644 --- a/lib/endpoint-proxy.js +++ b/lib/endpoint-proxy.js @@ -394,7 +394,7 @@ function expandDataDeclaration(id, dataDeclaration) { function expandParamDeclaration(paramDeclaration) { const paramName = paramDeclaration.name; if (paramName === void 0 || paramName === null) { - throw new Error(`missing parameter name`); + throw new Error('missing parameter name'); } expandDataDeclaration('${paramName} parameter', paramDeclaration); @@ -471,7 +471,7 @@ function expandReturnDeclaration(returnDeclaration) { function expandFunctionDeclaration(functionDeclaration) { const functionName = functionDeclaration.functionName; if (functionName === void 0 || functionName === null) { - throw new Error(`missing function name`); + throw new Error('missing function name'); } let paramsKind = 'empty'; @@ -566,7 +566,7 @@ function expandFunctionDeclaration(functionDeclaration) { } function expandEndpointDeclaration(endpointDeclaration) { const moduleExtension = endpointDeclaration.moduleExtension; - if (typeof moduleExtension !== "string" || moduleExtension.length === 0) { + if (typeof moduleExtension !== 'string' || moduleExtension.length === 0) { throw new Error('invalid module extension configuration: ' + moduleExtension); } else if (!moduleExtension.startsWith('.')) { endpointDeclaration.moduleExtension = '.' + moduleExtension; diff --git a/lib/endpointDeclarationValidator.js b/lib/endpointDeclarationValidator.js index e4db59c5..a34a325b 100644 --- a/lib/endpointDeclarationValidator.js +++ b/lib/endpointDeclarationValidator.js @@ -6,76 +6,76 @@ const Ajv = require('ajv'); const endpointDeclarationSchema = -{"$schema": "http://json-schema.org/draft-07/schema#", - "title": "MarkLogic Endpoint Function Declaration", - "$comment": "SIMPLIFIED TO THE STABLE DECLARATIONS USED FOR CODE GENERATION", - "type": "object", - "definitions": { - "desc": { - "type":"string", "description":"Documentation about the property" +{'$schema': 'http://json-schema.org/draft-07/schema#', + 'title': 'MarkLogic Endpoint Function Declaration', + '$comment': 'SIMPLIFIED TO THE STABLE DECLARATIONS USED FOR CODE GENERATION', + 'type': 'object', + 'definitions': { + 'desc': { + 'type':'string', 'description':'Documentation about the property' }, - "datatype": { - "type":"string", "description":"The type of the value", - "enum":[ - "boolean", "date", "dateTime", "dayTimeDuration", "decimal", "double", "float", - "int", "long", "string", "time", "unsignedInt", "unsignedLong", - "array", "object", - "binaryDocument", "jsonDocument", "textDocument", "xmlDocument", - "session" + 'datatype': { + 'type':'string', 'description':'The type of the value', + 'enum':[ + 'boolean', 'date', 'dateTime', 'dayTimeDuration', 'decimal', 'double', 'float', + 'int', 'long', 'string', 'time', 'unsignedInt', 'unsignedLong', + 'array', 'object', + 'binaryDocument', 'jsonDocument', 'textDocument', 'xmlDocument', + 'session' ] }, - "nullable": { - "type":"boolean", "description":"Whether a null value is allowed", - "default":false + 'nullable': { + 'type':'boolean', 'description':'Whether a null value is allowed', + 'default':false }, - "multiple": { - "type":"boolean", "description":"Whether multiple values are allowed", - "default":false + 'multiple': { + 'type':'boolean', 'description':'Whether multiple values are allowed', + 'default':false } // "$comment": "SIMPLIFIED BY DELETING doubleMeter, doubleLiteral, ulMeter, AND unsignedLongLiteral" }, - "propertyNames": { + 'propertyNames': { // "$comment": "MODIFIED TO ALLOW FOR PROPERTIES DELETED DURING SIMPLIFICATION OR ADDED IN LATER RELEASES", - "pattern": "^\\$?[A-Za-z_][\\w.-]*$" + 'pattern': '^\\$?[A-Za-z_][\\w.-]*$' }, - "properties": { - "functionName": { - "type":"string", "description":"The name of a database function provided by a service declared by service.json" + 'properties': { + 'functionName': { + 'type':'string', 'description':'The name of a database function provided by a service declared by service.json' }, - "endpoint": { - "type":"string", "description":"The full path name of a standalone bulk IO endpoint" + 'endpoint': { + 'type':'string', 'description':'The full path name of a standalone bulk IO endpoint' }, - "desc": {"$ref":"#/definitions/desc"}, - "params": { - "type":"array", "description":"The parameters of the function", - "items": { - "type":"object", - "required": ["name", "datatype"], - "propertyNames": { - "pattern": "^(\\$[A-Za-z_][\\w.-]*|name|desc|datatype|nullable|multiple)$" + 'desc': {'$ref':'#/definitions/desc'}, + 'params': { + 'type':'array', 'description':'The parameters of the function', + 'items': { + 'type':'object', + 'required': ['name', 'datatype'], + 'propertyNames': { + 'pattern': '^(\\$[A-Za-z_][\\w.-]*|name|desc|datatype|nullable|multiple)$' }, - "properties": { - "name": { - "type":"string", "description":"The name of the function parameter" + 'properties': { + 'name': { + 'type':'string', 'description':'The name of the function parameter' }, - "desc": {"$ref":"#/definitions/desc"}, - "datatype": {"$ref":"#/definitions/datatype"}, - "nullable": {"$ref":"#/definitions/nullable"}, - "multiple": {"$ref":"#/definitions/multiple"} + 'desc': {'$ref':'#/definitions/desc'}, + 'datatype': {'$ref':'#/definitions/datatype'}, + 'nullable': {'$ref':'#/definitions/nullable'}, + 'multiple': {'$ref':'#/definitions/multiple'} } } }, - "return": { - "type":"object", "description":"The return value of the function", - "required": ["datatype"], - "propertyNames": { - "pattern": "^(\\$[A-Za-z_][\\w.-]*|desc|datatype|nullable|multiple)$" + 'return': { + 'type':'object', 'description':'The return value of the function', + 'required': ['datatype'], + 'propertyNames': { + 'pattern': '^(\\$[A-Za-z_][\\w.-]*|desc|datatype|nullable|multiple)$' }, - "properties": { - "desc": {"$ref":"#/definitions/desc"}, - "datatype": {"$ref":"#/definitions/datatype"}, - "nullable": {"$ref":"#/definitions/nullable"}, - "multiple": {"$ref":"#/definitions/multiple"} + 'properties': { + 'desc': {'$ref':'#/definitions/desc'}, + 'datatype': {'$ref':'#/definitions/datatype'}, + 'nullable': {'$ref':'#/definitions/nullable'}, + 'multiple': {'$ref':'#/definitions/multiple'} } } // "$comment": "SIMPLIFIED BY DELETING errorDetail AND monitoring" diff --git a/lib/internal.js b/lib/internal.js index 73e60761..fbe8edb6 100644 --- a/lib/internal.js +++ b/lib/internal.js @@ -3,9 +3,9 @@ */ 'use strict'; -const Operation = require("./operation"); -const requester = require("./requester.js"); -const mlutil = require("./mlutil"); +const Operation = require('./operation'); +const requester = require('./requester.js'); +const mlutil = require('./mlutil'); class InternalClass { constructor(clientObject) { this.clientObject = clientObject; @@ -18,7 +18,7 @@ class InternalClass { if (requestOptionsCallback) { requestOptionsCallback(requestOptions); } - const operation = new Operation("", this.clientObject, requestOptions, "single", "single"); + const operation = new Operation('', this.clientObject, requestOptions, 'single', 'single'); if (operationCallback) { operationCallback(operation); } diff --git a/lib/marklogic.js b/lib/marklogic.js index e967f703..83ad0639 100644 --- a/lib/marklogic.js +++ b/lib/marklogic.js @@ -29,7 +29,7 @@ var Operation = require('./operation.js'); var requester = require('./requester.js'); let internal = require('./internal.js'); -const proxy = require("./endpoint-proxy.js"); +const proxy = require('./endpoint-proxy.js'); const dns = require('dns'); /** diff --git a/lib/mlutil.js b/lib/mlutil.js index 5ce86785..46d1b03f 100644 --- a/lib/mlutil.js +++ b/lib/mlutil.js @@ -2,7 +2,7 @@ * Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. */ 'use strict'; -var util = require("util"); +var util = require('util'); var multipartBoundary = 'MLBOUND_' + Date.UTC(2014,12,31); diff --git a/lib/operation.js b/lib/operation.js index c5327f95..68ab3066 100644 --- a/lib/operation.js +++ b/lib/operation.js @@ -271,7 +271,7 @@ function OperationHeaders( var lastChar = versionId.charAt(versionId.length - 1); this.versionId = ( (firstChar === '"' && lastChar === '"') || - (firstChar === "'" && lastChar === "'") + (firstChar === '\'' && lastChar === '\'') ) ? versionId.substring(1, versionId.length - 1) : versionId; } diff --git a/lib/patch-builder.js b/lib/patch-builder.js index 207c9533..673ef102 100644 --- a/lib/patch-builder.js +++ b/lib/patch-builder.js @@ -164,7 +164,7 @@ function library(module) { } var extension = module.substring((module.lastIndexOf('.')+1), module.length); - if(extension === "sjs") { + if(extension === 'sjs') { return {'replace-library':{ at: '/ext/marklogic/patch/apply/'+module }}; @@ -590,7 +590,7 @@ function pathLanguage() { ); } - return {"pathlang": pathlang}; + return {'pathlang': pathlang}; } /** diff --git a/lib/plan-builder-base.js b/lib/plan-builder-base.js index 664f4360..70e3a791 100644 --- a/lib/plan-builder-base.js +++ b/lib/plan-builder-base.js @@ -131,7 +131,7 @@ function castArg(arg, funcName, paramName, argPos, paramTypes) { return true; } throw new Error( - `bm25LengthWeight must be a number` + 'bm25LengthWeight must be a number' ); default: return false; @@ -285,7 +285,7 @@ function castArg(arg, funcName, paramName, argPos, paramTypes) { return true; } if(key === 'quality') { - if(typeof value !== "number") { + if(typeof value !== 'number') { throw new Error( `${argLabel(funcName, paramName, argPos)} - ${key} key must be type of number` ); @@ -320,7 +320,7 @@ function castArg(arg, funcName, paramName, argPos, paramTypes) { } return objKeysPlanSchemaDef.every(key => { if(key === 'kind') { - if(typeof arg[key] !== "string") { + if(typeof arg[key] !== 'string') { throw new Error( `${argLabel(funcName, paramName, argPos)} has another type than string` ); @@ -329,7 +329,7 @@ function castArg(arg, funcName, paramName, argPos, paramTypes) { } } if(key === 'mode') { - if(typeof arg[key] !== "string") { + if(typeof arg[key] !== 'string') { throw new Error( `${argLabel(funcName, paramName, argPos)} has another type than string` ); @@ -337,7 +337,7 @@ function castArg(arg, funcName, paramName, argPos, paramTypes) { return true; } if(key === 'schemaUri') { - if(typeof arg[key] !== "string") { + if(typeof arg[key] !== 'string') { throw new Error( `${argLabel(funcName, paramName, argPos)} has another type than string` ); @@ -350,7 +350,7 @@ function castArg(arg, funcName, paramName, argPos, paramTypes) { const value = arg[key]; const type = typeof value; if(key === 'path') { - if(type !== "string") { + if(type !== 'string') { throw new Error( `${argLabel(funcName, paramName, argPos)} should be a type of string` ); @@ -366,7 +366,7 @@ function castArg(arg, funcName, paramName, argPos, paramTypes) { return true; } if(key === 'params') { - if(type !== "object") { + if(type !== 'object') { throw new Error( `${argLabel(funcName, paramName, argPos)} should be a type of object` ); @@ -381,7 +381,7 @@ function castArg(arg, funcName, paramName, argPos, paramTypes) { } objKeys.every(key => { if(key === 'column') { - if(typeof arg[key] !== "string") { + if(typeof arg[key] !== 'string') { throw new Error( `${argLabel(funcName, paramName, argPos)} has another type than string` ); @@ -538,7 +538,7 @@ function makeSingleArgs(funcName, minArity, paramDef, args) { function exportOperators(plan) { const operList = plan._operators; if (!Array.isArray(operList)) { - throw new Error(`operator list is not an array: `+operList); + throw new Error('operator list is not an array: '+operList); } return { ns: 'op', diff --git a/lib/plan-builder.js b/lib/plan-builder.js index 554e55a4..c69d7610 100644 --- a/lib/plan-builder.js +++ b/lib/plan-builder.js @@ -9,7 +9,7 @@ const bldrgen = require('./plan-builder-generated.js'); /** @ignore */ function isNonEmptyString(arg) { - if (typeof arg === "string" || arg instanceof String) { + if (typeof arg === 'string' || arg instanceof String) { return (arg.length > 0); } return false; diff --git a/lib/proxy-generator.js b/lib/proxy-generator.js index 177ee70b..4e93be14 100644 --- a/lib/proxy-generator.js +++ b/lib/proxy-generator.js @@ -114,14 +114,14 @@ function buildModule(moduleName, servicedef, endpointdefs) { b.methodDefinition('constructor', b.identifier('constructor'), b.functionExpression(null, [b.identifier('client'), b.identifier('serviceDeclaration')], b.blockStatement([ - b.ifStatement(b.logicalExpression("||", + b.ifStatement(b.logicalExpression('||', b.binaryExpression('===', b.identifier('client'), b.identifier('undefined')), b.binaryExpression('===', b.identifier('client'), b.literal(null)) ), b.blockStatement([b.throwStatement(b.newExpression(b.identifier('Error'), [ b.literal('missing required client') ]))])), - b.ifStatement(b.logicalExpression("||", + b.ifStatement(b.logicalExpression('||', b.binaryExpression('===', b.identifier('serviceDeclaration'), b.identifier('undefined')), b.binaryExpression('===', b.identifier('serviceDeclaration'), b.literal(null)) ), @@ -341,21 +341,21 @@ function generateSessionFactoryDoc(className, sessionFactoryName) { function generateModuleSource(moduleName, servicedef, endpointdefs) { if (moduleName === void 0 || moduleName === null) { - throw new Error(`missing module name`); + throw new Error('missing module name'); } else if (servicedef === void 0 || servicedef === null) { - throw new Error(`missing service.json declaration`); + throw new Error('missing service.json declaration'); } else if (servicedef.endpointDirectory === void 0 || servicedef.endpointDirectory === null) { - throw new Error(`service.json declaration without endpointDirectory property`); + throw new Error('service.json declaration without endpointDirectory property'); } else if (!Array.isArray(endpointdefs) || endpointdefs.length === 0) { - throw new Error(`no endpoint pairs of *.api declaration and main module`); + throw new Error('no endpoint pairs of *.api declaration and main module'); } else { endpointdefs.forEach(endpoint => { if (endpoint.moduleExtension === void 0 || endpoint.moduleExtension === null) { - throw new Error(`endpoint without moduleExtension property`); + throw new Error('endpoint without moduleExtension property'); } else if (endpoint.declaration === void 0 || endpoint.declaration === null) { - throw new Error(`endpoint without declaration`); + throw new Error('endpoint without declaration'); } else if (endpoint.declaration.functionName === void 0 || endpoint.declaration.functionName === null) { - throw new Error(`endpoint declaration without functionName property`); + throw new Error('endpoint declaration without functionName property'); } const validationResult = endpointDeclarationValidator.validate(endpoint.declaration); if (!(validationResult.isValid)) { diff --git a/lib/query-builder.js b/lib/query-builder.js index b5879a0c..65808297 100644 --- a/lib/query-builder.js +++ b/lib/query-builder.js @@ -2,7 +2,7 @@ * Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved. */ 'use strict'; -var util = require("util"); +var util = require('util'); var mlutil = require('./mlutil.js'); diff --git a/lib/requester.js b/lib/requester.js index 4b4dade6..7d4d3ba8 100644 --- a/lib/requester.js +++ b/lib/requester.js @@ -24,7 +24,7 @@ function createAuthenticator(client, user, password, challenge) { function createAuthenticatorKerberos(client, credentials) { var authenticatorKerberos = { - "credentials": credentials + 'credentials': credentials }; client.authenticatorKerberos = authenticatorKerberos; return authenticatorKerberos; @@ -64,7 +64,7 @@ function getAccessToken(operation){ } const responseValue = JSON.parse(d.toString()); operation.accessToken = responseValue.access_token; - operation.expiration = new Date(responseValue[".expires"]); + operation.expiration = new Date(responseValue['.expires']); if(operation.lockAccessToken){ operation.lockAccessToken = false; } @@ -232,13 +232,13 @@ function challengeRequest(operation) { } function credentialsRequest(operation) { kerberos = new Kerberos(); - var uri = "HTTP@"+operation.options.host; + var uri = 'HTTP@'+operation.options.host; kerberos.authGSSClientInit(uri, 0, function(err, ctx) { if (err) { operation.errorListener('kerberos initialization failed at '+uri); } operation.logger.debug('kerberos initialized at '+uri); - kerberos.authGSSClientStep(ctx, "", function (err) { + kerberos.authGSSClientStep(ctx, '', function (err) { if (err) { operation.errorListener('kerberos credentials failed'); } @@ -279,7 +279,7 @@ function authenticatedRequest(operation) { operation.logger.debug('kerberos authentication'); request.setHeader( 'authorization', - "Negotiate "+authenticator.credentials + 'Negotiate '+authenticator.credentials ); break; default: @@ -301,14 +301,14 @@ function authenticatedRequest(operation) { } else { request.setHeader( 'authorization', - "bearer " +operation.accessToken + 'bearer ' +operation.accessToken ); } break; case 'OAUTH': request.setHeader( 'Authorization', - "Bearer " +options.oauthToken + 'Bearer ' +options.oauthToken ); } } diff --git a/lib/resources-exec.js b/lib/resources-exec.js index a429c7c2..d9b9db70 100644 --- a/lib/resources-exec.js +++ b/lib/resources-exec.js @@ -77,7 +77,7 @@ function makeRequestOptions(client, args) { return requestOptions; } function validateStatusCode(statusCode) { - return (statusCode < 400) ? null : "response with invalid "+statusCode+" status"; + return (statusCode < 400) ? null : 'response with invalid '+statusCode+' status'; } function Resources(client) { diff --git a/lib/responder.js b/lib/responder.js index 939be6ef..b5f6793f 100644 --- a/lib/responder.js +++ b/lib/responder.js @@ -7,7 +7,7 @@ var jsonParser = require('json-text-sequence').Parser; var Dicer = require('@fastify/busboy/deps/dicer/lib/Dicer'); var through2 = require('through2'); var mlutil = require('./mlutil.js'); -const requester = require("./requester"); +const requester = require('./requester'); const {createGunzip} = require('zlib'); /** @@ -499,7 +499,7 @@ MultipartDispatcher.prototype.promise = function dispatchMultipartPromise( if(errorListenerCheck) { if(response.headers['content-encoding']!=='gzip'){ - response.setEncoding("utf8"); + response.setEncoding('utf8'); } const multipartResponse = (isResponseGzipped(response.headers))?response.pipe(createGunzip()):response; diff --git a/lib/rows.js b/lib/rows.js index 47460f1d..61dbad31 100644 --- a/lib/rows.js +++ b/lib/rows.js @@ -9,7 +9,7 @@ const requester = require('./requester.js'), Operation = require('./operation.js'), planBuilder = require('./plan-builder.js'); const stream = require('stream'); -const bigInt = require("big-integer"); +const bigInt = require('big-integer'); /** @ignore */ function Rows(client) { diff --git a/lib/www-authenticate-patched/user-credentials.js b/lib/www-authenticate-patched/user-credentials.js index d6479bc0..e9128a3a 100644 --- a/lib/www-authenticate-patched/user-credentials.js +++ b/lib/www-authenticate-patched/user-credentials.js @@ -29,9 +29,9 @@ function user_credentials(username,password,options) { '' : (!password && password !== '' ? - Buffer.from(username, "ascii").toString("base64") + Buffer.from(username, 'ascii').toString('base64') : - Buffer.from(username+':'+password, "ascii").toString("base64") + Buffer.from(username+':'+password, 'ascii').toString('base64') ) function Credentials() { diff --git a/lib/www-authenticate-patched/www-authenticate.js b/lib/www-authenticate-patched/www-authenticate.js index 958f6d38..f4d818ac 100644 --- a/lib/www-authenticate-patched/www-authenticate.js +++ b/lib/www-authenticate-patched/www-authenticate.js @@ -26,7 +26,7 @@ var crypto= require('crypto') function hex8(num) { - return ("00000000" + num.toString(16)).slice(-8); + return ('00000000' + num.toString(16)).slice(-8); } var www_authenticator = function(username,password,options) @@ -67,14 +67,14 @@ var www_authenticator = function(username,password,options) case 'Digest': var realm= auth_parms.realm; if (!realm) { - return note_error("Realm not found in www-authenticate header."); + return note_error('Realm not found in www-authenticate header.'); } var ha1= credentials.digest(realm); var nonce= auth_parms.nonce; if (!nonce) { - return note_error("Nonce not found in www-authenticate header."); + return note_error('Nonce not found in www-authenticate header.'); } var fixed= 'Digest username="'+credentials.username+'",'+ @@ -128,7 +128,7 @@ var www_authenticator = function(username,password,options) return note_error('Server does not accept any supported quality of protection techniques.'); } default: - return note_error("Unknown scheme"); + return note_error('Unknown scheme'); } }