@koloseum/utils 0.2.28 → 0.3.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/dist/client.d.ts +125 -0
- package/dist/client.js +680 -0
- package/dist/formatting.d.ts +125 -0
- package/dist/formatting.js +369 -0
- package/dist/general.d.ts +54 -0
- package/dist/general.js +88 -0
- package/dist/platform.d.ts +66 -0
- package/dist/platform.js +764 -0
- package/dist/server.d.ts +77 -0
- package/dist/server.js +300 -0
- package/package.json +25 -3
- package/dist/utils.d.ts +0 -394
- package/dist/utils.js +0 -2019
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { MicroserviceGroup, MicroserviceObject, UserWithCustomMetadata } from "@koloseum/types/general";
|
|
2
|
+
import type { BranchAddressObject, County } from "@koloseum/types/public-auth";
|
|
3
|
+
export declare const Config: {
|
|
4
|
+
/**
|
|
5
|
+
* A reference of microservices available on the platform, represented as an object with each user group (i.e. `public`, `players`, `lounges`, and `backroom`) having its own array of microservices. Each microservice in a list is an object with the following properties:
|
|
6
|
+
* - `name`: The name of the microservice.
|
|
7
|
+
* - `description`: A description of the microservice.
|
|
8
|
+
* - `slug`: The slug of the microservice.
|
|
9
|
+
* - `features`: An array of features that the microservice has.
|
|
10
|
+
* - `roles`: An array of roles attached to the microservice.
|
|
11
|
+
*/
|
|
12
|
+
microservices: { [key in MicroserviceGroup]: MicroserviceObject<key>[]; };
|
|
13
|
+
};
|
|
14
|
+
export declare const Mock: {
|
|
15
|
+
/**
|
|
16
|
+
* A generic authenticated user.
|
|
17
|
+
* @param {string} id - The user ID; defaults to a random UUID
|
|
18
|
+
* @param {Date} date - The date and time; defaults to the current date and time
|
|
19
|
+
* @param {string} phone - The phone number; defaults to a generic Kenyan phone number
|
|
20
|
+
* @param {string} identityId - A default identity ID; defaults to a random UUID
|
|
21
|
+
* @returns A generic authenticated user.
|
|
22
|
+
*/
|
|
23
|
+
authenticatedUser: (id?: string, date?: Date, phone?: string, identityId?: string) => UserWithCustomMetadata;
|
|
24
|
+
};
|
|
25
|
+
export declare const Resource: {
|
|
26
|
+
/**
|
|
27
|
+
* Returns a list of all counties in Kenya.
|
|
28
|
+
* @param {"name" | "code"} sortBy - The field to sort the counties by, i.e. `name` or `code`; defaults to `name`
|
|
29
|
+
* @returns {Promise<County[]>} A list of objects with the county `name`, `code`, and a list of `subCounties`
|
|
30
|
+
*/
|
|
31
|
+
getKenyaCounties: (sortBy?: "name" | "code") => Promise<County[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the parent URL for a given base URL.
|
|
34
|
+
* @param {string} base - The base URL
|
|
35
|
+
* @returns {string} The parent URL
|
|
36
|
+
*/
|
|
37
|
+
getParentUrl: (base: string) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the redirect URL for a given URI.
|
|
40
|
+
* @param {string} uri - The URI to get the redirect URL for, i.e. `microserviceGroup:path` (e.g. `players:fgc/tournaments`)
|
|
41
|
+
* @param {"development" | "production"} env - The environment to use for the redirect URL; defaults to `production`
|
|
42
|
+
* @returns {string} An object with the redirect `url`, or an `error` if any occurs
|
|
43
|
+
*/
|
|
44
|
+
getRedirectUrl: (uri: string, env?: "development" | "production") => {
|
|
45
|
+
url?: string;
|
|
46
|
+
error?: any;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Parses a resource request and returns the URL and path.
|
|
50
|
+
* @param request - The request to parse.
|
|
51
|
+
* @returns An object with the `url` and `path` of the request.
|
|
52
|
+
*/
|
|
53
|
+
parseResourceRequest: (request: Request) => {
|
|
54
|
+
url: URL;
|
|
55
|
+
path?: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Validates address data submitted in a form and returns the validated data.
|
|
59
|
+
* @param {FormData} formData - The submitted form data
|
|
60
|
+
* @returns An object with the validated `address`, or an `error` if any has occurred
|
|
61
|
+
*/
|
|
62
|
+
validateAddress: (formData: FormData) => Promise<{
|
|
63
|
+
address?: BranchAddressObject;
|
|
64
|
+
error?: any;
|
|
65
|
+
}>;
|
|
66
|
+
};
|