@mongodb-js/mongodb-constants
Advanced tools
Comparing version 0.8.1 to 0.8.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getFilteredCompletions = exports.wrapField = exports.createConstantFilter = void 0; | ||
exports.getFilteredCompletions = exports.wrapField = exports.createConstantFilter = exports.ALL_CONSTANTS = void 0; | ||
const semver_1 = require("semver"); | ||
@@ -14,3 +14,3 @@ const accumulators_1 = require("./accumulators"); | ||
const system_variables_1 = require("./system-variables"); | ||
const ALL_CONSTANTS = [ | ||
exports.ALL_CONSTANTS = [ | ||
...accumulators_1.ACCUMULATORS, | ||
@@ -45,7 +45,7 @@ ...bson_types_1.BSON_TYPES, | ||
function satisfiesVersion(v1, v2) { | ||
const isGTECheck = /^\d+?\.\d+?\.\d+?$/.test(v2); | ||
const isGTECheck = /^\d+\.\d+\.\d+$/.test(v2); | ||
return (0, semver_1.satisfies)(v1, isGTECheck ? `>=${v2}` : v2); | ||
} | ||
function createConstantFilter({ meta: filterMeta, serverVersion = DEFAULT_SERVER_VERSION, stage: filterStage = {}, } = {}) { | ||
const currentServerVersion = /^(?<version>\d+?\.\d+?\.\d+?)/.exec(serverVersion)?.groups?.version ?? | ||
const currentServerVersion = /^(?<version>\d+\.\d+\.\d+)/.exec(serverVersion)?.groups?.version ?? | ||
DEFAULT_SERVER_VERSION; | ||
@@ -87,3 +87,3 @@ return ({ version: minServerVersion, meta, env, namespace, apiVersions }) => { | ||
} | ||
function getFilteredCompletions(options = {}, constants = ALL_CONSTANTS) { | ||
function getFilteredCompletions(options = {}, constants = exports.ALL_CONSTANTS) { | ||
const { serverVersion = DEFAULT_SERVER_VERSION, fields = [], meta, stage, } = options; | ||
@@ -90,0 +90,0 @@ const completionsFilter = createConstantFilter({ |
@@ -16,3 +16,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/devtools-shared", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"repository": { | ||
@@ -73,3 +73,3 @@ "type": "git", | ||
}, | ||
"gitHead": "96f27ef6eea0ffb99193a8d277df18a7cfdaabe5" | ||
"gitHead": "4bdafc692e5892d0e726d89af1e6ef3d478f25fc" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
358238
8455