@opexa/portal-sdk 0.0.5 → 0.0.6
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/dist/index.js +60 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +375 -354
- package/dist/index.mjs.map +1 -1
- package/dist/sdk.d.ts +21 -0
- package/dist/services/transaction.d.ts +0 -1
- package/dist/session-manager.d.ts +4 -1
- package/dist/types.d.ts +0 -1
- package/dist/utils/graphql-client.d.ts +3 -2
- package/dist/utils/http-error.d.ts +21 -1
- package/package.json +1 -4
package/dist/sdk.d.ts
CHANGED
|
@@ -28,7 +28,28 @@ export declare class Sdk {
|
|
|
28
28
|
signIn(input: SignInInput): Promise<SignInReturn>;
|
|
29
29
|
signOut(): Promise<void>;
|
|
30
30
|
/**
|
|
31
|
+
* @description Watches the session if it is still valid whenever signed in.
|
|
31
32
|
* @returns Unsubscribe function
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import * as React from 'react';
|
|
36
|
+
* import { useAuthenticated } from '@lib/stores';
|
|
37
|
+
*
|
|
38
|
+
* function WatchSession() {
|
|
39
|
+
* const { setAuthenticated } = useAuthenticated();
|
|
40
|
+
*
|
|
41
|
+
* React.useEffect(() => {
|
|
42
|
+
* const unsubscribe = sdk.watchSession({
|
|
43
|
+
* interval: 30000,
|
|
44
|
+
* onInvalid() {
|
|
45
|
+
* setAuthenticated(false);
|
|
46
|
+
* },
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* return unsubscribe;
|
|
50
|
+
* }, []);
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
32
53
|
*/
|
|
33
54
|
watchSession(input: WatchSessionInput): () => void;
|
|
34
55
|
session(): Promise<SessionReturn>;
|
|
@@ -9,7 +9,6 @@ export interface TransactionRecord {
|
|
|
9
9
|
currentBalance: Decimal;
|
|
10
10
|
referenceNumber: string;
|
|
11
11
|
dateTimeCreated: DateString;
|
|
12
|
-
dateTimeLastUpdated: DateString;
|
|
13
12
|
}
|
|
14
13
|
export interface TransactionRecordsQuery {
|
|
15
14
|
member: PaginatedQuery<'transactionRecords', TransactionRecord>;
|
|
@@ -7,12 +7,15 @@ interface Data {
|
|
|
7
7
|
refreshToken: string;
|
|
8
8
|
refreshTokenExpiresAt: number;
|
|
9
9
|
}
|
|
10
|
+
interface SessionManagerConfig extends AuthServiceConfig {
|
|
11
|
+
log?: boolean;
|
|
12
|
+
}
|
|
10
13
|
export declare class SessionManager {
|
|
11
14
|
private logger;
|
|
12
15
|
private storageKey;
|
|
13
16
|
private authService;
|
|
14
17
|
private _refreshing;
|
|
15
|
-
constructor(config:
|
|
18
|
+
constructor(config: SessionManagerConfig);
|
|
16
19
|
get refreshing(): boolean;
|
|
17
20
|
set refreshing(value: boolean);
|
|
18
21
|
create(input: CreateSessionInput): Promise<OperationResult<CreateSessionError>>;
|
package/dist/types.d.ts
CHANGED
|
@@ -511,7 +511,6 @@ export interface TransactionRecord {
|
|
|
511
511
|
currentBalance: number;
|
|
512
512
|
referenceNumber: string;
|
|
513
513
|
dateTimeCreated: Date;
|
|
514
|
-
dateTimeLastUpdated: Date;
|
|
515
514
|
}
|
|
516
515
|
export interface TransactionRecordsInput extends Internal.TransactionRecordsQueryVariables {
|
|
517
516
|
}
|
|
@@ -23,7 +23,8 @@ export declare class GraphQLClient {
|
|
|
23
23
|
request<Data>(query: string, variables?: GenericObject): Promise<GraphQLClientResponse<Data>>;
|
|
24
24
|
/** Single file upload */
|
|
25
25
|
upload<Data>(query: string, variables: GenericObject): Promise<GraphQLClientResponse<Data>>;
|
|
26
|
+
private exec;
|
|
26
27
|
private runMiddlewares;
|
|
27
|
-
private
|
|
28
|
-
private
|
|
28
|
+
private createUploadBody;
|
|
29
|
+
private extractFiles;
|
|
29
30
|
}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
export type HttpErrorCode =
|
|
1
|
+
export type HttpErrorCode =
|
|
2
|
+
/** 400 */
|
|
3
|
+
'HttpBadRequest'
|
|
4
|
+
/** 401 */
|
|
5
|
+
| 'HttpUnauthorized'
|
|
6
|
+
/** 403 */
|
|
7
|
+
| 'HttpForbidden'
|
|
8
|
+
/** 404 */
|
|
9
|
+
| 'HttpNotFound'
|
|
10
|
+
/** 408 */
|
|
11
|
+
| 'HttpRequestTimeout'
|
|
12
|
+
/** 429 */
|
|
13
|
+
| 'HttpTooManyRequests'
|
|
14
|
+
/** 500 */
|
|
15
|
+
| 'HttpInternalServerError'
|
|
16
|
+
/** 502 */
|
|
17
|
+
| 'HttpBadGateway'
|
|
18
|
+
/** 503 */
|
|
19
|
+
| 'HttpServiceUnavailable'
|
|
20
|
+
/** 504 */
|
|
21
|
+
| 'HttpGatewayTimeout';
|
|
2
22
|
export interface HttpError {
|
|
3
23
|
code: HttpErrorCode;
|
|
4
24
|
message: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opexa/portal-sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"typings": "dist/index.d.ts",
|
|
@@ -43,9 +43,6 @@
|
|
|
43
43
|
"date-fns": "3.6.0",
|
|
44
44
|
"msw": "2.3.1",
|
|
45
45
|
"postcss": "8.4.39",
|
|
46
|
-
"prettier": "3.3.2",
|
|
47
|
-
"prettier-plugin-svelte": "3.2.5",
|
|
48
|
-
"prettier-plugin-tailwindcss": "0.6.5",
|
|
49
46
|
"react": "18.3.1",
|
|
50
47
|
"react-dom": "18.3.1",
|
|
51
48
|
"react-router-dom": "6.24.0",
|