@fabriktor/client 0.0.74 → 0.0.76
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.
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type Bill, type BillableFolder, type Charge, type Equipment, type InBill, type InBillableFolder, type InCharge, type InEquipment, type InItem, type InLaborRate, type InMeterReading, type InQuantifier, type InTax, type InTmpBillNumber, type InVendorInvoice, type InWarehouse, type Item, type LaborRate, type MeterReading, type OperationResult, type PLBillableAcceptFixedEstimate, type PLBillablePeriodsFromDates, type PLBillableSetItemQuantity, type PLBillableVendorInvoiceFromBill, type PLBillableYearSpan, type Quantifier, type RPBillablePeriodsFromDates, type Tax, type TmpBillNumber, type VendorInvoice, type Warehouse, type YearSpan } from "@fabriktor/schema";
|
|
1
|
+
import { type Bill, type BillableFolder, type Charge, type Equipment, type InBill, type InBillableFolder, type InCharge, type InEquipment, type InItem, type InLaborRate, type InMeterReading, type InQuantifier, type InTax, type InTmpBillNumber, type InVendorInvoice, type InWarehouse, type Item, type LaborRate, type MeterReading, type OperationResult, type PLBillableAcceptFixedEstimate, type PLBillableBillAction, type PLBillablePeriodsFromDates, type PLBillableSetItemQuantity, type PLBillableVendorInvoiceFromBill, type PLBillableYearSpan, type Quantifier, type RPBillablePeriodsFromDates, type Tax, type TmpBillNumber, type VendorInvoice, type Warehouse, type YearSpan } from "@fabriktor/schema";
|
|
2
2
|
import type { TokenProvider } from "../core/auth.js";
|
|
3
3
|
import type { DeleteOneOptionsCRUD, FindOneOptionsCRUD, InsertOneOptionsCRUD, OperationResultOf, QueryOptionsCRUD, ReplaceOneOptionsCRUD, SearchManyOptionsCRUD, SearchResultOf } from "../core/crud.js";
|
|
4
4
|
import type { HTTPDoer } from "../core/http.js";
|
|
5
5
|
import type { CompletePayload } from "../core/type.js";
|
|
6
6
|
export type GenerateBillOptions = CompletePayload<InBill>;
|
|
7
7
|
export type AcceptFixedEstimateOptions = CompletePayload<PLBillableAcceptFixedEstimate>;
|
|
8
|
+
export type BillActionOptions = CompletePayload<PLBillableBillAction>;
|
|
8
9
|
export type YearSpanOptions = CompletePayload<PLBillableYearSpan>;
|
|
9
10
|
export type PeriodsFromDatesOptions = CompletePayload<PLBillablePeriodsFromDates>;
|
|
10
11
|
export type VendorInvoiceFromBillOptions = CompletePayload<PLBillableVendorInvoiceFromBill>;
|
|
@@ -16,10 +17,10 @@ export type BillableClientOptions = {
|
|
|
16
17
|
};
|
|
17
18
|
export interface BillableOperator {
|
|
18
19
|
queryBills(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Bill[]>>;
|
|
19
|
-
insertOneBill(opts: InsertOneOptionsCRUD<InBill>): Promise<OperationResult>;
|
|
20
20
|
findOneBill(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Bill>>;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
completeBill(opts: BillActionOptions): Promise<OperationResult>;
|
|
22
|
+
cancelBill(opts: BillActionOptions): Promise<OperationResult>;
|
|
23
|
+
retryBillReport(opts: BillActionOptions): Promise<OperationResult>;
|
|
23
24
|
searchManyBills(opts?: SearchManyOptionsCRUD): Promise<OperationResultOf<SearchResultOf<Bill>>>;
|
|
24
25
|
queryBillableFolders(opts?: QueryOptionsCRUD): Promise<OperationResultOf<BillableFolder[]>>;
|
|
25
26
|
insertOneBillableFolder(opts: InsertOneOptionsCRUD<InBillableFolder>): Promise<OperationResult>;
|
|
@@ -112,10 +113,7 @@ export declare class BillableClient implements BillableOperator {
|
|
|
112
113
|
private get_token?;
|
|
113
114
|
constructor(opts: BillableClientOptions);
|
|
114
115
|
queryBills(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Bill[]>>;
|
|
115
|
-
insertOneBill(opts: InsertOneOptionsCRUD<InBill>): Promise<OperationResult>;
|
|
116
116
|
findOneBill(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Bill>>;
|
|
117
|
-
replaceOneBill(opts: ReplaceOneOptionsCRUD<InBill>): Promise<OperationResult>;
|
|
118
|
-
deleteOneBill(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
119
117
|
searchManyBills(opts?: SearchManyOptionsCRUD): Promise<OperationResultOf<SearchResultOf<Bill>>>;
|
|
120
118
|
queryBillableFolders(opts?: QueryOptionsCRUD): Promise<OperationResultOf<BillableFolder[]>>;
|
|
121
119
|
insertOneBillableFolder(opts: InsertOneOptionsCRUD<InBillableFolder>): Promise<OperationResult>;
|
|
@@ -185,6 +183,10 @@ export declare class BillableClient implements BillableOperator {
|
|
|
185
183
|
searchManyWarehouses(opts?: SearchManyOptionsCRUD): Promise<OperationResultOf<SearchResultOf<Warehouse>>>;
|
|
186
184
|
generateBill(opts: GenerateBillOptions): Promise<OperationResult>;
|
|
187
185
|
acceptFixedEstimate(opts: AcceptFixedEstimateOptions): Promise<OperationResult>;
|
|
186
|
+
completeBill(opts: BillActionOptions): Promise<OperationResult>;
|
|
187
|
+
cancelBill(opts: BillActionOptions): Promise<OperationResult>;
|
|
188
|
+
retryBillReport(opts: BillActionOptions): Promise<OperationResult>;
|
|
189
|
+
private billAction;
|
|
188
190
|
yearSpan(opts: YearSpanOptions): Promise<OperationResultOf<YearSpan>>;
|
|
189
191
|
periodsFromDates(opts: PeriodsFromDatesOptions): Promise<OperationResultOf<RPBillablePeriodsFromDates>>;
|
|
190
192
|
vendorInvoiceFromBill(opts: VendorInvoiceFromBillOptions): Promise<OperationResult>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
4
|
// not use this file except in compliance with the License. You may obtain
|
|
5
5
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
import { ColBillableBills, ColBillableCharges, ColBillableEquipments, ColBillableFolders, ColBillableItems, ColBillableLaborRates, ColBillableMeterReadings, ColBillableQuantifiers, ColBillableTaxes, ColBillableTmpBillNumbers, ColBillableVendorInvoices, ColBillableWarehouses, HTTPMethodPost, PathBillableAcceptFixedEstimate, PathBillableFromBill, PathBillableGenerate, PathBillablePeriodsFromDates, PathBillableSetQuantity, PathBillableYearSpan, SvcBillable, } from "@fabriktor/schema";
|
|
6
|
+
import { ColBillableBills, ColBillableCharges, ColBillableEquipments, ColBillableFolders, ColBillableItems, ColBillableLaborRates, ColBillableMeterReadings, ColBillableQuantifiers, ColBillableTaxes, ColBillableTmpBillNumbers, ColBillableVendorInvoices, ColBillableWarehouses, HTTPMethodPost, PathBillableAcceptFixedEstimate, PathBillableCompleteBill, PathBillableCancelBill, PathBillableRetryBillReport, PathBillableFromBill, PathBillableGenerate, PathBillablePeriodsFromDates, PathBillableSetQuantity, PathBillableYearSpan, SvcBillable, } from "@fabriktor/schema";
|
|
7
7
|
import { requiredToken } from "../core/auth.js";
|
|
8
8
|
import { newCRUDClient } from "../core/crud.js";
|
|
9
9
|
import { buildPath } from "../core/path.js";
|
|
@@ -115,18 +115,9 @@ export class BillableClient {
|
|
|
115
115
|
async queryBills(opts) {
|
|
116
116
|
return await this.bills.query(opts);
|
|
117
117
|
}
|
|
118
|
-
async insertOneBill(opts) {
|
|
119
|
-
return await this.bills.insertOne(opts);
|
|
120
|
-
}
|
|
121
118
|
async findOneBill(opts) {
|
|
122
119
|
return await this.bills.findOne(opts);
|
|
123
120
|
}
|
|
124
|
-
async replaceOneBill(opts) {
|
|
125
|
-
return await this.bills.replaceOne(opts);
|
|
126
|
-
}
|
|
127
|
-
async deleteOneBill(opts) {
|
|
128
|
-
return await this.bills.deleteOne(opts);
|
|
129
|
-
}
|
|
130
121
|
async searchManyBills(opts) {
|
|
131
122
|
return await this.bills.searchMany(opts);
|
|
132
123
|
}
|
|
@@ -348,6 +339,25 @@ export class BillableClient {
|
|
|
348
339
|
body: opts,
|
|
349
340
|
});
|
|
350
341
|
}
|
|
342
|
+
async completeBill(opts) {
|
|
343
|
+
return await this.billAction(PathBillableCompleteBill, opts);
|
|
344
|
+
}
|
|
345
|
+
async cancelBill(opts) {
|
|
346
|
+
return await this.billAction(PathBillableCancelBill, opts);
|
|
347
|
+
}
|
|
348
|
+
async retryBillReport(opts) {
|
|
349
|
+
return await this.billAction(PathBillableRetryBillReport, opts);
|
|
350
|
+
}
|
|
351
|
+
async billAction(path, opts) {
|
|
352
|
+
const token = await requiredToken(this.get_token);
|
|
353
|
+
return await this.http.do({
|
|
354
|
+
base_url: this.base_url,
|
|
355
|
+
path: billPath(path),
|
|
356
|
+
method: HTTPMethodPost,
|
|
357
|
+
token,
|
|
358
|
+
body: opts,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
351
361
|
async yearSpan(opts) {
|
|
352
362
|
const token = await requiredToken(this.get_token);
|
|
353
363
|
return await this.http.do({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabriktor/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"typescript": "^6.0.3"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@fabriktor/schema": "0.0.
|
|
20
|
+
"@fabriktor/schema": "0.0.59"
|
|
21
21
|
}
|
|
22
22
|
}
|