@nlabs/metropolisjs 1.0.7 → 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.
- package/CHANGELOG.md +7 -0
- package/README.md +128 -42
- package/docs/ACTIONS.md +116 -3
- package/docs/assets/metropolisjs-logo.png +0 -0
- package/docs/assets/metropolisjs-mark.svg +7 -0
- package/examples/crud-usage.tsx +1 -1
- package/examples/factory-pattern-usage.ts +85 -78
- package/examples/signup-error-handling.ts +25 -24
- package/factoryPatternGuide.md +90 -174
- package/lib/actions/awsRumActions/awsRumActions.d.ts +8 -1
- package/lib/actions/awsRumActions/awsRumActions.js +9 -5
- package/lib/actions/translationActions/translationActions.d.ts +2 -11
- package/lib/actions/translationActions/translationActions.js +2 -2
- package/lib/actions/userActions/userActions.d.ts +7 -5
- package/lib/actions/userActions/userActions.js +111 -64
- package/lib/index.d.ts +4 -9
- package/lib/index.js +19 -10
- package/lib/stores/tagStore.d.ts +1 -0
- package/lib/stores/tagStore.js +1 -1
- package/lib/stores/userStore.d.ts +1 -0
- package/lib/stores/userStore.js +2 -1
- package/lib/utils/actionFactory.d.ts +52 -6
- package/lib/utils/actionFactory.js +8 -6
- package/lib/utils/api.d.ts +7 -0
- package/lib/utils/api.js +18 -1
- package/lib/utils/baseActionFactory.d.ts +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +2 -2
- package/lib/utils/session.d.ts +1 -1
- package/package.json +16 -14
- package/tsconfig.examples.json +23 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FluxFramework } from '@nlabs/arkhamjs';
|
|
2
2
|
import type { User } from '../../adapters/userAdapter/userAdapter.js';
|
|
3
3
|
import type { SessionType } from '../../utils/api.js';
|
|
4
|
-
import type { BaseAdapterOptions } from '../../utils/validatorFactory.js';
|
|
5
4
|
import type { ActionRequestOptions } from '../../utils/requestCache.js';
|
|
5
|
+
import type { BaseAdapterOptions } from '../../utils/validatorFactory.js';
|
|
6
6
|
export type UserAdapterOptions = BaseAdapterOptions;
|
|
7
7
|
export interface UserActionsOptions {
|
|
8
8
|
readonly userAdapter?: (input: unknown, options?: UserAdapterOptions) => any;
|
|
@@ -28,6 +28,8 @@ export interface UserApiResultsType {
|
|
|
28
28
|
readonly activeCount?: number;
|
|
29
29
|
readonly addUser?: Partial<User>;
|
|
30
30
|
readonly confirmCode?: boolean;
|
|
31
|
+
readonly completeBillingSetupSession?: Partial<User>;
|
|
32
|
+
readonly createBillingSetupSession?: string;
|
|
31
33
|
readonly deactivate?: Partial<User>;
|
|
32
34
|
readonly forgotPassword?: boolean;
|
|
33
35
|
readonly itemById?: Partial<User>;
|
|
@@ -46,7 +48,6 @@ export interface UserApiResultsType {
|
|
|
46
48
|
readonly refreshSession?: SessionType;
|
|
47
49
|
readonly remove?: Partial<User>;
|
|
48
50
|
readonly resetPassword?: boolean;
|
|
49
|
-
readonly saveBillingCard?: Partial<User>;
|
|
50
51
|
readonly sendVerificationEmail?: boolean;
|
|
51
52
|
readonly session?: Partial<User>;
|
|
52
53
|
readonly signIn?: Partial<User>;
|
|
@@ -57,13 +58,15 @@ export interface UserApiResultsType {
|
|
|
57
58
|
readonly updatePlan?: Partial<User>;
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
|
-
export interface
|
|
61
|
+
export interface UserActions {
|
|
61
62
|
addUser: (userInput: Partial<User>, userProps?: string[], requestOptions?: ActionRequestOptions) => Promise<User>;
|
|
62
63
|
confirmCode: (code: number, { type, value }: {
|
|
63
64
|
type: 'email' | 'phone';
|
|
64
65
|
value: string;
|
|
65
66
|
}, requestOptions?: ActionRequestOptions) => Promise<boolean>;
|
|
66
67
|
confirmSignUp: (code: string, type: 'email' | 'phone', requestOptions?: ActionRequestOptions) => Promise<boolean>;
|
|
68
|
+
completeBillingSetupSession: (sessionId: string, userProps?: string[], requestOptions?: ActionRequestOptions) => Promise<User>;
|
|
69
|
+
createBillingSetupSession: (returnUrl: string, requestOptions?: ActionRequestOptions) => Promise<string>;
|
|
67
70
|
currentAuthenticatedUser: (requestOptions?: ActionRequestOptions) => Promise<User>;
|
|
68
71
|
list: (userProps?: string[], requestOptions?: ActionRequestOptions) => Promise<User[]>;
|
|
69
72
|
listByConnection: (userId: string, from?: number, to?: number, userProps?: string[], requestOptions?: ActionRequestOptions) => Promise<User[]>;
|
|
@@ -83,7 +86,6 @@ export interface userActions {
|
|
|
83
86
|
search: (query: string, userProps?: string[], requestOptions?: ActionRequestOptions) => Promise<User[]>;
|
|
84
87
|
sendVerificationEmail: (email: string, emailOptions?: VerificationEmailOptions, requestOptions?: ActionRequestOptions) => Promise<boolean>;
|
|
85
88
|
session: (userProps?: string[], requestOptions?: ActionRequestOptions) => Promise<User>;
|
|
86
|
-
saveBillingCard: (card: Record<string, unknown>, userProps?: string[], requestOptions?: ActionRequestOptions) => Promise<User>;
|
|
87
89
|
signIn: (user: Partial<User>, expires?: number, requestOptions?: ActionRequestOptions) => Promise<SessionType>;
|
|
88
90
|
signOut: (requestOptions?: ActionRequestOptions) => Promise<boolean>;
|
|
89
91
|
signUp: (userInput: Partial<User>, userProps?: string[], requestOptions?: ActionRequestOptions) => Promise<User>;
|
|
@@ -93,4 +95,4 @@ export interface userActions {
|
|
|
93
95
|
updateUserAdapter: (adapter: (input: unknown, options?: UserAdapterOptions) => any) => void;
|
|
94
96
|
updateUserAdapterOptions: (options: UserAdapterOptions) => void;
|
|
95
97
|
}
|
|
96
|
-
export declare const createUserActions: (flux: FluxFramework, options?: UserActionsOptions) =>
|
|
98
|
+
export declare const createUserActions: (flux: FluxFramework, options?: UserActionsOptions) => UserActions;
|