@neo4j/cypher-builder
Version:
A programmatic API for building Cypher queries for Neo4j
178 lines (177 loc) • 7.45 kB
JavaScript
;
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.schema = exports.index = exports.cdc = void 0;
exports.nameFromElementId = nameFromElementId;
exports.awaitIndex = awaitIndex;
exports.awaitIndexes = awaitIndexes;
exports.createLabel = createLabel;
exports.createProperty = createProperty;
exports.createRelationshipType = createRelationshipType;
exports.info = info;
exports.labels = labels;
exports.ping = ping;
exports.propertyKeys = propertyKeys;
exports.relationshipTypes = relationshipTypes;
exports.resampleIndex = resampleIndex;
exports.resampleOutdatedIndexes = resampleOutdatedIndexes;
const CypherFunctions_1 = require("../../expressions/functions/CypherFunctions");
const CypherProcedure_1 = require("../../procedures/CypherProcedure");
const normalize_variable_1 = require("../../utils/normalize-variable");
exports.cdc = __importStar(require("./cdc"));
/**
* @hideGroups
*/
exports.index = __importStar(require("./index/dbIndex"));
exports.schema = __importStar(require("./schema"));
const DB_NAMESPACE = "db";
// FUNCTIONS
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/cypher-manual/current/functions/database/#functions-database-nameFromElementId)
* @group Functions
*/
function nameFromElementId(dbName) {
const dbNameExpr = (0, normalize_variable_1.normalizeExpr)(dbName);
return new CypherFunctions_1.CypherFunction("nameFromElementId", [dbNameExpr], DB_NAMESPACE);
}
// PROCEDURES
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_awaitindex)
* @group Functions
*/
function awaitIndex(indexName, timeOutSeconds) {
const indexNameExpr = (0, normalize_variable_1.normalizeExpr)(indexName);
const timeOutSecondsExpr = (0, normalize_variable_1.normalizeExpr)(timeOutSeconds);
return new CypherProcedure_1.VoidCypherProcedure("awaitIndex", [indexNameExpr, timeOutSecondsExpr], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_awaitindexes)
* @group Functions
*/
function awaitIndexes(timeOutSeconds) {
const timeOutSecondsExpr = (0, normalize_variable_1.normalizeExpr)(timeOutSeconds);
return new CypherProcedure_1.VoidCypherProcedure("awaitIndex", [timeOutSecondsExpr], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_createlabel)
* @group Procedures
*/
function createLabel(newLabel) {
const newLabelExpr = (0, normalize_variable_1.normalizeExpr)(newLabel);
return new CypherProcedure_1.VoidCypherProcedure("createLabel", [newLabelExpr], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_createproperty)
* @group Procedures
*/
function createProperty(newProperty) {
const newPropertyExpr = (0, normalize_variable_1.normalizeExpr)(newProperty);
return new CypherProcedure_1.VoidCypherProcedure("createProperty", [newPropertyExpr], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_createrelationshiptype)
* @group Procedures
*/
function createRelationshipType(newRelationshipType) {
const newRelationshipTypeExpr = (0, normalize_variable_1.normalizeExpr)(newRelationshipType);
return new CypherProcedure_1.VoidCypherProcedure("createRelationshipType", [newRelationshipTypeExpr], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_info)
* @group Procedures
*/
function info() {
return new CypherProcedure_1.CypherProcedure("info", [], DB_NAMESPACE);
}
/** Returns all labels in the database
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/5/reference/procedures/#procedure_db_labels)
* @group Procedures
*/
function labels() {
return new CypherProcedure_1.CypherProcedure("labels", [], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_ping)
* @group Procedures
*/
function ping() {
return new CypherProcedure_1.CypherProcedure("ping", [], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_propertykeys)
* @group Procedures
*/
function propertyKeys() {
return new CypherProcedure_1.CypherProcedure("propertyKeys", [], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_relationshiptypes)
* @group Procedures
*/
function relationshipTypes() {
return new CypherProcedure_1.CypherProcedure("relationshipTypes", [], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_resampleindex)
* @group Procedures
*/
function resampleIndex() {
return new CypherProcedure_1.CypherProcedure("resampleIndex", [], DB_NAMESPACE);
}
/**
* @see [Neo4j Documentation](https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_resampleoutdatedindexes)
* @group Procedures
*/
function resampleOutdatedIndexes() {
return new CypherProcedure_1.CypherProcedure("resampleOutdatedIndexes", [], DB_NAMESPACE);
}