@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,13 @@
|
|
|
1
|
+
import type { ApiClientLike } from '../core/client';
|
|
2
|
+
import type { QueryParams } from '../core/query-builder';
|
|
3
|
+
import type { OperationLog } from './types';
|
|
4
|
+
export declare function createOperationLogsApi(client: ApiClientLike): {
|
|
5
|
+
list: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
6
|
+
data: OperationLog[];
|
|
7
|
+
count?: number;
|
|
8
|
+
}>;
|
|
9
|
+
listByModel: (modelType: string, modelId: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
10
|
+
data: OperationLog[];
|
|
11
|
+
count?: number;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { withQuery } from '../core/query-builder.js';
|
|
2
|
+
export function createOperationLogsApi(client) {
|
|
3
|
+
return {
|
|
4
|
+
list: (params = {}, signal) => client.get(withQuery('/v5/operation-logs', params), { signal }).then(r => r.data),
|
|
5
|
+
listByModel: (modelType, modelId, params = {}, signal) => {
|
|
6
|
+
const slug = modelType.replace('_', '-');
|
|
7
|
+
return client.get(withQuery(`/v5/operation-logs/${slug}/${modelId}`, params), { signal }).then(r => r.data);
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const OperationLogSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
attributes: z.ZodObject<{
|
|
5
|
+
operation_type: z.ZodNullable<z.ZodString>;
|
|
6
|
+
operation_at: z.ZodNullable<z.ZodString>;
|
|
7
|
+
model_data: z.ZodNullable<z.ZodObject<{
|
|
8
|
+
id: z.ZodOptional<z.ZodString>;
|
|
9
|
+
attributes: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
relationships: z.ZodObject<{
|
|
13
|
+
model: z.ZodNullable<z.ZodObject<{
|
|
14
|
+
type: z.ZodString;
|
|
15
|
+
id: z.ZodString;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
sub_models: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
18
|
+
type: z.ZodString;
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
}, z.core.$strip>>>;
|
|
21
|
+
user: z.ZodNullable<z.ZodObject<{
|
|
22
|
+
attributes: z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
username: z.ZodNullable<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
enterprise: z.ZodNullable<z.ZodObject<{
|
|
28
|
+
attributes: z.ZodObject<{
|
|
29
|
+
name: z.ZodNullable<z.ZodString>;
|
|
30
|
+
cnpj: z.ZodNullable<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const OperationLogSchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
attributes: z.object({
|
|
5
|
+
operation_type: z.string().nullable(),
|
|
6
|
+
operation_at: z.string().nullable(),
|
|
7
|
+
model_data: z.object({
|
|
8
|
+
id: z.string().optional(),
|
|
9
|
+
attributes: z.record(z.string(), z.unknown()),
|
|
10
|
+
}).nullable(),
|
|
11
|
+
}),
|
|
12
|
+
relationships: z.object({
|
|
13
|
+
model: z.object({ type: z.string(), id: z.string() }).nullable(),
|
|
14
|
+
sub_models: z.array(z.object({ type: z.string(), id: z.string() })).nullable(),
|
|
15
|
+
user: z.object({
|
|
16
|
+
attributes: z.object({ name: z.string(), username: z.string().nullable() }),
|
|
17
|
+
}).nullable(),
|
|
18
|
+
enterprise: z.object({
|
|
19
|
+
attributes: z.object({ name: z.string().nullable(), cnpj: z.string().nullable() }),
|
|
20
|
+
}).nullable(),
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { EnterpriseRelAttr } from '../core/types';
|
|
2
|
+
export interface LogAttributes {
|
|
3
|
+
operation_type: string | null;
|
|
4
|
+
operation_at: string | null;
|
|
5
|
+
model_data: {
|
|
6
|
+
id?: string;
|
|
7
|
+
attributes: Record<string, unknown>;
|
|
8
|
+
} | null;
|
|
9
|
+
}
|
|
10
|
+
export interface OperationLog {
|
|
11
|
+
id: string;
|
|
12
|
+
attributes: LogAttributes;
|
|
13
|
+
relationships: {
|
|
14
|
+
model: {
|
|
15
|
+
type: string;
|
|
16
|
+
id: string;
|
|
17
|
+
} | null;
|
|
18
|
+
sub_models: Array<{
|
|
19
|
+
type: string;
|
|
20
|
+
id: string;
|
|
21
|
+
}> | null;
|
|
22
|
+
user: {
|
|
23
|
+
attributes: {
|
|
24
|
+
name: string;
|
|
25
|
+
username: string | null;
|
|
26
|
+
};
|
|
27
|
+
} | null;
|
|
28
|
+
enterprise: {
|
|
29
|
+
attributes: Pick<EnterpriseRelAttr, 'name' | 'cnpj'>;
|
|
30
|
+
} | null;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ApiClientLike } from '../core/client';
|
|
2
|
+
import type { QueryParams } from '../core/query-builder';
|
|
3
|
+
import type { Document } from '../core/types';
|
|
4
|
+
import type { Protocol, ProtocolCompletedRow, ProtocolEntriesRow, ProtocolPanelRow, ProtocolSection, ProtocolType } from './types';
|
|
5
|
+
export declare function createProtocolsApi(client: ApiClientLike): {
|
|
6
|
+
listDocuments: (id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
7
|
+
data: Document[];
|
|
8
|
+
count: number;
|
|
9
|
+
}>;
|
|
10
|
+
listTypes: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
11
|
+
data: ProtocolType[];
|
|
12
|
+
}>;
|
|
13
|
+
listSections: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
14
|
+
data: ProtocolSection[];
|
|
15
|
+
}>;
|
|
16
|
+
panel: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
17
|
+
data: ProtocolPanelRow[];
|
|
18
|
+
}>;
|
|
19
|
+
panelCompleted: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
20
|
+
data: ProtocolCompletedRow[];
|
|
21
|
+
}>;
|
|
22
|
+
panelEntries: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
23
|
+
data: ProtocolEntriesRow[];
|
|
24
|
+
}>;
|
|
25
|
+
endpoint: string;
|
|
26
|
+
list: <R = Protocol>(params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<import("..").ListResponse<R>>;
|
|
27
|
+
get: <R = Protocol>(id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
28
|
+
data: R;
|
|
29
|
+
}>;
|
|
30
|
+
create: (payload: unknown) => Promise<undefined>;
|
|
31
|
+
update: (id: string, payload: unknown) => Promise<undefined>;
|
|
32
|
+
remove: (id: string) => Promise<undefined>;
|
|
33
|
+
removeMany: (payload: unknown, signal?: AbortSignal) => Promise<undefined>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createResourceApi } from '../core/client.js';
|
|
2
|
+
import { withQuery } from '../core/query-builder.js';
|
|
3
|
+
export function createProtocolsApi(client) {
|
|
4
|
+
return {
|
|
5
|
+
...createResourceApi(client, '/v5/protocols'),
|
|
6
|
+
listDocuments: (id, params = {}, signal) => client.get(withQuery(`/v5/protocols/${id}/documents`, params), { signal }).then(r => r.data),
|
|
7
|
+
listTypes: (params = {}, signal) => client.get(withQuery('/v5/protocols/types', params), { signal }).then(r => r.data),
|
|
8
|
+
listSections: (params = {}, signal) => client.get(withQuery('/v5/protocols/sections', params), { signal }).then(r => r.data),
|
|
9
|
+
panel: (params = {}, signal) => client.get(withQuery('/v5/protocols', params), { signal }).then(r => r.data),
|
|
10
|
+
panelCompleted: (params = {}, signal) => client.get(withQuery('/v5/protocols', params), { signal }).then(r => r.data),
|
|
11
|
+
panelEntries: (params = {}, signal) => client.get(withQuery('/v5/protocols', params), { signal }).then(r => r.data),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ProtocolSchema: 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
|
+
email: z.ZodNullable<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
type: z.ZodNullable<z.ZodObject<{
|
|
23
|
+
attributes: z.ZodObject<{
|
|
24
|
+
name: z.ZodNullable<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
section: z.ZodNullable<z.ZodObject<{
|
|
28
|
+
attributes: z.ZodObject<{
|
|
29
|
+
name: z.ZodNullable<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
asset: z.ZodNullable<z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
attributes: z.ZodObject<{
|
|
35
|
+
plate: z.ZodNullable<z.ZodString>;
|
|
36
|
+
vin: z.ZodNullable<z.ZodString>;
|
|
37
|
+
label: z.ZodNullable<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
assignee: z.ZodNullable<z.ZodObject<{
|
|
41
|
+
attributes: z.ZodObject<{
|
|
42
|
+
name: z.ZodNullable<z.ZodString>;
|
|
43
|
+
email: z.ZodNullable<z.ZodString>;
|
|
44
|
+
phone1: z.ZodNullable<z.ZodString>;
|
|
45
|
+
phone2: z.ZodNullable<z.ZodString>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
addresses: z.ZodArray<z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
attributes: z.ZodObject<{
|
|
51
|
+
formatted_address: z.ZodNullable<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
completion: z.ZodNullable<z.ZodObject<{
|
|
55
|
+
attributes: z.ZodObject<{
|
|
56
|
+
completed_at: z.ZodNullable<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
attributes: z.ZodObject<{
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const ProtocolSchema = 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(), email: z.string().nullable() }),
|
|
17
|
+
}).nullable(),
|
|
18
|
+
type: z.object({ attributes: z.object({ name: z.string().nullable() }) }).nullable(),
|
|
19
|
+
section: z.object({ attributes: z.object({ name: z.string().nullable() }) }).nullable(),
|
|
20
|
+
asset: z.object({
|
|
21
|
+
id: z.string(),
|
|
22
|
+
attributes: z.object({ plate: z.string().nullable(), vin: z.string().nullable(), label: z.string().nullable() }),
|
|
23
|
+
}).nullable(),
|
|
24
|
+
assignee: z.object({
|
|
25
|
+
attributes: z.object({
|
|
26
|
+
name: z.string().nullable(),
|
|
27
|
+
email: z.string().nullable(),
|
|
28
|
+
phone1: z.string().nullable(),
|
|
29
|
+
phone2: z.string().nullable(),
|
|
30
|
+
}),
|
|
31
|
+
}).nullable(),
|
|
32
|
+
addresses: z.array(z.object({ id: z.string(), attributes: z.object({ formatted_address: z.string().nullable() }) })),
|
|
33
|
+
completion: z.object({ attributes: z.object({ completed_at: z.string().nullable() }) }).nullable(),
|
|
34
|
+
tags: z.array(z.object({ id: z.string(), attributes: z.object({ name: z.string() }) })),
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { AssigneeRelAttr, CompletionRelAttr, Document, EnterpriseRelAttr, SectionRelAttr, TaskBaseAttributes, TypeRelAttr, VehicleRelAttr } from '../core/types';
|
|
2
|
+
export interface ProtocolAttributes extends TaskBaseAttributes {
|
|
3
|
+
due_date: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface Protocol {
|
|
6
|
+
id: string;
|
|
7
|
+
attributes: ProtocolAttributes;
|
|
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
|
+
id: string;
|
|
20
|
+
attributes: Pick<VehicleRelAttr, 'plate' | 'vin' | 'label'>;
|
|
21
|
+
} | null;
|
|
22
|
+
assignee: {
|
|
23
|
+
attributes: AssigneeRelAttr;
|
|
24
|
+
} | null;
|
|
25
|
+
addresses: Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
attributes: {
|
|
28
|
+
formatted_address: string | null;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
completion: {
|
|
32
|
+
attributes: CompletionRelAttr;
|
|
33
|
+
} | null;
|
|
34
|
+
tags: Array<{
|
|
35
|
+
id: string;
|
|
36
|
+
attributes: {
|
|
37
|
+
name: string;
|
|
38
|
+
};
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface ProtocolType {
|
|
43
|
+
id: string;
|
|
44
|
+
attributes: {
|
|
45
|
+
name: string | null;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface ProtocolSection {
|
|
49
|
+
id: string;
|
|
50
|
+
attributes: {
|
|
51
|
+
name: string | null;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface ProtocolPanelRow {
|
|
55
|
+
attributes: {
|
|
56
|
+
count: string;
|
|
57
|
+
completed: boolean | null;
|
|
58
|
+
created_at: {
|
|
59
|
+
day: string;
|
|
60
|
+
} | null;
|
|
61
|
+
due_date: {
|
|
62
|
+
hour: string;
|
|
63
|
+
} | null;
|
|
64
|
+
type: {
|
|
65
|
+
name: string | null;
|
|
66
|
+
} | null;
|
|
67
|
+
asset_type: {
|
|
68
|
+
name: string | null;
|
|
69
|
+
} | null;
|
|
70
|
+
asset: {
|
|
71
|
+
brand: string | null;
|
|
72
|
+
color: string | null;
|
|
73
|
+
} | null;
|
|
74
|
+
sum: {
|
|
75
|
+
asset: {
|
|
76
|
+
current_value: string | null;
|
|
77
|
+
};
|
|
78
|
+
} | null;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export interface ProtocolCompletedRow {
|
|
82
|
+
attributes: {
|
|
83
|
+
count: string;
|
|
84
|
+
completed_at: {
|
|
85
|
+
day: string;
|
|
86
|
+
} | null;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export interface ProtocolEntriesRow {
|
|
90
|
+
attributes: {
|
|
91
|
+
count: string;
|
|
92
|
+
sum: {
|
|
93
|
+
entries: {
|
|
94
|
+
total_price: string | null;
|
|
95
|
+
};
|
|
96
|
+
} | null;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export type { Document };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ApiClientLike } from '../core/client';
|
|
2
|
+
import type { QueryParams } from '../core/query-builder';
|
|
3
|
+
import type { CustomField, Document, TaskEntry } from '../core/types';
|
|
4
|
+
import type { Acknowledgement, ServiceOrder, ServiceOrderEntriesRow, ServiceOrderPanelRow } from './types';
|
|
5
|
+
export declare function createServiceOrdersApi(client: ApiClientLike): {
|
|
6
|
+
listCustomFields: (id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
7
|
+
data: CustomField[];
|
|
8
|
+
count: number;
|
|
9
|
+
}>;
|
|
10
|
+
listDocuments: (id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
11
|
+
data: Document[];
|
|
12
|
+
count: number;
|
|
13
|
+
}>;
|
|
14
|
+
listEntries: (id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
15
|
+
data: TaskEntry[];
|
|
16
|
+
count: number;
|
|
17
|
+
}>;
|
|
18
|
+
createEntry: (id: string, payload: unknown) => Promise<undefined>;
|
|
19
|
+
panel: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
20
|
+
data: ServiceOrderPanelRow[];
|
|
21
|
+
}>;
|
|
22
|
+
panelEntries: (params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
23
|
+
data: ServiceOrderEntriesRow[];
|
|
24
|
+
}>;
|
|
25
|
+
listAcknowledgements: (userId: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
26
|
+
data: Acknowledgement[];
|
|
27
|
+
count: number;
|
|
28
|
+
}>;
|
|
29
|
+
endpoint: string;
|
|
30
|
+
list: <R = ServiceOrder>(params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<import("..").ListResponse<R>>;
|
|
31
|
+
get: <R = ServiceOrder>(id: string, params?: Partial<QueryParams>, signal?: AbortSignal) => Promise<{
|
|
32
|
+
data: R;
|
|
33
|
+
}>;
|
|
34
|
+
create: (payload: unknown) => Promise<undefined>;
|
|
35
|
+
update: (id: string, payload: unknown) => Promise<undefined>;
|
|
36
|
+
remove: (id: string) => Promise<undefined>;
|
|
37
|
+
removeMany: (payload: unknown, signal?: AbortSignal) => Promise<undefined>;
|
|
38
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createResourceApi } from '../core/client.js';
|
|
2
|
+
import { withQuery } from '../core/query-builder.js';
|
|
3
|
+
export function createServiceOrdersApi(client) {
|
|
4
|
+
return {
|
|
5
|
+
...createResourceApi(client, '/v5/service-orders'),
|
|
6
|
+
listCustomFields: (id, params = {}, signal) => client.get(withQuery(`/v5/service-orders/${id}/custom-fields`, params), { signal }).then(r => r.data),
|
|
7
|
+
listDocuments: (id, params = {}, signal) => client.get(withQuery(`/v5/service-orders/${id}/documents`, params), { signal }).then(r => r.data),
|
|
8
|
+
listEntries: (id, params = {}, signal) => client.get(withQuery(`/v5/service-orders/${id}/entries`, params), { signal }).then(r => r.data),
|
|
9
|
+
createEntry: (id, payload) => client.post(`/v5/service-orders/${id}/entries`, { data: payload }).then(() => undefined),
|
|
10
|
+
panel: (params = {}, signal) => client.get(withQuery('/v5/service-orders', params), { signal }).then(r => r.data),
|
|
11
|
+
panelEntries: (params = {}, signal) => client.get(withQuery('/v5/service-orders', params), { signal }).then(r => r.data),
|
|
12
|
+
listAcknowledgements: (userId, params = {}, signal) => client.get(withQuery(`/v5/service-orders/acknowledgements/${userId}`, params), { signal }).then(r => r.data),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ServiceOrderSchema: 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
|
+
email: z.ZodNullable<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
type: z.ZodNullable<z.ZodObject<{
|
|
23
|
+
attributes: z.ZodObject<{
|
|
24
|
+
name: z.ZodNullable<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
section: z.ZodNullable<z.ZodObject<{
|
|
28
|
+
attributes: z.ZodObject<{
|
|
29
|
+
name: z.ZodNullable<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
asset: z.ZodNullable<z.ZodObject<{
|
|
33
|
+
attributes: z.ZodObject<{
|
|
34
|
+
plate: z.ZodNullable<z.ZodString>;
|
|
35
|
+
vin: z.ZodNullable<z.ZodString>;
|
|
36
|
+
label: z.ZodNullable<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
assignee: z.ZodNullable<z.ZodObject<{
|
|
40
|
+
attributes: z.ZodObject<{
|
|
41
|
+
name: z.ZodNullable<z.ZodString>;
|
|
42
|
+
email: z.ZodNullable<z.ZodString>;
|
|
43
|
+
phone1: z.ZodNullable<z.ZodString>;
|
|
44
|
+
phone2: z.ZodNullable<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
addresses: z.ZodArray<z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
attributes: z.ZodObject<{
|
|
50
|
+
formatted_address: z.ZodNullable<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
completion: z.ZodNullable<z.ZodObject<{
|
|
54
|
+
attributes: z.ZodObject<{
|
|
55
|
+
completed_at: z.ZodNullable<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
attributes: z.ZodObject<{
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export declare const AcknowledgementSchema: z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
attributes: z.ZodObject<{
|
|
69
|
+
acknowledged: z.ZodNullable<z.ZodBoolean>;
|
|
70
|
+
acknowledged_at: z.ZodNullable<z.ZodString>;
|
|
71
|
+
rate: z.ZodNullable<z.ZodNumber>;
|
|
72
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
relationships: z.ZodObject<{
|
|
75
|
+
task: z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
attributes: z.ZodObject<{
|
|
78
|
+
token: z.ZodString;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const ServiceOrderSchema = 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(), email: z.string().nullable() }),
|
|
17
|
+
}).nullable(),
|
|
18
|
+
type: z.object({ attributes: z.object({ name: z.string().nullable() }) }).nullable(),
|
|
19
|
+
section: z.object({ attributes: z.object({ name: z.string().nullable() }) }).nullable(),
|
|
20
|
+
asset: z.object({
|
|
21
|
+
attributes: z.object({ plate: z.string().nullable(), vin: z.string().nullable(), label: z.string().nullable() }),
|
|
22
|
+
}).nullable(),
|
|
23
|
+
assignee: z.object({
|
|
24
|
+
attributes: z.object({
|
|
25
|
+
name: z.string().nullable(),
|
|
26
|
+
email: z.string().nullable(),
|
|
27
|
+
phone1: z.string().nullable(),
|
|
28
|
+
phone2: z.string().nullable(),
|
|
29
|
+
}),
|
|
30
|
+
}).nullable(),
|
|
31
|
+
addresses: z.array(z.object({ id: z.string(), attributes: z.object({ formatted_address: z.string().nullable() }) })),
|
|
32
|
+
completion: z.object({ attributes: z.object({ completed_at: z.string().nullable() }) }).nullable(),
|
|
33
|
+
tags: z.array(z.object({ id: z.string(), attributes: z.object({ name: z.string() }) })),
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
export const AcknowledgementSchema = z.object({
|
|
37
|
+
id: z.string(),
|
|
38
|
+
attributes: z.object({
|
|
39
|
+
acknowledged: z.boolean().nullable(),
|
|
40
|
+
acknowledged_at: z.string().nullable(),
|
|
41
|
+
rate: z.number().nullable(),
|
|
42
|
+
created_at: z.string().nullable(),
|
|
43
|
+
}),
|
|
44
|
+
relationships: z.object({
|
|
45
|
+
task: z.object({ id: z.string(), attributes: z.object({ token: z.string() }) }),
|
|
46
|
+
}),
|
|
47
|
+
});
|