@vef-framework/core 1.0.135 → 2.0.1

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.
Files changed (139) hide show
  1. package/README +15 -0
  2. package/dist/cjs/api/client.cjs +171 -0
  3. package/dist/cjs/api/constants.cjs +13 -0
  4. package/dist/cjs/api/helpers.cjs +12 -0
  5. package/dist/cjs/api/index.cjs +14 -0
  6. package/dist/cjs/auth/helpers.cjs +19 -0
  7. package/dist/cjs/auth/index.cjs +10 -0
  8. package/dist/cjs/common/index.cjs +3 -0
  9. package/dist/cjs/context/api-client.cjs +25 -0
  10. package/dist/cjs/context/app.cjs +15 -0
  11. package/dist/cjs/context/context-selector.cjs +65 -0
  12. package/dist/cjs/context/disabled.cjs +15 -0
  13. package/dist/cjs/context/index.cjs +19 -0
  14. package/dist/cjs/dnd/index.cjs +102 -0
  15. package/dist/cjs/http/client.cjs +445 -0
  16. package/dist/cjs/http/errors.cjs +23 -0
  17. package/dist/cjs/http/helpers.cjs +17 -0
  18. package/dist/cjs/http/index.cjs +17 -0
  19. package/dist/cjs/immer/index.cjs +40 -0
  20. package/dist/cjs/index.cjs +306 -0
  21. package/dist/cjs/motion/features.cjs +13 -0
  22. package/dist/cjs/motion/index.cjs +48 -0
  23. package/dist/cjs/motion/motion-provider.cjs +29 -0
  24. package/dist/cjs/query/constants.cjs +8 -0
  25. package/dist/cjs/query/helpers.cjs +67 -0
  26. package/dist/cjs/query/hooks.cjs +52 -0
  27. package/dist/cjs/query/index.cjs +20 -0
  28. package/dist/cjs/state/index.cjs +41 -0
  29. package/dist/cjs/state-machine/index.cjs +35 -0
  30. package/dist/cjs/store/bound.cjs +42 -0
  31. package/dist/cjs/store/index.cjs +20 -0
  32. package/dist/cjs/store/unbound.cjs +74 -0
  33. package/dist/cjs/store/use-deep.cjs +17 -0
  34. package/dist/es/api/client.js +167 -0
  35. package/dist/es/api/constants.js +8 -0
  36. package/dist/es/api/helpers.js +8 -0
  37. package/dist/es/api/index.js +4 -0
  38. package/dist/es/auth/helpers.js +15 -0
  39. package/dist/es/auth/index.js +2 -0
  40. package/dist/es/common/index.js +1 -0
  41. package/dist/es/context/api-client.js +20 -0
  42. package/dist/es/context/app.js +10 -0
  43. package/dist/es/context/context-selector.js +61 -0
  44. package/dist/es/context/disabled.js +10 -0
  45. package/dist/es/context/index.js +5 -0
  46. package/dist/es/dnd/index.js +7 -0
  47. package/dist/es/http/client.js +439 -0
  48. package/dist/es/http/errors.js +19 -0
  49. package/dist/es/http/helpers.js +12 -0
  50. package/dist/es/http/index.js +4 -0
  51. package/dist/es/immer/index.js +8 -0
  52. package/dist/es/index.js +43 -0
  53. package/dist/es/motion/features.js +2 -0
  54. package/dist/es/motion/index.js +5 -0
  55. package/dist/es/motion/motion-provider.js +25 -0
  56. package/dist/es/query/constants.js +4 -0
  57. package/dist/es/query/helpers.js +60 -0
  58. package/dist/es/query/hooks.js +27 -0
  59. package/dist/es/query/index.js +4 -0
  60. package/dist/es/state/index.js +2 -0
  61. package/dist/es/state-machine/index.js +12 -0
  62. package/dist/es/store/bound.js +37 -0
  63. package/dist/es/store/index.js +5 -0
  64. package/dist/es/store/unbound.js +70 -0
  65. package/dist/es/store/use-deep.js +13 -0
  66. package/dist/types/api/client.d.ts +75 -0
  67. package/dist/types/api/constants.d.ts +8 -0
  68. package/dist/types/api/helpers.d.ts +9 -0
  69. package/dist/types/api/index.d.ts +4 -0
  70. package/dist/types/api/types.d.ts +48 -0
  71. package/dist/types/auth/helpers.d.ts +11 -0
  72. package/dist/types/auth/index.d.ts +2 -0
  73. package/dist/types/auth/types.d.ts +1 -0
  74. package/dist/types/common/index.d.ts +1 -0
  75. package/dist/types/common/types.d.ts +95 -0
  76. package/dist/types/context/api-client.d.ts +18 -0
  77. package/dist/types/context/app.d.ts +4 -0
  78. package/dist/types/context/context-selector.d.ts +44 -0
  79. package/dist/types/context/disabled.d.ts +9 -0
  80. package/dist/types/context/index.d.ts +5 -0
  81. package/dist/types/context/types.d.ts +27 -0
  82. package/dist/types/dnd/index.d.ts +6 -0
  83. package/dist/types/http/client.d.ts +144 -0
  84. package/dist/types/http/errors.d.ts +14 -0
  85. package/dist/types/http/helpers.d.ts +17 -0
  86. package/dist/types/http/index.d.ts +4 -0
  87. package/dist/types/http/types.d.ts +101 -0
  88. package/dist/types/immer/index.d.ts +2 -0
  89. package/dist/types/index.d.ts +14 -0
  90. package/dist/types/motion/features.d.ts +1 -0
  91. package/dist/types/motion/index.d.ts +4 -0
  92. package/dist/types/motion/motion-provider.d.ts +5 -0
  93. package/dist/types/query/constants.d.ts +1 -0
  94. package/dist/types/query/helpers.d.ts +10 -0
  95. package/dist/types/query/hooks.d.ts +66 -0
  96. package/dist/types/query/index.d.ts +4 -0
  97. package/dist/types/query/types.d.ts +51 -0
  98. package/dist/types/state/index.d.ts +1 -0
  99. package/dist/types/state-machine/index.d.ts +14 -0
  100. package/dist/types/store/bound.d.ts +28 -0
  101. package/dist/types/store/index.d.ts +5 -0
  102. package/dist/types/store/types.d.ts +50 -0
  103. package/dist/types/store/unbound.d.ts +26 -0
  104. package/dist/types/store/use-deep.d.ts +7 -0
  105. package/package.json +59 -37
  106. package/README.md +0 -25
  107. package/cjs/api/api-client.cjs +0 -2
  108. package/cjs/api/api-context.cjs +0 -2
  109. package/cjs/api/index.cjs +0 -2
  110. package/cjs/api/query-client.cjs +0 -2
  111. package/cjs/api/request-client.cjs +0 -2
  112. package/cjs/auth/auth-context.cjs +0 -2
  113. package/cjs/auth/index.cjs +0 -2
  114. package/cjs/expr/compiler.cjs +0 -2
  115. package/cjs/expr/helpers.cjs +0 -2
  116. package/cjs/index.cjs +0 -2
  117. package/cjs/middleware/dispatcher.cjs +0 -2
  118. package/esm/api/api-client.js +0 -2
  119. package/esm/api/api-context.js +0 -2
  120. package/esm/api/index.js +0 -2
  121. package/esm/api/query-client.js +0 -2
  122. package/esm/api/request-client.js +0 -2
  123. package/esm/auth/auth-context.js +0 -2
  124. package/esm/auth/index.js +0 -2
  125. package/esm/expr/compiler.js +0 -2
  126. package/esm/expr/helpers.js +0 -2
  127. package/esm/index.js +0 -2
  128. package/esm/middleware/dispatcher.js +0 -2
  129. package/types/api/api-client.d.ts +0 -203
  130. package/types/api/api-context.d.ts +0 -167
  131. package/types/api/index.d.ts +0 -3
  132. package/types/api/query-client.d.ts +0 -27
  133. package/types/api/request-client.d.ts +0 -95
  134. package/types/auth/auth-context.d.ts +0 -29
  135. package/types/auth/index.d.ts +0 -1
  136. package/types/expr/compiler.d.ts +0 -35
  137. package/types/expr/helpers.d.ts +0 -58
  138. package/types/index.d.ts +0 -3
  139. 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, };
@@ -1 +0,0 @@
1
- export * from "./auth-context";
@@ -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 {};
@@ -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,3 +0,0 @@
1
- export * from "./api";
2
- export * from "./auth";
3
- export { compile } from "./expr/compiler";
@@ -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>;