@xylabs/promise 4.0.2 → 4.0.4

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.
@@ -0,0 +1,11 @@
1
+ export type PromiseExSubFunc<T, TResult = T> = (value: T) => TResult;
2
+ export type PromiseExFunc<T> = (resolve?: PromiseExSubFunc<T, void>, reject?: PromiseExSubFunc<T, void>) => void;
3
+ export type PromiseExValueFunc<V> = (value?: V) => boolean;
4
+ export declare class PromiseEx<T, V = void> extends Promise<T> {
5
+ cancelled?: boolean;
6
+ private _value?;
7
+ constructor(func: PromiseExFunc<T>, value?: V);
8
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null | undefined, onvalue?: (value?: V) => boolean): Promise<TResult1 | TResult2>;
9
+ value(onvalue?: (value?: V) => boolean): this;
10
+ }
11
+ //# sourceMappingURL=PromiseEx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PromiseEx.d.ts","sourceRoot":"","sources":["../../src/PromiseEx.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAA;AACpE,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,CAAA;AAChH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,OAAO,CAAA;AAE1D,qBAAa,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;IACpD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,MAAM,CAAC,CAAG;gBAEN,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;IAMpC,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAC1C,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACjF,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACvF,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,OAAO,GAC/B,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAO/B,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,OAAO;CAMvC"}
@@ -0,0 +1,12 @@
1
+ export type TypedValue = bigint | string | number | boolean | null | TypedObject | TypedArray | Function | symbol | undefined;
2
+ export type TypedKey<T extends string | void = void> = T extends string ? T : string | number | symbol;
3
+ export type TypedObject = {
4
+ [key: TypedKey]: TypedValue;
5
+ } | object;
6
+ export type TypedArray = TypedValue[];
7
+ export declare const isTypedKey: (value: unknown) => value is TypedKey;
8
+ export declare const isTypedValue: (value: unknown) => value is TypedValue;
9
+ export declare const isTypedArray: (value: unknown) => value is TypedArray;
10
+ export declare const isValidTypedFieldPair: (pair: [key: unknown, value: unknown]) => pair is [key: TypedKey, value: TypedValue];
11
+ export declare const isTypedObject: (value: unknown) => value is TypedObject;
12
+ //# sourceMappingURL=Typed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Typed.d.ts","sourceRoot":"","sources":["../../src/Typed.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAC7H,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AACtG,MAAM,MAAM,WAAW,GAAG;IAAE,CAAC,GAAG,EAAE,QAAQ,GAAG,UAAU,CAAA;CAAE,GAAG,MAAM,CAAA;AAClE,MAAM,MAAM,UAAU,GAAG,UAAU,EAAE,CAAA;AAErC,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,KAAK,IAAI,QAYpD,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,OAAO,KAAG,KAAK,IAAI,UAWtD,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,OAAO,KAAG,KAAK,IAAI,UAEtD,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAG,IAAI,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAGrH,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,KAAK,IAAI,WAMvD,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const fulfilled: <T>(val: PromiseSettledResult<T>) => val is PromiseFulfilledResult<T>;
2
+ //# sourceMappingURL=fulfilled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fulfilled.d.ts","sourceRoot":"","sources":["../../src/fulfilled.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,GAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAG,GAAG,IAAI,sBAAsB,CAAC,CAAC,CAE1F,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const fulfilledValues: <T>(previousValue: T[], currentValue: PromiseSettledResult<T>) => T[];
2
+ //# sourceMappingURL=fulfilledValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fulfilledValues.d.ts","sourceRoot":"","sources":["../../src/fulfilledValues.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe,GAAI,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,oBAAoB,CAAC,CAAC,CAAC,KAAG,CAAC,EAG/F,CAAA"}
@@ -1,44 +1,8 @@
1
- declare const fulfilled: <T>(val: PromiseSettledResult<T>) => val is PromiseFulfilledResult<T>;
2
-
3
- declare const fulfilledValues: <T>(previousValue: T[], currentValue: PromiseSettledResult<T>) => T[];
4
-
5
- type TypedValue = bigint | string | number | boolean | null | TypedObject | TypedArray | Function | symbol | undefined;
6
- type TypedKey<T extends string | void = void> = T extends string ? T : string | number | symbol;
7
- type TypedObject = {
8
- [key: TypedKey]: TypedValue;
9
- } | object;
10
- type TypedArray = TypedValue[];
11
- declare const isTypedKey: (value: unknown) => value is TypedKey;
12
- declare const isTypedValue: (value: unknown) => value is TypedValue;
13
- declare const isTypedArray: (value: unknown) => value is TypedArray;
14
- declare const isValidTypedFieldPair: (pair: [key: unknown, value: unknown]) => pair is [key: TypedKey, value: TypedValue];
15
- declare const isTypedObject: (value: unknown) => value is TypedObject;
16
-
17
- interface PromiseType {
18
- then: () => unknown;
19
- }
20
- type AnyNonPromise = Exclude<TypedValue, Promise<unknown>>;
21
- declare const isPromise: (value: unknown) => value is Promise<unknown>;
22
-
23
- type PromiseExSubFunc<T, TResult = T> = (value: T) => TResult;
24
- type PromiseExFunc<T> = (resolve?: PromiseExSubFunc<T, void>, reject?: PromiseExSubFunc<T, void>) => void;
25
- type PromiseExValueFunc<V> = (value?: V) => boolean;
26
- declare class PromiseEx<T, V = void> extends Promise<T> {
27
- cancelled?: boolean;
28
- private _value?;
29
- constructor(func: PromiseExFunc<T>, value?: V);
30
- then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null | undefined, onvalue?: (value?: V) => boolean): Promise<TResult1 | TResult2>;
31
- value(onvalue?: (value?: V) => boolean): this;
32
- }
33
-
34
- declare const rejected: <T>(val: PromiseSettledResult<T>) => val is PromiseRejectedResult;
35
-
36
- type Promisable<T, V = never> = PromiseEx<T, V> | Promise<T> | T;
37
- type PromisableArray<T, V = never> = Promisable<T[], V>;
38
- type OptionalPromisable<T, V = never> = Promisable<T | undefined, V>;
39
- type OptionalPromisableArray<T, V = never> = PromisableArray<T | undefined, V>;
40
- type NullablePromisable<T, V = never> = Promisable<T | null, V>;
41
- type NullablePromisableArray<T, V = never> = PromisableArray<T | null, V>;
42
- type AsyncMutex<T> = Promise<T>;
43
-
44
- export { type AnyNonPromise, type AsyncMutex, type NullablePromisable, type NullablePromisableArray, type OptionalPromisable, type OptionalPromisableArray, type Promisable, type PromisableArray, PromiseEx, type PromiseExFunc, type PromiseExSubFunc, type PromiseExValueFunc, type PromiseType, type TypedArray, type TypedKey, type TypedObject, type TypedValue, fulfilled, fulfilledValues, isPromise, isTypedArray, isTypedKey, isTypedObject, isTypedValue, isValidTypedFieldPair, rejected };
1
+ export { fulfilled } from './fulfilled.ts';
2
+ export { fulfilledValues } from './fulfilledValues.ts';
3
+ export * from './isPromise.ts';
4
+ export * from './PromiseEx.ts';
5
+ export { rejected } from './rejected.ts';
6
+ export * from './Typed.ts';
7
+ export * from './types.ts';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { TypedValue } from './Typed.ts';
2
+ export interface PromiseType {
3
+ then: () => unknown;
4
+ }
5
+ export type AnyNonPromise = Exclude<TypedValue, Promise<unknown>>;
6
+ export declare const isPromise: (value: unknown) => value is Promise<unknown>;
7
+ //# sourceMappingURL=isPromise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPromise.d.ts","sourceRoot":"","sources":["../../src/isPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,OAAO,CAAA;CACpB;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;AAEjE,eAAO,MAAM,SAAS,UAAW,OAAO,KAAG,KAAK,IAAI,OAAO,CAAC,OAAO,CAKlE,CAAA"}
@@ -0,0 +1,4 @@
1
+ export type FieldType = 'string' | 'number' | 'object' | 'symbol' | 'symbol' | 'undefined' | 'null' | 'array' | 'function';
2
+ export type ObjectTypeShape = Record<string | number | symbol, FieldType>;
3
+ export declare const isType: (value: unknown, expectedType: FieldType) => boolean;
4
+ //# sourceMappingURL=isType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isType.d.ts","sourceRoot":"","sources":["../../src/isType.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAA;AAE1H,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,SAAS,CAAC,CAAA;AAEzE,eAAO,MAAM,MAAM,UAAW,OAAO,gBAAgB,SAAS,YAwB7D,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const rejected: <T>(val: PromiseSettledResult<T>) => val is PromiseRejectedResult;
2
+ //# sourceMappingURL=rejected.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rejected.d.ts","sourceRoot":"","sources":["../../src/rejected.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ,GAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAG,GAAG,IAAI,qBAEjE,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { PromiseEx } from './PromiseEx.ts';
2
+ export type Promisable<T, V = never> = PromiseEx<T, V> | Promise<T> | T;
3
+ export type PromisableArray<T, V = never> = Promisable<T[], V>;
4
+ export type OptionalPromisable<T, V = never> = Promisable<T | undefined, V>;
5
+ export type OptionalPromisableArray<T, V = never> = PromisableArray<T | undefined, V>;
6
+ export type NullablePromisable<T, V = never> = Promisable<T | null, V>;
7
+ export type NullablePromisableArray<T, V = never> = PromisableArray<T | null, V>;
8
+ export type AsyncMutex<T> = Promise<T>;
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACvE,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC9D,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAA;AAC3E,MAAM,MAAM,uBAAuB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,eAAe,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAA;AACrF,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAA;AACtE,MAAM,MAAM,uBAAuB,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,eAAe,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAA;AAGhF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,16 +1,31 @@
1
1
  {
2
- "license": "LGPL-3.0-only",
3
2
  "name": "@xylabs/promise",
3
+ "version": "4.0.4",
4
+ "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
+ "keywords": [
6
+ "promise",
7
+ "xylabs",
8
+ "utility",
9
+ "typescript",
10
+ "esm"
11
+ ],
12
+ "homepage": "https://xylabs.com",
13
+ "bugs": {
14
+ "url": "git+https://github.com/xylabs/sdk-js/issues",
15
+ "email": "support@xylabs.com"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/xylabs/sdk-js.git"
20
+ },
21
+ "license": "LGPL-3.0-only",
4
22
  "author": {
5
- "email": "support@xylabs.com",
6
23
  "name": "XY Labs Development Team",
7
- "url": "https://xylabs.com"
8
- },
9
- "bugs": {
10
24
  "email": "support@xylabs.com",
11
- "url": "git+https://github.com/xylabs/sdk-js/issues"
25
+ "url": "https://xylabs.com"
12
26
  },
13
- "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
27
+ "sideEffects": false,
28
+ "type": "module",
14
29
  "exports": {
15
30
  ".": {
16
31
  "types": "./dist/neutral/index.d.ts",
@@ -18,20 +33,12 @@
18
33
  },
19
34
  "./package.json": "./package.json"
20
35
  },
21
- "types": "./dist/neutral/index.d.ts",
22
36
  "module": "./dist/neutral/index.mjs",
23
- "homepage": "https://xylabs.com",
24
- "keywords": [
25
- "promise",
26
- "xylabs",
27
- "utility",
28
- "typescript",
29
- "esm"
30
- ],
37
+ "types": "./dist/neutral/index.d.ts",
31
38
  "devDependencies": {
32
- "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
33
- "@xylabs/tsconfig": "^4.0.0-rc.15",
34
- "@xylabs/tsconfig-jest": "^4.0.0-rc.15",
39
+ "@xylabs/ts-scripts-yarn3": "^4.0.7",
40
+ "@xylabs/tsconfig": "^4.0.7",
41
+ "@xylabs/tsconfig-jest": "^4.0.7",
35
42
  "typescript": "^5.5.4"
36
43
  },
37
44
  "engines": {
@@ -39,12 +46,5 @@
39
46
  },
40
47
  "publishConfig": {
41
48
  "access": "public"
42
- },
43
- "repository": {
44
- "type": "git",
45
- "url": "git+https://github.com/xylabs/sdk-js.git"
46
- },
47
- "sideEffects": false,
48
- "version": "4.0.2",
49
- "type": "module"
49
+ }
50
50
  }
package/xy.config.ts CHANGED
@@ -2,9 +2,7 @@ import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
2
  const config: XyTsupConfig = {
3
3
  compile: {
4
4
  browser: {},
5
- neutral: {
6
- src: true,
7
- },
5
+ neutral: { src: true },
8
6
  node: {},
9
7
  },
10
8
  }