@softruck/api-contracts 0.1.1-beta.3
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/README.md +0 -0
- package/dist/alerts/api.d.ts +9 -0
- package/dist/alerts/api.js +8 -0
- package/dist/alerts/index.d.ts +3 -0
- package/dist/alerts/index.js +3 -0
- package/dist/alerts/schemas.d.ts +65 -0
- package/dist/alerts/schemas.js +29 -0
- package/dist/alerts/types.d.ts +36 -0
- package/dist/alerts/types.js +1 -0
- package/dist/auth/api.d.ts +26 -0
- package/dist/auth/api.js +39 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/schemas/access-codes.d.ts +16 -0
- package/dist/auth/schemas/access-codes.js +13 -0
- package/dist/auth/schemas/login.d.ts +13 -0
- package/dist/auth/schemas/login.js +9 -0
- package/dist/auth/schemas/passwords.d.ts +81 -0
- package/dist/auth/schemas/passwords.js +28 -0
- package/dist/auth/schemas/sessions.d.ts +3 -0
- package/dist/auth/schemas/sessions.js +2 -0
- package/dist/auth/schemas/tokens.d.ts +11 -0
- package/dist/auth/schemas/tokens.js +9 -0
- package/dist/auth/schemas.d.ts +5 -0
- package/dist/auth/schemas.js +5 -0
- package/dist/auth/types.d.ts +1 -0
- package/dist/auth/types.js +1 -0
- package/dist/checklist/api.d.ts +30 -0
- package/dist/checklist/api.js +15 -0
- package/dist/checklist/index.d.ts +3 -0
- package/dist/checklist/index.js +3 -0
- package/dist/checklist/schemas.d.ts +62 -0
- package/dist/checklist/schemas.js +46 -0
- package/dist/checklist/types.d.ts +76 -0
- package/dist/checklist/types.js +1 -0
- package/dist/chips/api.d.ts +17 -0
- package/dist/chips/api.js +8 -0
- package/dist/chips/connections/api.d.ts +13 -0
- package/dist/chips/connections/api.js +4 -0
- package/dist/chips/connections/index.d.ts +3 -0
- package/dist/chips/connections/index.js +3 -0
- package/dist/chips/connections/schemas.d.ts +31 -0
- package/dist/chips/connections/schemas.js +31 -0
- package/dist/chips/connections/types.d.ts +26 -0
- package/dist/chips/connections/types.js +1 -0
- package/dist/chips/index.d.ts +5 -0
- package/dist/chips/index.js +5 -0
- package/dist/chips/requirements/api.d.ts +13 -0
- package/dist/chips/requirements/api.js +4 -0
- package/dist/chips/requirements/index.d.ts +3 -0
- package/dist/chips/requirements/index.js +3 -0
- package/dist/chips/requirements/schemas.d.ts +21 -0
- package/dist/chips/requirements/schemas.js +21 -0
- package/dist/chips/requirements/types.d.ts +16 -0
- package/dist/chips/requirements/types.js +1 -0
- package/dist/chips/schemas.d.ts +78 -0
- package/dist/chips/schemas.js +72 -0
- package/dist/chips/types.d.ts +76 -0
- package/dist/chips/types.js +1 -0
- package/dist/core/client.d.ts +45 -0
- package/dist/core/client.js +42 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +4 -0
- package/dist/core/query-builder.d.ts +34 -0
- package/dist/core/query-builder.js +86 -0
- package/dist/core/schemas.d.ts +80 -0
- package/dist/core/schemas.js +31 -0
- package/dist/core/types.d.ts +119 -0
- package/dist/core/types.js +2 -0
- package/dist/devices/activations/api.d.ts +20 -0
- package/dist/devices/activations/api.js +9 -0
- package/dist/devices/activations/index.d.ts +3 -0
- package/dist/devices/activations/index.js +3 -0
- package/dist/devices/activations/schemas.d.ts +42 -0
- package/dist/devices/activations/schemas.js +42 -0
- package/dist/devices/activations/types.d.ts +75 -0
- package/dist/devices/activations/types.js +1 -0
- package/dist/devices/api.d.ts +28 -0
- package/dist/devices/api.js +11 -0
- package/dist/devices/commands/api.d.ts +17 -0
- package/dist/devices/commands/api.js +8 -0
- package/dist/devices/commands/index.d.ts +3 -0
- package/dist/devices/commands/index.js +3 -0
- package/dist/devices/commands/schemas.d.ts +39 -0
- package/dist/devices/commands/schemas.js +33 -0
- package/dist/devices/commands/types.d.ts +58 -0
- package/dist/devices/commands/types.js +1 -0
- package/dist/devices/index.d.ts +5 -0
- package/dist/devices/index.js +5 -0
- package/dist/devices/schemas.d.ts +115 -0
- package/dist/devices/schemas.js +96 -0
- package/dist/devices/types.d.ts +142 -0
- package/dist/devices/types.js +1 -0
- package/dist/enterprises/api.d.ts +27 -0
- package/dist/enterprises/api.js +15 -0
- package/dist/enterprises/index.d.ts +3 -0
- package/dist/enterprises/index.js +3 -0
- package/dist/enterprises/schemas.d.ts +59 -0
- package/dist/enterprises/schemas.js +53 -0
- package/dist/enterprises/types.d.ts +160 -0
- package/dist/enterprises/types.js +1 -0
- package/dist/events/api.d.ts +18 -0
- package/dist/events/api.js +13 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.js +3 -0
- package/dist/events/schemas.d.ts +262 -0
- package/dist/events/schemas.js +54 -0
- package/dist/events/types.d.ts +130 -0
- package/dist/events/types.js +1 -0
- package/dist/exports/api.d.ts +18 -0
- package/dist/exports/api.js +9 -0
- package/dist/exports/index.d.ts +3 -0
- package/dist/exports/index.js +3 -0
- package/dist/exports/schemas.d.ts +27 -0
- package/dist/exports/schemas.js +22 -0
- package/dist/exports/types.d.ts +47 -0
- package/dist/exports/types.js +1 -0
- package/dist/fuelings/api.d.ts +22 -0
- package/dist/fuelings/api.js +9 -0
- package/dist/fuelings/index.d.ts +3 -0
- package/dist/fuelings/index.js +3 -0
- package/dist/fuelings/schemas.d.ts +84 -0
- package/dist/fuelings/schemas.js +52 -0
- package/dist/fuelings/types.d.ts +80 -0
- package/dist/fuelings/types.js +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +22 -0
- package/dist/maintenances/api.d.ts +31 -0
- package/dist/maintenances/api.js +12 -0
- package/dist/maintenances/index.d.ts +3 -0
- package/dist/maintenances/index.js +3 -0
- package/dist/maintenances/schemas.d.ts +74 -0
- package/dist/maintenances/schemas.js +44 -0
- package/dist/maintenances/types.d.ts +69 -0
- package/dist/maintenances/types.js +1 -0
- package/dist/operation-logs/api.d.ts +13 -0
- package/dist/operation-logs/api.js +10 -0
- package/dist/operation-logs/index.d.ts +3 -0
- package/dist/operation-logs/index.js +3 -0
- package/dist/operation-logs/schemas.d.ts +34 -0
- package/dist/operation-logs/schemas.js +22 -0
- package/dist/operation-logs/types.d.ts +32 -0
- package/dist/operation-logs/types.js +1 -0
- package/dist/protocols/api.d.ts +34 -0
- package/dist/protocols/api.js +13 -0
- package/dist/protocols/index.d.ts +3 -0
- package/dist/protocols/index.js +3 -0
- package/dist/protocols/schemas.d.ts +66 -0
- package/dist/protocols/schemas.js +36 -0
- package/dist/protocols/types.d.ts +99 -0
- package/dist/protocols/types.js +1 -0
- package/dist/service-orders/api.d.ts +38 -0
- package/dist/service-orders/api.js +14 -0
- package/dist/service-orders/index.d.ts +3 -0
- package/dist/service-orders/index.js +3 -0
- package/dist/service-orders/schemas.d.ts +82 -0
- package/dist/service-orders/schemas.js +47 -0
- package/dist/service-orders/types.d.ts +84 -0
- package/dist/service-orders/types.js +1 -0
- package/dist/sharings/api.d.ts +17 -0
- package/dist/sharings/api.js +8 -0
- package/dist/sharings/index.d.ts +3 -0
- package/dist/sharings/index.js +3 -0
- package/dist/sharings/schemas.d.ts +47 -0
- package/dist/sharings/schemas.js +36 -0
- package/dist/sharings/types.d.ts +54 -0
- package/dist/sharings/types.js +1 -0
- package/dist/surveys/api.d.ts +2 -0
- package/dist/surveys/api.js +3 -0
- package/dist/surveys/index.d.ts +3 -0
- package/dist/surveys/index.js +3 -0
- package/dist/surveys/schemas.d.ts +33 -0
- package/dist/surveys/schemas.js +23 -0
- package/dist/surveys/types.d.ts +27 -0
- package/dist/surveys/types.js +1 -0
- package/dist/tags/api.d.ts +24 -0
- package/dist/tags/api.js +28 -0
- package/dist/tags/index.d.ts +3 -0
- package/dist/tags/index.js +3 -0
- package/dist/tags/schemas.d.ts +26 -0
- package/dist/tags/schemas.js +19 -0
- package/dist/tags/types.d.ts +16 -0
- package/dist/tags/types.js +1 -0
- package/dist/tracking/api.d.ts +2 -0
- package/dist/tracking/api.js +3 -0
- package/dist/tracking/index.d.ts +3 -0
- package/dist/tracking/index.js +3 -0
- package/dist/tracking/schemas.d.ts +12 -0
- package/dist/tracking/schemas.js +12 -0
- package/dist/tracking/types.d.ts +11 -0
- package/dist/tracking/types.js +1 -0
- package/dist/trajectories/api.d.ts +27 -0
- package/dist/trajectories/api.js +13 -0
- package/dist/trajectories/index.d.ts +3 -0
- package/dist/trajectories/index.js +3 -0
- package/dist/trajectories/schemas.d.ts +39 -0
- package/dist/trajectories/schemas.js +30 -0
- package/dist/trajectories/types.d.ts +58 -0
- package/dist/trajectories/types.js +1 -0
- package/dist/trips/api.d.ts +30 -0
- package/dist/trips/api.js +12 -0
- package/dist/trips/index.d.ts +3 -0
- package/dist/trips/index.js +3 -0
- package/dist/trips/schemas.d.ts +62 -0
- package/dist/trips/schemas.js +36 -0
- package/dist/trips/types.d.ts +65 -0
- package/dist/trips/types.js +1 -0
- package/dist/users/api.d.ts +533 -0
- package/dist/users/api.js +102 -0
- package/dist/users/configuration/api.d.ts +21 -0
- package/dist/users/configuration/api.js +16 -0
- package/dist/users/configuration/index.d.ts +3 -0
- package/dist/users/configuration/index.js +3 -0
- package/dist/users/configuration/schemas.d.ts +91 -0
- package/dist/users/configuration/schemas.js +42 -0
- package/dist/users/configuration/types.d.ts +36 -0
- package/dist/users/configuration/types.js +1 -0
- package/dist/users/index.d.ts +4 -0
- package/dist/users/index.js +4 -0
- package/dist/users/schemas/addresses.d.ts +136 -0
- package/dist/users/schemas/addresses.js +94 -0
- package/dist/users/schemas/authenticated-user.d.ts +30 -0
- package/dist/users/schemas/authenticated-user.js +21 -0
- package/dist/users/schemas/common.d.ts +28 -0
- package/dist/users/schemas/common.js +26 -0
- package/dist/users/schemas/documents.d.ts +40 -0
- package/dist/users/schemas/documents.js +53 -0
- package/dist/users/schemas/passwords.d.ts +10 -0
- package/dist/users/schemas/passwords.js +15 -0
- package/dist/users/schemas/roles.d.ts +60 -0
- package/dist/users/schemas/roles.js +9 -0
- package/dist/users/schemas/sessions.d.ts +84 -0
- package/dist/users/schemas/sessions.js +55 -0
- package/dist/users/schemas/usernames.d.ts +14 -0
- package/dist/users/schemas/usernames.js +12 -0
- package/dist/users/schemas/users.d.ts +648 -0
- package/dist/users/schemas/users.js +243 -0
- package/dist/users/schemas.d.ts +8 -0
- package/dist/users/schemas.js +8 -0
- package/dist/users/types.d.ts +1 -0
- package/dist/users/types.js +1 -0
- package/dist/vehicles/api.d.ts +28 -0
- package/dist/vehicles/api.js +13 -0
- package/dist/vehicles/index.d.ts +3 -0
- package/dist/vehicles/index.js +3 -0
- package/dist/vehicles/schemas.d.ts +88 -0
- package/dist/vehicles/schemas.js +71 -0
- package/dist/vehicles/types.d.ts +142 -0
- package/dist/vehicles/types.js +1 -0
- package/package.json +59 -0
package/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ApiClientLike } from '../core/client';
|
|
2
|
+
import type { QueryParams } from '../core/query-builder';
|
|
3
|
+
import type { Alert, AlertCountResponse } from './types';
|
|
4
|
+
export declare function createAlertsApi(client: ApiClientLike): {
|
|
5
|
+
list: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
6
|
+
data: Alert[];
|
|
7
|
+
}>;
|
|
8
|
+
count: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<AlertCountResponse>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { withQuery } from '../core/query-builder.js';
|
|
2
|
+
export function createAlertsApi(client) {
|
|
3
|
+
const endpoint = '/v4/alerts';
|
|
4
|
+
return {
|
|
5
|
+
list: (params = {}, signal) => client.get(withQuery(endpoint, params), { signal }).then((r) => r.data),
|
|
6
|
+
count: (params = {}, signal) => client.get(withQuery(`${endpoint}/count`, params), { signal }).then((r) => r.data),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AlertResponsibleSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
attributes: z.ZodObject<{
|
|
5
|
+
name: z.ZodNullable<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const AlertVehicleSchema: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
attributes: z.ZodObject<{
|
|
11
|
+
plate: z.ZodNullable<z.ZodString>;
|
|
12
|
+
vin: z.ZodNullable<z.ZodString>;
|
|
13
|
+
type: z.ZodNullable<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
relationships: z.ZodObject<{
|
|
16
|
+
responsibles: z.ZodArray<z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
attributes: z.ZodObject<{
|
|
19
|
+
name: z.ZodNullable<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const AlertAttributesSchema: z.ZodObject<{
|
|
25
|
+
tag: z.ZodString;
|
|
26
|
+
val: z.ZodString;
|
|
27
|
+
act: z.ZodNumber;
|
|
28
|
+
flood: z.ZodBoolean;
|
|
29
|
+
lat: z.ZodNullable<z.ZodNumber>;
|
|
30
|
+
lng: z.ZodNullable<z.ZodNumber>;
|
|
31
|
+
did: z.ZodString;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export declare const AlertSchema: z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
attributes: z.ZodObject<{
|
|
36
|
+
tag: z.ZodString;
|
|
37
|
+
val: z.ZodString;
|
|
38
|
+
act: z.ZodNumber;
|
|
39
|
+
flood: z.ZodBoolean;
|
|
40
|
+
lat: z.ZodNullable<z.ZodNumber>;
|
|
41
|
+
lng: z.ZodNullable<z.ZodNumber>;
|
|
42
|
+
did: z.ZodString;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
relationships: z.ZodObject<{
|
|
45
|
+
vehicle: z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
attributes: z.ZodObject<{
|
|
48
|
+
plate: z.ZodNullable<z.ZodString>;
|
|
49
|
+
vin: z.ZodNullable<z.ZodString>;
|
|
50
|
+
type: z.ZodNullable<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
relationships: z.ZodObject<{
|
|
53
|
+
responsibles: z.ZodArray<z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
attributes: z.ZodObject<{
|
|
56
|
+
name: z.ZodNullable<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export declare const AlertCountResponseSchema: z.ZodObject<{
|
|
64
|
+
count: z.ZodNumber;
|
|
65
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const AlertResponsibleSchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
attributes: z.object({ name: z.string().nullable() }),
|
|
5
|
+
});
|
|
6
|
+
export const AlertVehicleSchema = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
attributes: z.object({
|
|
9
|
+
plate: z.string().nullable(),
|
|
10
|
+
vin: z.string().nullable(),
|
|
11
|
+
type: z.string().nullable(),
|
|
12
|
+
}),
|
|
13
|
+
relationships: z.object({ responsibles: z.array(AlertResponsibleSchema) }),
|
|
14
|
+
});
|
|
15
|
+
export const AlertAttributesSchema = z.object({
|
|
16
|
+
tag: z.string(),
|
|
17
|
+
val: z.string(),
|
|
18
|
+
act: z.number(),
|
|
19
|
+
flood: z.boolean(),
|
|
20
|
+
lat: z.number().nullable(),
|
|
21
|
+
lng: z.number().nullable(),
|
|
22
|
+
did: z.string(),
|
|
23
|
+
});
|
|
24
|
+
export const AlertSchema = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
attributes: AlertAttributesSchema,
|
|
27
|
+
relationships: z.object({ vehicle: AlertVehicleSchema }),
|
|
28
|
+
});
|
|
29
|
+
export const AlertCountResponseSchema = z.object({ count: z.number() });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface AlertResponsible {
|
|
2
|
+
id: string;
|
|
3
|
+
attributes: {
|
|
4
|
+
name: string | null;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface AlertVehicle {
|
|
8
|
+
id: string;
|
|
9
|
+
attributes: {
|
|
10
|
+
plate: string | null;
|
|
11
|
+
vin: string | null;
|
|
12
|
+
type: string | null;
|
|
13
|
+
};
|
|
14
|
+
relationships: {
|
|
15
|
+
responsibles: AlertResponsible[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface AlertAttributes {
|
|
19
|
+
tag: string;
|
|
20
|
+
val: string;
|
|
21
|
+
act: number;
|
|
22
|
+
flood: boolean;
|
|
23
|
+
lat: number | null;
|
|
24
|
+
lng: number | null;
|
|
25
|
+
did: string;
|
|
26
|
+
}
|
|
27
|
+
export interface Alert {
|
|
28
|
+
id: string;
|
|
29
|
+
attributes: AlertAttributes;
|
|
30
|
+
relationships: {
|
|
31
|
+
vehicle: AlertVehicle;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface AlertCountResponse {
|
|
35
|
+
count: number;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ApiClientLike } from '../core/client';
|
|
2
|
+
import type { CodeLoginCredentials, LoginCredentials } from './types';
|
|
3
|
+
export declare function createAuthApi(client: ApiClientLike): {
|
|
4
|
+
login: (credentials: LoginCredentials) => Promise<{
|
|
5
|
+
data: {
|
|
6
|
+
token: string;
|
|
7
|
+
refresh_token: string;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
10
|
+
loginByCode: (credentials: CodeLoginCredentials) => Promise<{
|
|
11
|
+
data: {
|
|
12
|
+
token: string;
|
|
13
|
+
refresh_token: string;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
16
|
+
refreshToken: (token: string, refreshToken: string) => Promise<{
|
|
17
|
+
data: {
|
|
18
|
+
token: string;
|
|
19
|
+
refresh_token: string;
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
22
|
+
logout: () => Promise<undefined>;
|
|
23
|
+
forgotPassword: (username: string) => Promise<undefined>;
|
|
24
|
+
resetPassword: (token: string, password: string, confirmPassword: string) => Promise<undefined>;
|
|
25
|
+
generateAccessCode: (username: string) => Promise<undefined>;
|
|
26
|
+
};
|
package/dist/auth/api.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { parseOrLog } from '../core/client.js';
|
|
2
|
+
import { CodeLoginCredentialsSchema, ForgotPasswordPayloadSchema, ForgotPasswordResponseSchema, GenerateAccessCodePayloadSchema, GenerateAccessCodeResponseSchema, LoginCredentialsSchema, LoginResponseSchema, LogoutResponseSchema, RefreshTokenPayloadSchema, ResetPasswordPayloadSchema, ResetPasswordResponseSchema, } from './schemas.js';
|
|
3
|
+
export function createAuthApi(client) {
|
|
4
|
+
return {
|
|
5
|
+
login: (credentials) => Promise.resolve(credentials)
|
|
6
|
+
.then(p => parseOrLog(LoginCredentialsSchema, p, 'POST /v5/auth/login (payload)'))
|
|
7
|
+
.then(validCredentials => client.post('/v5/auth/login', validCredentials))
|
|
8
|
+
.then(r => parseOrLog(LoginResponseSchema, r.data, 'POST /v5/auth/login (response)')),
|
|
9
|
+
loginByCode: (credentials) => Promise.resolve(credentials)
|
|
10
|
+
.then(p => parseOrLog(CodeLoginCredentialsSchema, p, 'POST /v5/auth/access-code (payload)'))
|
|
11
|
+
.then(validCredentials => client.post('/v5/auth/access-code', validCredentials))
|
|
12
|
+
.then(r => parseOrLog(LoginResponseSchema, r.data, 'POST /v5/auth/access-code (response)')),
|
|
13
|
+
refreshToken: (token, refreshToken) => Promise.resolve({
|
|
14
|
+
auth_token: token,
|
|
15
|
+
refresh_token: refreshToken,
|
|
16
|
+
})
|
|
17
|
+
.then(p => parseOrLog(RefreshTokenPayloadSchema, p, 'POST /v5/auth/refresh-token (payload)'))
|
|
18
|
+
.then(validPayload => client.post('/v5/auth/refresh-token', validPayload))
|
|
19
|
+
.then(r => parseOrLog(LoginResponseSchema, r.data, 'POST /v5/auth/refresh-token (response)')),
|
|
20
|
+
logout: () => client.post('/v5/auth/logout')
|
|
21
|
+
.then(r => parseOrLog(LogoutResponseSchema, r.data, 'POST /v5/auth/logout (response)'))
|
|
22
|
+
.then(() => undefined),
|
|
23
|
+
forgotPassword: (username) => Promise.resolve({ data: { attributes: { username } } })
|
|
24
|
+
.then(p => parseOrLog(ForgotPasswordPayloadSchema, p, 'POST /v5/users/forgot-password (payload)'))
|
|
25
|
+
.then(validPayload => client.post('/v5/users/forgot-password', validPayload))
|
|
26
|
+
.then(r => parseOrLog(ForgotPasswordResponseSchema, r.data, 'POST /v5/users/forgot-password (response)'))
|
|
27
|
+
.then(() => undefined),
|
|
28
|
+
resetPassword: (token, password, confirmPassword) => Promise.resolve({ data: { attributes: { password, confirm_password: confirmPassword, token } } })
|
|
29
|
+
.then(p => parseOrLog(ResetPasswordPayloadSchema, p, 'PATCH /v5/users/forgot-password (payload)'))
|
|
30
|
+
.then(validPayload => client.patch('/v5/users/forgot-password', validPayload))
|
|
31
|
+
.then(r => parseOrLog(ResetPasswordResponseSchema, r.data, 'PATCH /v5/users/forgot-password (response)'))
|
|
32
|
+
.then(() => undefined),
|
|
33
|
+
generateAccessCode: (username) => Promise.resolve({ data: { attributes: { username } } })
|
|
34
|
+
.then(p => parseOrLog(GenerateAccessCodePayloadSchema, p, 'POST /v5/users/generate-access-code (payload)'))
|
|
35
|
+
.then(validPayload => client.post('/v5/users/generate-access-code', validPayload))
|
|
36
|
+
.then(r => parseOrLog(GenerateAccessCodeResponseSchema, r.data, 'POST /v5/users/generate-access-code (response)'))
|
|
37
|
+
.then(() => undefined),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CodeLoginCredentialsSchema: z.ZodObject<{
|
|
3
|
+
username: z.ZodString;
|
|
4
|
+
code: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
export type CodeLoginCredentials = z.infer<typeof CodeLoginCredentialsSchema>;
|
|
7
|
+
export declare const GenerateAccessCodePayloadSchema: z.ZodObject<{
|
|
8
|
+
data: z.ZodObject<{
|
|
9
|
+
attributes: z.ZodObject<{
|
|
10
|
+
username: z.ZodString;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export type GenerateAccessCodePayload = z.infer<typeof GenerateAccessCodePayloadSchema>;
|
|
15
|
+
export declare const GenerateAccessCodeResponseSchema: z.ZodUnion<readonly [z.ZodUndefined, z.ZodNull, z.ZodLiteral<"">]>;
|
|
16
|
+
export type GenerateAccessCodeResponse = z.infer<typeof GenerateAccessCodeResponseSchema>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CodeLoginCredentialsSchema = z.object({
|
|
3
|
+
username: z.string().min(1).max(255),
|
|
4
|
+
code: z.string().length(6),
|
|
5
|
+
}).strict();
|
|
6
|
+
export const GenerateAccessCodePayloadSchema = z.object({
|
|
7
|
+
data: z.object({
|
|
8
|
+
attributes: z.object({
|
|
9
|
+
username: z.string().min(1).max(255),
|
|
10
|
+
}).strict(),
|
|
11
|
+
}).strict(),
|
|
12
|
+
}).strict();
|
|
13
|
+
export const GenerateAccessCodeResponseSchema = z.union([z.undefined(), z.null(), z.literal('')]);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const LoginCredentialsSchema: z.ZodObject<{
|
|
3
|
+
username: z.ZodString;
|
|
4
|
+
password: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
export type LoginCredentials = z.infer<typeof LoginCredentialsSchema>;
|
|
7
|
+
export declare const LoginResponseSchema: z.ZodObject<{
|
|
8
|
+
data: z.ZodObject<{
|
|
9
|
+
token: z.ZodString;
|
|
10
|
+
refresh_token: z.ZodString;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
export type LoginResponse = z.infer<typeof LoginResponseSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AuthTokensSchema } from './tokens.js';
|
|
3
|
+
export const LoginCredentialsSchema = z.object({
|
|
4
|
+
username: z.string().min(1),
|
|
5
|
+
password: z.string().min(1),
|
|
6
|
+
}).strict();
|
|
7
|
+
export const LoginResponseSchema = z.object({
|
|
8
|
+
data: AuthTokensSchema,
|
|
9
|
+
}).strict();
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ForgotPasswordPayloadSchema: z.ZodObject<{
|
|
3
|
+
data: z.ZodObject<{
|
|
4
|
+
attributes: z.ZodObject<{
|
|
5
|
+
username: z.ZodString;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type ForgotPasswordPayload = z.infer<typeof ForgotPasswordPayloadSchema>;
|
|
10
|
+
export declare const ForgotPasswordResponseSchema: z.ZodUnion<readonly [z.ZodUndefined, z.ZodNull, z.ZodLiteral<"">]>;
|
|
11
|
+
export type ForgotPasswordResponse = z.infer<typeof ForgotPasswordResponseSchema>;
|
|
12
|
+
export declare const ResetPasswordPayloadSchema: z.ZodObject<{
|
|
13
|
+
data: z.ZodObject<{
|
|
14
|
+
attributes: z.ZodObject<{
|
|
15
|
+
password: z.ZodString;
|
|
16
|
+
confirm_password: z.ZodString;
|
|
17
|
+
token: z.ZodString;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export type ResetPasswordPayload = z.infer<typeof ResetPasswordPayloadSchema>;
|
|
22
|
+
export declare const ResetPasswordUserSchema: z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"users">;
|
|
24
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
25
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
26
|
+
attributes: z.ZodObject<{
|
|
27
|
+
username: z.ZodString;
|
|
28
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
phone1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
phone2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
emergency_contact: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
emergency_phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
document_number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
+
cpf: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
|
+
birthdate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
|
+
last_login_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
38
|
+
deactivated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
+
locale: z.ZodString;
|
|
40
|
+
user_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
last_integration_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
42
|
+
last_integration_time: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
|
+
created_at: z.ZodString;
|
|
44
|
+
updated_at: z.ZodString;
|
|
45
|
+
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
otp: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
relationships: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
export type ResetPasswordUser = z.infer<typeof ResetPasswordUserSchema>;
|
|
51
|
+
export declare const ResetPasswordResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
52
|
+
data: z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"users">;
|
|
54
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
55
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
56
|
+
attributes: z.ZodObject<{
|
|
57
|
+
username: z.ZodString;
|
|
58
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
phone1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
phone2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
|
+
emergency_contact: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
|
+
emergency_phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
|
+
document_number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
|
+
cpf: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
+
birthdate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
67
|
+
last_login_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
68
|
+
deactivated_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
locale: z.ZodString;
|
|
70
|
+
user_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
71
|
+
last_integration_source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
last_integration_time: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
created_at: z.ZodString;
|
|
74
|
+
updated_at: z.ZodString;
|
|
75
|
+
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
otp: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
relationships: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
}, z.core.$strict>, z.ZodUndefined, z.ZodNull, z.ZodLiteral<"">]>;
|
|
81
|
+
export type ResetPasswordResponse = z.infer<typeof ResetPasswordResponseSchema>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SerializedUserSchema } from '../../users/schemas.js';
|
|
3
|
+
export const ForgotPasswordPayloadSchema = z.object({
|
|
4
|
+
data: z.object({
|
|
5
|
+
attributes: z.object({
|
|
6
|
+
username: z.string().min(1).max(255),
|
|
7
|
+
}).strict(),
|
|
8
|
+
}).strict(),
|
|
9
|
+
}).strict();
|
|
10
|
+
export const ForgotPasswordResponseSchema = z.union([z.undefined(), z.null(), z.literal('')]);
|
|
11
|
+
export const ResetPasswordPayloadSchema = z.object({
|
|
12
|
+
data: z.object({
|
|
13
|
+
attributes: z.object({
|
|
14
|
+
password: z.string().min(1),
|
|
15
|
+
confirm_password: z.string().min(1),
|
|
16
|
+
token: z.string().min(1),
|
|
17
|
+
}).strict(),
|
|
18
|
+
}).strict(),
|
|
19
|
+
}).strict();
|
|
20
|
+
export const ResetPasswordUserSchema = SerializedUserSchema;
|
|
21
|
+
export const ResetPasswordResponseSchema = z.union([
|
|
22
|
+
z.object({
|
|
23
|
+
data: ResetPasswordUserSchema,
|
|
24
|
+
}).strict(),
|
|
25
|
+
z.undefined(),
|
|
26
|
+
z.null(),
|
|
27
|
+
z.literal(''),
|
|
28
|
+
]);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AuthTokensSchema: z.ZodObject<{
|
|
3
|
+
token: z.ZodString;
|
|
4
|
+
refresh_token: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
export type AuthTokens = z.infer<typeof AuthTokensSchema>;
|
|
7
|
+
export declare const RefreshTokenPayloadSchema: z.ZodObject<{
|
|
8
|
+
auth_token: z.ZodString;
|
|
9
|
+
refresh_token: z.ZodString;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export type RefreshTokenPayload = z.infer<typeof RefreshTokenPayloadSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const AuthTokensSchema = z.object({
|
|
3
|
+
token: z.string(),
|
|
4
|
+
refresh_token: z.string(),
|
|
5
|
+
}).strict();
|
|
6
|
+
export const RefreshTokenPayloadSchema = z.object({
|
|
7
|
+
auth_token: z.string().min(1),
|
|
8
|
+
refresh_token: z.string().min(1),
|
|
9
|
+
}).strict();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { AuthTokens, CodeLoginCredentials, ForgotPasswordPayload, ForgotPasswordResponse, GenerateAccessCodePayload, GenerateAccessCodeResponse, LoginCredentials, LoginResponse, LogoutResponse, RefreshTokenPayload, ResetPasswordPayload, ResetPasswordResponse, ResetPasswordUser, } from './schemas';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ApiClientLike } from '../core/client';
|
|
2
|
+
import type { QueryParams } from '../core/query-builder';
|
|
3
|
+
import type { ChecklistItem, ChecklistTemplate, CreateTemplatePayload } from './types';
|
|
4
|
+
export declare function createChecklistApi(client: ApiClientLike): {
|
|
5
|
+
listItems: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
6
|
+
data: ChecklistItem[];
|
|
7
|
+
count?: number;
|
|
8
|
+
}>;
|
|
9
|
+
getItem: (id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
10
|
+
data: ChecklistItem;
|
|
11
|
+
}>;
|
|
12
|
+
listTemplates: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
13
|
+
data: ChecklistTemplate[];
|
|
14
|
+
count?: number;
|
|
15
|
+
}>;
|
|
16
|
+
getTemplate: (id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
17
|
+
data: ChecklistTemplate;
|
|
18
|
+
}>;
|
|
19
|
+
createTemplate: (payload: CreateTemplatePayload) => Promise<undefined>;
|
|
20
|
+
addTemplateItems: (templateId: string, itemIds: string[]) => Promise<undefined>;
|
|
21
|
+
endpoint: string;
|
|
22
|
+
list: <R = ChecklistItem>(params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<import("..").ListResponse<R>>;
|
|
23
|
+
get: <R = ChecklistItem>(id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
24
|
+
data: R;
|
|
25
|
+
}>;
|
|
26
|
+
create: (payload: unknown) => Promise<undefined>;
|
|
27
|
+
update: (id: string, payload: unknown) => Promise<undefined>;
|
|
28
|
+
remove: (id: string) => Promise<undefined>;
|
|
29
|
+
removeMany: (payload: unknown, signal?: AbortSignal) => Promise<undefined>;
|
|
30
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createResourceApi } from '../core/client.js';
|
|
2
|
+
import { withQuery } from '../core/query-builder.js';
|
|
3
|
+
export function createChecklistApi(client) {
|
|
4
|
+
return {
|
|
5
|
+
...createResourceApi(client, '/v5/checklist/items'),
|
|
6
|
+
listItems: (params = {}, signal) => client.get(withQuery('/v5/checklist/items', params), { signal }).then(r => r.data),
|
|
7
|
+
getItem: (id, params = {}, signal) => client.get(withQuery(`/v5/checklist/items/${id}`, params), { signal }).then(r => r.data),
|
|
8
|
+
listTemplates: (params = {}, signal) => client.get(withQuery('/v5/checklist/templates', params), { signal }).then(r => r.data),
|
|
9
|
+
getTemplate: (id, params = {}, signal) => client.get(withQuery(`/v5/checklist/templates/${id}`, params), { signal }).then(r => r.data),
|
|
10
|
+
createTemplate: (payload) => client.post('/v5/checklist/templates', { data: payload }).then(() => undefined),
|
|
11
|
+
addTemplateItems: (templateId, itemIds) => client.post(`/v5/checklist/templates/${templateId}/items`, {
|
|
12
|
+
data: itemIds.map(id => ({ type: 'task_item', id })),
|
|
13
|
+
}).then(() => undefined),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ChecklistItemSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
attributes: z.ZodObject<{
|
|
5
|
+
name: z.ZodNullable<z.ZodString>;
|
|
6
|
+
field_format: z.ZodNullable<z.ZodString>;
|
|
7
|
+
required: z.ZodNullable<z.ZodBoolean>;
|
|
8
|
+
active: z.ZodNullable<z.ZodBoolean>;
|
|
9
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
relationships: z.ZodObject<{
|
|
12
|
+
enterprise: z.ZodNullable<z.ZodObject<{
|
|
13
|
+
attributes: z.ZodObject<{
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
cnpj: z.ZodNullable<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
address: z.ZodNullable<z.ZodObject<{
|
|
19
|
+
attributes: z.ZodObject<{
|
|
20
|
+
formatted_address: z.ZodNullable<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
attributes: z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
templates: z.ZodArray<z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
attributes: z.ZodObject<{
|
|
32
|
+
name: z.ZodNullable<z.ZodString>;
|
|
33
|
+
category: z.ZodNullable<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export declare const ChecklistTemplateSchema: z.ZodObject<{
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
attributes: z.ZodObject<{
|
|
41
|
+
name: z.ZodNullable<z.ZodString>;
|
|
42
|
+
category: z.ZodNullable<z.ZodString>;
|
|
43
|
+
active: z.ZodNullable<z.ZodBoolean>;
|
|
44
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
relationships: z.ZodObject<{
|
|
47
|
+
enterprise: z.ZodNullable<z.ZodObject<{
|
|
48
|
+
attributes: z.ZodObject<{
|
|
49
|
+
name: z.ZodNullable<z.ZodString>;
|
|
50
|
+
cnpj: z.ZodNullable<z.ZodString>;
|
|
51
|
+
fantasy_name: z.ZodNullable<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
items: z.ZodArray<z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
attributes: z.ZodObject<{
|
|
57
|
+
name: z.ZodNullable<z.ZodString>;
|
|
58
|
+
field_format: z.ZodNullable<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const ChecklistItemSchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
attributes: z.object({
|
|
5
|
+
name: z.string().nullable(),
|
|
6
|
+
field_format: z.string().nullable(),
|
|
7
|
+
required: z.boolean().nullable(),
|
|
8
|
+
active: z.boolean().nullable(),
|
|
9
|
+
created_at: z.string().nullable(),
|
|
10
|
+
}),
|
|
11
|
+
relationships: z.object({
|
|
12
|
+
enterprise: z.object({
|
|
13
|
+
attributes: z.object({ name: z.string(), cnpj: z.string().nullable() }),
|
|
14
|
+
}).nullable(),
|
|
15
|
+
address: z.object({
|
|
16
|
+
attributes: z.object({ formatted_address: z.string().nullable() }),
|
|
17
|
+
}).nullable(),
|
|
18
|
+
tags: z.array(z.object({ id: z.string(), attributes: z.object({ name: z.string() }) })),
|
|
19
|
+
templates: z.array(z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
attributes: z.object({ name: z.string().nullable(), category: z.string().nullable() }),
|
|
22
|
+
})),
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
export const ChecklistTemplateSchema = z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
attributes: z.object({
|
|
28
|
+
name: z.string().nullable(),
|
|
29
|
+
category: z.string().nullable(),
|
|
30
|
+
active: z.boolean().nullable(),
|
|
31
|
+
created_at: z.string().nullable(),
|
|
32
|
+
}),
|
|
33
|
+
relationships: z.object({
|
|
34
|
+
enterprise: z.object({
|
|
35
|
+
attributes: z.object({
|
|
36
|
+
name: z.string().nullable(),
|
|
37
|
+
cnpj: z.string().nullable(),
|
|
38
|
+
fantasy_name: z.string().nullable(),
|
|
39
|
+
}),
|
|
40
|
+
}).nullable(),
|
|
41
|
+
items: z.array(z.object({
|
|
42
|
+
id: z.string(),
|
|
43
|
+
attributes: z.object({ name: z.string().nullable(), field_format: z.string().nullable() }),
|
|
44
|
+
})),
|
|
45
|
+
}),
|
|
46
|
+
});
|