@fabriktor/client 0.0.28 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/billable/billable.d.ts +213 -0
- package/dist/src/billable/billable.js +441 -0
- package/dist/src/calls/calls.d.ts +34 -0
- package/dist/src/calls/calls.js +65 -0
- package/dist/src/chat/chat.d.ts +97 -0
- package/dist/src/chat/chat.js +224 -0
- package/dist/src/contacts/contacts.d.ts +37 -0
- package/dist/src/contacts/contacts.js +94 -0
- package/dist/src/core/col.d.ts +7 -1
- package/dist/src/core/col.js +29 -14
- package/dist/src/core/crud.d.ts +1 -1
- package/dist/src/core/crud.js +1 -1
- package/dist/src/core/http.d.ts +3 -4
- package/dist/src/core/http.js +3 -3
- package/dist/src/core/idempotency.js +1 -1
- package/dist/src/core/multipart.d.ts +25 -0
- package/dist/src/core/multipart.js +93 -0
- package/dist/src/feed/feed.d.ts +65 -0
- package/dist/src/feed/feed.js +130 -0
- package/dist/src/fulfillments/fulfillments.d.ts +36 -0
- package/dist/src/fulfillments/fulfillments.js +68 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.js +14 -0
- package/dist/src/jobs/jobs.d.ts +69 -0
- package/dist/src/jobs/jobs.js +143 -0
- package/dist/src/marketplace/marketplace.d.ts +49 -0
- package/dist/src/marketplace/marketplace.js +94 -0
- package/dist/src/payments/payments.d.ts +154 -0
- package/dist/src/payments/payments.js +328 -0
- package/dist/src/payrolls/payrolls.d.ts +179 -0
- package/dist/src/payrolls/payrolls.js +380 -0
- package/dist/src/processes/processes.d.ts +3 -3
- package/dist/src/routes/routes.d.ts +93 -0
- package/dist/src/routes/routes.js +185 -0
- package/dist/src/storage/storage.d.ts +124 -0
- package/dist/src/storage/storage.js +242 -0
- package/dist/src/timesheets/timesheets.d.ts +49 -0
- package/dist/src/timesheets/timesheets.js +105 -0
- package/dist/src/users/tmp_phones.d.ts +1 -1
- package/dist/src/users/tmp_usernames.d.ts +5 -4
- package/dist/src/users/users.d.ts +13 -12
- package/dist/src/users/users.js +4 -1
- package/package.json +3 -2
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
// Copyright (C) Fabriktor, Inc. 2025-present.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
|
+
// not use this file except in compliance with the License. You may obtain
|
|
5
|
+
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
import { ColPayrollsAdjustmentAggregates, ColPayrollsAdjustmentFolders, ColPayrollsAdjustmentRecords, ColPayrollsAdjustments, ColPayrollsEmployeePayConfigs, ColPayrollsHourBanks, ColPayrollsPayConfigs, ColPayrollsPayables, ColPayrollsPayrollPrograms, ColPayrollsPayrolls, HTTPMethodPost, PathPayrollsGenerate, PathPayrollsToPayroll, SvcPayrolls, } from "@fabriktor/schema";
|
|
7
|
+
import { requiredToken } from "../core/auth.js";
|
|
8
|
+
import { newCRUDClient } from "../core/crud.js";
|
|
9
|
+
import { buildPath } from "../core/path.js";
|
|
10
|
+
export class PayrollsClient {
|
|
11
|
+
payables;
|
|
12
|
+
payrolls;
|
|
13
|
+
pay_configs;
|
|
14
|
+
hour_banks;
|
|
15
|
+
adjustments;
|
|
16
|
+
adjustment_folders;
|
|
17
|
+
adjustment_records;
|
|
18
|
+
adjustment_aggregates;
|
|
19
|
+
employee_pay_configs;
|
|
20
|
+
payroll_programs;
|
|
21
|
+
http;
|
|
22
|
+
base_url;
|
|
23
|
+
get_token;
|
|
24
|
+
constructor(opts) {
|
|
25
|
+
this.payables = newCRUDClient({
|
|
26
|
+
http: opts.http,
|
|
27
|
+
base_url: opts.base_url,
|
|
28
|
+
svc: SvcPayrolls,
|
|
29
|
+
col: ColPayrollsPayables,
|
|
30
|
+
get_token: opts.get_token,
|
|
31
|
+
});
|
|
32
|
+
this.payrolls = newCRUDClient({
|
|
33
|
+
http: opts.http,
|
|
34
|
+
base_url: opts.base_url,
|
|
35
|
+
svc: SvcPayrolls,
|
|
36
|
+
col: ColPayrollsPayrolls,
|
|
37
|
+
get_token: opts.get_token,
|
|
38
|
+
});
|
|
39
|
+
this.pay_configs = newCRUDClient({
|
|
40
|
+
http: opts.http,
|
|
41
|
+
base_url: opts.base_url,
|
|
42
|
+
svc: SvcPayrolls,
|
|
43
|
+
col: ColPayrollsPayConfigs,
|
|
44
|
+
get_token: opts.get_token,
|
|
45
|
+
});
|
|
46
|
+
this.hour_banks = newCRUDClient({
|
|
47
|
+
http: opts.http,
|
|
48
|
+
base_url: opts.base_url,
|
|
49
|
+
svc: SvcPayrolls,
|
|
50
|
+
col: ColPayrollsHourBanks,
|
|
51
|
+
get_token: opts.get_token,
|
|
52
|
+
});
|
|
53
|
+
this.adjustments = newCRUDClient({
|
|
54
|
+
http: opts.http,
|
|
55
|
+
base_url: opts.base_url,
|
|
56
|
+
svc: SvcPayrolls,
|
|
57
|
+
col: ColPayrollsAdjustments,
|
|
58
|
+
get_token: opts.get_token,
|
|
59
|
+
});
|
|
60
|
+
this.adjustment_folders = newCRUDClient({
|
|
61
|
+
http: opts.http,
|
|
62
|
+
base_url: opts.base_url,
|
|
63
|
+
svc: SvcPayrolls,
|
|
64
|
+
col: ColPayrollsAdjustmentFolders,
|
|
65
|
+
get_token: opts.get_token,
|
|
66
|
+
});
|
|
67
|
+
this.adjustment_records = newCRUDClient({
|
|
68
|
+
http: opts.http,
|
|
69
|
+
base_url: opts.base_url,
|
|
70
|
+
svc: SvcPayrolls,
|
|
71
|
+
col: ColPayrollsAdjustmentRecords,
|
|
72
|
+
get_token: opts.get_token,
|
|
73
|
+
});
|
|
74
|
+
this.adjustment_aggregates = newCRUDClient({
|
|
75
|
+
http: opts.http,
|
|
76
|
+
base_url: opts.base_url,
|
|
77
|
+
svc: SvcPayrolls,
|
|
78
|
+
col: ColPayrollsAdjustmentAggregates,
|
|
79
|
+
get_token: opts.get_token,
|
|
80
|
+
});
|
|
81
|
+
this.employee_pay_configs = newCRUDClient({
|
|
82
|
+
http: opts.http,
|
|
83
|
+
base_url: opts.base_url,
|
|
84
|
+
svc: SvcPayrolls,
|
|
85
|
+
col: ColPayrollsEmployeePayConfigs,
|
|
86
|
+
get_token: opts.get_token,
|
|
87
|
+
});
|
|
88
|
+
this.payroll_programs = newCRUDClient({
|
|
89
|
+
http: opts.http,
|
|
90
|
+
base_url: opts.base_url,
|
|
91
|
+
svc: SvcPayrolls,
|
|
92
|
+
col: ColPayrollsPayrollPrograms,
|
|
93
|
+
get_token: opts.get_token,
|
|
94
|
+
});
|
|
95
|
+
this.http = opts.http;
|
|
96
|
+
this.base_url = opts.base_url;
|
|
97
|
+
this.get_token = opts.get_token;
|
|
98
|
+
}
|
|
99
|
+
async queryPayables(opts) {
|
|
100
|
+
return await this.payables.query(opts);
|
|
101
|
+
}
|
|
102
|
+
async insertOnePayable(opts) {
|
|
103
|
+
return await this.payables.insertOne(opts);
|
|
104
|
+
}
|
|
105
|
+
async findOnePayable(opts) {
|
|
106
|
+
return await this.payables.findOne(opts);
|
|
107
|
+
}
|
|
108
|
+
async replaceOnePayable(opts) {
|
|
109
|
+
return await this.payables.replaceOne(opts);
|
|
110
|
+
}
|
|
111
|
+
async deleteOnePayable(opts) {
|
|
112
|
+
return await this.payables.deleteOne(opts);
|
|
113
|
+
}
|
|
114
|
+
async deleteManyPayables(opts) {
|
|
115
|
+
return await this.payables.deleteMany(opts);
|
|
116
|
+
}
|
|
117
|
+
async searchManyPayables(opts) {
|
|
118
|
+
return await this.payables.searchMany(opts);
|
|
119
|
+
}
|
|
120
|
+
async queryPayrolls(opts) {
|
|
121
|
+
return await this.payrolls.query(opts);
|
|
122
|
+
}
|
|
123
|
+
async insertOnePayroll(opts) {
|
|
124
|
+
return await this.payrolls.insertOne(opts);
|
|
125
|
+
}
|
|
126
|
+
async findOnePayroll(opts) {
|
|
127
|
+
return await this.payrolls.findOne(opts);
|
|
128
|
+
}
|
|
129
|
+
async replaceOnePayroll(opts) {
|
|
130
|
+
return await this.payrolls.replaceOne(opts);
|
|
131
|
+
}
|
|
132
|
+
async deleteOnePayroll(opts) {
|
|
133
|
+
return await this.payrolls.deleteOne(opts);
|
|
134
|
+
}
|
|
135
|
+
async deleteManyPayrolls(opts) {
|
|
136
|
+
return await this.payrolls.deleteMany(opts);
|
|
137
|
+
}
|
|
138
|
+
async searchManyPayrolls(opts) {
|
|
139
|
+
return await this.payrolls.searchMany(opts);
|
|
140
|
+
}
|
|
141
|
+
async queryPayConfigs(opts) {
|
|
142
|
+
return await this.pay_configs.query(opts);
|
|
143
|
+
}
|
|
144
|
+
async insertOnePayConfig(opts) {
|
|
145
|
+
return await this.pay_configs.insertOne(opts);
|
|
146
|
+
}
|
|
147
|
+
async findOnePayConfig(opts) {
|
|
148
|
+
return await this.pay_configs.findOne(opts);
|
|
149
|
+
}
|
|
150
|
+
async replaceOnePayConfig(opts) {
|
|
151
|
+
return await this.pay_configs.replaceOne(opts);
|
|
152
|
+
}
|
|
153
|
+
async deleteOnePayConfig(opts) {
|
|
154
|
+
return await this.pay_configs.deleteOne(opts);
|
|
155
|
+
}
|
|
156
|
+
async deleteManyPayConfigs(opts) {
|
|
157
|
+
return await this.pay_configs.deleteMany(opts);
|
|
158
|
+
}
|
|
159
|
+
async searchManyPayConfigs(opts) {
|
|
160
|
+
return await this.pay_configs.searchMany(opts);
|
|
161
|
+
}
|
|
162
|
+
async queryHourBanks(opts) {
|
|
163
|
+
return await this.hour_banks.query(opts);
|
|
164
|
+
}
|
|
165
|
+
async insertOneHourBank(opts) {
|
|
166
|
+
return await this.hour_banks.insertOne(opts);
|
|
167
|
+
}
|
|
168
|
+
async findOneHourBank(opts) {
|
|
169
|
+
return await this.hour_banks.findOne(opts);
|
|
170
|
+
}
|
|
171
|
+
async replaceOneHourBank(opts) {
|
|
172
|
+
return await this.hour_banks.replaceOne(opts);
|
|
173
|
+
}
|
|
174
|
+
async deleteOneHourBank(opts) {
|
|
175
|
+
return await this.hour_banks.deleteOne(opts);
|
|
176
|
+
}
|
|
177
|
+
async deleteManyHourBanks(opts) {
|
|
178
|
+
return await this.hour_banks.deleteMany(opts);
|
|
179
|
+
}
|
|
180
|
+
async searchManyHourBanks(opts) {
|
|
181
|
+
return await this.hour_banks.searchMany(opts);
|
|
182
|
+
}
|
|
183
|
+
async queryAdjustments(opts) {
|
|
184
|
+
return await this.adjustments.query(opts);
|
|
185
|
+
}
|
|
186
|
+
async insertOneAdjustment(opts) {
|
|
187
|
+
return await this.adjustments.insertOne(opts);
|
|
188
|
+
}
|
|
189
|
+
async findOneAdjustment(opts) {
|
|
190
|
+
return await this.adjustments.findOne(opts);
|
|
191
|
+
}
|
|
192
|
+
async replaceOneAdjustment(opts) {
|
|
193
|
+
return await this.adjustments.replaceOne(opts);
|
|
194
|
+
}
|
|
195
|
+
async deleteOneAdjustment(opts) {
|
|
196
|
+
return await this.adjustments.deleteOne(opts);
|
|
197
|
+
}
|
|
198
|
+
async deleteManyAdjustments(opts) {
|
|
199
|
+
return await this.adjustments.deleteMany(opts);
|
|
200
|
+
}
|
|
201
|
+
async searchManyAdjustments(opts) {
|
|
202
|
+
return await this.adjustments.searchMany(opts);
|
|
203
|
+
}
|
|
204
|
+
async queryAdjustmentFolders(opts) {
|
|
205
|
+
return await this.adjustment_folders.query(opts);
|
|
206
|
+
}
|
|
207
|
+
async insertOneAdjustmentFolder(opts) {
|
|
208
|
+
return await this.adjustment_folders.insertOne(opts);
|
|
209
|
+
}
|
|
210
|
+
async findOneAdjustmentFolder(opts) {
|
|
211
|
+
return await this.adjustment_folders.findOne(opts);
|
|
212
|
+
}
|
|
213
|
+
async replaceOneAdjustmentFolder(opts) {
|
|
214
|
+
return await this.adjustment_folders.replaceOne(opts);
|
|
215
|
+
}
|
|
216
|
+
async deleteOneAdjustmentFolder(opts) {
|
|
217
|
+
return await this.adjustment_folders.deleteOne(opts);
|
|
218
|
+
}
|
|
219
|
+
async deleteManyAdjustmentFolders(opts) {
|
|
220
|
+
return await this.adjustment_folders.deleteMany(opts);
|
|
221
|
+
}
|
|
222
|
+
async searchManyAdjustmentFolders(opts) {
|
|
223
|
+
return await this.adjustment_folders.searchMany(opts);
|
|
224
|
+
}
|
|
225
|
+
async queryAdjustmentRecords(opts) {
|
|
226
|
+
return await this.adjustment_records.query(opts);
|
|
227
|
+
}
|
|
228
|
+
async insertOneAdjustmentRecord(opts) {
|
|
229
|
+
return await this.adjustment_records.insertOne(opts);
|
|
230
|
+
}
|
|
231
|
+
async findOneAdjustmentRecord(opts) {
|
|
232
|
+
return await this.adjustment_records.findOne(opts);
|
|
233
|
+
}
|
|
234
|
+
async replaceOneAdjustmentRecord(opts) {
|
|
235
|
+
return await this.adjustment_records.replaceOne(opts);
|
|
236
|
+
}
|
|
237
|
+
async deleteOneAdjustmentRecord(opts) {
|
|
238
|
+
return await this.adjustment_records.deleteOne(opts);
|
|
239
|
+
}
|
|
240
|
+
async deleteManyAdjustmentRecords(opts) {
|
|
241
|
+
return await this.adjustment_records.deleteMany(opts);
|
|
242
|
+
}
|
|
243
|
+
async searchManyAdjustmentRecords(opts) {
|
|
244
|
+
return await this.adjustment_records.searchMany(opts);
|
|
245
|
+
}
|
|
246
|
+
async queryAdjustmentAggregates(opts) {
|
|
247
|
+
return await this.adjustment_aggregates.query(opts);
|
|
248
|
+
}
|
|
249
|
+
async insertOneAdjustmentAggregate(opts) {
|
|
250
|
+
return await this.adjustment_aggregates.insertOne(opts);
|
|
251
|
+
}
|
|
252
|
+
async findOneAdjustmentAggregate(opts) {
|
|
253
|
+
return await this.adjustment_aggregates.findOne(opts);
|
|
254
|
+
}
|
|
255
|
+
async replaceOneAdjustmentAggregate(opts) {
|
|
256
|
+
return await this.adjustment_aggregates.replaceOne(opts);
|
|
257
|
+
}
|
|
258
|
+
async deleteOneAdjustmentAggregate(opts) {
|
|
259
|
+
return await this.adjustment_aggregates.deleteOne(opts);
|
|
260
|
+
}
|
|
261
|
+
async deleteManyAdjustmentAggregates(opts) {
|
|
262
|
+
return await this.adjustment_aggregates.deleteMany(opts);
|
|
263
|
+
}
|
|
264
|
+
async searchManyAdjustmentAggregates(opts) {
|
|
265
|
+
return await this.adjustment_aggregates.searchMany(opts);
|
|
266
|
+
}
|
|
267
|
+
async queryEmployeePayConfigs(opts) {
|
|
268
|
+
return await this.employee_pay_configs.query(opts);
|
|
269
|
+
}
|
|
270
|
+
async insertOneEmployeePayConfig(opts) {
|
|
271
|
+
return await this.employee_pay_configs.insertOne(opts);
|
|
272
|
+
}
|
|
273
|
+
async findOneEmployeePayConfig(opts) {
|
|
274
|
+
return await this.employee_pay_configs.findOne(opts);
|
|
275
|
+
}
|
|
276
|
+
async replaceOneEmployeePayConfig(opts) {
|
|
277
|
+
return await this.employee_pay_configs.replaceOne(opts);
|
|
278
|
+
}
|
|
279
|
+
async deleteOneEmployeePayConfig(opts) {
|
|
280
|
+
return await this.employee_pay_configs.deleteOne(opts);
|
|
281
|
+
}
|
|
282
|
+
async deleteManyEmployeePayConfigs(opts) {
|
|
283
|
+
return await this.employee_pay_configs.deleteMany(opts);
|
|
284
|
+
}
|
|
285
|
+
async searchManyEmployeePayConfigs(opts) {
|
|
286
|
+
return await this.employee_pay_configs.searchMany(opts);
|
|
287
|
+
}
|
|
288
|
+
async queryPayrollPrograms(opts) {
|
|
289
|
+
return await this.payroll_programs.query(opts);
|
|
290
|
+
}
|
|
291
|
+
async insertOnePayrollProgram(opts) {
|
|
292
|
+
return await this.payroll_programs.insertOne(opts);
|
|
293
|
+
}
|
|
294
|
+
async findOnePayrollProgram(opts) {
|
|
295
|
+
return await this.payroll_programs.findOne(opts);
|
|
296
|
+
}
|
|
297
|
+
async replaceOnePayrollProgram(opts) {
|
|
298
|
+
return await this.payroll_programs.replaceOne(opts);
|
|
299
|
+
}
|
|
300
|
+
async deleteOnePayrollProgram(opts) {
|
|
301
|
+
return await this.payroll_programs.deleteOne(opts);
|
|
302
|
+
}
|
|
303
|
+
async deleteManyPayrollPrograms(opts) {
|
|
304
|
+
return await this.payroll_programs.deleteMany(opts);
|
|
305
|
+
}
|
|
306
|
+
async searchManyPayrollPrograms(opts) {
|
|
307
|
+
return await this.payroll_programs.searchMany(opts);
|
|
308
|
+
}
|
|
309
|
+
async generatePayroll(opts) {
|
|
310
|
+
const token = await requiredToken(this.get_token);
|
|
311
|
+
return await this.http.do({
|
|
312
|
+
base_url: this.base_url,
|
|
313
|
+
path: payrollPath(PathPayrollsGenerate),
|
|
314
|
+
method: HTTPMethodPost,
|
|
315
|
+
token,
|
|
316
|
+
body: opts,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
async generatePayrollFromPayables(opts) {
|
|
320
|
+
const token = await requiredToken(this.get_token);
|
|
321
|
+
return await this.http.do({
|
|
322
|
+
base_url: this.base_url,
|
|
323
|
+
path: payablePath(PathPayrollsToPayroll),
|
|
324
|
+
method: HTTPMethodPost,
|
|
325
|
+
token,
|
|
326
|
+
body: opts,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
async generatePayrollFromHourBanks(opts) {
|
|
330
|
+
const token = await requiredToken(this.get_token);
|
|
331
|
+
return await this.http.do({
|
|
332
|
+
base_url: this.base_url,
|
|
333
|
+
path: hourBankPath(PathPayrollsToPayroll),
|
|
334
|
+
method: HTTPMethodPost,
|
|
335
|
+
token,
|
|
336
|
+
body: opts,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
async aggregateAdjustments(opts) {
|
|
340
|
+
const token = await requiredToken(this.get_token);
|
|
341
|
+
return await this.http.do({
|
|
342
|
+
base_url: this.base_url,
|
|
343
|
+
path: adjustmentAggregatePath(PathPayrollsGenerate),
|
|
344
|
+
method: HTTPMethodPost,
|
|
345
|
+
token,
|
|
346
|
+
body: opts,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
export function newPayrollsClient(opts) {
|
|
351
|
+
return new PayrollsClient(opts);
|
|
352
|
+
}
|
|
353
|
+
function payrollPath(action) {
|
|
354
|
+
return buildPath({
|
|
355
|
+
svc: SvcPayrolls,
|
|
356
|
+
col: ColPayrollsPayrolls,
|
|
357
|
+
action,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
function payablePath(action) {
|
|
361
|
+
return buildPath({
|
|
362
|
+
svc: SvcPayrolls,
|
|
363
|
+
col: ColPayrollsPayables,
|
|
364
|
+
action,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
function hourBankPath(action) {
|
|
368
|
+
return buildPath({
|
|
369
|
+
svc: SvcPayrolls,
|
|
370
|
+
col: ColPayrollsHourBanks,
|
|
371
|
+
action,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
function adjustmentAggregatePath(action) {
|
|
375
|
+
return buildPath({
|
|
376
|
+
svc: SvcPayrolls,
|
|
377
|
+
col: ColPayrollsAdjustmentAggregates,
|
|
378
|
+
action,
|
|
379
|
+
});
|
|
380
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PLProcessesSpeechToText, type
|
|
1
|
+
import { type PLProcessesSpeechToText, type RPProcessesSpeechToText } from "@fabriktor/schema";
|
|
2
2
|
import type { TokenProvider } from "../core/auth.js";
|
|
3
3
|
import type { OperationResultOf } from "../core/crud.js";
|
|
4
4
|
import type { HTTPDoer } from "../core/http.js";
|
|
@@ -9,13 +9,13 @@ export type ProcessesClientOptions = {
|
|
|
9
9
|
get_token?: TokenProvider;
|
|
10
10
|
};
|
|
11
11
|
export interface ProcessesOperator {
|
|
12
|
-
speechToText(opts: SpeechToTextOptions): Promise<OperationResultOf<
|
|
12
|
+
speechToText(opts: SpeechToTextOptions): Promise<OperationResultOf<RPProcessesSpeechToText>>;
|
|
13
13
|
}
|
|
14
14
|
export declare class ProcessesClient implements ProcessesOperator {
|
|
15
15
|
private http;
|
|
16
16
|
private base_url;
|
|
17
17
|
private get_token?;
|
|
18
18
|
constructor(opts: ProcessesClientOptions);
|
|
19
|
-
speechToText(opts: SpeechToTextOptions): Promise<OperationResultOf<
|
|
19
|
+
speechToText(opts: SpeechToTextOptions): Promise<OperationResultOf<RPProcessesSpeechToText>>;
|
|
20
20
|
}
|
|
21
21
|
export declare function newProcessesClient(opts: ProcessesClientOptions): ProcessesClient;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type ClientAvailability, type InClientAvailability, type InRoute, type InRouteTeam, type InTag, type InTracking, type OperationResult, type PLRoutesAvailability, type PLRoutesDesignation, type Route, type RouteTeam, type RPRoutesAvailability, type Tag, type Tracking } from "@fabriktor/schema";
|
|
2
|
+
import type { TokenProvider } from "../core/auth.js";
|
|
3
|
+
import type { DeleteManyOptionsCRUD, DeleteOneOptionsCRUD, FindOneOptionsCRUD, InsertOneOptionsCRUD, OperationResultOf, QueryOptionsCRUD, ReplaceOneOptionsCRUD, SearchManyOptionsCRUD, SearchResultOf } from "../core/crud.js";
|
|
4
|
+
import type { HTTPDoer } from "../core/http.js";
|
|
5
|
+
export type GetAvailabilityOptions = PLRoutesAvailability;
|
|
6
|
+
export type GetDesignationOptions = PLRoutesDesignation;
|
|
7
|
+
export type RoutesClientOptions = {
|
|
8
|
+
http: HTTPDoer;
|
|
9
|
+
base_url: string;
|
|
10
|
+
get_token?: TokenProvider;
|
|
11
|
+
};
|
|
12
|
+
export interface RoutesOperator {
|
|
13
|
+
queryRoutes(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Route[]>>;
|
|
14
|
+
insertOneRoute(opts: InsertOneOptionsCRUD<InRoute>): Promise<OperationResult>;
|
|
15
|
+
findOneRoute(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Route>>;
|
|
16
|
+
replaceOneRoute(opts: ReplaceOneOptionsCRUD<InRoute>): Promise<OperationResult>;
|
|
17
|
+
deleteOneRoute(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
18
|
+
deleteManyRoutes(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
19
|
+
queryTags(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Tag[]>>;
|
|
20
|
+
insertOneTag(opts: InsertOneOptionsCRUD<InTag>): Promise<OperationResult>;
|
|
21
|
+
findOneTag(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Tag>>;
|
|
22
|
+
replaceOneTag(opts: ReplaceOneOptionsCRUD<InTag>): Promise<OperationResult>;
|
|
23
|
+
deleteOneTag(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
24
|
+
deleteManyTags(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
25
|
+
searchManyTags(opts?: SearchManyOptionsCRUD): Promise<OperationResultOf<SearchResultOf<Tag>>>;
|
|
26
|
+
queryClientAvailabilities(opts?: QueryOptionsCRUD): Promise<OperationResultOf<ClientAvailability[]>>;
|
|
27
|
+
insertOneClientAvailability(opts: InsertOneOptionsCRUD<InClientAvailability>): Promise<OperationResult>;
|
|
28
|
+
findOneClientAvailability(opts: FindOneOptionsCRUD): Promise<OperationResultOf<ClientAvailability>>;
|
|
29
|
+
replaceOneClientAvailability(opts: ReplaceOneOptionsCRUD<InClientAvailability>): Promise<OperationResult>;
|
|
30
|
+
deleteOneClientAvailability(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
31
|
+
deleteManyClientAvailabilities(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
32
|
+
queryTracking(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Tracking[]>>;
|
|
33
|
+
insertOneTracking(opts: InsertOneOptionsCRUD<InTracking>): Promise<OperationResult>;
|
|
34
|
+
findOneTracking(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Tracking>>;
|
|
35
|
+
replaceOneTracking(opts: ReplaceOneOptionsCRUD<InTracking>): Promise<OperationResult>;
|
|
36
|
+
deleteOneTracking(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
37
|
+
deleteManyTracking(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
38
|
+
queryRouteTeams(opts?: QueryOptionsCRUD): Promise<OperationResultOf<RouteTeam[]>>;
|
|
39
|
+
insertOneRouteTeam(opts: InsertOneOptionsCRUD<InRouteTeam>): Promise<OperationResult>;
|
|
40
|
+
findOneRouteTeam(opts: FindOneOptionsCRUD): Promise<OperationResultOf<RouteTeam>>;
|
|
41
|
+
replaceOneRouteTeam(opts: ReplaceOneOptionsCRUD<InRouteTeam>): Promise<OperationResult>;
|
|
42
|
+
deleteOneRouteTeam(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
43
|
+
deleteManyRouteTeams(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
44
|
+
searchManyRouteTeams(opts?: SearchManyOptionsCRUD): Promise<OperationResultOf<SearchResultOf<RouteTeam>>>;
|
|
45
|
+
getAvailability(opts: GetAvailabilityOptions): Promise<OperationResultOf<RPRoutesAvailability>>;
|
|
46
|
+
getDesignation(opts: GetDesignationOptions): Promise<OperationResultOf<Route[]>>;
|
|
47
|
+
}
|
|
48
|
+
export declare class RoutesClient implements RoutesOperator {
|
|
49
|
+
private routes;
|
|
50
|
+
private tags;
|
|
51
|
+
private client_availabilities;
|
|
52
|
+
private tracking;
|
|
53
|
+
private route_teams;
|
|
54
|
+
private http;
|
|
55
|
+
private base_url;
|
|
56
|
+
private get_token?;
|
|
57
|
+
constructor(opts: RoutesClientOptions);
|
|
58
|
+
queryRoutes(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Route[]>>;
|
|
59
|
+
insertOneRoute(opts: InsertOneOptionsCRUD<InRoute>): Promise<OperationResult>;
|
|
60
|
+
findOneRoute(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Route>>;
|
|
61
|
+
replaceOneRoute(opts: ReplaceOneOptionsCRUD<InRoute>): Promise<OperationResult>;
|
|
62
|
+
deleteOneRoute(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
63
|
+
deleteManyRoutes(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
64
|
+
queryTags(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Tag[]>>;
|
|
65
|
+
insertOneTag(opts: InsertOneOptionsCRUD<InTag>): Promise<OperationResult>;
|
|
66
|
+
findOneTag(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Tag>>;
|
|
67
|
+
replaceOneTag(opts: ReplaceOneOptionsCRUD<InTag>): Promise<OperationResult>;
|
|
68
|
+
deleteOneTag(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
69
|
+
deleteManyTags(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
70
|
+
searchManyTags(opts?: SearchManyOptionsCRUD): Promise<OperationResultOf<SearchResultOf<Tag>>>;
|
|
71
|
+
queryClientAvailabilities(opts?: QueryOptionsCRUD): Promise<OperationResultOf<ClientAvailability[]>>;
|
|
72
|
+
insertOneClientAvailability(opts: InsertOneOptionsCRUD<InClientAvailability>): Promise<OperationResult>;
|
|
73
|
+
findOneClientAvailability(opts: FindOneOptionsCRUD): Promise<OperationResultOf<ClientAvailability>>;
|
|
74
|
+
replaceOneClientAvailability(opts: ReplaceOneOptionsCRUD<InClientAvailability>): Promise<OperationResult>;
|
|
75
|
+
deleteOneClientAvailability(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
76
|
+
deleteManyClientAvailabilities(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
77
|
+
queryTracking(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Tracking[]>>;
|
|
78
|
+
insertOneTracking(opts: InsertOneOptionsCRUD<InTracking>): Promise<OperationResult>;
|
|
79
|
+
findOneTracking(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Tracking>>;
|
|
80
|
+
replaceOneTracking(opts: ReplaceOneOptionsCRUD<InTracking>): Promise<OperationResult>;
|
|
81
|
+
deleteOneTracking(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
82
|
+
deleteManyTracking(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
83
|
+
queryRouteTeams(opts?: QueryOptionsCRUD): Promise<OperationResultOf<RouteTeam[]>>;
|
|
84
|
+
insertOneRouteTeam(opts: InsertOneOptionsCRUD<InRouteTeam>): Promise<OperationResult>;
|
|
85
|
+
findOneRouteTeam(opts: FindOneOptionsCRUD): Promise<OperationResultOf<RouteTeam>>;
|
|
86
|
+
replaceOneRouteTeam(opts: ReplaceOneOptionsCRUD<InRouteTeam>): Promise<OperationResult>;
|
|
87
|
+
deleteOneRouteTeam(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
88
|
+
deleteManyRouteTeams(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
89
|
+
searchManyRouteTeams(opts?: SearchManyOptionsCRUD): Promise<OperationResultOf<SearchResultOf<RouteTeam>>>;
|
|
90
|
+
getAvailability(opts: GetAvailabilityOptions): Promise<OperationResultOf<RPRoutesAvailability>>;
|
|
91
|
+
getDesignation(opts: GetDesignationOptions): Promise<OperationResultOf<Route[]>>;
|
|
92
|
+
}
|
|
93
|
+
export declare function newRoutesClient(opts: RoutesClientOptions): RoutesClient;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// Copyright (C) Fabriktor, Inc. 2025-present.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
|
+
// not use this file except in compliance with the License. You may obtain
|
|
5
|
+
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
import { ColRoutesClientAvailabilities, ColRoutesRouteTeams, ColRoutesRoutes, ColRoutesTags, ColRoutesTracking, HTTPMethodPost, PathRoutesGetAvailability, PathRoutesGetDesignation, SvcRoutes, } from "@fabriktor/schema";
|
|
7
|
+
import { requiredToken } from "../core/auth.js";
|
|
8
|
+
import { newCRUDClient } from "../core/crud.js";
|
|
9
|
+
import { buildPath } from "../core/path.js";
|
|
10
|
+
export class RoutesClient {
|
|
11
|
+
routes;
|
|
12
|
+
tags;
|
|
13
|
+
client_availabilities;
|
|
14
|
+
tracking;
|
|
15
|
+
route_teams;
|
|
16
|
+
http;
|
|
17
|
+
base_url;
|
|
18
|
+
get_token;
|
|
19
|
+
constructor(opts) {
|
|
20
|
+
this.routes = newCRUDClient({
|
|
21
|
+
http: opts.http,
|
|
22
|
+
base_url: opts.base_url,
|
|
23
|
+
svc: SvcRoutes,
|
|
24
|
+
col: ColRoutesRoutes,
|
|
25
|
+
get_token: opts.get_token,
|
|
26
|
+
});
|
|
27
|
+
this.tags = newCRUDClient({
|
|
28
|
+
http: opts.http,
|
|
29
|
+
base_url: opts.base_url,
|
|
30
|
+
svc: SvcRoutes,
|
|
31
|
+
col: ColRoutesTags,
|
|
32
|
+
get_token: opts.get_token,
|
|
33
|
+
});
|
|
34
|
+
this.client_availabilities = newCRUDClient({
|
|
35
|
+
http: opts.http,
|
|
36
|
+
base_url: opts.base_url,
|
|
37
|
+
svc: SvcRoutes,
|
|
38
|
+
col: ColRoutesClientAvailabilities,
|
|
39
|
+
get_token: opts.get_token,
|
|
40
|
+
});
|
|
41
|
+
this.tracking = newCRUDClient({
|
|
42
|
+
http: opts.http,
|
|
43
|
+
base_url: opts.base_url,
|
|
44
|
+
svc: SvcRoutes,
|
|
45
|
+
col: ColRoutesTracking,
|
|
46
|
+
get_token: opts.get_token,
|
|
47
|
+
});
|
|
48
|
+
this.route_teams = newCRUDClient({
|
|
49
|
+
http: opts.http,
|
|
50
|
+
base_url: opts.base_url,
|
|
51
|
+
svc: SvcRoutes,
|
|
52
|
+
col: ColRoutesRouteTeams,
|
|
53
|
+
get_token: opts.get_token,
|
|
54
|
+
});
|
|
55
|
+
this.http = opts.http;
|
|
56
|
+
this.base_url = opts.base_url;
|
|
57
|
+
this.get_token = opts.get_token;
|
|
58
|
+
}
|
|
59
|
+
async queryRoutes(opts) {
|
|
60
|
+
return await this.routes.query(opts);
|
|
61
|
+
}
|
|
62
|
+
async insertOneRoute(opts) {
|
|
63
|
+
return await this.routes.insertOne(opts);
|
|
64
|
+
}
|
|
65
|
+
async findOneRoute(opts) {
|
|
66
|
+
return await this.routes.findOne(opts);
|
|
67
|
+
}
|
|
68
|
+
async replaceOneRoute(opts) {
|
|
69
|
+
return await this.routes.replaceOne(opts);
|
|
70
|
+
}
|
|
71
|
+
async deleteOneRoute(opts) {
|
|
72
|
+
return await this.routes.deleteOne(opts);
|
|
73
|
+
}
|
|
74
|
+
async deleteManyRoutes(opts) {
|
|
75
|
+
return await this.routes.deleteMany(opts);
|
|
76
|
+
}
|
|
77
|
+
async queryTags(opts) {
|
|
78
|
+
return await this.tags.query(opts);
|
|
79
|
+
}
|
|
80
|
+
async insertOneTag(opts) {
|
|
81
|
+
return await this.tags.insertOne(opts);
|
|
82
|
+
}
|
|
83
|
+
async findOneTag(opts) {
|
|
84
|
+
return await this.tags.findOne(opts);
|
|
85
|
+
}
|
|
86
|
+
async replaceOneTag(opts) {
|
|
87
|
+
return await this.tags.replaceOne(opts);
|
|
88
|
+
}
|
|
89
|
+
async deleteOneTag(opts) {
|
|
90
|
+
return await this.tags.deleteOne(opts);
|
|
91
|
+
}
|
|
92
|
+
async deleteManyTags(opts) {
|
|
93
|
+
return await this.tags.deleteMany(opts);
|
|
94
|
+
}
|
|
95
|
+
async searchManyTags(opts) {
|
|
96
|
+
return await this.tags.searchMany(opts);
|
|
97
|
+
}
|
|
98
|
+
async queryClientAvailabilities(opts) {
|
|
99
|
+
return await this.client_availabilities.query(opts);
|
|
100
|
+
}
|
|
101
|
+
async insertOneClientAvailability(opts) {
|
|
102
|
+
return await this.client_availabilities.insertOne(opts);
|
|
103
|
+
}
|
|
104
|
+
async findOneClientAvailability(opts) {
|
|
105
|
+
return await this.client_availabilities.findOne(opts);
|
|
106
|
+
}
|
|
107
|
+
async replaceOneClientAvailability(opts) {
|
|
108
|
+
return await this.client_availabilities.replaceOne(opts);
|
|
109
|
+
}
|
|
110
|
+
async deleteOneClientAvailability(opts) {
|
|
111
|
+
return await this.client_availabilities.deleteOne(opts);
|
|
112
|
+
}
|
|
113
|
+
async deleteManyClientAvailabilities(opts) {
|
|
114
|
+
return await this.client_availabilities.deleteMany(opts);
|
|
115
|
+
}
|
|
116
|
+
async queryTracking(opts) {
|
|
117
|
+
return await this.tracking.query(opts);
|
|
118
|
+
}
|
|
119
|
+
async insertOneTracking(opts) {
|
|
120
|
+
return await this.tracking.insertOne(opts);
|
|
121
|
+
}
|
|
122
|
+
async findOneTracking(opts) {
|
|
123
|
+
return await this.tracking.findOne(opts);
|
|
124
|
+
}
|
|
125
|
+
async replaceOneTracking(opts) {
|
|
126
|
+
return await this.tracking.replaceOne(opts);
|
|
127
|
+
}
|
|
128
|
+
async deleteOneTracking(opts) {
|
|
129
|
+
return await this.tracking.deleteOne(opts);
|
|
130
|
+
}
|
|
131
|
+
async deleteManyTracking(opts) {
|
|
132
|
+
return await this.tracking.deleteMany(opts);
|
|
133
|
+
}
|
|
134
|
+
async queryRouteTeams(opts) {
|
|
135
|
+
return await this.route_teams.query(opts);
|
|
136
|
+
}
|
|
137
|
+
async insertOneRouteTeam(opts) {
|
|
138
|
+
return await this.route_teams.insertOne(opts);
|
|
139
|
+
}
|
|
140
|
+
async findOneRouteTeam(opts) {
|
|
141
|
+
return await this.route_teams.findOne(opts);
|
|
142
|
+
}
|
|
143
|
+
async replaceOneRouteTeam(opts) {
|
|
144
|
+
return await this.route_teams.replaceOne(opts);
|
|
145
|
+
}
|
|
146
|
+
async deleteOneRouteTeam(opts) {
|
|
147
|
+
return await this.route_teams.deleteOne(opts);
|
|
148
|
+
}
|
|
149
|
+
async deleteManyRouteTeams(opts) {
|
|
150
|
+
return await this.route_teams.deleteMany(opts);
|
|
151
|
+
}
|
|
152
|
+
async searchManyRouteTeams(opts) {
|
|
153
|
+
return await this.route_teams.searchMany(opts);
|
|
154
|
+
}
|
|
155
|
+
async getAvailability(opts) {
|
|
156
|
+
const token = await requiredToken(this.get_token);
|
|
157
|
+
return await this.http.do({
|
|
158
|
+
base_url: this.base_url,
|
|
159
|
+
path: routePath(PathRoutesGetAvailability),
|
|
160
|
+
method: HTTPMethodPost,
|
|
161
|
+
token,
|
|
162
|
+
body: opts,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
async getDesignation(opts) {
|
|
166
|
+
const token = await requiredToken(this.get_token);
|
|
167
|
+
return await this.http.do({
|
|
168
|
+
base_url: this.base_url,
|
|
169
|
+
path: routePath(PathRoutesGetDesignation),
|
|
170
|
+
method: HTTPMethodPost,
|
|
171
|
+
token,
|
|
172
|
+
body: opts,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
export function newRoutesClient(opts) {
|
|
177
|
+
return new RoutesClient(opts);
|
|
178
|
+
}
|
|
179
|
+
function routePath(action) {
|
|
180
|
+
return buildPath({
|
|
181
|
+
svc: SvcRoutes,
|
|
182
|
+
col: ColRoutesRoutes,
|
|
183
|
+
action,
|
|
184
|
+
});
|
|
185
|
+
}
|