@leancodepl/cqrs-client-base 7.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/index.cjs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.cjs.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
package/index.esm.js ADDED
@@ -0,0 +1 @@
1
+
package/package.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@leancodepl/cqrs-client-base",
3
+ "version": "7.1.0",
4
+ "type": "commonjs",
5
+ "main": "./index.cjs.js",
6
+ "module": "./index.esm.js"
7
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ export type TokenProvider = {
2
+ getToken: () => Promise<string | undefined>;
3
+ invalidateToken: () => Promise<boolean>;
4
+ };
5
+ export type ValidationError<TErrorCodes extends Record<string, number>> = {
6
+ readonly PropertyName: string;
7
+ readonly ErrorMessage: string;
8
+ readonly AttemptedValue: unknown;
9
+ readonly ErrorCode: TErrorCodes[keyof TErrorCodes];
10
+ };
11
+ export type CommandResult<TErrorCodes extends Record<string, number>> = {
12
+ readonly WasSuccessful: true;
13
+ } | {
14
+ readonly WasSuccessful: false;
15
+ readonly ValidationErrors: ValidationError<TErrorCodes>[];
16
+ };
17
+ export type ApiSuccess<TResult> = {
18
+ readonly isSuccess: true;
19
+ readonly result: TResult;
20
+ };
21
+ export type ApiError = {
22
+ readonly isSuccess: false;
23
+ readonly error: any;
24
+ };
25
+ export type ApiResponse<TResult> = ApiSuccess<TResult> | ApiError;