apeframework 0.0.0-dev.3 → 0.0.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -14
- package/api/Api.d.ts +28 -0
- package/api/Api.js +72 -0
- package/api/Api.ts +104 -0
- package/api/Endpoint.d.ts +12 -0
- package/api/Endpoint.ts +16 -0
- package/api/ErrorHandler.d.ts +3 -0
- package/api/ErrorHandler.ts +11 -0
- package/api/Handler.d.ts +3 -0
- package/api/Handler.ts +10 -0
- package/api/Method.d.ts +8 -0
- package/api/Method.js +11 -0
- package/api/Method.ts +11 -0
- package/api/Schema.d.ts +9 -0
- package/api/Schema.ts +13 -0
- package/cipher/Cipher.js +2 -2
- package/cipher/Cipher.ts +2 -2
- package/cipher/errors/{CipherDecryptError.d.ts → DecryptError.d.ts} +2 -2
- package/cipher/errors/{CipherDecryptError.js → DecryptError.js} +3 -3
- package/cipher/errors/{CipherDecryptError.ts → DecryptError.ts} +2 -2
- package/cipher/errors/SecretLengthError.d.ts +5 -0
- package/{jwt/errors/JwtSecretLengthError.js → cipher/errors/SecretLengthError.js} +3 -3
- package/{jwt/errors/JwtSecretLengthError.ts → cipher/errors/SecretLengthError.ts} +2 -2
- package/cipher/validateSecretLength.js +2 -2
- package/cipher/validateSecretLength.ts +2 -2
- package/cli/utils/print.d.ts +2 -0
- package/cli/utils/{write.js → print.js} +3 -3
- package/cli/utils/print.ts +7 -0
- package/cli/utils/printLn.d.ts +2 -0
- package/cli/utils/{writeLn.js → printLn.js} +3 -3
- package/cli/utils/{writeLn.ts → printLn.ts} +2 -2
- package/{env/errors/EnvFileReadError.d.ts → config/errors/FileReadError.d.ts} +2 -2
- package/{tls/errors/TlsFileReadError.js → config/errors/FileReadError.js} +3 -3
- package/{env/errors/EnvFileReadError.ts → config/errors/FileReadError.ts} +2 -2
- package/config/errors/PropertyNameError.d.ts +5 -0
- package/config/errors/{ConfigPropertyNameError.js → PropertyNameError.js} +3 -3
- package/config/errors/{ConfigPropertyNameError.ts → PropertyNameError.ts} +2 -2
- package/config/errors/PropertyParseError.d.ts +5 -0
- package/config/errors/PropertyParseError.js +10 -0
- package/config/errors/PropertyParseError.ts +11 -0
- package/config/parseProperty.js +2 -2
- package/config/parseProperty.ts +2 -2
- package/config/readFile.js +4 -4
- package/config/readFile.ts +4 -4
- package/config/validatePropertyName.js +2 -2
- package/config/validatePropertyName.ts +2 -2
- package/{tls/errors/TlsFileReadError.d.ts → env/errors/FileReadError.d.ts} +2 -2
- package/env/errors/{EnvFileReadError.js → FileReadError.js} +3 -3
- package/{tls/errors/TlsFileReadError.ts → env/errors/FileReadError.ts} +2 -2
- package/env/readFile.js +3 -3
- package/env/readFile.ts +3 -3
- package/jwt/Jwt.d.ts +0 -6
- package/jwt/Jwt.js +8 -34
- package/jwt/Jwt.ts +8 -51
- package/jwt/Payload.d.ts +7 -3
- package/jwt/Payload.ts +7 -3
- package/jwt/errors/SecretLengthError.d.ts +5 -0
- package/{cipher/errors/CipherSecretLengthError.js → jwt/errors/SecretLengthError.js} +3 -3
- package/{cipher/errors/CipherSecretLengthError.ts → jwt/errors/SecretLengthError.ts} +2 -2
- package/jwt/validateSecretLength.js +2 -2
- package/jwt/validateSecretLength.ts +2 -2
- package/logger/Level.d.ts +7 -6
- package/logger/Level.js +7 -6
- package/logger/Level.ts +7 -6
- package/logger/Logger.d.ts +9 -9
- package/logger/Logger.js +4 -0
- package/logger/Logger.ts +15 -9
- package/logger/Severity.d.ts +6 -7
- package/logger/Severity.js +6 -7
- package/logger/Severity.ts +6 -7
- package/logger/adapters/file/FileLogger.d.ts +5 -5
- package/logger/adapters/file/FileLogger.js +17 -17
- package/logger/adapters/file/FileLogger.ts +19 -19
- package/logger/adapters/noop/NoopLogger.d.ts +2 -2
- package/logger/adapters/noop/NoopLogger.js +2 -1
- package/logger/adapters/noop/NoopLogger.ts +2 -2
- package/logger/adapters/stdio/StdioLogger.d.ts +5 -5
- package/logger/adapters/stdio/StdioLogger.js +19 -17
- package/logger/adapters/stdio/StdioLogger.ts +21 -19
- package/mailer/Event.d.ts +4 -4
- package/mailer/Event.ts +4 -4
- package/mailer/{EventLocation.d.ts → Location.d.ts} +2 -2
- package/mailer/Location.js +2 -0
- package/mailer/{EventLocation.ts → Location.ts} +2 -2
- package/mailer/Mailer.d.ts +5 -4
- package/mailer/Mailer.js +48 -0
- package/mailer/Mailer.ts +63 -4
- package/mailer/Method.d.ts +5 -0
- package/mailer/Method.js +8 -0
- package/mailer/{EventMethod.ts → Method.ts} +2 -2
- package/mailer/adapters/noop/NoopMailer.d.ts +3 -3
- package/mailer/adapters/noop/NoopMailer.js +3 -2
- package/mailer/adapters/noop/NoopMailer.ts +3 -3
- package/mailer/adapters/smtp/SmtpMailer.d.ts +3 -3
- package/mailer/adapters/smtp/SmtpMailer.js +4 -2
- package/mailer/adapters/smtp/SmtpMailer.ts +5 -3
- package/mailer/errors/AddressEmailError.d.ts +5 -0
- package/mailer/errors/{MailerAddressEmailError.js → AddressEmailError.js} +3 -3
- package/mailer/errors/{MailerAddressEmailError.ts → AddressEmailError.ts} +2 -2
- package/mailer/errors/EventAttachmentUrlError.d.ts +5 -0
- package/mailer/errors/{MailerEventAttachmentUrlError.js → EventAttachmentUrlError.js} +3 -3
- package/mailer/errors/{MailerEventAttachmentUrlError.ts → EventAttachmentUrlError.ts} +2 -2
- package/mailer/errors/{MailerEventGeolocationError.d.ts → EventGeolocationError.d.ts} +2 -2
- package/mailer/errors/{MailerEventGeolocationError.js → EventGeolocationError.js} +3 -3
- package/mailer/errors/{MailerEventGeolocationError.ts → EventGeolocationError.ts} +2 -2
- package/mailer/errors/EventUrlError.d.ts +5 -0
- package/mailer/errors/{MailerEventUrlError.js → EventUrlError.js} +3 -3
- package/mailer/errors/{MailerEventUrlError.ts → EventUrlError.ts} +2 -2
- package/mailer/errors/{MailerListUrlError.d.ts → ListUrlError.d.ts} +2 -2
- package/mailer/errors/{MailerListUrlError.js → ListUrlError.js} +3 -3
- package/mailer/errors/{MailerListUrlError.ts → ListUrlError.ts} +2 -2
- package/mailer/validateAddressEmail.js +2 -2
- package/mailer/validateAddressEmail.ts +2 -2
- package/mailer/validateEventAttachmentUrl.js +2 -2
- package/mailer/validateEventAttachmentUrl.ts +2 -2
- package/mailer/validateEventGeolocation.js +2 -2
- package/mailer/validateEventGeolocation.ts +2 -2
- package/mailer/validateEventUrl.js +2 -2
- package/mailer/validateEventUrl.ts +2 -2
- package/mailer/validateListUrl.js +2 -2
- package/mailer/validateListUrl.ts +2 -2
- package/package.json +1 -5
- package/parser/errors/{ParserInputError.d.ts → ParseError.d.ts} +2 -2
- package/parser/errors/ParseError.js +10 -0
- package/parser/errors/ParseError.ts +11 -0
- package/parser/factories/unit/createUnitParser.js +3 -3
- package/parser/factories/unit/createUnitParser.ts +3 -3
- package/parser/parseBoolean.js +2 -2
- package/parser/parseBoolean.ts +2 -2
- package/parser/parseInteger.js +3 -3
- package/parser/parseInteger.ts +3 -3
- package/parser/parseNumber.js +3 -3
- package/parser/parseNumber.ts +3 -3
- package/parser/parseString.js +2 -2
- package/parser/parseString.ts +2 -2
- package/pwd/errors/{PwdHashRoundsError.d.ts → HashRoundsError.d.ts} +2 -2
- package/pwd/errors/{PwdHashRoundsError.js → HashRoundsError.js} +3 -3
- package/pwd/errors/{PwdHashRoundsError.ts → HashRoundsError.ts} +2 -2
- package/pwd/validateHashRounds.js +2 -2
- package/pwd/validateHashRounds.ts +2 -2
- package/{config/errors/ConfigFileReadError.d.ts → tls/errors/FileReadError.d.ts} +2 -2
- package/{config/errors/ConfigFileReadError.js → tls/errors/FileReadError.js} +3 -3
- package/{config/errors/ConfigFileReadError.ts → tls/errors/FileReadError.ts} +2 -2
- package/tls/readFile.js +3 -3
- package/tls/readFile.ts +3 -3
- package/cipher/errors/CipherSecretLengthError.d.ts +0 -5
- package/cli/utils/write.d.ts +0 -2
- package/cli/utils/write.ts +0 -7
- package/cli/utils/writeLn.d.ts +0 -2
- package/config/errors/ConfigParseError.d.ts +0 -5
- package/config/errors/ConfigParseError.js +0 -10
- package/config/errors/ConfigParseError.ts +0 -11
- package/config/errors/ConfigPropertyNameError.d.ts +0 -5
- package/db/ColumnBuilder.d.ts +0 -13
- package/db/ColumnBuilder.js +0 -42
- package/db/ColumnBuilder.ts +0 -61
- package/db/Database.d.ts +0 -19
- package/db/Database.js +0 -49
- package/db/Database.ts +0 -74
- package/db/Driver.d.ts +0 -30
- package/db/Driver.ts +0 -33
- package/db/NullConstraint.d.ts +0 -2
- package/db/NullConstraint.ts +0 -5
- package/db/ReferentialAction.d.ts +0 -2
- package/db/ReferentialAction.ts +0 -5
- package/db/TableBuilder.d.ts +0 -49
- package/db/TableBuilder.js +0 -234
- package/db/TableBuilder.ts +0 -367
- package/db/adapters/mysql/createMysqlDatabase.d.ts +0 -12
- package/db/adapters/mysql/createMysqlDatabase.js +0 -32
- package/db/adapters/mysql/createMysqlDatabase.ts +0 -39
- package/db/adapters/mysql/driver.d.ts +0 -3
- package/db/adapters/mysql/driver.js +0 -43
- package/db/adapters/mysql/driver.ts +0 -45
- package/db/adapters/mysql/typeCast.d.ts +0 -2
- package/db/adapters/mysql/typeCast.js +0 -17
- package/db/adapters/mysql/typeCast.ts +0 -18
- package/db/adapters/postgres/driver.d.ts +0 -3
- package/db/adapters/postgres/driver.js +0 -43
- package/db/adapters/postgres/driver.ts +0 -45
- package/db/adapters/sqlite/driver.d.ts +0 -3
- package/db/adapters/sqlite/driver.js +0 -43
- package/db/adapters/sqlite/driver.ts +0 -45
- package/db/errors/DbColumnLengthError.d.ts +0 -5
- package/db/errors/DbColumnLengthError.js +0 -10
- package/db/errors/DbColumnLengthError.ts +0 -11
- package/db/errors/DbColumnMaxLengthError.d.ts +0 -5
- package/db/errors/DbColumnMaxLengthError.js +0 -10
- package/db/errors/DbColumnMaxLengthError.ts +0 -11
- package/db/errors/DbColumnPrecisionError.d.ts +0 -5
- package/db/errors/DbColumnPrecisionError.js +0 -10
- package/db/errors/DbColumnPrecisionError.ts +0 -11
- package/db/errors/DbColumnScaleError.d.ts +0 -5
- package/db/errors/DbColumnScaleError.js +0 -10
- package/db/errors/DbColumnScaleError.ts +0 -11
- package/db/getConstraintName.d.ts +0 -2
- package/db/getConstraintName.js +0 -15
- package/db/getConstraintName.ts +0 -18
- package/db/getReferentialActionSql.d.ts +0 -3
- package/db/getReferentialActionSql.js +0 -12
- package/db/getReferentialActionSql.ts +0 -17
- package/db/setNullConstraint.d.ts +0 -4
- package/db/setNullConstraint.js +0 -9
- package/db/setNullConstraint.ts +0 -15
- package/db/validateColumnLength.d.ts +0 -2
- package/db/validateColumnLength.js +0 -10
- package/db/validateColumnLength.ts +0 -11
- package/db/validateColumnMaxLength.d.ts +0 -2
- package/db/validateColumnMaxLength.js +0 -10
- package/db/validateColumnMaxLength.ts +0 -11
- package/db/validateColumnPrecision.d.ts +0 -2
- package/db/validateColumnPrecision.js +0 -14
- package/db/validateColumnPrecision.ts +0 -15
- package/jwt/errors/JwtSecretLengthError.d.ts +0 -5
- package/mailer/EventMethod.d.ts +0 -5
- package/mailer/EventMethod.js +0 -8
- package/mailer/errors/MailerAddressEmailError.d.ts +0 -5
- package/mailer/errors/MailerEventAttachmentUrlError.d.ts +0 -5
- package/mailer/errors/MailerEventUrlError.d.ts +0 -5
- package/parser/errors/ParserInputError.js +0 -10
- package/parser/errors/ParserInputError.ts +0 -11
- /package/{db/Driver.js → api/Endpoint.js} +0 -0
- /package/{db/NullConstraint.js → api/ErrorHandler.js} +0 -0
- /package/{db/ReferentialAction.js → api/Handler.js} +0 -0
- /package/{mailer/EventLocation.js → api/Schema.js} +0 -0
package/parser/parseNumber.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseNumber = void 0;
|
|
4
|
-
const
|
|
4
|
+
const ParseError_1 = require("./errors/ParseError");
|
|
5
5
|
const parseNumber = (input) => {
|
|
6
6
|
if ([undefined, null].includes(input)) {
|
|
7
7
|
return 0;
|
|
8
8
|
}
|
|
9
9
|
else if (['object', 'function', 'symbol'].includes(typeof input)) {
|
|
10
|
-
throw new
|
|
10
|
+
throw new ParseError_1.ParseError('number');
|
|
11
11
|
}
|
|
12
12
|
const number = Number(input);
|
|
13
13
|
if (!Number.isFinite(number)) {
|
|
14
|
-
throw new
|
|
14
|
+
throw new ParseError_1.ParseError('number');
|
|
15
15
|
}
|
|
16
16
|
return number;
|
|
17
17
|
};
|
package/parser/parseNumber.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParseError } from './errors/ParseError'
|
|
2
2
|
import type { Parser } from './Parser'
|
|
3
3
|
|
|
4
4
|
const parseNumber: Parser<number> = (input) => {
|
|
5
5
|
if ([undefined, null].includes(input)) {
|
|
6
6
|
return 0
|
|
7
7
|
} else if (['object', 'function', 'symbol'].includes(typeof input)) {
|
|
8
|
-
throw new
|
|
8
|
+
throw new ParseError('number')
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const number = Number(input)
|
|
12
12
|
|
|
13
13
|
if (!Number.isFinite(number)) {
|
|
14
|
-
throw new
|
|
14
|
+
throw new ParseError('number')
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
return number
|
package/parser/parseString.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseString = void 0;
|
|
4
|
-
const
|
|
4
|
+
const ParseError_1 = require("./errors/ParseError");
|
|
5
5
|
const parseString = (input) => {
|
|
6
6
|
if ([undefined, null].includes(input)) {
|
|
7
7
|
return '';
|
|
@@ -13,7 +13,7 @@ const parseString = (input) => {
|
|
|
13
13
|
return '1';
|
|
14
14
|
}
|
|
15
15
|
else if (['object', 'function', 'symbol'].includes(typeof input)) {
|
|
16
|
-
throw new
|
|
16
|
+
throw new ParseError_1.ParseError('string');
|
|
17
17
|
}
|
|
18
18
|
return String(input);
|
|
19
19
|
};
|
package/parser/parseString.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParseError } from './errors/ParseError'
|
|
2
2
|
import type { Parser } from './Parser'
|
|
3
3
|
|
|
4
4
|
const parseString: Parser<string> = (input) => {
|
|
@@ -9,7 +9,7 @@ const parseString: Parser<string> = (input) => {
|
|
|
9
9
|
} else if (input === true) {
|
|
10
10
|
return '1'
|
|
11
11
|
} else if (['object', 'function', 'symbol'].includes(typeof input)) {
|
|
12
|
-
throw new
|
|
12
|
+
throw new ParseError('string')
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
return String(input)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.HashRoundsError = void 0;
|
|
4
4
|
const BaseError_1 = require("../../error/BaseError");
|
|
5
|
-
class
|
|
5
|
+
class HashRoundsError extends BaseError_1.BaseError {
|
|
6
6
|
constructor(hashRounds) {
|
|
7
7
|
super(`invalid hash rounds "${hashRounds}"`);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
exports.
|
|
10
|
+
exports.HashRoundsError = HashRoundsError;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BaseError } from '../../error/BaseError'
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class HashRoundsError extends BaseError {
|
|
4
4
|
public constructor(hashRounds: number) {
|
|
5
5
|
super(`invalid hash rounds "${hashRounds}"`)
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
HashRoundsError,
|
|
11
11
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateHashRounds = void 0;
|
|
4
|
-
const
|
|
4
|
+
const HashRoundsError_1 = require("./errors/HashRoundsError");
|
|
5
5
|
const validateHashRounds = (hashRounds) => {
|
|
6
6
|
if (hashRounds < 1) {
|
|
7
|
-
throw new
|
|
7
|
+
throw new HashRoundsError_1.HashRoundsError(hashRounds);
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
exports.validateHashRounds = validateHashRounds;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HashRoundsError } from './errors/HashRoundsError'
|
|
2
2
|
|
|
3
3
|
const validateHashRounds = (hashRounds: number): void => {
|
|
4
4
|
if (hashRounds < 1) {
|
|
5
|
-
throw new
|
|
5
|
+
throw new HashRoundsError(hashRounds)
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseError } from '../../error/BaseError';
|
|
2
|
-
declare class
|
|
2
|
+
declare class FileReadError extends BaseError {
|
|
3
3
|
constructor(path: string, message: string);
|
|
4
4
|
}
|
|
5
|
-
export {
|
|
5
|
+
export { FileReadError, };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FileReadError = void 0;
|
|
4
4
|
const BaseError_1 = require("../../error/BaseError");
|
|
5
|
-
class
|
|
5
|
+
class FileReadError extends BaseError_1.BaseError {
|
|
6
6
|
constructor(path, message) {
|
|
7
7
|
super(`failed reading file "${path}": ${message}`);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
exports.
|
|
10
|
+
exports.FileReadError = FileReadError;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BaseError } from '../../error/BaseError'
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class FileReadError extends BaseError {
|
|
4
4
|
public constructor(path: string, message: string) {
|
|
5
5
|
super(`failed reading file "${path}": ${message}`)
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
FileReadError,
|
|
11
11
|
}
|
package/tls/readFile.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.readFile = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
const
|
|
8
|
+
const FileReadError_1 = require("./errors/FileReadError");
|
|
9
9
|
const readFile = (path) => {
|
|
10
10
|
try {
|
|
11
11
|
if (fs_extra_1.default.existsSync(path)) {
|
|
@@ -13,8 +13,8 @@ const readFile = (path) => {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
catch (error) {
|
|
16
|
-
throw new
|
|
16
|
+
throw new FileReadError_1.FileReadError(path, error.message);
|
|
17
17
|
}
|
|
18
|
-
throw new
|
|
18
|
+
throw new FileReadError_1.FileReadError(path, 'missing file');
|
|
19
19
|
};
|
|
20
20
|
exports.readFile = readFile;
|
package/tls/readFile.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'fs-extra'
|
|
2
|
-
import {
|
|
2
|
+
import { FileReadError } from './errors/FileReadError'
|
|
3
3
|
|
|
4
4
|
const readFile = (path: string): string => {
|
|
5
5
|
try {
|
|
@@ -7,10 +7,10 @@ const readFile = (path: string): string => {
|
|
|
7
7
|
return fs.readFileSync(path).toString()
|
|
8
8
|
}
|
|
9
9
|
} catch (error) {
|
|
10
|
-
throw new
|
|
10
|
+
throw new FileReadError(path, (error as Error).message)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
throw new
|
|
13
|
+
throw new FileReadError(path, 'missing file')
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export {
|
package/cli/utils/write.d.ts
DELETED
package/cli/utils/write.ts
DELETED
package/cli/utils/writeLn.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigParseError = void 0;
|
|
4
|
-
const BaseError_1 = require("../../error/BaseError");
|
|
5
|
-
class ConfigParseError extends BaseError_1.BaseError {
|
|
6
|
-
constructor(property, source, message) {
|
|
7
|
-
super(`failed parsing property "${property}" from ${source}: ${message}`);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.ConfigParseError = ConfigParseError;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseError } from '../../error/BaseError'
|
|
2
|
-
|
|
3
|
-
class ConfigParseError extends BaseError {
|
|
4
|
-
public constructor(property: string, source: string, message: string) {
|
|
5
|
-
super(`failed parsing property "${property}" from ${source}: ${message}`)
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
ConfigParseError,
|
|
11
|
-
}
|
package/db/ColumnBuilder.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ReferentialAction } from './ReferentialAction';
|
|
2
|
-
import type { Knex } from 'knex';
|
|
3
|
-
declare class ColumnBuilder {
|
|
4
|
-
private readonly table;
|
|
5
|
-
private readonly column;
|
|
6
|
-
private readonly knexColumnBuilder;
|
|
7
|
-
constructor(table: string, column: string, knexColumnBuilder: Knex.ColumnBuilder);
|
|
8
|
-
primary(): this;
|
|
9
|
-
foreign(referencedTable: string, referencedColumn: string, onUpdate: ReferentialAction, onDelete: ReferentialAction): this;
|
|
10
|
-
index(): this;
|
|
11
|
-
unique(): this;
|
|
12
|
-
}
|
|
13
|
-
export { ColumnBuilder, };
|
package/db/ColumnBuilder.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ColumnBuilder = void 0;
|
|
4
|
-
const getConstraintName_1 = require("./getConstraintName");
|
|
5
|
-
const getReferentialActionSql_1 = require("./getReferentialActionSql");
|
|
6
|
-
class ColumnBuilder {
|
|
7
|
-
table;
|
|
8
|
-
column;
|
|
9
|
-
knexColumnBuilder;
|
|
10
|
-
constructor(table, column, knexColumnBuilder) {
|
|
11
|
-
this.table = table;
|
|
12
|
-
this.column = column;
|
|
13
|
-
this.knexColumnBuilder = knexColumnBuilder;
|
|
14
|
-
}
|
|
15
|
-
primary() {
|
|
16
|
-
this.knexColumnBuilder.primary({
|
|
17
|
-
constraintName: 'PRIMARY',
|
|
18
|
-
});
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
foreign(referencedTable, referencedColumn, onUpdate, onDelete) {
|
|
22
|
-
this.knexColumnBuilder
|
|
23
|
-
.references(referencedColumn)
|
|
24
|
-
.inTable(referencedTable)
|
|
25
|
-
.onUpdate((0, getReferentialActionSql_1.getReferentialActionSql)(onUpdate))
|
|
26
|
-
.onDelete((0, getReferentialActionSql_1.getReferentialActionSql)(onDelete))
|
|
27
|
-
.withKeyName((0, getConstraintName_1.getConstraintName)('FOREIGN', this.table, [this.column]));
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
index() {
|
|
31
|
-
this.knexColumnBuilder
|
|
32
|
-
.index((0, getConstraintName_1.getConstraintName)('INDEX', this.table, [this.column]));
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
unique() {
|
|
36
|
-
this.knexColumnBuilder.unique({
|
|
37
|
-
indexName: (0, getConstraintName_1.getConstraintName)('UNIQUE', this.table, [this.column]),
|
|
38
|
-
});
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.ColumnBuilder = ColumnBuilder;
|
package/db/ColumnBuilder.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { getConstraintName } from './getConstraintName'
|
|
2
|
-
import { getReferentialActionSql } from './getReferentialActionSql'
|
|
3
|
-
import type { ReferentialAction } from './ReferentialAction'
|
|
4
|
-
import type { Knex } from 'knex'
|
|
5
|
-
|
|
6
|
-
class ColumnBuilder {
|
|
7
|
-
private readonly table: string
|
|
8
|
-
|
|
9
|
-
private readonly column: string
|
|
10
|
-
|
|
11
|
-
private readonly knexColumnBuilder: Knex.ColumnBuilder
|
|
12
|
-
|
|
13
|
-
public constructor(
|
|
14
|
-
table: string,
|
|
15
|
-
column: string,
|
|
16
|
-
knexColumnBuilder: Knex.ColumnBuilder,
|
|
17
|
-
) {
|
|
18
|
-
this.table = table
|
|
19
|
-
this.column = column
|
|
20
|
-
this.knexColumnBuilder = knexColumnBuilder
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public primary(): this {
|
|
24
|
-
this.knexColumnBuilder.primary({
|
|
25
|
-
constraintName: 'PRIMARY',
|
|
26
|
-
})
|
|
27
|
-
return this
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public foreign(
|
|
31
|
-
referencedTable: string,
|
|
32
|
-
referencedColumn: string,
|
|
33
|
-
onUpdate: ReferentialAction,
|
|
34
|
-
onDelete: ReferentialAction,
|
|
35
|
-
): this {
|
|
36
|
-
this.knexColumnBuilder
|
|
37
|
-
.references(referencedColumn)
|
|
38
|
-
.inTable(referencedTable)
|
|
39
|
-
.onUpdate(getReferentialActionSql(onUpdate))
|
|
40
|
-
.onDelete(getReferentialActionSql(onDelete))
|
|
41
|
-
.withKeyName(getConstraintName('FOREIGN', this.table, [this.column]))
|
|
42
|
-
return this
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public index(): this {
|
|
46
|
-
this.knexColumnBuilder
|
|
47
|
-
.index(getConstraintName('INDEX', this.table, [this.column]))
|
|
48
|
-
return this
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public unique(): this {
|
|
52
|
-
this.knexColumnBuilder.unique({
|
|
53
|
-
indexName: getConstraintName('UNIQUE', this.table, [this.column]),
|
|
54
|
-
})
|
|
55
|
-
return this
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
ColumnBuilder,
|
|
61
|
-
}
|
package/db/Database.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { TableBuilder } from './TableBuilder';
|
|
2
|
-
import type { Driver } from './Driver';
|
|
3
|
-
import type { Knex } from 'knex';
|
|
4
|
-
declare class Database {
|
|
5
|
-
private readonly knex;
|
|
6
|
-
private readonly driver;
|
|
7
|
-
constructor(knex: Knex, driver: Driver);
|
|
8
|
-
createTable(table: string, build: (tableBuilder: TableBuilder) => void): Promise<void>;
|
|
9
|
-
createTableLike(table: string, like: string, build: (tableBuilder: TableBuilder) => void): Promise<void>;
|
|
10
|
-
alterTable(table: string, build: (tableBuilder: TableBuilder) => void): Promise<void>;
|
|
11
|
-
dropTable(table: string): Promise<void>;
|
|
12
|
-
dropTableIfExists(table: string): Promise<void>;
|
|
13
|
-
renameTable(table: string, newName: string): Promise<void>;
|
|
14
|
-
hasTable(table: string): Promise<boolean>;
|
|
15
|
-
hasColumn(table: string, column: string): Promise<boolean>;
|
|
16
|
-
table<Type extends Knex>(table: string): Promise<Knex<Type>>;
|
|
17
|
-
from(table: Knex.Table): Promise<Knex.QueryBuilder>;
|
|
18
|
-
}
|
|
19
|
-
export { Database, };
|
package/db/Database.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Database = void 0;
|
|
4
|
-
const TableBuilder_1 = require("./TableBuilder");
|
|
5
|
-
class Database {
|
|
6
|
-
knex;
|
|
7
|
-
driver;
|
|
8
|
-
constructor(knex, driver) {
|
|
9
|
-
this.knex = knex;
|
|
10
|
-
this.driver = driver;
|
|
11
|
-
}
|
|
12
|
-
async createTable(table, build) {
|
|
13
|
-
return this.knex.schema.createTable(table, (knexTableBuilder) => {
|
|
14
|
-
build(new TableBuilder_1.TableBuilder(table, knexTableBuilder, this.driver));
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
async createTableLike(table, like, build) {
|
|
18
|
-
return this.knex.schema.createTableLike(table, like, (knexTableBuilder) => {
|
|
19
|
-
build(new TableBuilder_1.TableBuilder(table, knexTableBuilder, this.driver));
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
async alterTable(table, build) {
|
|
23
|
-
return this.knex.schema.alterTable(table, (knexTableBuilder) => {
|
|
24
|
-
build(new TableBuilder_1.TableBuilder(table, knexTableBuilder, this.driver));
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
async dropTable(table) {
|
|
28
|
-
return this.knex.schema.dropTable(table);
|
|
29
|
-
}
|
|
30
|
-
async dropTableIfExists(table) {
|
|
31
|
-
return this.knex.schema.dropTableIfExists(table);
|
|
32
|
-
}
|
|
33
|
-
async renameTable(table, newName) {
|
|
34
|
-
await this.knex.schema.renameTable(table, newName);
|
|
35
|
-
}
|
|
36
|
-
async hasTable(table) {
|
|
37
|
-
return this.knex.schema.hasTable(table);
|
|
38
|
-
}
|
|
39
|
-
async hasColumn(table, column) {
|
|
40
|
-
return this.knex.schema.hasColumn(table, column);
|
|
41
|
-
}
|
|
42
|
-
async table(table) {
|
|
43
|
-
return this.knex(table);
|
|
44
|
-
}
|
|
45
|
-
async from(table) {
|
|
46
|
-
return this.knex.from(table);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.Database = Database;
|
package/db/Database.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { TableBuilder } from './TableBuilder'
|
|
2
|
-
import type { Driver } from './Driver'
|
|
3
|
-
import type { Knex } from 'knex'
|
|
4
|
-
|
|
5
|
-
class Database {
|
|
6
|
-
private readonly knex: Knex
|
|
7
|
-
|
|
8
|
-
private readonly driver: Driver
|
|
9
|
-
|
|
10
|
-
public constructor(knex: Knex, driver: Driver) {
|
|
11
|
-
this.knex = knex
|
|
12
|
-
this.driver = driver
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public async createTable(
|
|
16
|
-
table: string,
|
|
17
|
-
build: (tableBuilder: TableBuilder) => void,
|
|
18
|
-
): Promise<void> {
|
|
19
|
-
return this.knex.schema.createTable(table, (knexTableBuilder) => {
|
|
20
|
-
build(new TableBuilder(table, knexTableBuilder, this.driver))
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public async createTableLike(
|
|
25
|
-
table: string,
|
|
26
|
-
like: string,
|
|
27
|
-
build: (tableBuilder: TableBuilder) => void,
|
|
28
|
-
): Promise<void> {
|
|
29
|
-
return this.knex.schema.createTableLike(table, like, (knexTableBuilder) => {
|
|
30
|
-
build(new TableBuilder(table, knexTableBuilder, this.driver))
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public async alterTable(
|
|
35
|
-
table: string,
|
|
36
|
-
build: (tableBuilder: TableBuilder) => void,
|
|
37
|
-
): Promise<void> {
|
|
38
|
-
return this.knex.schema.alterTable(table, (knexTableBuilder) => {
|
|
39
|
-
build(new TableBuilder(table, knexTableBuilder, this.driver))
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public async dropTable(table: string): Promise<void> {
|
|
44
|
-
return this.knex.schema.dropTable(table)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public async dropTableIfExists(table: string): Promise<void> {
|
|
48
|
-
return this.knex.schema.dropTableIfExists(table)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public async renameTable(table: string, newName: string): Promise<void> {
|
|
52
|
-
await this.knex.schema.renameTable(table, newName)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public async hasTable(table: string): Promise<boolean> {
|
|
56
|
-
return this.knex.schema.hasTable(table)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public async hasColumn(table: string, column: string): Promise<boolean> {
|
|
60
|
-
return this.knex.schema.hasColumn(table, column)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public async table<Type extends Knex>(table: string): Promise<Knex<Type>> {
|
|
64
|
-
return this.knex(table)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public async from(table: Knex.Table): Promise<Knex.QueryBuilder> {
|
|
68
|
-
return this.knex.from(table)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
Database,
|
|
74
|
-
}
|
package/db/Driver.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
interface Driver {
|
|
2
|
-
dataType: {
|
|
3
|
-
boolean: string;
|
|
4
|
-
tinyInt: string;
|
|
5
|
-
smallInt: string;
|
|
6
|
-
smallIntPrimaryAutoIncrement: string;
|
|
7
|
-
int: string;
|
|
8
|
-
intPrimaryAutoIncrement: string;
|
|
9
|
-
bigInt: string;
|
|
10
|
-
bigIntPrimaryAutoIncrement: string;
|
|
11
|
-
float: string;
|
|
12
|
-
double: string;
|
|
13
|
-
numeric: (precision: number, scale: number) => string;
|
|
14
|
-
char: (length: number) => string;
|
|
15
|
-
varChar: (maxLength: number) => string;
|
|
16
|
-
tinyText: string;
|
|
17
|
-
text: string;
|
|
18
|
-
longText: string;
|
|
19
|
-
binary: (length: number) => string;
|
|
20
|
-
varBinary: (maxLength: number) => string;
|
|
21
|
-
tinyBlob: string;
|
|
22
|
-
blob: string;
|
|
23
|
-
longBlob: string;
|
|
24
|
-
timestamp: string;
|
|
25
|
-
dateTime: string;
|
|
26
|
-
date: string;
|
|
27
|
-
time: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export { type Driver, };
|
package/db/Driver.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
interface Driver {
|
|
2
|
-
dataType: {
|
|
3
|
-
boolean: string,
|
|
4
|
-
tinyInt: string,
|
|
5
|
-
smallInt: string,
|
|
6
|
-
smallIntPrimaryAutoIncrement: string,
|
|
7
|
-
int: string,
|
|
8
|
-
intPrimaryAutoIncrement: string,
|
|
9
|
-
bigInt: string,
|
|
10
|
-
bigIntPrimaryAutoIncrement: string,
|
|
11
|
-
float: string,
|
|
12
|
-
double: string,
|
|
13
|
-
numeric: (precision: number, scale: number) => string,
|
|
14
|
-
char: (length: number) => string,
|
|
15
|
-
varChar: (maxLength: number) => string,
|
|
16
|
-
tinyText: string,
|
|
17
|
-
text: string,
|
|
18
|
-
longText: string,
|
|
19
|
-
binary: (length: number) => string,
|
|
20
|
-
varBinary: (maxLength: number) => string,
|
|
21
|
-
tinyBlob: string,
|
|
22
|
-
blob: string,
|
|
23
|
-
longBlob: string,
|
|
24
|
-
timestamp: string,
|
|
25
|
-
dateTime: string,
|
|
26
|
-
date: string,
|
|
27
|
-
time: string,
|
|
28
|
-
},
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
type Driver,
|
|
33
|
-
}
|
package/db/NullConstraint.d.ts
DELETED
package/db/NullConstraint.ts
DELETED