@temboplus/afloat 0.1.13 → 0.1.30

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 (119) hide show
  1. package/esm/src/features/auth/access/contract.d.ts +14 -0
  2. package/esm/src/features/auth/access/contract.d.ts.map +1 -0
  3. package/esm/src/features/auth/access/contract.js +14 -0
  4. package/esm/src/features/auth/contract.d.ts +20 -20
  5. package/esm/src/features/auth/contract.js +2 -2
  6. package/esm/src/features/auth/identity/contract.d.ts +0 -7
  7. package/esm/src/features/auth/identity/contract.d.ts.map +1 -1
  8. package/esm/src/features/auth/identity/contract.js +0 -1
  9. package/esm/src/features/auth/identity/repository.d.ts +2 -2
  10. package/esm/src/features/auth/identity/repository.d.ts.map +1 -1
  11. package/esm/src/features/auth/identity/repository.js +5 -5
  12. package/esm/src/features/auth/manager.js +1 -1
  13. package/esm/src/features/auth/profile/contract.d.ts +17 -25
  14. package/esm/src/features/auth/profile/contract.d.ts.map +1 -1
  15. package/esm/src/features/auth/profile/contract.js +2 -4
  16. package/esm/src/features/auth/repository.d.ts +0 -1
  17. package/esm/src/features/auth/repository.d.ts.map +1 -1
  18. package/esm/src/features/auth/repository.js +3 -11
  19. package/esm/src/features/auth/storage/server_token_handler.d.ts +7 -6
  20. package/esm/src/features/auth/storage/server_token_handler.d.ts.map +1 -1
  21. package/esm/src/features/auth/storage/server_token_handler.js +73 -26
  22. package/esm/src/features/contact/contract.d.ts +10 -10
  23. package/esm/src/features/payout/contract.d.ts +12 -12
  24. package/esm/src/features/wallet/repository.d.ts +1 -28
  25. package/esm/src/features/wallet/repository.d.ts.map +1 -1
  26. package/esm/src/features/wallet/repository.js +0 -51
  27. package/esm/src/models/contact/derivatives/contact.js +2 -2
  28. package/esm/src/models/contact/derivatives/contact_info.d.ts +8 -8
  29. package/esm/src/models/contact/derivatives/contact_info.d.ts.map +1 -1
  30. package/esm/src/models/contact/derivatives/contact_info.js +12 -12
  31. package/esm/src/models/payout/channel.d.ts +4 -4
  32. package/esm/src/models/payout/channel.d.ts.map +1 -1
  33. package/esm/src/models/payout/channel.js +2 -2
  34. package/esm/src/models/payout/derivatives/payout.d.ts.map +1 -1
  35. package/esm/src/models/payout/derivatives/payout.js +2 -2
  36. package/esm/src/models/user/profile.d.ts +135 -12
  37. package/esm/src/models/user/profile.d.ts.map +1 -1
  38. package/esm/src/models/user/profile.js +318 -12
  39. package/esm/src/models/user/user.d.ts +14 -17
  40. package/esm/src/models/user/user.d.ts.map +1 -1
  41. package/esm/src/models/user/user.js +109 -26
  42. package/esm/src/models/wallet/index.d.ts +0 -1
  43. package/esm/src/models/wallet/index.d.ts.map +1 -1
  44. package/esm/src/models/wallet/index.js +0 -1
  45. package/esm/src/shared/token_required_repository.d.ts +78 -0
  46. package/esm/src/shared/token_required_repository.d.ts.map +1 -0
  47. package/esm/src/shared/token_required_repository.js +128 -0
  48. package/package.json +7 -7
  49. package/script/src/features/auth/access/contract.d.ts +14 -0
  50. package/script/src/features/auth/access/contract.d.ts.map +1 -0
  51. package/script/src/features/auth/access/contract.js +17 -0
  52. package/script/src/features/auth/contract.d.ts +20 -20
  53. package/script/src/features/auth/contract.js +1 -1
  54. package/script/src/features/auth/identity/contract.d.ts +0 -7
  55. package/script/src/features/auth/identity/contract.d.ts.map +1 -1
  56. package/script/src/features/auth/identity/contract.js +0 -1
  57. package/script/src/features/auth/identity/repository.d.ts +2 -2
  58. package/script/src/features/auth/identity/repository.d.ts.map +1 -1
  59. package/script/src/features/auth/identity/repository.js +5 -5
  60. package/script/src/features/auth/manager.js +1 -1
  61. package/script/src/features/auth/profile/contract.d.ts +17 -25
  62. package/script/src/features/auth/profile/contract.d.ts.map +1 -1
  63. package/script/src/features/auth/profile/contract.js +1 -3
  64. package/script/src/features/auth/repository.d.ts +0 -1
  65. package/script/src/features/auth/repository.d.ts.map +1 -1
  66. package/script/src/features/auth/repository.js +3 -11
  67. package/script/src/features/auth/storage/server_token_handler.d.ts +7 -6
  68. package/script/src/features/auth/storage/server_token_handler.d.ts.map +1 -1
  69. package/script/src/features/auth/storage/server_token_handler.js +72 -25
  70. package/script/src/features/contact/contract.d.ts +10 -10
  71. package/script/src/features/payout/contract.d.ts +12 -12
  72. package/script/src/features/wallet/repository.d.ts +1 -28
  73. package/script/src/features/wallet/repository.d.ts.map +1 -1
  74. package/script/src/features/wallet/repository.js +0 -51
  75. package/script/src/models/contact/derivatives/contact.js +1 -1
  76. package/script/src/models/contact/derivatives/contact_info.d.ts +8 -8
  77. package/script/src/models/contact/derivatives/contact_info.d.ts.map +1 -1
  78. package/script/src/models/contact/derivatives/contact_info.js +11 -11
  79. package/script/src/models/payout/channel.d.ts +4 -4
  80. package/script/src/models/payout/channel.d.ts.map +1 -1
  81. package/script/src/models/payout/channel.js +2 -2
  82. package/script/src/models/payout/derivatives/payout.d.ts.map +1 -1
  83. package/script/src/models/payout/derivatives/payout.js +1 -1
  84. package/script/src/models/user/profile.d.ts +135 -12
  85. package/script/src/models/user/profile.d.ts.map +1 -1
  86. package/script/src/models/user/profile.js +320 -13
  87. package/script/src/models/user/user.d.ts +14 -17
  88. package/script/src/models/user/user.d.ts.map +1 -1
  89. package/script/src/models/user/user.js +109 -26
  90. package/script/src/models/wallet/index.d.ts +0 -1
  91. package/script/src/models/wallet/index.d.ts.map +1 -1
  92. package/script/src/models/wallet/index.js +0 -1
  93. package/script/src/shared/token_required_repository.d.ts +78 -0
  94. package/script/src/shared/token_required_repository.d.ts.map +1 -0
  95. package/script/src/shared/token_required_repository.js +132 -0
  96. package/esm/src/features/auth/profile/repository.d.ts +0 -11
  97. package/esm/src/features/auth/profile/repository.d.ts.map +0 -1
  98. package/esm/src/features/auth/profile/repository.js +0 -21
  99. package/esm/src/features/files-gen/contract.d.ts +0 -67
  100. package/esm/src/features/files-gen/contract.d.ts.map +0 -1
  101. package/esm/src/features/files-gen/contract.js +0 -40
  102. package/esm/src/features/files-gen/repository.d.ts +0 -50
  103. package/esm/src/features/files-gen/repository.d.ts.map +0 -1
  104. package/esm/src/features/files-gen/repository.js +0 -56
  105. package/esm/src/models/wallet/statement.d.ts +0 -27
  106. package/esm/src/models/wallet/statement.d.ts.map +0 -1
  107. package/esm/src/models/wallet/statement.js +0 -13
  108. package/script/src/features/auth/profile/repository.d.ts +0 -11
  109. package/script/src/features/auth/profile/repository.d.ts.map +0 -1
  110. package/script/src/features/auth/profile/repository.js +0 -25
  111. package/script/src/features/files-gen/contract.d.ts +0 -67
  112. package/script/src/features/files-gen/contract.d.ts.map +0 -1
  113. package/script/src/features/files-gen/contract.js +0 -43
  114. package/script/src/features/files-gen/repository.d.ts +0 -50
  115. package/script/src/features/files-gen/repository.d.ts.map +0 -1
  116. package/script/src/features/files-gen/repository.js +0 -60
  117. package/script/src/models/wallet/statement.d.ts +0 -27
  118. package/script/src/models/wallet/statement.d.ts.map +0 -1
  119. package/script/src/models/wallet/statement.js +0 -16
@@ -0,0 +1,78 @@
1
+ import { type AppRouter } from "@ts-rest/core";
2
+ import type { InitClientArgs } from "@ts-rest/core";
3
+ /**
4
+ * TokenRequiredRepository
5
+ *
6
+ * A generic base class to build repositories for interacting with the API,
7
+ * without any dependency on AfloatAuth. Instead, it requires token to be
8
+ * explicitly provided when initializing the repository.
9
+ *
10
+ * @template TContract - The API contract extending `AppRouter` from `@ts-rest/core`.
11
+ */
12
+ export declare class TokenRequiredRepository<TContract extends AppRouter> {
13
+ /**
14
+ * A "ts-rest" contract
15
+ *
16
+ * @protected
17
+ */
18
+ protected contract: TContract;
19
+ /**
20
+ * An API endpoint
21
+ *
22
+ * @protected
23
+ */
24
+ protected endpoint: string;
25
+ /**
26
+ * An API Root URL
27
+ *
28
+ * @protected
29
+ */
30
+ protected root: string | undefined;
31
+ /**
32
+ * Authentication token
33
+ *
34
+ * @protected
35
+ */
36
+ protected token: string;
37
+ /**
38
+ * Constructs a new instance of `TokenRequiredRepository`.
39
+ *
40
+ * @param endpoint - API endpoint
41
+ * @param contract - The "ts-rest" contract
42
+ * @param token - Authentication token (required)
43
+ * @param root - Optional API root URL
44
+ */
45
+ constructor(endpoint: string, contract: TContract, token: string, root?: string);
46
+ /**
47
+ * Gets the initialized client for making API requests.
48
+ * Uses the provided authentication token.
49
+ */
50
+ get client(): { [TKey in keyof TContract]: TContract[TKey] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey], InitClientArgs>> : TContract[TKey] extends AppRouter ? TContract[TKey] extends infer T extends AppRouter ? { [TKey_1 in keyof T]: TContract[TKey][TKey_1] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1], InitClientArgs>> : TContract[TKey][TKey_1] extends AppRouter ? TContract[TKey][TKey_1] extends infer T_1 extends AppRouter ? { [TKey_2 in keyof T_1]: TContract[TKey][TKey_1][TKey_2] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2] extends AppRouter ? TContract[TKey][TKey_1][TKey_2] extends infer T_2 extends AppRouter ? { [TKey_3 in keyof T_2]: TContract[TKey][TKey_1][TKey_2][TKey_3] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3] extends infer T_3 extends AppRouter ? { [TKey_4 in keyof T_3]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends infer T_4 extends AppRouter ? { [TKey_5 in keyof T_4]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends infer T_5 extends AppRouter ? { [TKey_6 in keyof T_5]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends infer T_6 extends AppRouter ? { [TKey_7 in keyof T_6]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends infer T_7 extends AppRouter ? { [TKey_8 in keyof T_7]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends infer T_8 extends AppRouter ? { [TKey_9 in keyof T_8]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends infer T_9 extends AppRouter ? { [TKey_10 in keyof T_9]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10] extends AppRouter ? any : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; };
51
+ /**
52
+ * Updates the token used by this repository
53
+ *
54
+ * @param token - New authentication token
55
+ */
56
+ setToken(token: string): void;
57
+ /**
58
+ * Gets the current token
59
+ *
60
+ * @returns The current authentication token
61
+ */
62
+ getToken(): string;
63
+ /**
64
+ * Handles the API response by checking the HTTP status code and returning the response body
65
+ * for successful requests or throwing an `APIError` for errors.
66
+ *
67
+ * @template T - The expected type of the successful response body.
68
+ * @param result - The API response object containing the status code and response body.
69
+ * @param successStatusCode - The expected HTTP status code indicating success (e.g., 200, 201).
70
+ * @returns The response body typed as `T` if the status code matches the success criteria.
71
+ * @throws `APIError` - If the status code indicates a failure.
72
+ */
73
+ handleResponse<T>(result: {
74
+ status: number;
75
+ body: unknown;
76
+ }, successStatusCode: number): T;
77
+ }
78
+ //# sourceMappingURL=token_required_repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token_required_repository.d.ts","sourceRoot":"","sources":["../../../src/src/shared/token_required_repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,eAAe,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD;;;;;;;;GAQG;AACH,qBAAa,uBAAuB,CAAC,SAAS,SAAS,SAAS;IAC9D;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE9B;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;gBAED,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM;IAQf;;;OAGG;IACH,IAAI,MAAM,k0LAcT;IAED;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B;;;;OAIG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EACd,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,EACzC,iBAAiB,EAAE,MAAM,GACxB,CAAC;CAgBL"}
@@ -0,0 +1,128 @@
1
+ import { initClient } from "@ts-rest/core";
2
+ import { APIError } from "../errors/api_error.js";
3
+ import { v4 as uuidv4 } from "uuid";
4
+ /**
5
+ * TokenRequiredRepository
6
+ *
7
+ * A generic base class to build repositories for interacting with the API,
8
+ * without any dependency on AfloatAuth. Instead, it requires token to be
9
+ * explicitly provided when initializing the repository.
10
+ *
11
+ * @template TContract - The API contract extending `AppRouter` from `@ts-rest/core`.
12
+ */
13
+ export class TokenRequiredRepository {
14
+ /**
15
+ * Constructs a new instance of `TokenRequiredRepository`.
16
+ *
17
+ * @param endpoint - API endpoint
18
+ * @param contract - The "ts-rest" contract
19
+ * @param token - Authentication token (required)
20
+ * @param root - Optional API root URL
21
+ */
22
+ constructor(endpoint, contract, token, root) {
23
+ /**
24
+ * A "ts-rest" contract
25
+ *
26
+ * @protected
27
+ */
28
+ Object.defineProperty(this, "contract", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: void 0
33
+ });
34
+ /**
35
+ * An API endpoint
36
+ *
37
+ * @protected
38
+ */
39
+ Object.defineProperty(this, "endpoint", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: void 0
44
+ });
45
+ /**
46
+ * An API Root URL
47
+ *
48
+ * @protected
49
+ */
50
+ Object.defineProperty(this, "root", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: void 0
55
+ });
56
+ /**
57
+ * Authentication token
58
+ *
59
+ * @protected
60
+ */
61
+ Object.defineProperty(this, "token", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: void 0
66
+ });
67
+ this.contract = contract;
68
+ this.endpoint = endpoint;
69
+ this.token = token;
70
+ this.root = root;
71
+ }
72
+ /**
73
+ * Gets the initialized client for making API requests.
74
+ * Uses the provided authentication token.
75
+ */
76
+ get client() {
77
+ const baseUrl = this.root
78
+ ? `${this.root}/${this.endpoint}`
79
+ : `https://api.afloat.money/v1/${this.endpoint}`;
80
+ const args = {
81
+ baseUrl,
82
+ baseHeaders: {
83
+ "token": this.token,
84
+ "x-request-id": uuidv4(),
85
+ },
86
+ };
87
+ return initClient(this.contract, args);
88
+ }
89
+ /**
90
+ * Updates the token used by this repository
91
+ *
92
+ * @param token - New authentication token
93
+ */
94
+ setToken(token) {
95
+ this.token = token;
96
+ }
97
+ /**
98
+ * Gets the current token
99
+ *
100
+ * @returns The current authentication token
101
+ */
102
+ getToken() {
103
+ return this.token;
104
+ }
105
+ /**
106
+ * Handles the API response by checking the HTTP status code and returning the response body
107
+ * for successful requests or throwing an `APIError` for errors.
108
+ *
109
+ * @template T - The expected type of the successful response body.
110
+ * @param result - The API response object containing the status code and response body.
111
+ * @param successStatusCode - The expected HTTP status code indicating success (e.g., 200, 201).
112
+ * @returns The response body typed as `T` if the status code matches the success criteria.
113
+ * @throws `APIError` - If the status code indicates a failure.
114
+ */
115
+ handleResponse(result, successStatusCode) {
116
+ if (successStatusCode === result.status) {
117
+ return result.body;
118
+ }
119
+ if (result.status === 400) {
120
+ throw new APIError(result.body);
121
+ }
122
+ throw new APIError({
123
+ message: "We encountered an error trying to process your request. Please try again later",
124
+ statusCode: 520,
125
+ error: "UNKNOWN ERROR",
126
+ });
127
+ }
128
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/afloat",
3
- "version": "0.1.13",
3
+ "version": "0.1.30",
4
4
  "description": "A JavaScript/TypeScript package providing common utilities and logic shared across all Temboplus-Afloat Projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,12 +23,12 @@
23
23
  },
24
24
  "private": false,
25
25
  "dependencies": {
26
- "@temboplus/frontend-core": "^0.2.0",
27
- "@ts-rest/core": "^3.51.0",
28
- "antd": "^5.22.7",
29
- "uuid": "^11.0.3",
30
- "zod": "^3.24.1",
31
- "zustand": "^5.0.2"
26
+ "@temboplus/frontend-core": "^0.2.4",
27
+ "@ts-rest/core": "^3.52.1",
28
+ "antd": "^5.24.5",
29
+ "uuid": "^11.1.0",
30
+ "zod": "^3.24.2",
31
+ "zustand": "^5.0.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.9.0",
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Auth API contract
4
+ */
5
+ export declare const accessContract: {
6
+ getAccessList: {
7
+ method: "GET";
8
+ path: "/access";
9
+ responses: {
10
+ 200: z.ZodArray<z.ZodString, "many">;
11
+ };
12
+ };
13
+ };
14
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/access/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;CAQzB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.accessContract = void 0;
4
+ const zod_1 = require("zod");
5
+ const core_1 = require("@ts-rest/core");
6
+ /**
7
+ * Auth API contract
8
+ */
9
+ exports.accessContract = (0, core_1.initContract)().router({
10
+ getAccessList: {
11
+ method: "GET",
12
+ path: "/access",
13
+ responses: {
14
+ 200: zod_1.z.string().array(),
15
+ },
16
+ },
17
+ });
@@ -23,28 +23,28 @@ export declare const authContract: {
23
23
  201: z.ZodObject<{
24
24
  profile: z.ZodObject<{
25
25
  id: z.ZodString;
26
- firstName: z.ZodString;
27
- lastName: z.ZodString;
26
+ firstName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
27
+ lastName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
28
28
  displayName: z.ZodString;
29
- phone: z.ZodString;
29
+ phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
30
30
  accountNo: z.ZodString;
31
- email: z.ZodString;
31
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
32
  }, z.UnknownKeysParam, z.ZodTypeAny, {
33
33
  id: string;
34
- firstName: string;
35
- lastName: string;
36
34
  displayName: string;
37
- phone: string;
38
35
  accountNo: string;
39
- email: string;
36
+ firstName?: string | null | undefined;
37
+ lastName?: string | null | undefined;
38
+ phone?: string | null | undefined;
39
+ email?: string | null | undefined;
40
40
  }, {
41
41
  id: string;
42
- firstName: string;
43
- lastName: string;
44
42
  displayName: string;
45
- phone: string;
46
43
  accountNo: string;
47
- email: string;
44
+ firstName?: string | null | undefined;
45
+ lastName?: string | null | undefined;
46
+ phone?: string | null | undefined;
47
+ email?: string | null | undefined;
48
48
  }>;
49
49
  token: z.ZodString;
50
50
  access: z.ZodArray<z.ZodString, "many">;
@@ -53,12 +53,12 @@ export declare const authContract: {
53
53
  resetPassword: boolean;
54
54
  profile: {
55
55
  id: string;
56
- firstName: string;
57
- lastName: string;
58
56
  displayName: string;
59
- phone: string;
60
57
  accountNo: string;
61
- email: string;
58
+ firstName?: string | null | undefined;
59
+ lastName?: string | null | undefined;
60
+ phone?: string | null | undefined;
61
+ email?: string | null | undefined;
62
62
  };
63
63
  token: string;
64
64
  access: string[];
@@ -66,12 +66,12 @@ export declare const authContract: {
66
66
  resetPassword: boolean;
67
67
  profile: {
68
68
  id: string;
69
- firstName: string;
70
- lastName: string;
71
69
  displayName: string;
72
- phone: string;
73
70
  accountNo: string;
74
- email: string;
71
+ firstName?: string | null | undefined;
72
+ lastName?: string | null | undefined;
73
+ phone?: string | null | undefined;
74
+ email?: string | null | undefined;
75
75
  };
76
76
  token: string;
77
77
  access: string[];
@@ -18,7 +18,7 @@ exports.authContract = (0, core_1.initContract)().router({
18
18
  }),
19
19
  responses: {
20
20
  201: zod_1.z.object({
21
- profile: index_js_1.profileSchema,
21
+ profile: index_js_1.Profile.schema,
22
22
  token: zod_1.z.string(),
23
23
  access: zod_1.z.array(zod_1.z.string()),
24
24
  resetPassword: zod_1.z.boolean(),
@@ -6,13 +6,6 @@ export declare const identityContract: {
6
6
  getUserCredentials: {
7
7
  method: "GET";
8
8
  path: "/me";
9
- headers: z.ZodObject<{
10
- token: z.ZodString;
11
- }, "strip", z.ZodTypeAny, {
12
- token: string;
13
- }, {
14
- token: string;
15
- }>;
16
9
  responses: {
17
10
  200: z.ZodObject<{
18
11
  name: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/identity/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;CAY3B,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/identity/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;CAW3B,CAAC"}
@@ -10,7 +10,6 @@ exports.identityContract = (0, core_1.initContract)().router({
10
10
  getUserCredentials: {
11
11
  method: "GET",
12
12
  path: "/me",
13
- headers: zod_1.z.object({ token: zod_1.z.string() }),
14
13
  responses: {
15
14
  200: zod_1.z.object({
16
15
  name: zod_1.z.string(),
@@ -1,12 +1,12 @@
1
- import { BaseRepository } from "../../../shared/index.js";
2
1
  import { identityContract } from "./contract.js";
3
2
  import type { ClientInferResponseBody } from "@ts-rest/core";
3
+ import { TokenRequiredRepository } from "../../../shared/token_required_repository.js";
4
4
  type GetUserIdentityResponse = ClientInferResponseBody<typeof identityContract.getUserCredentials>;
5
5
  /**
6
6
  * Class representing the LoginRepository.
7
7
  * Provides methods to retrieve user identity-related information.
8
8
  */
9
- export declare class LoginRepository extends BaseRepository<typeof identityContract> {
9
+ export declare class LoginRepository extends TokenRequiredRepository<typeof identityContract> {
10
10
  /**
11
11
  * Initializes an instance of LoginRepository.
12
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/identity/repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,KAAK,uBAAuB,GAAG,uBAAuB,CACpD,OAAO,gBAAgB,CAAC,kBAAkB,CAC3C,CAAC;AAEF;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,cAAc,CAAC,OAAO,gBAAgB,CAAC;IAC1E;;OAEG;;IAKH;;;;OAIG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAUnE"}
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/identity/repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAEvF,KAAK,uBAAuB,GAAG,uBAAuB,CACpD,OAAO,gBAAgB,CAAC,kBAAkB,CAC3C,CAAC;AAEF;;;GAGG;AACH,qBAAa,eACX,SAAQ,uBAAuB,CAAC,OAAO,gBAAgB,CAAC;IACxD;;OAEG;;IAKH;;;;OAIG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAUnE"}
@@ -2,18 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LoginRepository = void 0;
4
4
  const api_error_js_1 = require("../../../errors/api_error.js");
5
- const index_js_1 = require("../../../shared/index.js");
6
5
  const contract_js_1 = require("./contract.js");
6
+ const token_required_repository_js_1 = require("../../../shared/token_required_repository.js");
7
7
  /**
8
8
  * Class representing the LoginRepository.
9
9
  * Provides methods to retrieve user identity-related information.
10
10
  */
11
- class LoginRepository extends index_js_1.BaseRepository {
11
+ class LoginRepository extends token_required_repository_js_1.TokenRequiredRepository {
12
12
  /**
13
13
  * Initializes an instance of LoginRepository.
14
14
  */
15
15
  constructor() {
16
- super("login", contract_js_1.identityContract);
16
+ super("login", contract_js_1.identityContract, "");
17
17
  }
18
18
  /**
19
19
  * Retrieves the user's login credentials.
@@ -21,8 +21,8 @@ class LoginRepository extends index_js_1.BaseRepository {
21
21
  * @throws {APIError} If an error occurs while retrieving the credentials.
22
22
  */
23
23
  async getIdentity(token) {
24
- const headers = { token };
25
- const result = await this.client.getUserCredentials({ headers });
24
+ this.setToken(token);
25
+ const result = await this.client.getUserCredentials();
26
26
  if (result.status === 200)
27
27
  return result.body;
28
28
  throw new api_error_js_1.APIError({
@@ -80,7 +80,7 @@ class AfloatAuth {
80
80
  const store = new server_store_js_1.ServerStore();
81
81
  try {
82
82
  // Fetch and construct user data
83
- const user = await tokenHandler.constructUser();
83
+ const user = await tokenHandler.constructUser(token);
84
84
  store.setUser(user);
85
85
  // Create and initialize auth instance
86
86
  const auth = new AfloatAuth(store, tokenHandler);
@@ -1,4 +1,3 @@
1
- import { z } from "zod";
2
1
  /**
3
2
  * Profile API contract
4
3
  */
@@ -6,38 +5,31 @@ export declare const profileContract: {
6
5
  getCurrentProfile: {
7
6
  method: "GET";
8
7
  path: "/me";
9
- headers: z.ZodObject<{
10
- token: z.ZodString;
11
- }, "strip", z.ZodTypeAny, {
12
- token: string;
13
- }, {
14
- token: string;
15
- }>;
16
8
  responses: {
17
- 200: z.ZodObject<{
18
- id: z.ZodString;
19
- firstName: z.ZodString;
20
- lastName: z.ZodString;
21
- displayName: z.ZodString;
22
- phone: z.ZodString;
23
- accountNo: z.ZodString;
24
- email: z.ZodString;
25
- }, z.UnknownKeysParam, z.ZodTypeAny, {
9
+ 200: import("zod").ZodObject<{
10
+ id: import("zod").ZodString;
11
+ firstName: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
12
+ lastName: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
13
+ displayName: import("zod").ZodString;
14
+ phone: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
15
+ accountNo: import("zod").ZodString;
16
+ email: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
17
+ }, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {
26
18
  id: string;
27
- firstName: string;
28
- lastName: string;
29
19
  displayName: string;
30
- phone: string;
31
20
  accountNo: string;
32
- email: string;
21
+ firstName?: string | null | undefined;
22
+ lastName?: string | null | undefined;
23
+ phone?: string | null | undefined;
24
+ email?: string | null | undefined;
33
25
  }, {
34
26
  id: string;
35
- firstName: string;
36
- lastName: string;
37
27
  displayName: string;
38
- phone: string;
39
28
  accountNo: string;
40
- email: string;
29
+ firstName?: string | null | undefined;
30
+ lastName?: string | null | undefined;
31
+ phone?: string | null | undefined;
32
+ email?: string | null | undefined;
41
33
  }>;
42
34
  };
43
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/profile/contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS1B,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/profile/contract.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ1B,CAAC"}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.profileContract = void 0;
4
4
  const core_1 = require("@ts-rest/core");
5
5
  const index_js_1 = require("../../../models/index.js");
6
- const zod_1 = require("zod");
7
6
  /**
8
7
  * Profile API contract
9
8
  */
@@ -11,9 +10,8 @@ exports.profileContract = (0, core_1.initContract)().router({
11
10
  getCurrentProfile: {
12
11
  method: "GET",
13
12
  path: "/me",
14
- headers: zod_1.z.object({ token: zod_1.z.string() }),
15
13
  responses: {
16
- 200: index_js_1.profileSchema,
14
+ 200: index_js_1.Profile.schema,
17
15
  },
18
16
  },
19
17
  });
@@ -26,6 +26,5 @@ export declare class AuthRepository extends BaseRepository<typeof authContract>
26
26
  * @throws {APIError} If the current password is invalid or another error occurs during the update process.
27
27
  */
28
28
  updatePassword(currentPassword: string, newPassword: string): Promise<boolean>;
29
- getAccessList(token: string): Promise<string[]>;
30
29
  }
31
30
  //# sourceMappingURL=repository.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/auth/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAI7C;;;GAGG;AACH,qBAAa,cAAe,SAAQ,cAAc,CAAC,OAAO,YAAY,CAAC;IACrE;;OAEG;;IAKH;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB3D;;;;;;OAMG;IACG,cAAc,CAClB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC;IAkBb,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAStD"}
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/auth/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAI7C;;;GAGG;AACH,qBAAa,cAAe,SAAQ,cAAc,CAAC,OAAO,YAAY,CAAC;IACrE;;OAEG;;IAKH;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB3D;;;;;;OAMG;IACG,cAAc,CAClB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC;CAiBpB"}
@@ -36,8 +36,9 @@ class AuthRepository extends base_repository_js_1.BaseRepository {
36
36
  if (result.status === 201) {
37
37
  const repo = new repository_js_1.LoginRepository();
38
38
  const loginCredentials = await repo.getIdentity(result.body.token);
39
- const user = new index_js_1.User({ ...result.body, loginCredentials });
40
- return user;
39
+ const user = index_js_1.User.from({ ...result.body, ...loginCredentials });
40
+ if (user)
41
+ return user;
41
42
  }
42
43
  throw new api_error_js_1.APIError({
43
44
  message: "An error occurred while trying to log in",
@@ -68,14 +69,5 @@ class AuthRepository extends base_repository_js_1.BaseRepository {
68
69
  statusCode: 502,
69
70
  });
70
71
  }
71
- async getAccessList(token) {
72
- const result = await this.client.access({ headers: { token: token } });
73
- if (result.status === 200)
74
- return result.body;
75
- throw new api_error_js_1.APIError({
76
- message: "An error occurred while trying to get access list",
77
- statusCode: 502,
78
- });
79
- }
80
72
  }
81
73
  exports.AuthRepository = AuthRepository;
@@ -3,15 +3,19 @@ import { User } from "../../../models/index.js";
3
3
  /**
4
4
  * Server-side implementation of TokenHandler.
5
5
  * Manages tokens in memory for the duration of a request.
6
+ * Uses TokenRequiredRepository instead of repositories that rely on AfloatAuth.
6
7
  * @implements {TokenHandler}
7
8
  */
8
9
  export declare class ServerTokenHandler implements TokenHandler {
9
- private token?;
10
+ private token;
11
+ private accessRepo;
12
+ private profileRepo;
13
+ private identityRepo;
10
14
  /**
11
15
  * Creates a new instance of ServerTokenHandler.
12
16
  * @param {string} [token] - Optional initial token value
13
17
  */
14
- constructor(token?: string | undefined);
18
+ constructor(token: string);
15
19
  /**
16
20
  * Returns the stored token.
17
21
  * @returns {string | undefined} The current token or undefined if not set
@@ -22,14 +26,11 @@ export declare class ServerTokenHandler implements TokenHandler {
22
26
  * @param {string} token - The token to store
23
27
  */
24
28
  setUserToken(token: string): void;
25
- /**
26
- * Clears the stored token from memory.
27
- */
28
29
  clearToken(): void;
29
30
  /**
30
31
  * Fetches and constructs the full user data
31
32
  * @returns {Promise<User>}
32
33
  */
33
- constructUser(): Promise<User>;
34
+ constructUser(token: string): Promise<User>;
34
35
  }
35
36
  //# sourceMappingURL=server_token_handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server_token_handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/server_token_handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAKhD;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IAKzC,OAAO,CAAC,KAAK,CAAC;IAJ1B;;;OAGG;gBACiB,KAAK,CAAC,EAAE,MAAM,YAAA;IAElC;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBrC"}
1
+ {"version":3,"file":"server_token_handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/storage/server_token_handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAW,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAMzD;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAiD;IACnE,OAAO,CAAC,WAAW,CAAkD;IACrE,OAAO,CAAC,YAAY,CAAmD;IAEvE;;;OAGG;gBACS,KAAK,EAAE,MAAM;IAqBzB;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOjC,UAAU,IAAI,IAAI;IAOlB;;;OAGG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAoDlD"}