-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
173 lines (173 loc) · 8.67 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import type { mssql } from '@cityssm/mssql-multi-pool';
import type { DateString } from '@cityssm/utils-datetime';
import { type AccountNumberSource } from './helpers/getAccountNumber.js';
import { type AddEquipment } from './queries/equipment/addEquipment.js';
import type { EquipmentItem } from './queries/equipment/types.js';
import { type AddResourceItem } from './queries/items/addResourceItem.js';
import { type CreateStockTransactionBatch } from './queries/items/createStockTransactionBatch.js';
import type { ResourceItem } from './queries/items/types.js';
import type { Activity, Job, JobActivityObjectCode, JobAssignedObjectCode, ObjectCode } from './queries/jobs/types.js';
import type { BigIntString } from './queries/types.js';
import { type AddWorkOrderResource } from './queries/workOrders/addWorkOrderResource.js';
import type { WorkOrder, WorkOrderResource } from './queries/workOrders/types.js';
import { type UpdateWorkOrderResource } from './queries/workOrders/updateWorkOrderResource.js';
/**
* WorkTech API
*/
export declare class WorkTechAPI {
#private;
/**
* @param mssqlConfig - SQL Server configuration.
*/
constructor(mssqlConfig: mssql.config);
/**
* Retrieves a piece of equipment.
* @param equipmentId - The equipment id.
* @returns - The equipment record, if available.
*/
getEquipmentByEquipmentId(equipmentId: string): Promise<EquipmentItem | undefined>;
addEquipment(equipment: AddEquipment): Promise<BigIntString>;
/**
* Retrieves an item.
* @param itemId - The item id.
* @returns - The item, if available.
*/
getItemByItemId(itemId: string): Promise<ResourceItem | undefined>;
addResourceItem(resourceItem: AddResourceItem): Promise<BigIntString>;
/**
* Creates a new stock transaction batch.
* @param batch - The batch details
* @returns - The batch id.
*/
createStockTransactionBatch(batch: CreateStockTransactionBatch): Promise<number>;
/**
* Retrieves a work order.
* @param workOrderNumber - The work order number.
* @returns - The work order, if available.
*/
getWorkOrderByWorkOrderNumber(workOrderNumber: string): Promise<WorkOrder | undefined>;
/**
* Retrieves a list of work order resources.
* @param workOrderNumber - The work order number.
* @returns - An array of resources associated with a work order.
*/
getWorkOrderResourcesByWorkOrderNumber(workOrderNumber: string): Promise<WorkOrderResource[]>;
/**
* Retrieves a list of work order resources.
* @param startDateFrom - The minimum start date.
* @param startDateTo - The maximum start date.
* @returns - An array of resources between a given start time range.
*/
getWorkOrderResourcesByStartDateTimeRange(startDateFrom: Date | string, startDateTo: Date | string): Promise<WorkOrderResource[]>;
/**
* Retrieves a list of work order resources.
* @param startDateString - The start date.
* @returns - An array of resources on a given start date.
*/
getWorkOrderResourcesByStartDate(startDateString: DateString): Promise<WorkOrderResource[]>;
/**
* Adds a resource to a work order.
* @param workOrderResource - The work order resource fields.
* @returns - The system id for the new resource record.
*/
addWorkOrderResource(workOrderResource: AddWorkOrderResource): Promise<BigIntString>;
/**
* Updates a resource on a work order.
* Note that only a subset of fields can be updated,
* and each group must have all fields within it's grouping defined to be updated.
* - workDescription
* - serviceRequestSystemId, workOrderNumber
* - startDateTime
* - quantity, unitPrice, baseAmount
* @param workOrderResource - The work order resource fields.
* @returns - True when the update is processed successfully.
*/
updateWorkOrderResource(workOrderResource: UpdateWorkOrderResource): Promise<boolean>;
/**
* Deletes a resource on a work order.
* @param serviceRequestItemSystemId - The work order resource id.
* @returns - True when the delete is processed successfully.
*/
deleteWorkOrderResource(serviceRequestItemSystemId: BigIntString): Promise<boolean>;
/**
* Retrieves a job.
* @param jobId - The job id
* @returns - The job, if available.
*/
getJobByJobId(jobId: string): Promise<Job | undefined>;
/**
* Retrieves an activity.
* @param activityId - The activity id
* @returns - The activity, if available.
*/
getActivityByActivityId(activityId: string): Promise<Activity | undefined>;
/**
* Retrieves the activities associated with a given job and fiscal year.
* @param jobId - The job id
* @param fiscalYear - The fiscal year
* @returns - An array of activities.
*/
getActivitiesAssignedToJobByFiscalYear(jobId: string, fiscalYear: number | string): Promise<Activity[]>;
/**
* Retrieves an object code.
* @param objectCode - The object code
* @returns - The object code, if available.
*/
getObjectCodeByObjectCode(objectCode: string): Promise<ObjectCode | undefined>;
/**
* Retrieves a list of object codes associated with a given job and fiscal year.
* @param jobId - The job id.
* @param fiscalYear - The fiscal year.
* @returns - An array of object codes assigned to a given job.
*/
getObjectCodesAssignedToJobByFiscalYear(jobId: string, fiscalYear: number | string): Promise<JobAssignedObjectCode[]>;
/**
* Retrieves an object code associated with a given job and fiscal year.
* @param jobId - The job id.
* @param objectCode - The object code.
* @param fiscalYear - The fiscal year.
* @returns - The object code, if available.
*/
getObjectCodeAssignedToJobByObjectCodeAndFiscalYear(jobId: string, objectCode: string, fiscalYear: number | string): Promise<JobAssignedObjectCode | undefined>;
/**
* Retrieves a job - activity - object code.
* @param keys - The keys to search on.
* @param keys.jobId - The job id.
* @param keys.activityId - The activity id.
* @param keys.objectCode - The object code.
* @param keys.fiscalYear - The fiscal year.
* @returns - The job - activity - object code combination if available.
*/
getJobActivityObjectCodeByKeys(keys: {
jobId: string;
activityId: string;
objectCode: string;
fiscalYear: number | string;
}): Promise<JobActivityObjectCode | undefined>;
/**
* Retrieves an account number for a given work order.
* @param workOrderNumber - The work order number.
* @param optionalObjectCode - An optional object code.
* @returns - The account number and its source, if available.
*/
getAccountNumberByWorkOrderNumberAndObjectCode(workOrderNumber: string, optionalObjectCode?: string): Promise<AccountNumberSource | undefined>;
}
export { getAccountNumberByWorkOrderNumberAndObjectCode } from './helpers/getAccountNumber.js';
export { getEquipmentByEquipmentId } from './queries/equipment/getEquipment.js';
export { addEquipment } from './queries/equipment/addEquipment.js';
export { getItemByItemId } from './queries/items/getItems.js';
export { type AddResourceItem, addResourceItem } from './queries/items/addResourceItem.js';
export { type CreateStockTransactionBatch, type CreateStockTransactionBatchEntry, createStockTransactionBatch } from './queries/items/createStockTransactionBatch.js';
export { getActivityByActivityId, getActivitiesAssignedToJobByFiscalYear } from './queries/jobs/getActivities.js';
export { getJobByJobId } from './queries/jobs/getJobs.js';
export { getObjectCodeByObjectCode, getObjectCodesAssignedToJobByFiscalYear, getObjectCodeAssignedToJobByObjectCodeAndFiscalYear } from './queries/jobs/getObjectCodes.js';
export { getJobActivityObjectCodeByKeys } from './queries/jobs/getJobActivityObjectCodes.js';
export { getWorkOrderByWorkOrderNumber } from './queries/workOrders/getWorkOrders.js';
export { addWorkOrderResource } from './queries/workOrders/addWorkOrderResource.js';
export { getWorkOrderResourcesByStartDate, getWorkOrderResourcesByStartDateTimeRange, getWorkOrderResourcesByWorkOrderNumber } from './queries/workOrders/getWorkOrderResources.js';
export { updateWorkOrderResource } from './queries/workOrders/updateWorkOrderResource.js';
export { deleteWorkOrderResource } from './queries/workOrders/deleteWorkOrderResource.js';
export type { EquipmentItem } from './queries/equipment/types.js';
export type { ResourceItem } from './queries/items/types.js';
export type { Job, Activity, ObjectCode, JobActivityObjectCode } from './queries/jobs/types.js';
export type { WorkOrder, WorkOrderResource } from './queries/workOrders/types.js';