@sparted/shared-library 1.0.27 → 1.0.28-dev.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/_virtual/_tslib.js +6 -1
- package/_virtual/_tslib.js.map +1 -1
- package/array/array-to-map.d.ts +1 -1
- package/cdn/cdn.factory.js +3 -5
- package/cdn/cdn.factory.js.map +1 -1
- package/cdn/types/cdn-factory.type.d.ts +14 -14
- package/cdn/utils/extract-info-from-url.util.d.ts +1 -1
- package/cdn/utils/get-cdn-from-s3-url.util.d.ts +1 -1
- package/cdn/utils/get-cdn-url.util.d.ts +1 -1
- package/cdn/utils/get-cdn-url.util.js +2 -2
- package/cdn/utils/get-cdn-url.util.js.map +1 -1
- package/fp/run-while.d.ts +2 -2
- package/http/encode-search-object.d.ts +1 -1
- package/http/fetch-with-timeout.d.ts +1 -1
- package/linked-list/linked-list-utils.d.ts +4 -4
- package/linked-list/type.d.ts +7 -7
- package/math/interpolate.d.ts +1 -1
- package/math/number-range.d.ts +1 -1
- package/package.json +1 -1
- package/promise/execute-or-resolve-default.d.ts +1 -1
- package/string/replace-in-template.d.ts +1 -1
- package/time/get-time-diff-as-string.d.ts +2 -2
- package/types/function.d.ts +1 -1
- package/types/general.d.ts +5 -5
- package/types/object.d.ts +11 -11
- package/types/search.d.ts +8 -8
package/_virtual/_tslib.js
CHANGED
|
@@ -37,7 +37,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
37
37
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
38
38
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
39
|
});
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
43
|
+
var e = new Error(message);
|
|
44
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
45
|
+
};
|
|
41
46
|
|
|
42
47
|
exports.__awaiter = __awaiter;
|
|
43
48
|
exports.__rest = __rest;
|
package/_virtual/_tslib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/array/array-to-map.d.ts
CHANGED
package/cdn/cdn.factory.js
CHANGED
|
@@ -23,8 +23,8 @@ const twicpicsTransformationQueries = (params) => {
|
|
|
23
23
|
const quality = params.quality || 90;
|
|
24
24
|
const transformations = [['quality', quality]];
|
|
25
25
|
const dpr = params.devicePixelRatio || 1;
|
|
26
|
-
const width = params.width ? params.width * dpr : '-';
|
|
27
|
-
const height = params.height ? params.height * dpr : '-';
|
|
26
|
+
const width = params.width ? Math.round(params.width * dpr) : '-';
|
|
27
|
+
const height = params.height ? Math.round(params.height * dpr) : '-';
|
|
28
28
|
const fit = params.fit || 'cover';
|
|
29
29
|
if (params.width !== undefined || params.height !== undefined) {
|
|
30
30
|
transformations.push([fit, `${width}x${height}`]);
|
|
@@ -46,9 +46,7 @@ const createCdn = ({ type, domain, instanceMapper, cacheVersion }) => {
|
|
|
46
46
|
const getCdnUrl = getCdnUrl_util.getCdnUrlFactory({
|
|
47
47
|
domain,
|
|
48
48
|
instanceMapper,
|
|
49
|
-
transformationQueries: type === 'imgix'
|
|
50
|
-
? imgixTransformationQueries
|
|
51
|
-
: twicpicsTransformationQueries,
|
|
49
|
+
transformationQueries: type === 'imgix' ? imgixTransformationQueries : twicpicsTransformationQueries,
|
|
52
50
|
cacheVersion,
|
|
53
51
|
});
|
|
54
52
|
return {
|
package/cdn/cdn.factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdn.factory.js","sources":["../../src/cdn/cdn.factory.ts"],"sourcesContent":["import { buildSearchParams } from '../http/build-search-params';\nimport type { CdnConfig, CdnType, TransformationQueries, TwicpicsTransformationChain } from './types';\nimport { getCdnFromS3UrlFactory } from './utils/get-cdn-from-s3-url.util';\nimport { getCdnUrlFactory } from './utils/get-cdn-url.util';\nimport { twicpicsTransformationChainToString } from './utils/twicpics-transformations.util';\n\nexport const imgixTransformationQueries: TransformationQueries = ({\n fit,\n width,\n height,\n quality,\n compress = true,\n devicePixelRatio,\n}) => {\n const params = {\n auto: compress ? 'compress,format' : undefined,\n fit: fit === 'crop' ? 'crop' : undefined,\n dpr: Number.isFinite(devicePixelRatio) ? devicePixelRatio : undefined,\n h: Number.isFinite(height) ? height : undefined,\n w: Number.isFinite(width) ? width : undefined,\n q: quality !== undefined && quality >= 0 && quality <= 100 ? quality : undefined,\n };\n const searchParams = buildSearchParams(params).toString();\n\n return searchParams ? `${searchParams}` : '';\n};\n\nexport const twicpicsTransformationQueries: TransformationQueries = (
|
|
1
|
+
{"version":3,"file":"cdn.factory.js","sources":["../../src/cdn/cdn.factory.ts"],"sourcesContent":["import { buildSearchParams } from '../http/build-search-params';\nimport type { CdnConfig, CdnType, TransformationQueries, TwicpicsTransformationChain } from './types';\nimport { getCdnFromS3UrlFactory } from './utils/get-cdn-from-s3-url.util';\nimport { getCdnUrlFactory } from './utils/get-cdn-url.util';\nimport { twicpicsTransformationChainToString } from './utils/twicpics-transformations.util';\n\nexport const imgixTransformationQueries: TransformationQueries = ({\n fit,\n width,\n height,\n quality,\n compress = true,\n devicePixelRatio,\n}) => {\n const params = {\n auto: compress ? 'compress,format' : undefined,\n fit: fit === 'crop' ? 'crop' : undefined,\n dpr: Number.isFinite(devicePixelRatio) ? devicePixelRatio : undefined,\n h: Number.isFinite(height) ? height : undefined,\n w: Number.isFinite(width) ? width : undefined,\n q: quality !== undefined && quality >= 0 && quality <= 100 ? quality : undefined,\n };\n const searchParams = buildSearchParams(params).toString();\n\n return searchParams ? `${searchParams}` : '';\n};\n\nexport const twicpicsTransformationQueries: TransformationQueries = (params) => {\n const quality = params.quality || 90;\n const transformations: TwicpicsTransformationChain = [['quality', quality]];\n const dpr = params.devicePixelRatio || 1;\n\n const width = params.width ? Math.round(params.width * dpr) : '-';\n const height = params.height ? Math.round(params.height * dpr) : '-';\n const fit = params.fit || 'cover';\n\n if (params.width !== undefined || params.height !== undefined) {\n transformations.push([fit, `${width}x${height}`]);\n }\n\n if (params.output !== undefined) {\n transformations.push(['output', params.output]);\n }\n\n return twicpicsTransformationChainToString(transformations);\n};\n\n/**\n *\n * @param type cdn provider: 'twicpics' | 'imgix'\n * @param domain provider domain\n * @param instanceMapper domain + the result of the instanceMapper will form the base path\n * @param cacheVersion\n * @returns \\{ getCdnUrl, transformationQueries \\}\n */\nexport const createCdn = <T extends CdnType>({ type, domain, instanceMapper, cacheVersion }: CdnConfig<T>) => {\n const getCdnUrl = getCdnUrlFactory({\n domain,\n instanceMapper,\n transformationQueries: type === 'imgix' ? imgixTransformationQueries : twicpicsTransformationQueries,\n cacheVersion,\n });\n\n return {\n getCdnUrl,\n getCdnFromS3Url: getCdnFromS3UrlFactory({\n getCdnUrl,\n }),\n };\n};\n"],"names":["buildSearchParams","twicpicsTransformationChainToString","getCdnUrlFactory","getCdnFromS3UrlFactory"],"mappings":";;;;;;;;;MAMa,0BAA0B,GAA0B,CAAC,EAChE,GAAG,EACH,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,GAAG,IAAI,EACf,gBAAgB,GACjB,KAAI;AACH,IAAA,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,SAAS;QAC9C,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,SAAS;AACxC,QAAA,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,GAAG,SAAS;AACrE,QAAA,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS;AAC/C,QAAA,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,SAAS;AAC7C,QAAA,CAAC,EAAE,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,IAAI,OAAO,IAAI,GAAG,GAAG,OAAO,GAAG,SAAS;KACjF,CAAC;IACF,MAAM,YAAY,GAAGA,mCAAiB,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE1D,OAAO,YAAY,GAAG,CAAA,EAAG,YAAY,CAAA,CAAE,GAAG,EAAE,CAAC;AAC/C,EAAE;AAEW,MAAA,6BAA6B,GAA0B,CAAC,MAAM,KAAI;AAC7E,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,eAAe,GAAgC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAC5E,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,gBAAgB,IAAI,CAAC,CAAC;IAEzC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAClE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACrE,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC;IAElC,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE;AAC7D,QAAA,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAG,EAAA,KAAK,CAAI,CAAA,EAAA,MAAM,CAAE,CAAA,CAAC,CAAC,CAAC;AACnD,KAAA;AAED,IAAA,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE;QAC/B,eAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AACjD,KAAA;AAED,IAAA,OAAOC,gEAAmC,CAAC,eAAe,CAAC,CAAC;AAC9D,EAAE;AAEF;;;;;;;AAOG;AACI,MAAM,SAAS,GAAG,CAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,YAAY,EAAgB,KAAI;IAC3G,MAAM,SAAS,GAAGC,+BAAgB,CAAC;QACjC,MAAM;QACN,cAAc;QACd,qBAAqB,EAAE,IAAI,KAAK,OAAO,GAAG,0BAA0B,GAAG,6BAA6B;QACpG,YAAY;AACb,KAAA,CAAC,CAAC;IAEH,OAAO;QACL,SAAS;QACT,eAAe,EAAEC,2CAAsB,CAAC;YACtC,SAAS;SACV,CAAC;KACH,CAAC;AACJ;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type BaseUrlMapperFunc = (instanceId: string) => string;
|
|
2
|
+
export type Transformation = {
|
|
3
3
|
fit?: 'crop' | 'contain';
|
|
4
4
|
width?: number;
|
|
5
5
|
height?: number;
|
|
@@ -11,26 +11,26 @@ export declare type Transformation = {
|
|
|
11
11
|
compress?: boolean;
|
|
12
12
|
output?: 'jpeg' | 'png' | 'webp' | 'image';
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type CdnParams = {
|
|
15
15
|
asThumbnail?: boolean;
|
|
16
16
|
transformation?: Transformation;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
18
|
+
export type TransformationQueries = (params: Transformation) => string;
|
|
19
|
+
type TwicpicsOutputTransformation = ['output', Transformation['output']];
|
|
20
|
+
type TwicpicsFitTransformation = ['cover' | 'crop' | 'contain', string] | ['quality', number];
|
|
21
|
+
export type TwicpicsTransformation = TwicpicsOutputTransformation | TwicpicsFitTransformation;
|
|
22
|
+
export type TwicpicsTransformationChain = TwicpicsTransformation[];
|
|
23
|
+
export type GetCdnUrl = (instanceId: string, path: `/${string}`, params?: CdnParams) => string;
|
|
24
|
+
export type GetCdnFromS3Url = (url: string, params?: CdnParams) => string;
|
|
25
|
+
export type InstanceMapper = (instanceId: string) => string;
|
|
26
|
+
export type CdnType = 'twicpics' | 'imgix';
|
|
27
|
+
export type CdnConfig<T extends CdnType> = {
|
|
28
28
|
type: T;
|
|
29
29
|
domain: `https://${string}`;
|
|
30
30
|
instanceMapper: InstanceMapper;
|
|
31
31
|
cacheVersion?: T extends 'twicpics' ? number : undefined;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type Cdn = {
|
|
34
34
|
getCdnUrl: GetCdnUrl;
|
|
35
35
|
getCdnFromS3Url: GetCdnFromS3Url;
|
|
36
36
|
};
|
|
@@ -8,8 +8,8 @@ const DEFAULT_THUMBNAIL_CONFIG = {
|
|
|
8
8
|
};
|
|
9
9
|
const genCacheVersionQuery = (cacheVersion) => (cacheVersion ? `v=${cacheVersion}` : '');
|
|
10
10
|
const getCdnUrlFactory = (config) => (instanceId, path, params = {}) => {
|
|
11
|
-
const { domain, instanceMapper, transformationQueries, cacheVersion
|
|
12
|
-
const { transformation = params.asThumbnail ? DEFAULT_THUMBNAIL_CONFIG : {}
|
|
11
|
+
const { domain, instanceMapper, transformationQueries, cacheVersion } = config;
|
|
12
|
+
const { transformation = params.asThumbnail ? DEFAULT_THUMBNAIL_CONFIG : {} } = params;
|
|
13
13
|
const transformationQuery = transformationQueries(transformation);
|
|
14
14
|
const cacheVersionQuery = genCacheVersionQuery(cacheVersion);
|
|
15
15
|
const hasQueryParams = [transformationQuery, cacheVersionQuery].some((query) => query !== '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-cdn-url.util.js","sources":["../../../src/cdn/utils/get-cdn-url.util.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"get-cdn-url.util.js","sources":["../../../src/cdn/utils/get-cdn-url.util.ts"],"sourcesContent":["import type { GetCdnUrl, InstanceMapper, Transformation, TransformationQueries } from '../types';\n\nconst DEFAULT_THUMBNAIL_CONFIG: Transformation = {\n width: 300,\n height: 300,\n};\n\ntype FactoryConfig = {\n domain: `https://${string}`;\n instanceMapper: InstanceMapper;\n transformationQueries: TransformationQueries;\n cacheVersion?: number;\n};\n\nexport const genCacheVersionQuery = (cacheVersion?: number) => (cacheVersion ? `v=${cacheVersion}` : '');\n\nexport const getCdnUrlFactory =\n (config: FactoryConfig): GetCdnUrl =>\n (instanceId, path, params = {}) => {\n const { domain, instanceMapper, transformationQueries, cacheVersion } = config;\n\n const { transformation = params.asThumbnail ? DEFAULT_THUMBNAIL_CONFIG : {} } = params;\n\n const transformationQuery: string = transformationQueries(transformation);\n const cacheVersionQuery = genCacheVersionQuery(cacheVersion);\n const hasQueryParams = [transformationQuery, cacheVersionQuery].some((query) => query !== '');\n\n return `${domain}${instanceMapper(instanceId)}${path}${hasQueryParams ? '?' : ''}${transformationQuery}${\n cacheVersionQuery ? `&${cacheVersionQuery}` : ''\n }`;\n };\n"],"names":[],"mappings":";;;;AAEA,MAAM,wBAAwB,GAAmB;AAC/C,IAAA,KAAK,EAAE,GAAG;AACV,IAAA,MAAM,EAAE,GAAG;CACZ,CAAC;MASW,oBAAoB,GAAG,CAAC,YAAqB,MAAM,YAAY,GAAG,KAAK,YAAY,CAAA,CAAE,GAAG,EAAE,EAAE;AAE5F,MAAA,gBAAgB,GAC3B,CAAC,MAAqB,KACtB,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,KAAI;IAChC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;AAE/E,IAAA,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC,WAAW,GAAG,wBAAwB,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;AAEvF,IAAA,MAAM,mBAAmB,GAAW,qBAAqB,CAAC,cAAc,CAAC,CAAC;AAC1E,IAAA,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;AAC7D,IAAA,MAAM,cAAc,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,EAAE,CAAC,CAAC;AAE9F,IAAA,OAAO,CAAG,EAAA,MAAM,CAAG,EAAA,cAAc,CAAC,UAAU,CAAC,CAAG,EAAA,IAAI,GAAG,cAAc,GAAG,GAAG,GAAG,EAAE,CAAG,EAAA,mBAAmB,CACpG,EAAA,iBAAiB,GAAG,CAAI,CAAA,EAAA,iBAAiB,EAAE,GAAG,EAChD,EAAE,CAAC;AACL;;;;;"}
|
package/fp/run-while.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type RunWhileConfig<T> = {
|
|
2
2
|
/**
|
|
3
3
|
* Return a boolean to keep running the callback or not.
|
|
4
4
|
*/
|
|
@@ -17,7 +17,7 @@ export declare type RunWhileConfig<T> = {
|
|
|
17
17
|
*/
|
|
18
18
|
initialValue: T;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type RunWhileFn = <T>(config: RunWhileConfig<T>) => {
|
|
21
21
|
/**
|
|
22
22
|
* The callback last result.
|
|
23
23
|
*/
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { LinkedListFormat, LinkedListItem, SimpleLinkedList } from './type';
|
|
2
|
-
export
|
|
2
|
+
export type WalkConfig<T extends LinkedListItem, Result> = {
|
|
3
3
|
startId: string | null;
|
|
4
4
|
items: Record<string, T>;
|
|
5
5
|
initValue: Result;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type WalkCallbackResult<R> = {
|
|
8
8
|
result: R;
|
|
9
9
|
control?: {
|
|
10
10
|
stop?: boolean;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type WalkCallback<Item, Result> = (accumulator: Result, current: Item) => WalkCallbackResult<Result>;
|
|
14
14
|
export declare const walkListItemRecord: <T extends LinkedListItem, Result>(callback: WalkCallback<T, Result>, config: WalkConfig<T, Result>) => Result;
|
|
15
15
|
export declare const findPreviousId: <T extends LinkedListItem>(id: string | null, list: SimpleLinkedList<T>) => string | null;
|
|
16
16
|
export declare const assertItemCompatibility: <T extends LinkedListItem>(item: T, format: LinkedListFormat | null) => void;
|
|
17
17
|
export declare const assertPresence: (id: string | null | undefined, items: Record<string, unknown>) => void;
|
|
18
|
-
|
|
18
|
+
type PositionAssertionConfig = {
|
|
19
19
|
previousId: string | null;
|
|
20
20
|
list: SimpleLinkedList<LinkedListItem>;
|
|
21
21
|
};
|
package/linked-list/type.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type LinkedListItem = {
|
|
2
2
|
id: string;
|
|
3
3
|
nextId: string | null;
|
|
4
4
|
previousId?: string | null;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type SimpleLinkedList<T extends LinkedListItem> = {
|
|
7
7
|
headId: string | null;
|
|
8
8
|
items: {
|
|
9
9
|
[id: string]: T;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
12
|
+
export type ReduceCallback<Item, Result> = (accumulator: Result, current: Item) => Result;
|
|
13
|
+
export type ItemPredicate<Item> = (item: Item) => boolean;
|
|
14
|
+
export type LinkedListFormat = 'double' | 'single';
|
|
15
|
+
export type ManipulationConfig<T extends LinkedListItem> = {
|
|
16
16
|
format: LinkedListFormat | null;
|
|
17
17
|
list: SimpleLinkedList<T>;
|
|
18
18
|
factory: (list: SimpleLinkedList<T>) => LinkedList<T>;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type LinkedList<T extends LinkedListItem> = {
|
|
21
21
|
readonly head: T | null;
|
|
22
22
|
readonly items: {
|
|
23
23
|
[id: string]: T;
|
package/math/interpolate.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type RangeArray = [number, number];
|
|
2
2
|
export declare const interpolate: (num: number, inputRange: RangeArray, outputRange: RangeArray) => number;
|
package/math/number-range.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type MonthLocaleLabels = [
|
|
2
2
|
string,
|
|
3
3
|
string,
|
|
4
4
|
string,
|
|
@@ -12,7 +12,7 @@ export declare type MonthLocaleLabels = [
|
|
|
12
12
|
string,
|
|
13
13
|
string
|
|
14
14
|
];
|
|
15
|
-
export
|
|
15
|
+
export type DiffTemplate = {
|
|
16
16
|
/**
|
|
17
17
|
* e.g.: ("%time% %timelabel% blabla")
|
|
18
18
|
*/
|
package/types/function.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type GenericFunction<TS extends any[], R> = (...args: TS) => R;
|
package/types/general.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export type Primitive = string | number | boolean;
|
|
2
|
+
export type Nullable<T> = T | null;
|
|
3
|
+
export type ValueType = Primitive | null | void | Array<any> | ReadonlyArray<any>;
|
|
4
|
+
export type ValueOf<T> = T[keyof T];
|
|
5
|
+
export type Range = {
|
|
6
6
|
min: number;
|
|
7
7
|
max: number;
|
|
8
8
|
};
|
package/types/object.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { ValueType } from './general';
|
|
2
|
-
export
|
|
2
|
+
export type NonMethodKeys<T> = {
|
|
3
3
|
[P in keyof T]: T[P] extends Function ? never : P;
|
|
4
4
|
}[keyof T];
|
|
5
|
-
export
|
|
5
|
+
export type Attributes<T> = {
|
|
6
6
|
[K in NonMethodKeys<T>]: T[K];
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type PartialAttributes<T> = {
|
|
9
9
|
[K in NonMethodKeys<T>]?: T[K];
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type MethodKeys<T> = {
|
|
12
12
|
[P in keyof T]: T[P] extends Function ? P : never;
|
|
13
13
|
}[keyof T];
|
|
14
|
-
export
|
|
14
|
+
export type Methods<T> = {
|
|
15
15
|
[K in MethodKeys<T>]: T[K];
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type PartialMethods<T> = {
|
|
18
18
|
[K in MethodKeys<T>]?: T[K];
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type ClassType<T, Params extends Array<any> = Array<any>> = {
|
|
21
21
|
new (...args: Params): T;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
24
|
-
export
|
|
23
|
+
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
24
|
+
export type DeepPartial<T> = T extends ValueType ? T : {
|
|
25
25
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type Intersection<A, B> = {
|
|
28
28
|
[P in keyof A & keyof B]: A[P] | B[P];
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
@@ -32,4 +32,4 @@ export declare type Intersection<A, B> = {
|
|
|
32
32
|
* "widen" the type by accident if it is a generic that should be inferred
|
|
33
33
|
* from elsewhere.
|
|
34
34
|
*/
|
|
35
|
-
export
|
|
35
|
+
export type NoInfer<T> = [T][T extends any ? 0 : never];
|
package/types/search.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type SearchSortBy = string;
|
|
2
|
+
export type SearchSortOrder = 'asc' | 'desc';
|
|
3
|
+
export type SearchSort = {
|
|
4
4
|
[by: SearchSortBy]: SearchSortOrder;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
6
|
+
export type SearchQueryProperty = string;
|
|
7
|
+
export type SearchQueryValue = string;
|
|
8
|
+
export type SearchQuery = {
|
|
9
9
|
[property: SearchQueryProperty]: SearchQueryValue;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type SearchObject = {
|
|
12
12
|
offset: number;
|
|
13
13
|
limit: number;
|
|
14
14
|
sort?: Record<string, SearchSortOrder>;
|
|
15
15
|
query?: SearchQuery;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type SearchResponse<T> = {
|
|
18
18
|
items: ReadonlyArray<T>;
|
|
19
19
|
offset: number;
|
|
20
20
|
limit: number;
|