@dereekb/util 8.10.0 → 8.11.2
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/CHANGELOG.md +22 -0
- package/package.json +1 -1
- package/src/lib/path/path.d.ts +5 -3
- package/src/lib/path/path.js +9 -4
- package/src/lib/path/path.js.map +1 -1
- package/src/lib/service/handler.d.ts +2 -2
- package/src/lib/type.d.ts +31 -2
- package/test/CHANGELOG.md +12 -0
- package/test/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [8.11.2](https://github.com/dereekb/dbx-components/compare/v8.11.1-dev...v8.11.2) (2022-07-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* fixed slashPathType() ([180f2d6](https://github.com/dereekb/dbx-components/commit/180f2d645c10d772aa9ba4255ec3b0f2b8655096))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [8.11.1](https://github.com/dereekb/dbx-components/compare/v8.11.0-dev...v8.11.1) (2022-07-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [8.11.0](https://github.com/dereekb/dbx-components/compare/v8.10.0-dev...v8.11.0) (2022-07-05)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* added specifier for crud functions ([39e366e](https://github.com/dereekb/dbx-components/commit/39e366e09936b5963cd3e74bc127ad3146d14ef7))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
5
27
|
# [8.10.0](https://github.com/dereekb/dbx-components/compare/v8.9.1-dev...v8.10.0) (2022-07-04)
|
|
6
28
|
|
|
7
29
|
|
package/package.json
CHANGED
package/src/lib/path/path.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MapSameFunction } from '../value/map';
|
|
2
2
|
import { ArrayOrValue } from '../array/array';
|
|
3
|
+
import { Maybe } from '../value';
|
|
3
4
|
import { FactoryWithRequiredInput } from '../getter/getter';
|
|
4
5
|
export declare const SLASH_PATH_SEPARATOR = "/";
|
|
5
6
|
export declare const SLASH_PATH_FILE_TYPE_SEPARATOR = ".";
|
|
@@ -45,7 +46,8 @@ export declare type SlashPathType = 'folder' | 'file' | 'typedfile' | 'invalid';
|
|
|
45
46
|
* @returns
|
|
46
47
|
*/
|
|
47
48
|
export declare function slashPathType(input: SlashPath): SlashPathType;
|
|
48
|
-
export declare function isSlashPathFile(input: string): input is
|
|
49
|
+
export declare function isSlashPathFile(input: string): input is SlashPathFile;
|
|
50
|
+
export declare function isSlashPathTypedFile(input: string): input is SlashPathTypedFile;
|
|
49
51
|
export declare function isSlashPathFolder(input: string): input is SlashPathFolder;
|
|
50
52
|
export declare function isValidSlashPath(input: string): input is SlashPath;
|
|
51
53
|
/**
|
|
@@ -137,7 +139,7 @@ export declare function slashPathValidationFactory(config?: SlashPathValidationF
|
|
|
137
139
|
/**
|
|
138
140
|
* Factory use to generate/merge file paths together.
|
|
139
141
|
*/
|
|
140
|
-
export declare type SlashPathFactory = FactoryWithRequiredInput<SlashPath, ArrayOrValue<SlashPath
|
|
142
|
+
export declare type SlashPathFactory = FactoryWithRequiredInput<SlashPath, ArrayOrValue<Maybe<SlashPath>>>;
|
|
141
143
|
export interface SlashPathFactoryConfig {
|
|
142
144
|
/**
|
|
143
145
|
* SlashPath start type to enforce
|
|
@@ -153,5 +155,5 @@ export interface SlashPathFactoryConfig {
|
|
|
153
155
|
validate?: boolean | SlashPathValidationFactoryConfig;
|
|
154
156
|
}
|
|
155
157
|
export declare function slashPathFactory(config?: SlashPathFactoryConfig): SlashPathFactory;
|
|
156
|
-
export declare function mergeSlashPaths(paths: SlashPath[]): SlashPath;
|
|
158
|
+
export declare function mergeSlashPaths(paths: Maybe<SlashPath>[]): SlashPath;
|
|
157
159
|
export declare function slashPathInvalidError(): Error;
|
package/src/lib/path/path.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.slashPathInvalidError = exports.mergeSlashPaths = exports.slashPathFactory = exports.slashPathValidationFactory = exports.replaceInvalidFilePathTypeSeparatorsInSlashPathFunction = exports.replaceInvalidFilePathTypeSeparatorsInSlashPath = exports.removeTrailingFileTypeSeparators = exports.replaceMultipleFilePathsInSlashPath = exports.fixMultiSlashesInSlashPath = exports.toAbsoluteSlashPathStartType = exports.toRelativeSlashPathStartType = exports.ALL_SLASH_PATH_FILE_TYPE_SEPARATORS_REGEX = exports.ALL_DOUBLE_SLASHES_REGEX = exports.ALL_SLASHES_REGEX = exports.TRAILING_FILE_TYPE_SEPARATORS_REGEX = exports.TRAILING_SLASHES_REGEX = exports.LEADING_SLASHES_REGEX = exports.slashPathStartTypeFactory = exports.slashPathParts = exports.slashPathName = exports.isValidSlashPath = exports.isSlashPathFolder = exports.isSlashPathFile = exports.slashPathType = exports.DEFAULT_SLASH_PATH_ILLEGAL_CHARACTER_REPLACEMENT = exports.DEFAULT_SLASH_PATH_ILLEGAL_CHARACTERS = exports.SLASH_PATH_FILE_TYPE_SEPARATOR = exports.SLASH_PATH_SEPARATOR = void 0;
|
|
3
|
+
exports.slashPathInvalidError = exports.mergeSlashPaths = exports.slashPathFactory = exports.slashPathValidationFactory = exports.replaceInvalidFilePathTypeSeparatorsInSlashPathFunction = exports.replaceInvalidFilePathTypeSeparatorsInSlashPath = exports.removeTrailingFileTypeSeparators = exports.replaceMultipleFilePathsInSlashPath = exports.fixMultiSlashesInSlashPath = exports.toAbsoluteSlashPathStartType = exports.toRelativeSlashPathStartType = exports.ALL_SLASH_PATH_FILE_TYPE_SEPARATORS_REGEX = exports.ALL_DOUBLE_SLASHES_REGEX = exports.ALL_SLASHES_REGEX = exports.TRAILING_FILE_TYPE_SEPARATORS_REGEX = exports.TRAILING_SLASHES_REGEX = exports.LEADING_SLASHES_REGEX = exports.slashPathStartTypeFactory = exports.slashPathParts = exports.slashPathName = exports.isValidSlashPath = exports.isSlashPathFolder = exports.isSlashPathTypedFile = exports.isSlashPathFile = exports.slashPathType = exports.DEFAULT_SLASH_PATH_ILLEGAL_CHARACTER_REPLACEMENT = exports.DEFAULT_SLASH_PATH_ILLEGAL_CHARACTERS = exports.SLASH_PATH_FILE_TYPE_SEPARATOR = exports.SLASH_PATH_SEPARATOR = void 0;
|
|
4
4
|
const map_1 = require("../value/map");
|
|
5
5
|
const array_1 = require("../array/array");
|
|
6
6
|
const string_1 = require("../string");
|
|
@@ -19,7 +19,7 @@ exports.DEFAULT_SLASH_PATH_ILLEGAL_CHARACTER_REPLACEMENT = '_';
|
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
21
|
function slashPathType(input) {
|
|
22
|
-
const dotCount = input.split(exports.SLASH_PATH_FILE_TYPE_SEPARATOR, 2).length;
|
|
22
|
+
const dotCount = input.split(exports.SLASH_PATH_FILE_TYPE_SEPARATOR, 2).length - 1;
|
|
23
23
|
let type;
|
|
24
24
|
switch (dotCount) {
|
|
25
25
|
case 0:
|
|
@@ -37,7 +37,7 @@ function slashPathType(input) {
|
|
|
37
37
|
}
|
|
38
38
|
break;
|
|
39
39
|
case 1:
|
|
40
|
-
type = '
|
|
40
|
+
type = 'typedfile';
|
|
41
41
|
break;
|
|
42
42
|
default:
|
|
43
43
|
type = 'invalid';
|
|
@@ -51,6 +51,11 @@ function isSlashPathFile(input) {
|
|
|
51
51
|
return type === 'file' || type === 'typedfile';
|
|
52
52
|
}
|
|
53
53
|
exports.isSlashPathFile = isSlashPathFile;
|
|
54
|
+
function isSlashPathTypedFile(input) {
|
|
55
|
+
const type = slashPathType(input);
|
|
56
|
+
return type === 'typedfile';
|
|
57
|
+
}
|
|
58
|
+
exports.isSlashPathTypedFile = isSlashPathTypedFile;
|
|
54
59
|
function isSlashPathFolder(input) {
|
|
55
60
|
return slashPathType(input) === 'folder';
|
|
56
61
|
}
|
|
@@ -204,7 +209,7 @@ function slashPathValidationFactory(config) {
|
|
|
204
209
|
exports.slashPathValidationFactory = slashPathValidationFactory;
|
|
205
210
|
function slashPathFactory(config) {
|
|
206
211
|
const { startType: type = 'any', basePath: inputBasePaths, validate = true } = config !== null && config !== void 0 ? config : {};
|
|
207
|
-
const basePath = inputBasePaths ? mergeSlashPaths((0, array_1.asArray)(inputBasePaths)) :
|
|
212
|
+
const basePath = inputBasePaths ? mergeSlashPaths((0, array_1.asArray)(inputBasePaths)) : undefined;
|
|
208
213
|
const typeFactory = slashPathStartTypeFactory(type);
|
|
209
214
|
const validationFactory = validate ? (typeof validate === 'boolean' ? slashPathValidationFactory() : slashPathValidationFactory(validate)) : null;
|
|
210
215
|
const finalizeFn = (0, value_1.chainMapFunction)(typeFactory, validationFactory);
|
package/src/lib/path/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/path/path.ts"],"names":[],"mappings":";;;AAAA,sCAAsE;AACtE,0CAAmF;AACnF,sCAAqI;AACrI,
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/path/path.ts"],"names":[],"mappings":";;;AAAA,sCAAsE;AACtE,0CAAmF;AACnF,sCAAqI;AACrI,oCAAwE;AAG3D,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAC3B,QAAA,8BAA8B,GAAG,GAAG,CAAC;AAKrC,QAAA,qCAAqC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAE/E;;GAEG;AACU,QAAA,gDAAgD,GAAG,GAAG,CAAC;AAoCpE;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAgB;IAC5C,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK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C,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9E,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAXD,4CAWC;AAED,SAAgB,eAAe,CAAC,KAAyB;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,4BAAoB,CAAC,CAAC;IACzE,OAAO,0BAA0B,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC;AAHD,0CAGC;AAED,SAAgB,qBAAqB;IACnC,OAAO,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAChD,CAAC;AAFD,sDAEC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PrimativeKey, ReadKeyFunction } from '
|
|
2
|
-
import { ArrayOrValue } from '
|
|
1
|
+
import { PrimativeKey, ReadKeyFunction } from '../key';
|
|
2
|
+
import { ArrayOrValue } from '../array/array';
|
|
3
3
|
import { PromiseOrValue } from '../promise/promise';
|
|
4
4
|
/**
|
|
5
5
|
* Key used to signify
|
package/src/lib/type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Merge, NonNever, PickProperties, StrictOmit, Writable } from 'ts-essentials';
|
|
1
|
+
import { Merge, NonNever, PickProperties, StrictOmit, UnionToIntersection, Writable } from 'ts-essentials';
|
|
2
2
|
/**
|
|
3
3
|
* Class typing, restricted to types that have a constructor via the new keyword.
|
|
4
4
|
*/
|
|
@@ -24,10 +24,12 @@ export declare type StringKeyValueTransformMap<T, V> = {
|
|
|
24
24
|
export declare type KeysAsStrings<T> = {
|
|
25
25
|
[K in keyof T as string]: T[K];
|
|
26
26
|
};
|
|
27
|
+
export declare type ValuesTypesAsArray<T> = T[keyof T][];
|
|
27
28
|
/**
|
|
28
29
|
* Converts the input value to a string, if possible. Never otherwise.
|
|
29
30
|
*/
|
|
30
|
-
export declare type KeyAsString<K> =
|
|
31
|
+
export declare type KeyAsString<K> = `${KeyCanBeString<K>}`;
|
|
32
|
+
export declare type KeyCanBeString<K> = K extends number | boolean | string | null | undefined ? K : never;
|
|
31
33
|
export declare type BooleanKeyValueTransformMap<T> = KeyValueTransformMap<T, boolean>;
|
|
32
34
|
/**
|
|
33
35
|
* Merges the types T and R, but replaces keys within T with those in R.
|
|
@@ -67,3 +69,30 @@ export declare type StringKeyPropertyKeys<T> = keyof StringKeyProperties<T>;
|
|
|
67
69
|
* Makes a readonly type able to be configured. Useful for configurating readonly types before they are used.
|
|
68
70
|
*/
|
|
69
71
|
export declare type Configurable<T> = Writable<T>;
|
|
72
|
+
/**
|
|
73
|
+
* StringConcatination of all keys of an object.
|
|
74
|
+
*/
|
|
75
|
+
export declare type CommaSeparatedKeysOfObject<T extends object> = CommaSeparatedKeys<`${KeyCanBeString<keyof T>}`>;
|
|
76
|
+
export declare type CommaSeparatedKeys<T extends string> = StringConcatination<T, ','>;
|
|
77
|
+
export declare type CommaSeparatedKeyCombinationsOfObject<T extends object> = CommaSeparatedKeyCombinations<`${KeyCanBeString<keyof T>}`>;
|
|
78
|
+
export declare type CommaSeparatedKeyCombinations<T extends string> = StringCombinations<T, ','>;
|
|
79
|
+
export declare type UnionToOvlds<U> = UnionToIntersection<U extends any ? (f: U) => void : never>;
|
|
80
|
+
export declare type PopUnion<U> = UnionToOvlds<U> extends (a: infer A) => void ? A : never;
|
|
81
|
+
/**
|
|
82
|
+
* A type that merges all combinations of strings together using a separator.
|
|
83
|
+
*
|
|
84
|
+
* Example:
|
|
85
|
+
* 'a' | 'b' | 'c' w/ ',' -> 'a' | 'b' | 'c' | 'a,b' | 'a,c' | 'a,b,c' | etc...
|
|
86
|
+
*
|
|
87
|
+
* Credit to:
|
|
88
|
+
*
|
|
89
|
+
* https://stackoverflow.com/a/65157132
|
|
90
|
+
*/
|
|
91
|
+
export declare type StringCombinations<S extends string, SEPARATOR extends string> = PopUnion<S> extends infer SELF ? SELF extends string ? Exclude<S, SELF> extends never ? SELF : `${StringCombinations<Exclude<S, SELF>, SEPARATOR>}${SEPARATOR}${SELF}` | StringCombinations<Exclude<S, SELF>, SEPARATOR> | SELF : never : never;
|
|
92
|
+
/**
|
|
93
|
+
* A type that merges all the input strings together using a separator.
|
|
94
|
+
*
|
|
95
|
+
* Example:
|
|
96
|
+
* 'a' | 'b' | 'c' w/ ',' -> 'a,b,c' | 'a,c,b'
|
|
97
|
+
*/
|
|
98
|
+
export declare type StringConcatination<S extends string, SEPARATOR extends string> = PopUnion<S> extends infer SELF ? SELF extends string ? Exclude<S, SELF> extends never ? SELF : `${StringConcatination<Exclude<S, SELF>, SEPARATOR>}${SEPARATOR}${SELF}` | `${SELF}${SEPARATOR}${StringConcatination<Exclude<S, SELF>, SEPARATOR>}` : never : never;
|
package/test/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [8.11.2](https://github.com/dereekb/dbx-components/compare/v8.11.1-dev...v8.11.2) (2022-07-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [8.11.1](https://github.com/dereekb/dbx-components/compare/v8.11.0-dev...v8.11.1) (2022-07-05)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# [8.11.0](https://github.com/dereekb/dbx-components/compare/v8.10.0-dev...v8.11.0) (2022-07-05)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
5
17
|
# [8.10.0](https://github.com/dereekb/dbx-components/compare/v8.9.1-dev...v8.10.0) (2022-07-04)
|
|
6
18
|
|
|
7
19
|
|
package/test/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util/test",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.2",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@dereekb/util": "8.
|
|
9
|
+
"@dereekb/util": "8.11.2",
|
|
10
10
|
"make-error": "^1.3.0",
|
|
11
11
|
"ts-essentials": "^9.1.2",
|
|
12
12
|
"extra-set": "^2.2.11",
|