promise-logic 1.0.0 → 1.1.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.
@@ -0,0 +1,12 @@
1
+ interface CreatePromiseLogicOptions {
2
+ prefix?: string;
3
+ suffix?: string;
4
+ rename?: Record<string, string>;
5
+ }
6
+
7
+ declare function createPromiseLogic(options?: CreatePromiseLogicOptions): {
8
+ [key: string]: <T>(iterable: Iterable<T | PromiseLike<T>>) => Promise<T[]>;
9
+ };
10
+
11
+ export { createPromiseLogic };
12
+ export type { CreatePromiseLogicOptions };
@@ -0,0 +1,41 @@
1
+ declare class PromiseLogicError extends Error {
2
+ type: 'XOR_ERROR' | 'NAND_ERROR' | 'NOR_ERROR' | 'XNOR_ERROR' | 'MAJORITY_ERROR';
3
+ results: PromiseSettledResult<unknown>[];
4
+ constructor(type: string, message: string, results: PromiseSettledResult<unknown>[]);
5
+ }
6
+
7
+ interface FlipFlop {
8
+ getState(): boolean;
9
+ toggle(): Promise<boolean>;
10
+ setState(state: boolean): Promise<boolean>;
11
+ }
12
+
13
+ declare class PromiseLogic {
14
+ static and<T>(iterable: Iterable<T | PromiseLike<T>>): Promise<T[]>;
15
+ static or<T>(iterable: Iterable<T | PromiseLike<T>>): Promise<T[]>;
16
+ static race<T>(iterable: Iterable<T | PromiseLike<T>>): Promise<T>;
17
+ static allSettled<T>(iterable: Iterable<T | PromiseLike<T>>): Promise<PromiseSettledResult<T>[]>;
18
+
19
+ static xor<T>(iterable: Iterable<T | PromiseLike<T>>): Promise<T[]>;
20
+ static nand<T>(iterable: Iterable<T | PromiseLike<T>>): Promise<T[]>;
21
+ static nor<T>(iterable: Iterable<T | PromiseLike<T>>): Promise<T[]>;
22
+ static xnor<T>(iterable: Iterable<T | PromiseLike<T>>): Promise<T[]>;
23
+ static majority<T>(iterable: Iterable<T | PromiseLike<T>>): Promise<T[]>;
24
+
25
+ static createFlipFlop(initialState?: boolean): FlipFlop;
26
+ }
27
+
28
+ interface CreatePromiseLogicOptions {
29
+ prefix?: string;
30
+ suffix?: string;
31
+ rename?: Record<string, string>;
32
+ }
33
+
34
+ declare function createPromiseLogic(options?: CreatePromiseLogicOptions): {
35
+ [key: string]: <T>(iterable: Iterable<T | PromiseLike<T>>) => Promise<T[]>;
36
+ };
37
+
38
+ declare function createLogicError(type: string, fulfilledCount: number, total: number, results: PromiseSettledResult<unknown>[]): PromiseLogicError;
39
+
40
+ export { PromiseLogic, PromiseLogicError, createLogicError, createPromiseLogic };
41
+ export type { CreatePromiseLogicOptions, FlipFlop };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promise-logic",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Compose promises with logic gate semantics (AND, OR, XOR, NAND, NOR, XNOR, Majority). Forget APIs, remember logic.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
@@ -75,7 +75,9 @@
75
75
  "jest": "^29.0.0",
76
76
  "jest-environment-jsdom": "^30.2.0",
77
77
  "prettier": "^3.0.0",
78
- "rollup": "^4.0.0"
78
+ "rollup": "^4.0.0",
79
+ "rollup-plugin-copy": "^3.5.0",
80
+ "rollup-plugin-dts": "^6.3.0"
79
81
  },
80
82
  "dependencies": {
81
83
  "@monaco-editor/react": "^4.7.0",