march-hare 0.6.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/README.md +453 -0
- package/dist/march-hare.js +6 -0
- package/dist/march-hare.umd.cjs +1 -0
- package/dist/src/library/action/index.d.ts +66 -0
- package/dist/src/library/action/utils.d.ts +89 -0
- package/dist/src/library/annotate/index.d.ts +25 -0
- package/dist/src/library/boundary/components/broadcast/index.d.ts +12 -0
- package/dist/src/library/boundary/components/broadcast/types.d.ts +19 -0
- package/dist/src/library/boundary/components/broadcast/utils.d.ts +39 -0
- package/dist/src/library/boundary/components/consumer/components/partition/index.d.ts +27 -0
- package/dist/src/library/boundary/components/consumer/components/partition/types.d.ts +9 -0
- package/dist/src/library/boundary/components/consumer/index.d.ts +19 -0
- package/dist/src/library/boundary/components/consumer/types.d.ts +37 -0
- package/dist/src/library/boundary/components/consumer/utils.d.ts +13 -0
- package/dist/src/library/boundary/components/mode/index.d.ts +15 -0
- package/dist/src/library/boundary/components/mode/types.d.ts +7 -0
- package/dist/src/library/boundary/components/mode/utils.d.ts +55 -0
- package/dist/src/library/boundary/components/scope/index.d.ts +40 -0
- package/dist/src/library/boundary/components/scope/types.d.ts +20 -0
- package/dist/src/library/boundary/components/scope/utils.d.ts +19 -0
- package/dist/src/library/boundary/components/tasks/index.d.ts +14 -0
- package/dist/src/library/boundary/components/tasks/types.d.ts +43 -0
- package/dist/src/library/boundary/components/tasks/utils.d.ts +26 -0
- package/dist/src/library/boundary/index.d.ts +20 -0
- package/dist/src/library/boundary/types.d.ts +4 -0
- package/dist/src/library/error/index.d.ts +2 -0
- package/dist/src/library/error/types.d.ts +75 -0
- package/dist/src/library/error/utils.d.ts +15 -0
- package/dist/src/library/hooks/index.d.ts +43 -0
- package/dist/src/library/hooks/types.d.ts +72 -0
- package/dist/src/library/hooks/utils.d.ts +198 -0
- package/dist/src/library/index.d.ts +16 -0
- package/dist/src/library/resource/index.d.ts +99 -0
- package/dist/src/library/types/index.d.ts +718 -0
- package/dist/src/library/utils/index.d.ts +42 -0
- package/dist/src/library/utils/utils.d.ts +5 -0
- package/dist/src/library/utils.d.ts +37 -0
- package/package.json +104 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Pk } from '../types/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a promise that resolves after the specified number of milliseconds.
|
|
4
|
+
* The sleep will reject with an AbortError when the signal is aborted,
|
|
5
|
+
* allowing cleanup of pending operations.
|
|
6
|
+
*
|
|
7
|
+
* @param ms The number of milliseconds to sleep.
|
|
8
|
+
* @param signal AbortSignal to cancel the sleep early.
|
|
9
|
+
* @returns A promise that resolves after the delay or rejects if aborted.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sleep(ms: number, signal: AbortSignal | undefined): Promise<void>;
|
|
12
|
+
/** Shorthand alias for {@link sleep}. */
|
|
13
|
+
export declare const ζ: typeof sleep;
|
|
14
|
+
/**
|
|
15
|
+
* Repeatedly calls a function at a fixed interval until it returns `true` or
|
|
16
|
+
* the signal is aborted. The function is invoked immediately on the first
|
|
17
|
+
* iteration, then after each interval.
|
|
18
|
+
*
|
|
19
|
+
* @param ms The interval in milliseconds between invocations.
|
|
20
|
+
* @param signal Optional AbortSignal to cancel polling early.
|
|
21
|
+
* @param fn Callback invoked each iteration. Return `true` to stop polling.
|
|
22
|
+
* @returns A promise that resolves when `fn` returns `true`, or rejects with
|
|
23
|
+
* an AbortError if the signal is aborted.
|
|
24
|
+
*/
|
|
25
|
+
export declare function poll(ms: number, signal: AbortSignal | undefined, fn: () => boolean | Promise<boolean>): Promise<void>;
|
|
26
|
+
/** Shorthand alias for {@link poll}. */
|
|
27
|
+
export declare const π: typeof poll;
|
|
28
|
+
/**
|
|
29
|
+
* Generates a unique primary key.
|
|
30
|
+
* @returns A new unique symbol representing the primary key.
|
|
31
|
+
*/
|
|
32
|
+
export declare function pk(): symbol;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the provided ID is a valid primary key.
|
|
35
|
+
* A valid primary key is considered any value that is not a symbol.
|
|
36
|
+
* @template T The type of the object.
|
|
37
|
+
* @param id The primary key to validate.
|
|
38
|
+
* @returns `true` if the ID is valid, `false` otherwise.
|
|
39
|
+
*/
|
|
40
|
+
export declare function pk<T>(id: Pk<T>): boolean;
|
|
41
|
+
/** Shorthand alias for {@link pk}. */
|
|
42
|
+
export declare const κ: typeof pk;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal symbol description factories. Each function returns a namespaced
|
|
3
|
+
* string suitable for `Symbol()` descriptions or `startsWith` checks.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const describe: {
|
|
8
|
+
/** Unicast action description. `describe.action("Fetch")` → `"march-hare.action/Fetch"` */
|
|
9
|
+
action: (name?: string) => string;
|
|
10
|
+
/** Broadcast action description. `describe.broadcast("User")` → `"march-hare.action/broadcast/User"` */
|
|
11
|
+
broadcast: (name?: string) => string;
|
|
12
|
+
/** Multicast action description. `describe.multicast("Update")` → `"march-hare.action/multicast/Update"` */
|
|
13
|
+
multicast: (name?: string) => string;
|
|
14
|
+
/** Channeled action description. `describe.channel("user")` → `"march-hare.channel/user"` */
|
|
15
|
+
channel: (name?: string) => string;
|
|
16
|
+
/** Cache entry description. `describe.cache("users")` → `"march-hare.cache/users"` */
|
|
17
|
+
cache: (name?: string) => string;
|
|
18
|
+
/** Lifecycle action description. `describe.lifecycle("Mount")` → `"march-hare.action.lifecycle/Mount"` */
|
|
19
|
+
lifecycle: (name?: string) => string;
|
|
20
|
+
/** Mount replay sentinel description. Used to create the {@link replay} symbol. */
|
|
21
|
+
replay: (name?: string) => string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Flat record used for shallow property comparison in {@link changes}.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
type Changes = Record<string, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* Get high-level changed paths between two objects.
|
|
30
|
+
* Returns an object containing only the properties that were added or updated.
|
|
31
|
+
*
|
|
32
|
+
* @param previous - The previous state object
|
|
33
|
+
* @param next - The next state object
|
|
34
|
+
* @returns Object with changed property keys and their new values
|
|
35
|
+
*/
|
|
36
|
+
export declare function changes(previous: Changes, next: Changes): Changes;
|
|
37
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "march-hare",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"packageManager": "yarn@1.22.22",
|
|
7
|
+
"main": "./dist/march-hare.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/march-hare.js",
|
|
13
|
+
"require": "./dist/march-hare.umd.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"eventemitter3": "^5.0.4",
|
|
18
|
+
"immertation": "^0.1.26"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@mobily/ts-belt": "^3.0.0",
|
|
22
|
+
"immer": "^10.0.0",
|
|
23
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
24
|
+
},
|
|
25
|
+
"resolutions": {
|
|
26
|
+
"vitest/vite": "^7.3.1"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "vite build",
|
|
33
|
+
"build:example": "vite build --mode example --outDir dist-example --base /march-hare/",
|
|
34
|
+
"dev": "vite",
|
|
35
|
+
"preview": "vite preview",
|
|
36
|
+
"release": "make checks",
|
|
37
|
+
"prepare": "husky"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@babel/plugin-proposal-decorators": "^7.29.0",
|
|
41
|
+
"@babel/preset-env": "^7.29.0",
|
|
42
|
+
"@babel/preset-react": "^7.28.5",
|
|
43
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
44
|
+
"@emotion/css": "^11.13.5",
|
|
45
|
+
"@eslint/js": "^9.39.3",
|
|
46
|
+
"@faker-js/faker": "^10.3.0",
|
|
47
|
+
"@jest/globals": "^30.2.0",
|
|
48
|
+
"@js-temporal/polyfill": "^0.5.1",
|
|
49
|
+
"@mobily/ts-belt": "4.0.0-rc.5",
|
|
50
|
+
"@playwright/test": "^1.58.2",
|
|
51
|
+
"@testing-library/dom": "^10.4.1",
|
|
52
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
53
|
+
"@testing-library/react": "^16.3.2",
|
|
54
|
+
"@types/dom-navigation": "^1.0.7",
|
|
55
|
+
"@types/lodash": "^4.17.23",
|
|
56
|
+
"@types/ms": "^2.1.0",
|
|
57
|
+
"@types/ramda": "^0.31.1",
|
|
58
|
+
"@types/react": "^19.2.14",
|
|
59
|
+
"@types/react-dom": "^19.2.3",
|
|
60
|
+
"@types/traverse": "^0.6.37",
|
|
61
|
+
"@vitejs/plugin-react": "^5.1.4",
|
|
62
|
+
"antd": "^6.3.0",
|
|
63
|
+
"commit-and-tag-version": "^12.6.1",
|
|
64
|
+
"dayjs": "^1.11.19",
|
|
65
|
+
"dexie": "^4.3.0",
|
|
66
|
+
"eslint": "^9.39.3",
|
|
67
|
+
"eslint-plugin-fp": "^2.3.0",
|
|
68
|
+
"eslint-plugin-import": "^2.32.0",
|
|
69
|
+
"eslint-plugin-react": "^7.37.5",
|
|
70
|
+
"fslint": "^1.1.0",
|
|
71
|
+
"get-port-cli": "^3.0.0",
|
|
72
|
+
"globals": "^17.3.0",
|
|
73
|
+
"happy-dom": "^20.6.1",
|
|
74
|
+
"husky": "^9.1.7",
|
|
75
|
+
"immer": "^11.1.4",
|
|
76
|
+
"jest": "^30.2.0",
|
|
77
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
78
|
+
"jsdom": "^28.1.0",
|
|
79
|
+
"ky": "^2.0.2",
|
|
80
|
+
"lodash": "^4.17.23",
|
|
81
|
+
"lucide-react": "^0.564.0",
|
|
82
|
+
"madge": "^8.0.0",
|
|
83
|
+
"ms": "2",
|
|
84
|
+
"prettier": "^3.8.1",
|
|
85
|
+
"ramda": "^0.32.0",
|
|
86
|
+
"react": "^19.2.4",
|
|
87
|
+
"react-dom": "^19.2.4",
|
|
88
|
+
"react-flip-numbers": "^3.0.9",
|
|
89
|
+
"react-router-dom": "^7.13.0",
|
|
90
|
+
"react-test-renderer": "^19.2.4",
|
|
91
|
+
"react-wayfinder": "^0.1.3",
|
|
92
|
+
"rollup-plugin-visualizer": "^6.0.5",
|
|
93
|
+
"terser": "^5.46.0",
|
|
94
|
+
"traverse": "^0.6.11",
|
|
95
|
+
"ts-jest": "^29.4.6",
|
|
96
|
+
"ts-node": "^10.9.2",
|
|
97
|
+
"typescript": "^6.0.3",
|
|
98
|
+
"typescript-eslint": "^8.55.0",
|
|
99
|
+
"vite": "^7.3.1",
|
|
100
|
+
"vite-plugin-dts": "^4.5.4",
|
|
101
|
+
"vitest": "^4.0.18",
|
|
102
|
+
"wait-on": "^9.0.4"
|
|
103
|
+
}
|
|
104
|
+
}
|