Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/basic-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions lib/endpoint-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
106 changes: 53 additions & 53 deletions lib/endpointDeclarationValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions lib/internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/marklogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/mlutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion lib/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/patch-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}};
Expand Down Expand Up @@ -590,7 +590,7 @@ function pathLanguage() {
);
}

return {"pathlang": pathlang};
return {'pathlang': pathlang};
}

/**
Expand Down
18 changes: 9 additions & 9 deletions lib/plan-builder-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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`
);
Expand Down Expand Up @@ -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`
);
Expand All @@ -329,15 +329,15 @@ 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`
);
}
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`
);
Expand All @@ -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`
);
Expand All @@ -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`
);
Expand All @@ -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`
);
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion lib/plan-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions lib/proxy-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
),
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/query-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
Loading