@xylabs/promise 4.2.2 → 4.3.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.
@@ -1,2 +1,7 @@
1
+ /**
2
+ * For use with Promise.allSettled to filter only successful results
3
+ * @param val
4
+ * @returns
5
+ */
1
6
  export declare const fulfilled: <T>(val: PromiseSettledResult<T>) => val is PromiseFulfilledResult<T>;
2
7
  //# sourceMappingURL=fulfilled.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"fulfilled.d.ts","sourceRoot":"","sources":["../../src/fulfilled.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAG,GAAG,IAAI,sBAAsB,CAAC,CAAC,CAE1F,CAAA"}
@@ -1,2 +1,20 @@
1
+ /**
2
+ * For use with Promise.allSettled to reduce to only successful result values
3
+ * @example <caption>Casting the initialValue provided to reduce</caption>
4
+ * const resolved = Promise.resolve('resolved')
5
+ * const rejected = Promise.reject('rejected')
6
+ * const settled = await Promise.allSettled([resolved, rejected])
7
+ * const results = settled.reduce(fulfilledValues, [] as string[])
8
+ * // results === [ 'resolved' ]
9
+ * @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption>
10
+ * const resolved = Promise.resolve('resolved')
11
+ * const rejected = Promise.reject('rejected')
12
+ * const settled = await Promise.allSettled([resolved, rejected])
13
+ * const results = settled.reduce<string[]>(fulfilledValues, [])
14
+ * // results === [ 'resolved' ]
15
+ * @param previousValue
16
+ * @param currentValue
17
+ * @returns
18
+ */
1
19
  export declare const fulfilledValues: <T>(previousValue: T[], currentValue: PromiseSettledResult<T>) => T[];
2
20
  //# sourceMappingURL=fulfilledValues.d.ts.map
@@ -1 +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
+ {"version":3,"file":"fulfilledValues.d.ts","sourceRoot":"","sources":["../../src/fulfilledValues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,oBAAoB,CAAC,CAAC,CAAC,KAAG,CAAC,EAG/F,CAAA"}
@@ -1,2 +1,7 @@
1
+ /**
2
+ * For use with Promise.allSettled to filter only rejected results
3
+ * @param val
4
+ * @returns
5
+ */
1
6
  export declare const rejected: <T>(val: PromiseSettledResult<T>) => val is PromiseRejectedResult;
2
7
  //# sourceMappingURL=rejected.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"rejected.d.ts","sourceRoot":"","sources":["../../src/rejected.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAG,GAAG,IAAI,qBAEjE,CAAA"}
@@ -5,5 +5,6 @@ export type OptionalPromisable<T, V = never> = Promisable<T | undefined, V>;
5
5
  export type OptionalPromisableArray<T, V = never> = PromisableArray<T | undefined, V>;
6
6
  export type NullablePromisable<T, V = never> = Promisable<T | null, V>;
7
7
  export type NullablePromisableArray<T, V = never> = PromisableArray<T | null, V>;
8
+ /** @description Used to document promises that are being used as Mutexes */
8
9
  export type AsyncMutex<T> = Promise<T>;
9
10
  //# sourceMappingURL=types.d.ts.map
@@ -1 +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"}
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;AAEhF,4EAA4E;AAC5E,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/promise",
3
- "version": "4.2.2",
3
+ "version": "4.3.0",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "promise",
@@ -36,8 +36,8 @@
36
36
  "module": "./dist/neutral/index.mjs",
37
37
  "types": "./dist/neutral/index.d.ts",
38
38
  "devDependencies": {
39
- "@xylabs/ts-scripts-yarn3": "^4.2.1",
40
- "@xylabs/tsconfig": "^4.2.1",
39
+ "@xylabs/ts-scripts-yarn3": "^4.2.3",
40
+ "@xylabs/tsconfig": "^4.2.3",
41
41
  "@xylabs/tsconfig-jest": "^4.1.0",
42
42
  "typescript": "^5.6.3"
43
43
  },