@vef-framework/core 1.0.134 → 2.0.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 +15 -0
- package/dist/cjs/api/client.cjs +171 -0
- package/dist/cjs/api/constants.cjs +13 -0
- package/dist/cjs/api/helpers.cjs +12 -0
- package/dist/cjs/api/index.cjs +14 -0
- package/dist/cjs/auth/helpers.cjs +19 -0
- package/dist/cjs/auth/index.cjs +10 -0
- package/dist/cjs/common/index.cjs +3 -0
- package/dist/cjs/context/api-client.cjs +25 -0
- package/dist/cjs/context/app.cjs +15 -0
- package/dist/cjs/context/context-selector.cjs +65 -0
- package/dist/cjs/context/disabled.cjs +15 -0
- package/dist/cjs/context/index.cjs +19 -0
- package/dist/cjs/dnd/index.cjs +102 -0
- package/dist/cjs/http/client.cjs +445 -0
- package/dist/cjs/http/errors.cjs +23 -0
- package/dist/cjs/http/helpers.cjs +17 -0
- package/dist/cjs/http/index.cjs +17 -0
- package/dist/cjs/immer/index.cjs +40 -0
- package/dist/cjs/index.cjs +306 -0
- package/dist/cjs/motion/features.cjs +13 -0
- package/dist/cjs/motion/index.cjs +48 -0
- package/dist/cjs/motion/motion-provider.cjs +29 -0
- package/dist/cjs/query/constants.cjs +8 -0
- package/dist/cjs/query/helpers.cjs +67 -0
- package/dist/cjs/query/hooks.cjs +52 -0
- package/dist/cjs/query/index.cjs +20 -0
- package/dist/cjs/state/index.cjs +41 -0
- package/dist/cjs/state-machine/index.cjs +35 -0
- package/dist/cjs/store/bound.cjs +42 -0
- package/dist/cjs/store/index.cjs +20 -0
- package/dist/cjs/store/unbound.cjs +74 -0
- package/dist/cjs/store/use-deep.cjs +17 -0
- package/dist/es/api/client.js +167 -0
- package/dist/es/api/constants.js +8 -0
- package/dist/es/api/helpers.js +8 -0
- package/dist/es/api/index.js +4 -0
- package/dist/es/auth/helpers.js +15 -0
- package/dist/es/auth/index.js +2 -0
- package/dist/es/common/index.js +1 -0
- package/dist/es/context/api-client.js +20 -0
- package/dist/es/context/app.js +10 -0
- package/dist/es/context/context-selector.js +61 -0
- package/dist/es/context/disabled.js +10 -0
- package/dist/es/context/index.js +5 -0
- package/dist/es/dnd/index.js +7 -0
- package/dist/es/http/client.js +439 -0
- package/dist/es/http/errors.js +19 -0
- package/dist/es/http/helpers.js +12 -0
- package/dist/es/http/index.js +4 -0
- package/dist/es/immer/index.js +8 -0
- package/dist/es/index.js +43 -0
- package/dist/es/motion/features.js +2 -0
- package/dist/es/motion/index.js +5 -0
- package/dist/es/motion/motion-provider.js +25 -0
- package/dist/es/query/constants.js +4 -0
- package/dist/es/query/helpers.js +60 -0
- package/dist/es/query/hooks.js +27 -0
- package/dist/es/query/index.js +4 -0
- package/dist/es/state/index.js +2 -0
- package/dist/es/state-machine/index.js +12 -0
- package/dist/es/store/bound.js +37 -0
- package/dist/es/store/index.js +5 -0
- package/dist/es/store/unbound.js +70 -0
- package/dist/es/store/use-deep.js +13 -0
- package/dist/types/api/client.d.ts +75 -0
- package/dist/types/api/constants.d.ts +8 -0
- package/dist/types/api/helpers.d.ts +9 -0
- package/dist/types/api/index.d.ts +4 -0
- package/dist/types/api/types.d.ts +48 -0
- package/dist/types/auth/helpers.d.ts +11 -0
- package/dist/types/auth/index.d.ts +2 -0
- package/dist/types/auth/types.d.ts +1 -0
- package/dist/types/common/index.d.ts +1 -0
- package/dist/types/common/types.d.ts +95 -0
- package/dist/types/context/api-client.d.ts +18 -0
- package/dist/types/context/app.d.ts +4 -0
- package/dist/types/context/context-selector.d.ts +44 -0
- package/dist/types/context/disabled.d.ts +9 -0
- package/dist/types/context/index.d.ts +5 -0
- package/dist/types/context/types.d.ts +27 -0
- package/dist/types/dnd/index.d.ts +6 -0
- package/dist/types/http/client.d.ts +144 -0
- package/dist/types/http/errors.d.ts +14 -0
- package/dist/types/http/helpers.d.ts +17 -0
- package/dist/types/http/index.d.ts +4 -0
- package/dist/types/http/types.d.ts +101 -0
- package/dist/types/immer/index.d.ts +2 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/motion/features.d.ts +1 -0
- package/dist/types/motion/index.d.ts +4 -0
- package/dist/types/motion/motion-provider.d.ts +5 -0
- package/dist/types/query/constants.d.ts +1 -0
- package/dist/types/query/helpers.d.ts +10 -0
- package/dist/types/query/hooks.d.ts +66 -0
- package/dist/types/query/index.d.ts +4 -0
- package/dist/types/query/types.d.ts +51 -0
- package/dist/types/state/index.d.ts +1 -0
- package/dist/types/state-machine/index.d.ts +14 -0
- package/dist/types/store/bound.d.ts +28 -0
- package/dist/types/store/index.d.ts +5 -0
- package/dist/types/store/types.d.ts +50 -0
- package/dist/types/store/unbound.d.ts +26 -0
- package/dist/types/store/use-deep.d.ts +7 -0
- package/package.json +59 -36
- package/README.md +0 -25
- package/cjs/api/api-client.cjs +0 -2
- package/cjs/api/api-context.cjs +0 -2
- package/cjs/api/index.cjs +0 -2
- package/cjs/api/query-client.cjs +0 -2
- package/cjs/api/request-client.cjs +0 -2
- package/cjs/auth/auth-context.cjs +0 -2
- package/cjs/auth/index.cjs +0 -2
- package/cjs/expr/compiler.cjs +0 -2
- package/cjs/expr/helpers.cjs +0 -2
- package/cjs/index.cjs +0 -2
- package/cjs/middleware/dispatcher.cjs +0 -2
- package/esm/api/api-client.js +0 -2
- package/esm/api/api-context.js +0 -2
- package/esm/api/index.js +0 -2
- package/esm/api/query-client.js +0 -2
- package/esm/api/request-client.js +0 -2
- package/esm/auth/auth-context.js +0 -2
- package/esm/auth/index.js +0 -2
- package/esm/expr/compiler.js +0 -2
- package/esm/expr/helpers.js +0 -2
- package/esm/index.js +0 -2
- package/esm/middleware/dispatcher.js +0 -2
- package/types/api/api-client.d.ts +0 -203
- package/types/api/api-context.d.ts +0 -167
- package/types/api/index.d.ts +0 -3
- package/types/api/query-client.d.ts +0 -27
- package/types/api/request-client.d.ts +0 -95
- package/types/auth/auth-context.d.ts +0 -29
- package/types/auth/index.d.ts +0 -1
- package/types/expr/compiler.d.ts +0 -35
- package/types/expr/helpers.d.ts +0 -58
- package/types/index.d.ts +0 -3
- package/types/middleware/dispatcher.d.ts +0 -22
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Api, ChildrenProps, Mapper, PermissionChecker } from "@vef-framework/shared";
|
|
2
|
-
import type { FC } from "react";
|
|
3
|
-
/**
|
|
4
|
-
* The props of the AuthContextProvider component.
|
|
5
|
-
*/
|
|
6
|
-
export interface AuthContextProviderProps extends ChildrenProps {
|
|
7
|
-
/**
|
|
8
|
-
* The permission checker.
|
|
9
|
-
*/
|
|
10
|
-
permissionChecker?: PermissionChecker;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* The auth context.
|
|
14
|
-
*/
|
|
15
|
-
export interface AuthContext {
|
|
16
|
-
/**
|
|
17
|
-
* The function to check the permission.
|
|
18
|
-
*/
|
|
19
|
-
checkPermission: Mapper<string | Api<any, any>, boolean>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The auth context provider.
|
|
23
|
-
*/
|
|
24
|
-
declare const AuthContextProvider: FC<AuthContextProviderProps>;
|
|
25
|
-
/**
|
|
26
|
-
* The use auth context hook.
|
|
27
|
-
*/
|
|
28
|
-
declare function useAuthContext(): AuthContext;
|
|
29
|
-
export { AuthContextProvider, useAuthContext, };
|
package/types/auth/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./auth-context";
|
package/types/expr/compiler.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tokens are strings that map to functions.
|
|
3
|
-
*/
|
|
4
|
-
interface Tokens {
|
|
5
|
-
[index: string]: (...args: any[]) => any;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* The compiler output, a function that adds the required tokens.
|
|
9
|
-
*/
|
|
10
|
-
export interface ExpressionEvaluator {
|
|
11
|
-
(tokens?: Tokens): any;
|
|
12
|
-
provide: (bind: (names: string[]) => Tokens) => ExpressionEvaluator;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Compiles a logical string like `"a != z || b == c"` into a single function.
|
|
16
|
-
* The return value is an object with a "provide" method that iterates over all
|
|
17
|
-
* requirement tokens to use as replacements.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* ```typescript
|
|
22
|
-
* let name = {
|
|
23
|
-
* value: 'jon'
|
|
24
|
-
* }
|
|
25
|
-
* const condition = compile("$name == 'bob'").provide((token) => {
|
|
26
|
-
* return () => name.value // must return a function!
|
|
27
|
-
* })
|
|
28
|
-
*
|
|
29
|
-
* condition() // false
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @param expr - An expression string to compile.
|
|
33
|
-
*/
|
|
34
|
-
export declare function compile(expr: string): ExpressionEvaluator;
|
|
35
|
-
export {};
|
package/types/expr/helpers.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if the given property exists on the given object.
|
|
3
|
-
*
|
|
4
|
-
* @param obj - An object to check.
|
|
5
|
-
* @param property - The property to check.
|
|
6
|
-
*
|
|
7
|
-
* @returns `boolean`
|
|
8
|
-
*/
|
|
9
|
-
export declare function has(obj: {
|
|
10
|
-
[index: string]: any;
|
|
11
|
-
[index: number]: any;
|
|
12
|
-
}, property: string | symbol | number): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Get a specific value via dot notation.
|
|
15
|
-
*
|
|
16
|
-
* @param obj - An object to fetch data from.
|
|
17
|
-
* @param addr - An "address" in dot notation.
|
|
18
|
-
*
|
|
19
|
-
* @returns `unknown`
|
|
20
|
-
*/
|
|
21
|
-
export declare function getAt(obj: any, addr: string): unknown;
|
|
22
|
-
/**
|
|
23
|
-
* Determine if the given string is fully quoted.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
*
|
|
27
|
-
* ```javascript
|
|
28
|
-
* hello - false
|
|
29
|
-
* "hello" - true
|
|
30
|
-
* 'world' - true
|
|
31
|
-
* "hello"=="world" - false
|
|
32
|
-
* "hello'this'" - false
|
|
33
|
-
* "hello"'there' - false
|
|
34
|
-
* "hello""there" - false
|
|
35
|
-
* 'hello === world' - true
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* @param str - The string to check.
|
|
39
|
-
*
|
|
40
|
-
* @returns `boolean`
|
|
41
|
-
*/
|
|
42
|
-
export declare function isQuotedString(str: string): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Parse a string for comma-separated arguments.
|
|
45
|
-
*
|
|
46
|
-
* @param str - String to parse arguments from.
|
|
47
|
-
*
|
|
48
|
-
* @returns `string[]`
|
|
49
|
-
*/
|
|
50
|
-
export declare function parseArgs(str: string): string[];
|
|
51
|
-
/**
|
|
52
|
-
* Remove extra escape characters.
|
|
53
|
-
*
|
|
54
|
-
* @param str - String to remove extra escape characters from.
|
|
55
|
-
*
|
|
56
|
-
* @returns `string`
|
|
57
|
-
*/
|
|
58
|
-
export declare function rmEscapes(str: string): string;
|
package/types/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* All Middleware conform to the pattern of accepting a payload and a
|
|
3
|
-
* `next()` function. They can either pass the payload to the next middleware
|
|
4
|
-
* explicitly (as an argument of next), or implicitly (no argument for next).
|
|
5
|
-
*/
|
|
6
|
-
export type Middleware<T = unknown> = (payload: T, next: (payload: T) => T) => T;
|
|
7
|
-
/**
|
|
8
|
-
* The Dispatcher interface is responsible creating/running "hooks".
|
|
9
|
-
*/
|
|
10
|
-
export interface Dispatcher<T> {
|
|
11
|
-
(middleware: Middleware<T>): number;
|
|
12
|
-
unshift: (middleware: Middleware<T>) => number;
|
|
13
|
-
remove: (middleware: Middleware<T>) => void;
|
|
14
|
-
dispatch: (payload: T) => T;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Creates a new dispatcher that allows the addition/removal of middleware
|
|
18
|
-
* functions, and the ability to dispatch a payload to all middleware.
|
|
19
|
-
*
|
|
20
|
-
* @returns Dispatcher
|
|
21
|
-
*/
|
|
22
|
-
export default function createDispatcher<T>(): Dispatcher<T>;
|