forked from Azure/postgresql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9,559 changed files
with
1,842,058 additions
and
1,551 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PsqlConstants = exports.FileConstants = void 0; | ||
class FileConstants { | ||
} | ||
exports.FileConstants = FileConstants; | ||
// regex checks that string should end with .sql and if folderPath is present, * should not be included in folderPath | ||
FileConstants.singleParentDirRegex = /^((?!\*\/).)*(\.sql)$/g; | ||
class PsqlConstants { | ||
} | ||
exports.PsqlConstants = PsqlConstants; | ||
PsqlConstants.SELECT_1 = "SELECT 1"; | ||
// host, port, dbname, user, password must be present in connection string in any order. | ||
PsqlConstants.connectionStringTestRegex = /^(?=.*host(\s)*=(\s)*.+)(?=.*port(\s)*=(\s)*.+)(?=.*dbname(\s)*=(\s)*.+)(?=.*user(\s)*=(\s)*.+)(?=.*password(\s)*=(\s)*.+).+/g; | ||
// extracting password from connection string | ||
PsqlConstants.extractPasswordRegex = /(?<key>password)\s*=\s*(?<val>[^\s]*)/g; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PsqlConstants = exports.FileConstants = void 0; | ||
class FileConstants { | ||
} | ||
exports.FileConstants = FileConstants; | ||
// regex checks that string should end with .sql and if folderPath is present, * should not be included in folderPath | ||
FileConstants.singleParentDirRegex = /^((?!\*\/).)*(\.sql)$/g; | ||
class PsqlConstants { | ||
} | ||
exports.PsqlConstants = PsqlConstants; | ||
PsqlConstants.SELECT_1 = "SELECT 1"; | ||
// host, port, dbname, user, password must be present in connection string in any order. | ||
PsqlConstants.connectionStringTestRegex = /^(?=.*host(\s)*=(\s)*.+)(?=.*port(\s)*=(\s)*.+)(?=.*dbname(\s)*=(\s)*.+)(?=.*user(\s)*=(\s)*.+)(?=.*password(\s)*=(\s)*.+).+/g; | ||
// extracting password from connection string | ||
PsqlConstants.extractPasswordRegex = /(?<key>password)\s*=\s*(?<val>[^\s]*)/g; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FileListCreator = void 0; | ||
const SingleParentDir_1 = __importDefault(require("./SingleParentDir")); | ||
const Constants_1 = require("../Constants"); | ||
class FileListCreator { | ||
static getFileList(filePathRegex) { | ||
if (Constants_1.FileConstants.singleParentDirRegex.test(filePathRegex)) { | ||
const singleParentDir = new SingleParentDir_1.default(filePathRegex); | ||
this.fileList = singleParentDir.getFileList(); | ||
} | ||
if (!this.fileList) { | ||
throw new Error(`Invalid file path. File path should be of the format <file>.sql, <folder>/<regex>.sql, <folder1>/<folder2>/<folder3>/<regex>.sql`); | ||
} | ||
return this.fileList; | ||
} | ||
} | ||
exports.FileListCreator = FileListCreator; | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FileListCreator = void 0; | ||
const SingleParentDir_1 = __importDefault(require("./SingleParentDir")); | ||
const Constants_1 = require("../Constants"); | ||
class FileListCreator { | ||
static getFileList(filePathRegex) { | ||
if (Constants_1.FileConstants.singleParentDirRegex.test(filePathRegex)) { | ||
const singleParentDir = new SingleParentDir_1.default(filePathRegex); | ||
this.fileList = singleParentDir.getFileList(); | ||
} | ||
if (!this.fileList) { | ||
throw new Error(`Invalid file path. File path should be of the format <file>.sql, <folder>/<regex>.sql, <folder1>/<folder2>/<folder3>/<regex>.sql`); | ||
} | ||
return this.fileList; | ||
} | ||
} | ||
exports.FileListCreator = FileListCreator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path = __importStar(require("path")); | ||
const core = __importStar(require("@actions/core")); | ||
const glob = __importStar(require("glob")); | ||
class SingleParentDir { | ||
constructor(filePathRegex) { | ||
this.filePathRegex = filePathRegex; | ||
} | ||
/** | ||
* Get list of files to execute in lexicographical order from the given filePathRegex | ||
* Supported filePathRegex are: | ||
* <file>.sql | ||
* <folder>/<regex>.sql | ||
* <folder1>/<folder2>/<folder3>/<regex>.sql | ||
*/ | ||
getFileList() { | ||
core.debug(`Getting list of files to execute`); | ||
const basedir = process.env.GITHUB_WORKSPACE; | ||
if (!basedir) { | ||
throw new Error("GITHUB_WORKSPACE env variable is empty"); | ||
} | ||
; | ||
let listOfMatchedFiles = glob.sync(this.filePathRegex, {}); | ||
core.debug(`Matching list of files: ${listOfMatchedFiles}`); | ||
listOfMatchedFiles.sort(); | ||
listOfMatchedFiles = listOfMatchedFiles.map((fileName) => path.join(basedir, fileName)); | ||
console.log("List of files to be executed in order: " + listOfMatchedFiles); | ||
return listOfMatchedFiles; | ||
} | ||
} | ||
exports.default = SingleParentDir; | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path = __importStar(require("path")); | ||
const core = __importStar(require("@actions/core")); | ||
const glob = __importStar(require("glob")); | ||
class SingleParentDir { | ||
constructor(filePathRegex) { | ||
this.filePathRegex = filePathRegex; | ||
} | ||
/** | ||
* Get list of files to execute in lexicographical order from the given filePathRegex | ||
* Supported filePathRegex are: | ||
* <file>.sql | ||
* <folder>/<regex>.sql | ||
* <folder1>/<folder2>/<folder3>/<regex>.sql | ||
*/ | ||
getFileList() { | ||
core.debug(`Getting list of files to execute`); | ||
const basedir = process.env.GITHUB_WORKSPACE; | ||
if (!basedir) { | ||
throw new Error("GITHUB_WORKSPACE env variable is empty"); | ||
} | ||
; | ||
let listOfMatchedFiles = glob.sync(this.filePathRegex, {}); | ||
core.debug(`Matching list of files: ${listOfMatchedFiles}`); | ||
listOfMatchedFiles.sort(); | ||
listOfMatchedFiles = listOfMatchedFiles.map((fileName) => path.join(basedir, fileName)); | ||
console.log("List of files to be executed in order: " + listOfMatchedFiles); | ||
return listOfMatchedFiles; | ||
} | ||
} | ||
exports.default = SingleParentDir; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const PsqlToolRunner_1 = __importDefault(require("./Utils/PsqlUtils/PsqlToolRunner")); | ||
const FileListCreator_1 = require("./FileListCreator/FileListCreator"); | ||
class PsqlFilesExecutor { | ||
constructor(connectionString, filePath, args) { | ||
this.connectionString = connectionString; | ||
this.plsqlFilePath = filePath; | ||
this.args = args; | ||
this.extractedFiles = FileListCreator_1.FileListCreator.getFileList(this.plsqlFilePath); | ||
} | ||
static getPsqlFilesExecutor(connectionString, filePath, args) { | ||
if (!this.psqlFileExecutor) { | ||
this.psqlFileExecutor = new PsqlFilesExecutor(connectionString, filePath, args); | ||
} | ||
return this.psqlFileExecutor; | ||
} | ||
execute() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let error = ""; | ||
const options = { | ||
listeners: { | ||
stderr: (data) => { | ||
error += data.toString(); | ||
} | ||
} | ||
}; | ||
yield PsqlToolRunner_1.default.init(); | ||
for (const file of this.extractedFiles) { | ||
console.log(`Executing file: ${file}`); | ||
yield PsqlToolRunner_1.default.executePsqlFile(this.connectionString, file, this.args, options); | ||
if (error) { | ||
throw new Error(`error in file: ${file}\n${error}`); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
exports.default = PsqlFilesExecutor; | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const PsqlToolRunner_1 = __importDefault(require("./Utils/PsqlUtils/PsqlToolRunner")); | ||
const FileListCreator_1 = require("./FileListCreator/FileListCreator"); | ||
class PsqlFilesExecutor { | ||
constructor(connectionString, filePath, args) { | ||
this.connectionString = connectionString; | ||
this.plsqlFilePath = filePath; | ||
this.args = args; | ||
this.extractedFiles = FileListCreator_1.FileListCreator.getFileList(this.plsqlFilePath); | ||
} | ||
static getPsqlFilesExecutor(connectionString, filePath, args) { | ||
if (!this.psqlFileExecutor) { | ||
this.psqlFileExecutor = new PsqlFilesExecutor(connectionString, filePath, args); | ||
} | ||
return this.psqlFileExecutor; | ||
} | ||
execute() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let error = ""; | ||
const options = { | ||
listeners: { | ||
stderr: (data) => { | ||
error += data.toString(); | ||
} | ||
} | ||
}; | ||
yield PsqlToolRunner_1.default.init(); | ||
for (const file of this.extractedFiles) { | ||
console.log(`Executing file: ${file}`); | ||
yield PsqlToolRunner_1.default.executePsqlFile(this.connectionString, file, this.args, options); | ||
if (error) { | ||
throw new Error(`error in file: ${file}\n${error}`); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
exports.default = PsqlFilesExecutor; |
Oops, something went wrong.