@naturalcycles/nodejs-lib 13.25.0 → 13.26.0
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/dist/buffer/buffer.util.d.ts +0 -1
- package/dist/buffer/buffer.util.js +1 -2
- package/dist/csv/csvReader.js +2 -3
- package/dist/csv/csvWriter.js +3 -3
- package/dist/csv/transformToCSV.js +1 -2
- package/dist/diff/tableDiff.js +1 -2
- package/dist/fs/del.js +2 -3
- package/dist/fs/fs2.d.ts +0 -3
- package/dist/fs/json2env.js +7 -8
- package/dist/fs/kpy.js +2 -3
- package/dist/infra/process.util.js +3 -3
- package/dist/jwt/jwt.service.d.ts +0 -1
- package/dist/script/runScript.js +1 -2
- package/dist/secret/secrets-decrypt.util.d.ts +0 -1
- package/dist/secret/secrets-decrypt.util.js +1 -2
- package/dist/secret/secrets-encrypt.util.d.ts +0 -1
- package/dist/secret/secrets-encrypt.util.js +1 -2
- package/dist/security/crypto.util.d.ts +0 -1
- package/dist/security/crypto.util.js +7 -8
- package/dist/security/hash.util.d.ts +0 -2
- package/dist/security/hash.util.js +16 -17
- package/dist/security/id.util.js +4 -4
- package/dist/security/nanoid.js +3 -3
- package/dist/security/secret.util.js +8 -9
- package/dist/slack/slack.service.js +2 -2
- package/dist/stream/ndjson/ndjsonMap.js +1 -2
- package/dist/stream/ndjson/ndjsonStreamForEach.js +1 -2
- package/dist/stream/ndjson/transformJsonParse.d.ts +0 -1
- package/dist/stream/ndjson/transformJsonParse.js +2 -2
- package/dist/stream/ndjson/transformToNDJson.js +1 -2
- package/dist/stream/pipeline/pipeline.d.ts +0 -2
- package/dist/stream/pipeline/pipeline.js +3 -3
- package/dist/stream/progressLogger.js +3 -3
- package/dist/stream/readable/readableCreate.d.ts +0 -1
- package/dist/stream/readable/readableCreate.js +2 -3
- package/dist/stream/readable/readableForEach.js +2 -3
- package/dist/stream/readable/readableFromArray.d.ts +0 -1
- package/dist/stream/readable/readableFromArray.js +1 -2
- package/dist/stream/readable/readableToArray.js +1 -2
- package/dist/stream/stream.model.d.ts +0 -1
- package/dist/stream/stream.util.d.ts +0 -1
- package/dist/stream/stream.util.js +1 -2
- package/dist/stream/transform/transformChunk.js +1 -2
- package/dist/stream/transform/transformFilter.js +2 -3
- package/dist/stream/transform/transformLimit.d.ts +0 -1
- package/dist/stream/transform/transformLimit.js +2 -2
- package/dist/stream/transform/transformLogProgress.js +1 -2
- package/dist/stream/transform/transformMap.js +2 -3
- package/dist/stream/transform/transformMapSimple.js +1 -2
- package/dist/stream/transform/transformMapSync.js +2 -2
- package/dist/stream/transform/transformNoOp.js +1 -2
- package/dist/stream/transform/transformOffset.js +1 -2
- package/dist/stream/transform/transformSplit.d.ts +0 -1
- package/dist/stream/transform/transformSplit.js +2 -3
- package/dist/stream/transform/transformTap.js +1 -2
- package/dist/stream/transform/transformTee.d.ts +0 -1
- package/dist/stream/transform/transformTee.js +1 -2
- package/dist/stream/transform/transformToArray.js +1 -2
- package/dist/stream/transform/worker/transformMultiThreaded.js +1 -2
- package/dist/stream/writable/writableForEach.js +2 -3
- package/dist/stream/writable/writableFork.d.ts +0 -1
- package/dist/stream/writable/writableFork.js +1 -2
- package/dist/stream/writable/writableLimit.d.ts +0 -1
- package/dist/stream/writable/writableLimit.js +1 -2
- package/dist/stream/writable/writablePushToArray.js +1 -2
- package/dist/stream/writable/writableVoid.d.ts +0 -1
- package/dist/stream/writable/writableVoid.js +1 -2
- package/dist/string/inspect.d.ts +0 -1
- package/dist/string/inspect.js +2 -2
- package/dist/util/buildInfo.util.js +1 -2
- package/dist/util/env.util.js +2 -3
- package/dist/util/exec.util.d.ts +0 -1
- package/dist/util/exec.util.js +2 -3
- package/dist/util/git.util.js +11 -12
- package/dist/util/zip.util.d.ts +0 -2
- package/dist/util/zip.util.js +8 -9
- package/dist/validation/ajv/ajv.util.js +2 -3
- package/dist/validation/ajv/getAjv.js +1 -2
- package/dist/validation/joi/joi.shared.schemas.d.ts +0 -1
- package/dist/validation/joi/joi.shared.schemas.js +6 -5
- package/dist/validation/joi/joi.validation.util.js +5 -6
- package/dist/validation/joi/number.extensions.js +1 -2
- package/dist/validation/joi/string.extensions.js +1 -2
- package/package.json +1 -1
- package/src/validation/joi/joi.shared.schemas.ts +2 -1
package/dist/util/git.util.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getLastGitCommitMsg = getLastGitCommitMsg;
|
|
4
|
+
exports.commitMessageToTitleMessage = commitMessageToTitleMessage;
|
|
5
|
+
exports.gitHasUncommittedChanges = gitHasUncommittedChanges;
|
|
6
|
+
exports.gitCommitAll = gitCommitAll;
|
|
7
|
+
exports.gitIsAhead = gitIsAhead;
|
|
8
|
+
exports.gitPull = gitPull;
|
|
9
|
+
exports.gitPush = gitPush;
|
|
10
|
+
exports.gitCurrentCommitSha = gitCurrentCommitSha;
|
|
11
|
+
exports.gitCurrentCommitTimestamp = gitCurrentCommitTimestamp;
|
|
12
|
+
exports.gitCurrentBranchName = gitCurrentBranchName;
|
|
13
|
+
exports.gitCurrentRepoName = gitCurrentRepoName;
|
|
4
14
|
const tslib_1 = require("tslib");
|
|
5
15
|
const node_child_process_1 = tslib_1.__importDefault(require("node:child_process"));
|
|
6
16
|
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
@@ -8,13 +18,11 @@ const colors_1 = require("../colors/colors");
|
|
|
8
18
|
function getLastGitCommitMsg() {
|
|
9
19
|
return execSync('git log -1 --pretty=%B');
|
|
10
20
|
}
|
|
11
|
-
exports.getLastGitCommitMsg = getLastGitCommitMsg;
|
|
12
21
|
function commitMessageToTitleMessage(msg) {
|
|
13
22
|
const firstLine = msg.split('\n')[0];
|
|
14
23
|
const [preTitle, title] = firstLine.split(': ');
|
|
15
24
|
return title || preTitle;
|
|
16
25
|
}
|
|
17
|
-
exports.commitMessageToTitleMessage = commitMessageToTitleMessage;
|
|
18
26
|
function gitHasUncommittedChanges() {
|
|
19
27
|
// git diff-index --quiet HEAD -- || echo "untracked"
|
|
20
28
|
try {
|
|
@@ -27,7 +35,6 @@ function gitHasUncommittedChanges() {
|
|
|
27
35
|
return true;
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
|
-
exports.gitHasUncommittedChanges = gitHasUncommittedChanges;
|
|
31
38
|
/**
|
|
32
39
|
* @returns true if there were changes
|
|
33
40
|
*/
|
|
@@ -47,7 +54,6 @@ function gitCommitAll(msg) {
|
|
|
47
54
|
return false;
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
|
-
exports.gitCommitAll = gitCommitAll;
|
|
51
57
|
/**
|
|
52
58
|
* @returns true if there are not pushed commits.
|
|
53
59
|
*/
|
|
@@ -58,7 +64,6 @@ function gitIsAhead() {
|
|
|
58
64
|
// console.log(`gitIsAhead: ${stdout}`)
|
|
59
65
|
return Number(stdout) > 0;
|
|
60
66
|
}
|
|
61
|
-
exports.gitIsAhead = gitIsAhead;
|
|
62
67
|
function gitPull() {
|
|
63
68
|
const cmd = 'git pull';
|
|
64
69
|
try {
|
|
@@ -68,7 +73,6 @@ function gitPull() {
|
|
|
68
73
|
}
|
|
69
74
|
catch { }
|
|
70
75
|
}
|
|
71
|
-
exports.gitPull = gitPull;
|
|
72
76
|
function gitPush() {
|
|
73
77
|
// git push --set-upstream origin $CIRCLE_BRANCH && echo "pushed, exiting" && exit 0
|
|
74
78
|
let cmd = 'git push';
|
|
@@ -81,25 +85,20 @@ function gitPush() {
|
|
|
81
85
|
stdio: 'inherit',
|
|
82
86
|
});
|
|
83
87
|
}
|
|
84
|
-
exports.gitPush = gitPush;
|
|
85
88
|
function gitCurrentCommitSha(full = false) {
|
|
86
89
|
const sha = execSync('git rev-parse HEAD');
|
|
87
90
|
return full ? sha : sha.slice(0, 7);
|
|
88
91
|
}
|
|
89
|
-
exports.gitCurrentCommitSha = gitCurrentCommitSha;
|
|
90
92
|
function gitCurrentCommitTimestamp() {
|
|
91
93
|
return Number(execSync('git log -1 --format=%ct'));
|
|
92
94
|
}
|
|
93
|
-
exports.gitCurrentCommitTimestamp = gitCurrentCommitTimestamp;
|
|
94
95
|
function gitCurrentBranchName() {
|
|
95
96
|
return execSync('git rev-parse --abbrev-ref HEAD');
|
|
96
97
|
}
|
|
97
|
-
exports.gitCurrentBranchName = gitCurrentBranchName;
|
|
98
98
|
function gitCurrentRepoName() {
|
|
99
99
|
const originUrl = execSync('git config --get remote.origin.url');
|
|
100
100
|
return node_path_1.default.basename(originUrl, '.git');
|
|
101
101
|
}
|
|
102
|
-
exports.gitCurrentRepoName = gitCurrentRepoName;
|
|
103
102
|
function execSync(cmd) {
|
|
104
103
|
return node_child_process_1.default
|
|
105
104
|
.execSync(cmd, {
|
package/dist/util/zip.util.d.ts
CHANGED
package/dist/util/zip.util.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.deflateBuffer = deflateBuffer;
|
|
4
|
+
exports.inflateBuffer = inflateBuffer;
|
|
5
|
+
exports.deflateString = deflateString;
|
|
6
|
+
exports.inflateToString = inflateToString;
|
|
7
|
+
exports.gzipBuffer = gzipBuffer;
|
|
8
|
+
exports.gunzipBuffer = gunzipBuffer;
|
|
9
|
+
exports.gzipString = gzipString;
|
|
10
|
+
exports.gunzipToString = gunzipToString;
|
|
4
11
|
const tslib_1 = require("tslib");
|
|
5
12
|
const node_util_1 = require("node:util");
|
|
6
13
|
const node_zlib_1 = tslib_1.__importDefault(require("node:zlib"));
|
|
@@ -16,11 +23,9 @@ const gunzip = (0, node_util_1.promisify)(node_zlib_1.default.gunzip.bind(node_z
|
|
|
16
23
|
async function deflateBuffer(buf, options = {}) {
|
|
17
24
|
return await deflate(buf, options);
|
|
18
25
|
}
|
|
19
|
-
exports.deflateBuffer = deflateBuffer;
|
|
20
26
|
async function inflateBuffer(buf, options = {}) {
|
|
21
27
|
return await inflate(buf, options);
|
|
22
28
|
}
|
|
23
|
-
exports.inflateBuffer = inflateBuffer;
|
|
24
29
|
/**
|
|
25
30
|
* deflateString uses `deflate`.
|
|
26
31
|
* It's 9 bytes shorter than `gzip`.
|
|
@@ -28,11 +33,9 @@ exports.inflateBuffer = inflateBuffer;
|
|
|
28
33
|
async function deflateString(s, options) {
|
|
29
34
|
return await deflateBuffer(Buffer.from(s), options);
|
|
30
35
|
}
|
|
31
|
-
exports.deflateString = deflateString;
|
|
32
36
|
async function inflateToString(buf, options) {
|
|
33
37
|
return (await inflateBuffer(buf, options)).toString();
|
|
34
38
|
}
|
|
35
|
-
exports.inflateToString = inflateToString;
|
|
36
39
|
/**
|
|
37
40
|
* gzipBuffer uses `gzip`
|
|
38
41
|
* It's 9 bytes longer than `deflate`.
|
|
@@ -40,11 +43,9 @@ exports.inflateToString = inflateToString;
|
|
|
40
43
|
async function gzipBuffer(buf, options = {}) {
|
|
41
44
|
return await gzip(buf, options);
|
|
42
45
|
}
|
|
43
|
-
exports.gzipBuffer = gzipBuffer;
|
|
44
46
|
async function gunzipBuffer(buf, options = {}) {
|
|
45
47
|
return await gunzip(buf, options);
|
|
46
48
|
}
|
|
47
|
-
exports.gunzipBuffer = gunzipBuffer;
|
|
48
49
|
/**
|
|
49
50
|
* gzipString uses `gzip`.
|
|
50
51
|
* It's 9 bytes longer than `deflate`.
|
|
@@ -52,8 +53,6 @@ exports.gunzipBuffer = gunzipBuffer;
|
|
|
52
53
|
async function gzipString(s, options) {
|
|
53
54
|
return await gzipBuffer(Buffer.from(s), options);
|
|
54
55
|
}
|
|
55
|
-
exports.gzipString = gzipString;
|
|
56
56
|
async function gunzipToString(buf, options) {
|
|
57
57
|
return (await gunzipBuffer(buf, options)).toString();
|
|
58
58
|
}
|
|
59
|
-
exports.gunzipToString = gunzipToString;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.readJsonSchemas = readJsonSchemas;
|
|
4
|
+
exports.readAjvSchemas = readAjvSchemas;
|
|
4
5
|
const __1 = require("../..");
|
|
5
6
|
const ajvSchema_1 = require("./ajvSchema");
|
|
6
7
|
/**
|
|
@@ -14,7 +15,6 @@ const ajvSchema_1 = require("./ajvSchema");
|
|
|
14
15
|
function readJsonSchemas(patterns, opt) {
|
|
15
16
|
return __1.fastGlob.sync(patterns, opt).map(fileName => __1.fs2.readJson(fileName));
|
|
16
17
|
}
|
|
17
|
-
exports.readJsonSchemas = readJsonSchemas;
|
|
18
18
|
/**
|
|
19
19
|
* Reads json schemas from given dir (glob pattern).
|
|
20
20
|
* Creates new AjvSchema for each of them (ajv validates them upon creation).
|
|
@@ -29,4 +29,3 @@ function readAjvSchemas(patterns, cfg) {
|
|
|
29
29
|
...cfg,
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
exports.readAjvSchemas = readAjvSchemas;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAjv =
|
|
3
|
+
exports.getAjv = getAjv;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const ajv_1 = tslib_1.__importDefault(require("ajv"));
|
|
6
6
|
const AJV_OPTIONS = {
|
|
@@ -39,7 +39,6 @@ function getAjv(opt) {
|
|
|
39
39
|
// require('ajv-merge-patch')(ajv)
|
|
40
40
|
return ajv;
|
|
41
41
|
}
|
|
42
|
-
exports.getAjv = getAjv;
|
|
43
42
|
const TS_2500 = 16725225600; // 2500-01-01
|
|
44
43
|
const TS_2000 = 946684800; // 2000-01-01
|
|
45
44
|
function addCustomAjvFormats(ajv) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.baseDBEntitySchema = exports.ipAddressSchema = exports.ianaTimezoneSchema = exports.utcOffsetSchema = exports.userAgentSchema = exports.semVerSchema = exports.SEM_VER_REGEX = exports.emailSchema = exports.verSchema = exports.unixTimestampMillis2000Schema = exports.unixTimestampMillisSchema = exports.unixTimestamp2000Schema = exports.unixTimestampSchema = exports.slugSchema = exports.SLUG_REGEX = exports.idBase64UrlSchema = exports.idBase64Schema = exports.idBase62Schema = exports.idSchema = exports.jwtSchema = exports.JWT_REGEX = exports.base64UrlSchema = exports.base64Schema = exports.base62Schema = exports.BASE64URL_REGEX = exports.BASE64_REGEX = exports.BASE62_REGEX = exports.anyObjectSchema = exports.anySchema = exports.
|
|
3
|
+
exports.baseDBEntitySchema = exports.ipAddressSchema = exports.ianaTimezoneSchema = exports.utcOffsetSchema = exports.userAgentSchema = exports.semVerSchema = exports.SEM_VER_REGEX = exports.emailSchema = exports.verSchema = exports.unixTimestampMillis2000Schema = exports.unixTimestampMillisSchema = exports.unixTimestamp2000Schema = exports.unixTimestampSchema = exports.slugSchema = exports.SLUG_REGEX = exports.idBase64UrlSchema = exports.idBase64Schema = exports.idBase62Schema = exports.idSchema = exports.jwtSchema = exports.JWT_REGEX = exports.base64UrlSchema = exports.base64Schema = exports.base62Schema = exports.BASE64URL_REGEX = exports.BASE64_REGEX = exports.BASE62_REGEX = exports.anyObjectSchema = exports.anySchema = exports.urlSchema = exports.numberEnumKeySchema = exports.numberEnumValueSchema = exports.stringEnumKeySchema = exports.stringEnumValueSchema = exports.dateIntervalStringSchema = exports.dateObjectSchema = exports.binarySchema = exports.dateStringSchema = exports.percentageSchema = exports.integerSchema = exports.numberSchemaTyped = exports.numberSchema = exports.stringSchemaTyped = exports.stringSchema = exports.booleanDefaultToFalseSchema = exports.booleanSchema = void 0;
|
|
4
|
+
exports.arraySchema = arraySchema;
|
|
5
|
+
exports.objectSchema = objectSchema;
|
|
6
|
+
exports.oneOfSchema = oneOfSchema;
|
|
4
7
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
5
8
|
const joi_extensions_1 = require("./joi.extensions");
|
|
6
9
|
exports.booleanSchema = joi_extensions_1.Joi.boolean();
|
|
@@ -45,15 +48,12 @@ exports.urlSchema = urlSchema;
|
|
|
45
48
|
function arraySchema(items) {
|
|
46
49
|
return items ? joi_extensions_1.Joi.array().items(items) : joi_extensions_1.Joi.array();
|
|
47
50
|
}
|
|
48
|
-
exports.arraySchema = arraySchema;
|
|
49
51
|
function objectSchema(schema) {
|
|
50
52
|
return joi_extensions_1.Joi.object(schema);
|
|
51
53
|
}
|
|
52
|
-
exports.objectSchema = objectSchema;
|
|
53
54
|
function oneOfSchema(...schemas) {
|
|
54
55
|
return joi_extensions_1.Joi.alternatives(schemas);
|
|
55
56
|
}
|
|
56
|
-
exports.oneOfSchema = oneOfSchema;
|
|
57
57
|
exports.anySchema = joi_extensions_1.Joi.any();
|
|
58
58
|
exports.anyObjectSchema = joi_extensions_1.Joi.object().options({ stripUnknown: false });
|
|
59
59
|
exports.BASE62_REGEX = /^[a-zA-Z0-9]+$/;
|
|
@@ -125,7 +125,8 @@ exports.utcOffsetSchema = exports.numberSchema
|
|
|
125
125
|
.max(14 * 60)
|
|
126
126
|
.dividable(15);
|
|
127
127
|
exports.ianaTimezoneSchema = exports.stringSchema
|
|
128
|
-
|
|
128
|
+
// UTC is added to assist unit-testing, which uses UTC by default (not technically a valid Iana timezone identifier)
|
|
129
|
+
.valid(...Intl.supportedValuesOf('timeZone'), 'UTC')
|
|
129
130
|
.messages({
|
|
130
131
|
'any.only': `must be a valid IANA timezone string`,
|
|
131
132
|
});
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
* "Converts" mean e.g trims all strings from leading/trailing spaces.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
10
|
+
exports.validate = validate;
|
|
11
|
+
exports.getValidationResult = getValidationResult;
|
|
12
|
+
exports.isValid = isValid;
|
|
13
|
+
exports.undefinedIfInvalid = undefinedIfInvalid;
|
|
14
|
+
exports.convert = convert;
|
|
11
15
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
12
16
|
const joi_validation_error_1 = require("./joi.validation.error");
|
|
13
17
|
// Strip colors in production (for e.g Sentry reporting)
|
|
@@ -47,7 +51,6 @@ function validate(input, schema, objectName, opt = {}) {
|
|
|
47
51
|
}
|
|
48
52
|
return returnValue;
|
|
49
53
|
}
|
|
50
|
-
exports.validate = validate;
|
|
51
54
|
/**
|
|
52
55
|
* Validates with Joi.
|
|
53
56
|
* Returns JoiValidationResult with converted value and error (if any).
|
|
@@ -70,7 +73,6 @@ function getValidationResult(input, schema, objectName, options = {}) {
|
|
|
70
73
|
}
|
|
71
74
|
return vr;
|
|
72
75
|
}
|
|
73
|
-
exports.getValidationResult = getValidationResult;
|
|
74
76
|
/**
|
|
75
77
|
* Convenience function that returns true if !error.
|
|
76
78
|
*/
|
|
@@ -80,14 +82,12 @@ function isValid(input, schema) {
|
|
|
80
82
|
const { error } = schema.validate(input, defaultOptions);
|
|
81
83
|
return !error;
|
|
82
84
|
}
|
|
83
|
-
exports.isValid = isValid;
|
|
84
85
|
function undefinedIfInvalid(input, schema) {
|
|
85
86
|
if (!schema)
|
|
86
87
|
return input;
|
|
87
88
|
const { value, error } = schema.validate(input, defaultOptions);
|
|
88
89
|
return error ? undefined : value;
|
|
89
90
|
}
|
|
90
|
-
exports.undefinedIfInvalid = undefinedIfInvalid;
|
|
91
91
|
/**
|
|
92
92
|
* Will do joi-conversion, regardless of error/validity of value.
|
|
93
93
|
*
|
|
@@ -99,7 +99,6 @@ function convert(input, schema) {
|
|
|
99
99
|
const { value } = schema.validate(input, defaultOptions);
|
|
100
100
|
return value;
|
|
101
101
|
}
|
|
102
|
-
exports.convert = convert;
|
|
103
102
|
function createError(value, err, objectName) {
|
|
104
103
|
const tokens = [];
|
|
105
104
|
const objectId = (0, js_lib_1._isObject)(value) ? value['id'] : undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.numberExtensions =
|
|
3
|
+
exports.numberExtensions = numberExtensions;
|
|
4
4
|
function numberExtensions(joi) {
|
|
5
5
|
return {
|
|
6
6
|
base: joi.number(),
|
|
@@ -39,4 +39,3 @@ function numberExtensions(joi) {
|
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
exports.numberExtensions = numberExtensions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringExtensions =
|
|
3
|
+
exports.stringExtensions = stringExtensions;
|
|
4
4
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
5
5
|
function stringExtensions(joi) {
|
|
6
6
|
return {
|
|
@@ -69,7 +69,6 @@ function stringExtensions(joi) {
|
|
|
69
69
|
},
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
exports.stringExtensions = stringExtensions;
|
|
73
72
|
const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
74
73
|
// Based on: https://github.com/ajv-validator
|
|
75
74
|
function isValidDate(parts) {
|
package/package.json
CHANGED
|
@@ -157,7 +157,8 @@ export const utcOffsetSchema = numberSchema
|
|
|
157
157
|
.dividable(15)
|
|
158
158
|
|
|
159
159
|
export const ianaTimezoneSchema = stringSchema
|
|
160
|
-
|
|
160
|
+
// UTC is added to assist unit-testing, which uses UTC by default (not technically a valid Iana timezone identifier)
|
|
161
|
+
.valid(...Intl.supportedValuesOf('timeZone'), 'UTC')
|
|
161
162
|
.messages({
|
|
162
163
|
'any.only': `must be a valid IANA timezone string`,
|
|
163
164
|
})
|