@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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { AssigneeRelAttr, CompletionRelAttr, CustomField, Document, EnterpriseRelAttr, SectionRelAttr, TaskBaseAttributes, TaskEntry, TypeRelAttr, VehicleRelAttr } from '../core/types';
|
|
2
|
+
export interface ServiceOrderAttributes extends TaskBaseAttributes {
|
|
3
|
+
due_date: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface ServiceOrder {
|
|
6
|
+
id: string;
|
|
7
|
+
attributes: ServiceOrderAttributes;
|
|
8
|
+
relationships: {
|
|
9
|
+
enterprise: {
|
|
10
|
+
attributes: EnterpriseRelAttr;
|
|
11
|
+
} | null;
|
|
12
|
+
type: {
|
|
13
|
+
attributes: TypeRelAttr;
|
|
14
|
+
} | null;
|
|
15
|
+
section: {
|
|
16
|
+
attributes: SectionRelAttr;
|
|
17
|
+
} | null;
|
|
18
|
+
asset: {
|
|
19
|
+
attributes: Pick<VehicleRelAttr, 'plate' | 'vin' | 'label'>;
|
|
20
|
+
} | null;
|
|
21
|
+
assignee: {
|
|
22
|
+
attributes: AssigneeRelAttr;
|
|
23
|
+
} | null;
|
|
24
|
+
addresses: Array<{
|
|
25
|
+
id: string;
|
|
26
|
+
attributes: {
|
|
27
|
+
formatted_address: string | null;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
completion: {
|
|
31
|
+
attributes: CompletionRelAttr;
|
|
32
|
+
} | null;
|
|
33
|
+
tags: Array<{
|
|
34
|
+
id: string;
|
|
35
|
+
attributes: {
|
|
36
|
+
name: string;
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface ServiceOrderPanelRow {
|
|
42
|
+
attributes: {
|
|
43
|
+
count: string;
|
|
44
|
+
completed: boolean | null;
|
|
45
|
+
created_at: {
|
|
46
|
+
day: string;
|
|
47
|
+
} | null;
|
|
48
|
+
type: {
|
|
49
|
+
name: string | null;
|
|
50
|
+
} | null;
|
|
51
|
+
asset_type: {
|
|
52
|
+
name: string | null;
|
|
53
|
+
} | null;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface ServiceOrderEntriesRow {
|
|
57
|
+
attributes: {
|
|
58
|
+
count: string;
|
|
59
|
+
sum: {
|
|
60
|
+
entries: {
|
|
61
|
+
total_price: string | null;
|
|
62
|
+
};
|
|
63
|
+
} | null;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface AcknowledgementAttributes {
|
|
67
|
+
acknowledged: boolean | null;
|
|
68
|
+
acknowledged_at: string | null;
|
|
69
|
+
rate: number | null;
|
|
70
|
+
created_at: string | null;
|
|
71
|
+
}
|
|
72
|
+
export interface Acknowledgement {
|
|
73
|
+
id: string;
|
|
74
|
+
attributes: AcknowledgementAttributes;
|
|
75
|
+
relationships: {
|
|
76
|
+
task: {
|
|
77
|
+
id: string;
|
|
78
|
+
attributes: {
|
|
79
|
+
token: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export type { CustomField, Document, TaskEntry };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ApiClientLike } from '../core/client';
|
|
2
|
+
import type { QueryParams } from '../core/query-builder';
|
|
3
|
+
import type { Sharing, SharingPanelRow } from './types';
|
|
4
|
+
export declare function createSharingsApi(client: ApiClientLike): {
|
|
5
|
+
panel: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
6
|
+
data: SharingPanelRow[];
|
|
7
|
+
}>;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
list: <R = Sharing>(params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<import("..").ListResponse<R>>;
|
|
10
|
+
get: <R = Sharing>(id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
11
|
+
data: R;
|
|
12
|
+
}>;
|
|
13
|
+
create: (payload: unknown) => Promise<undefined>;
|
|
14
|
+
update: (id: string, payload: unknown) => Promise<undefined>;
|
|
15
|
+
remove: (id: string) => Promise<undefined>;
|
|
16
|
+
removeMany: (payload: unknown, signal?: AbortSignal) => Promise<undefined>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createResourceApi } from '../core/client.js';
|
|
2
|
+
import { withQuery } from '../core/query-builder.js';
|
|
3
|
+
export function createSharingsApi(client) {
|
|
4
|
+
return {
|
|
5
|
+
...createResourceApi(client, '/v5/sharings'),
|
|
6
|
+
panel: (params = {}, signal) => client.get(withQuery('/v5/sharings', params), { signal }).then(r => r.data),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SharingSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
attributes: z.ZodObject<{
|
|
5
|
+
hash: z.ZodNullable<z.ZodString>;
|
|
6
|
+
type: z.ZodNullable<z.ZodString>;
|
|
7
|
+
valid_until: z.ZodNullable<z.ZodString>;
|
|
8
|
+
active: z.ZodNullable<z.ZodBoolean>;
|
|
9
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
10
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
relationships: z.ZodObject<{
|
|
13
|
+
enterprise: z.ZodNullable<z.ZodObject<{
|
|
14
|
+
attributes: z.ZodObject<{
|
|
15
|
+
name: z.ZodNullable<z.ZodString>;
|
|
16
|
+
cnpj: z.ZodNullable<z.ZodString>;
|
|
17
|
+
email: z.ZodNullable<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
creator: z.ZodNullable<z.ZodObject<{
|
|
21
|
+
attributes: z.ZodObject<{
|
|
22
|
+
name: z.ZodNullable<z.ZodString>;
|
|
23
|
+
email: z.ZodNullable<z.ZodString>;
|
|
24
|
+
phone1: z.ZodNullable<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
asset: z.ZodNullable<z.ZodObject<{
|
|
28
|
+
attributes: z.ZodObject<{
|
|
29
|
+
plate: z.ZodNullable<z.ZodString>;
|
|
30
|
+
vin: z.ZodNullable<z.ZodString>;
|
|
31
|
+
label: z.ZodNullable<z.ZodString>;
|
|
32
|
+
type_name: z.ZodNullable<z.ZodString>;
|
|
33
|
+
code: z.ZodNullable<z.ZodString>;
|
|
34
|
+
model_name: z.ZodNullable<z.ZodString>;
|
|
35
|
+
trim_name: z.ZodNullable<z.ZodString>;
|
|
36
|
+
year: z.ZodNullable<z.ZodNumber>;
|
|
37
|
+
color: z.ZodNullable<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
device: z.ZodNullable<z.ZodObject<{
|
|
41
|
+
attributes: z.ZodObject<{
|
|
42
|
+
name: z.ZodNullable<z.ZodString>;
|
|
43
|
+
imei: z.ZodNullable<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const SharingSchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
attributes: z.object({
|
|
5
|
+
hash: z.string().nullable(),
|
|
6
|
+
type: z.string().nullable(),
|
|
7
|
+
valid_until: z.string().nullable(),
|
|
8
|
+
active: z.boolean().nullable(),
|
|
9
|
+
created_at: z.string().nullable(),
|
|
10
|
+
updated_at: z.string().nullable(),
|
|
11
|
+
}),
|
|
12
|
+
relationships: z.object({
|
|
13
|
+
enterprise: z.object({
|
|
14
|
+
attributes: z.object({ name: z.string().nullable(), cnpj: z.string().nullable(), email: z.string().nullable() }),
|
|
15
|
+
}).nullable(),
|
|
16
|
+
creator: z.object({
|
|
17
|
+
attributes: z.object({ name: z.string().nullable(), email: z.string().nullable(), phone1: z.string().nullable() }),
|
|
18
|
+
}).nullable(),
|
|
19
|
+
asset: z.object({
|
|
20
|
+
attributes: z.object({
|
|
21
|
+
plate: z.string().nullable(),
|
|
22
|
+
vin: z.string().nullable(),
|
|
23
|
+
label: z.string().nullable(),
|
|
24
|
+
type_name: z.string().nullable(),
|
|
25
|
+
code: z.string().nullable(),
|
|
26
|
+
model_name: z.string().nullable(),
|
|
27
|
+
trim_name: z.string().nullable(),
|
|
28
|
+
year: z.number().nullable(),
|
|
29
|
+
color: z.string().nullable(),
|
|
30
|
+
}),
|
|
31
|
+
}).nullable(),
|
|
32
|
+
device: z.object({
|
|
33
|
+
attributes: z.object({ name: z.string().nullable(), imei: z.string().nullable() }),
|
|
34
|
+
}).nullable(),
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { EnterpriseRelAttr, Timestamped, UserRelAttr, VehicleRelAttr } from '../core/types';
|
|
2
|
+
export interface SharingAttributes extends Timestamped {
|
|
3
|
+
hash: string | null;
|
|
4
|
+
type: string | null;
|
|
5
|
+
valid_until: string | null;
|
|
6
|
+
tokens_generated: number | null;
|
|
7
|
+
active: boolean | null;
|
|
8
|
+
}
|
|
9
|
+
export interface Sharing {
|
|
10
|
+
id: string;
|
|
11
|
+
attributes: SharingAttributes;
|
|
12
|
+
relationships: {
|
|
13
|
+
enterprise: {
|
|
14
|
+
attributes: EnterpriseRelAttr;
|
|
15
|
+
} | null;
|
|
16
|
+
creator: {
|
|
17
|
+
attributes: Pick<UserRelAttr, 'name' | 'email' | 'phone1'>;
|
|
18
|
+
} | null;
|
|
19
|
+
asset: {
|
|
20
|
+
attributes: VehicleRelAttr & {
|
|
21
|
+
code: string | null;
|
|
22
|
+
model_name: string | null;
|
|
23
|
+
trim_name: string | null;
|
|
24
|
+
year: number | null;
|
|
25
|
+
color: string | null;
|
|
26
|
+
};
|
|
27
|
+
} | null;
|
|
28
|
+
device: {
|
|
29
|
+
attributes: {
|
|
30
|
+
name: string | null;
|
|
31
|
+
imei: string | null;
|
|
32
|
+
};
|
|
33
|
+
} | null;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface SharingPanelRow {
|
|
37
|
+
attributes: {
|
|
38
|
+
count: string;
|
|
39
|
+
created_at: {
|
|
40
|
+
day: string;
|
|
41
|
+
} | null;
|
|
42
|
+
creator: {
|
|
43
|
+
name: string | null;
|
|
44
|
+
} | null;
|
|
45
|
+
device: {
|
|
46
|
+
name: string | null;
|
|
47
|
+
} | null;
|
|
48
|
+
sum: {
|
|
49
|
+
sharings: {
|
|
50
|
+
tokens_generated: string | null;
|
|
51
|
+
};
|
|
52
|
+
} | null;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SurveySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
attributes: z.ZodObject<{
|
|
5
|
+
token: z.ZodNullable<z.ZodString>;
|
|
6
|
+
status: z.ZodNullable<z.ZodString>;
|
|
7
|
+
priority: z.ZodNullable<z.ZodString>;
|
|
8
|
+
description: z.ZodNullable<z.ZodString>;
|
|
9
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
10
|
+
due_date: z.ZodNullable<z.ZodString>;
|
|
11
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
12
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
relationships: z.ZodObject<{
|
|
15
|
+
enterprise: z.ZodNullable<z.ZodObject<{
|
|
16
|
+
attributes: z.ZodObject<{
|
|
17
|
+
name: z.ZodNullable<z.ZodString>;
|
|
18
|
+
cnpj: z.ZodNullable<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
type: z.ZodNullable<z.ZodObject<{
|
|
22
|
+
attributes: z.ZodObject<{
|
|
23
|
+
name: z.ZodNullable<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
asset: z.ZodNullable<z.ZodObject<{
|
|
27
|
+
attributes: z.ZodObject<{
|
|
28
|
+
plate: z.ZodNullable<z.ZodString>;
|
|
29
|
+
label: z.ZodNullable<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const SurveySchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
attributes: z.object({
|
|
5
|
+
token: z.string().nullable(),
|
|
6
|
+
status: z.string().nullable(),
|
|
7
|
+
priority: z.string().nullable(),
|
|
8
|
+
description: z.string().nullable(),
|
|
9
|
+
notes: z.string().nullable(),
|
|
10
|
+
due_date: z.string().nullable(),
|
|
11
|
+
created_at: z.string().nullable(),
|
|
12
|
+
updated_at: z.string().nullable(),
|
|
13
|
+
}),
|
|
14
|
+
relationships: z.object({
|
|
15
|
+
enterprise: z.object({
|
|
16
|
+
attributes: z.object({ name: z.string().nullable(), cnpj: z.string().nullable() }),
|
|
17
|
+
}).nullable(),
|
|
18
|
+
type: z.object({ attributes: z.object({ name: z.string().nullable() }) }).nullable(),
|
|
19
|
+
asset: z.object({
|
|
20
|
+
attributes: z.object({ plate: z.string().nullable(), label: z.string().nullable() }),
|
|
21
|
+
}).nullable(),
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TaskBaseAttributes } from '../core/types';
|
|
2
|
+
export interface SurveyAttributes extends TaskBaseAttributes {
|
|
3
|
+
due_date: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface Survey {
|
|
6
|
+
id: string;
|
|
7
|
+
attributes: SurveyAttributes;
|
|
8
|
+
relationships: {
|
|
9
|
+
enterprise: {
|
|
10
|
+
attributes: {
|
|
11
|
+
name: string | null;
|
|
12
|
+
cnpj: string | null;
|
|
13
|
+
};
|
|
14
|
+
} | null;
|
|
15
|
+
type: {
|
|
16
|
+
attributes: {
|
|
17
|
+
name: string | null;
|
|
18
|
+
};
|
|
19
|
+
} | null;
|
|
20
|
+
asset: {
|
|
21
|
+
attributes: {
|
|
22
|
+
plate: string | null;
|
|
23
|
+
label: string | null;
|
|
24
|
+
};
|
|
25
|
+
} | null;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ApiClientLike } from '../core/client';
|
|
2
|
+
import type { QueryParams } from '../core/query-builder';
|
|
3
|
+
import type { Tag, TagResource } from './types';
|
|
4
|
+
interface SearchTagsOptions {
|
|
5
|
+
enterpriseId?: string;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}
|
|
8
|
+
export declare function createTagsApi(client: ApiClientLike): {
|
|
9
|
+
search: (query: string, options?: SearchTagsOptions) => Promise<{
|
|
10
|
+
data: Tag[];
|
|
11
|
+
}>;
|
|
12
|
+
assign: (tagId: string, target: string, entityId: string, signal?: AbortSignal) => Promise<undefined>;
|
|
13
|
+
unassign: (tagId: string, target: string, entityId: string, signal?: AbortSignal) => Promise<undefined>;
|
|
14
|
+
endpoint: string;
|
|
15
|
+
list: <R = TagResource>(params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<import("..").ListResponse<R>>;
|
|
16
|
+
get: <R = TagResource>(id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
17
|
+
data: R;
|
|
18
|
+
}>;
|
|
19
|
+
create: (payload: unknown) => Promise<undefined>;
|
|
20
|
+
update: (id: string, payload: unknown) => Promise<undefined>;
|
|
21
|
+
remove: (id: string) => Promise<undefined>;
|
|
22
|
+
removeMany: (payload: unknown, signal?: AbortSignal) => Promise<undefined>;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
package/dist/tags/api.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createResourceApi } from '../core/client.js';
|
|
2
|
+
import { withQuery } from '../core/query-builder.js';
|
|
3
|
+
export function createTagsApi(client) {
|
|
4
|
+
return {
|
|
5
|
+
...createResourceApi(client, '/v5/tags'),
|
|
6
|
+
search: (query, options = {}) => {
|
|
7
|
+
const params = {
|
|
8
|
+
attributes: ['name', 'color'],
|
|
9
|
+
limit: 20,
|
|
10
|
+
search: query === '' ? undefined : query,
|
|
11
|
+
...(options.enterpriseId ? { filters: { 'enterprise.id': { operator: 'eq', value: options.enterpriseId } } } : {}),
|
|
12
|
+
};
|
|
13
|
+
return client.get(withQuery('/v5/tags', params), { signal: options.signal }).then(r => r.data);
|
|
14
|
+
},
|
|
15
|
+
assign: (tagId, target, entityId, signal) => client.post(`/v5/tags/${tagId}/assignments`, {
|
|
16
|
+
data: {
|
|
17
|
+
attributes: { target },
|
|
18
|
+
relationships: { assignment: [{ type: target, id: entityId }] },
|
|
19
|
+
},
|
|
20
|
+
}, { signal }).then(() => undefined),
|
|
21
|
+
unassign: (tagId, target, entityId, signal) => client.delete(`/v5/tags/assignments`, {
|
|
22
|
+
data: {
|
|
23
|
+
data: [{ relationships: { tag: { type: 'tags', id: tagId }, assignment: { type: target, id: entityId } } }],
|
|
24
|
+
},
|
|
25
|
+
signal,
|
|
26
|
+
}).then(() => undefined),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const TagSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
attributes: z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
color: z.ZodNullable<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const TagResourceSchema: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
attributes: z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
color: z.ZodNullable<z.ZodString>;
|
|
14
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
15
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
relationships: z.ZodObject<{
|
|
18
|
+
enterprise: z.ZodNullable<z.ZodObject<{
|
|
19
|
+
attributes: z.ZodObject<{
|
|
20
|
+
name: z.ZodNullable<z.ZodString>;
|
|
21
|
+
cnpj: z.ZodNullable<z.ZodString>;
|
|
22
|
+
email: z.ZodNullable<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const TagSchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
attributes: z.object({ name: z.string(), color: z.string().nullable() }),
|
|
5
|
+
});
|
|
6
|
+
export const TagResourceSchema = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
attributes: z.object({
|
|
9
|
+
name: z.string(),
|
|
10
|
+
color: z.string().nullable(),
|
|
11
|
+
created_at: z.string().nullable(),
|
|
12
|
+
updated_at: z.string().nullable(),
|
|
13
|
+
}),
|
|
14
|
+
relationships: z.object({
|
|
15
|
+
enterprise: z.object({
|
|
16
|
+
attributes: z.object({ name: z.string().nullable(), cnpj: z.string().nullable(), email: z.string().nullable() }),
|
|
17
|
+
}).nullable(),
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EnterpriseRelAttr, Tag } from '../core/types';
|
|
2
|
+
export interface TagResource {
|
|
3
|
+
id: string;
|
|
4
|
+
attributes: {
|
|
5
|
+
name: string;
|
|
6
|
+
color: string | null;
|
|
7
|
+
created_at: string | null;
|
|
8
|
+
updated_at: string | null;
|
|
9
|
+
};
|
|
10
|
+
relationships: {
|
|
11
|
+
enterprise: {
|
|
12
|
+
attributes: EnterpriseRelAttr;
|
|
13
|
+
} | null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export type { Tag };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const TrackingDeviceSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
attributes: z.ZodObject<{
|
|
5
|
+
imei: z.ZodNullable<z.ZodString>;
|
|
6
|
+
lat: z.ZodNullable<z.ZodNumber>;
|
|
7
|
+
lng: z.ZodNullable<z.ZodNumber>;
|
|
8
|
+
ign: z.ZodNullable<z.ZodBoolean>;
|
|
9
|
+
spd: z.ZodNullable<z.ZodNumber>;
|
|
10
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const TrackingDeviceSchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
attributes: z.object({
|
|
5
|
+
imei: z.string().nullable(),
|
|
6
|
+
lat: z.number().nullable(),
|
|
7
|
+
lng: z.number().nullable(),
|
|
8
|
+
ign: z.boolean().nullable(),
|
|
9
|
+
spd: z.number().nullable(),
|
|
10
|
+
updated_at: z.string().nullable(),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ApiClientLike } from '../core/client';
|
|
2
|
+
import type { QueryParams } from '../core/query-builder';
|
|
3
|
+
import type { ActivityReportAttributes, Trajectory } from './types';
|
|
4
|
+
export declare function createTrajectoriesApi(client: ApiClientLike): {
|
|
5
|
+
activityReport: (params: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
6
|
+
data: {
|
|
7
|
+
attributes: ActivityReportAttributes;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
10
|
+
movementReport: (params: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
11
|
+
data: {
|
|
12
|
+
attributes: {
|
|
13
|
+
report: number[][];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
endpoint: string;
|
|
18
|
+
list: <R = Trajectory>(params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<import("..").ListResponse<R>>;
|
|
19
|
+
get: <R = Trajectory>(id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
20
|
+
data: R;
|
|
21
|
+
}>;
|
|
22
|
+
create: (payload: unknown) => Promise<undefined>;
|
|
23
|
+
update: (id: string, payload: unknown) => Promise<undefined>;
|
|
24
|
+
remove: (id: string) => Promise<undefined>;
|
|
25
|
+
removeMany: (payload: unknown, signal?: AbortSignal) => Promise<undefined>;
|
|
26
|
+
};
|
|
27
|
+
export type { QueryParams };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createResourceApi } from '../core/client.js';
|
|
2
|
+
import { withQuery } from '../core/query-builder.js';
|
|
3
|
+
export function createTrajectoriesApi(client) {
|
|
4
|
+
return {
|
|
5
|
+
...createResourceApi(client, '/v5/trajectories'),
|
|
6
|
+
activityReport: (params, signal) => client
|
|
7
|
+
.get(withQuery('/v5/trajectories/reports/activity/enterprise', params), { signal })
|
|
8
|
+
.then((r) => r.data),
|
|
9
|
+
movementReport: (params, signal) => client
|
|
10
|
+
.get(withQuery('/v5/trajectories/reports/movement/enterprise', params), { signal })
|
|
11
|
+
.then((r) => r.data),
|
|
12
|
+
};
|
|
13
|
+
}
|