@fabriktor/fx 0.0.88 → 0.0.89

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.
@@ -253,6 +253,7 @@ export declare class BillableFX implements BillableFXOperator {
253
253
  vendorInvoiceFromBill(opts: VendorInvoiceFromBillOptions): Promise<VendorInvoice>;
254
254
  private generateBill;
255
255
  private checkVendorInvoiceNumber;
256
+ private searchReadableActivity;
256
257
  private searchReadable;
257
258
  private findBill;
258
259
  private findBillableFolder;
@@ -140,13 +140,8 @@ export class BillableFX {
140
140
  });
141
141
  }
142
142
  async searchReadableCharges(opts) {
143
- const employer_scope_ids = activityEmployerScopeIDs(opts);
144
- return await this.searchReadable({
143
+ return await this.searchReadableActivity({
145
144
  ...opts,
146
- allowed_owner_ids: activityOwnerIDs(opts.context),
147
- filter: employer_scope_ids === undefined
148
- ? undefined
149
- : (charge) => employer_scope_ids.has(charge.employer_id),
150
145
  search: (searchOpts) => this.billable.searchManyCharges(searchOpts),
151
146
  });
152
147
  }
@@ -236,21 +231,8 @@ export class BillableFX {
236
231
  });
237
232
  }
238
233
  async searchReadableMeterReadings(opts) {
239
- const employer_scope_ids = activityEmployerScopeIDs(opts);
240
- const equipment_owners = new Map();
241
- return await this.searchReadable({
234
+ return await this.searchReadableActivity({
242
235
  ...opts,
243
- allowed_owner_ids: activityOwnerIDs(opts.context),
244
- filter: employer_scope_ids === undefined
245
- ? undefined
246
- : async (reading) => {
247
- let owner = equipment_owners.get(reading.equipment_id);
248
- if (owner === undefined) {
249
- owner = this.findEquipment(reading.equipment_id).then((equipment) => equipment.owner_id);
250
- equipment_owners.set(reading.equipment_id, owner);
251
- }
252
- return employer_scope_ids.has(await owner);
253
- },
254
236
  search: (searchOpts) => this.billable.searchManyMeterReadings(searchOpts),
255
237
  });
256
238
  }
@@ -415,6 +397,16 @@ export class BillableFX {
415
397
  },
416
398
  });
417
399
  }
400
+ async searchReadableActivity(opts) {
401
+ const employer_scope_ids = activityEmployerScopeIDs(opts);
402
+ return await this.searchReadable({
403
+ ...opts,
404
+ allowed_owner_ids: activityOwnerIDs(opts.context),
405
+ filter: employer_scope_ids === undefined
406
+ ? undefined
407
+ : (value) => employer_scope_ids.has(value.employer_id),
408
+ });
409
+ }
418
410
  async searchReadable(opts) {
419
411
  const { context: _context, owner_ids: requested_owner_ids, employer_scope_ids: _employer_scope_ids, allowed_owner_ids, search, filter, query, ...searchOpts } = opts;
420
412
  const owner_ids = restrictOwnerIDs(allowed_owner_ids, requested_owner_ids);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/fx",
3
- "version": "0.0.88",
3
+ "version": "0.0.89",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/client": "0.0.73",
21
- "@fabriktor/schema": "0.0.56"
20
+ "@fabriktor/client": "0.0.74",
21
+ "@fabriktor/schema": "0.0.57"
22
22
  }
23
23
  }