@fabriktor/fx 0.0.69 → 0.0.71

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.
@@ -3,10 +3,9 @@
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 { OwnerIDKey, } from "@fabriktor/schema";
7
6
  import { errResolveFailed } from "../core/err.js";
8
7
  import { requiredOperationID } from "../core/id.js";
9
- import { runSearch } from "../core/search.js";
8
+ import { runOwnerSearch, } from "../core/search.js";
10
9
  const resourcePayable = "payable";
11
10
  const msgCreatedPayableIDMissing = "Created payable response did not contain an ID.";
12
11
  const msgPayableMissing = "Payable could not be resolved after the mutation.";
@@ -52,14 +51,9 @@ export class PayrollsFX {
52
51
  return await this.findPayable(opts.id);
53
52
  }
54
53
  async searchPayables(opts) {
55
- return await runSearch({
54
+ return await runOwnerSearch({
55
+ ...opts,
56
56
  search: (searchOpts) => this.payrolls.searchManyPayables(searchOpts),
57
- query: {
58
- [OwnerIDKey]: opts.owner_id,
59
- },
60
- q: opts.q,
61
- page: opts.page,
62
- per_page: opts.per_page,
63
57
  });
64
58
  }
65
59
  async createPayroll(opts) {
@@ -72,14 +66,9 @@ export class PayrollsFX {
72
66
  return await this.findPayroll(opts.id);
73
67
  }
74
68
  async searchPayrolls(opts) {
75
- return await runSearch({
69
+ return await runOwnerSearch({
70
+ ...opts,
76
71
  search: (searchOpts) => this.payrolls.searchManyPayrolls(searchOpts),
77
- query: {
78
- [OwnerIDKey]: opts.owner_id,
79
- },
80
- q: opts.q,
81
- page: opts.page,
82
- per_page: opts.per_page,
83
72
  });
84
73
  }
85
74
  async createPayConfig(opts) {
@@ -92,14 +81,9 @@ export class PayrollsFX {
92
81
  return await this.findPayConfig(opts.id);
93
82
  }
94
83
  async searchPayConfigs(opts) {
95
- return await runSearch({
84
+ return await runOwnerSearch({
85
+ ...opts,
96
86
  search: (searchOpts) => this.payrolls.searchManyPayConfigs(searchOpts),
97
- query: {
98
- [OwnerIDKey]: opts.owner_id,
99
- },
100
- q: opts.q,
101
- page: opts.page,
102
- per_page: opts.per_page,
103
87
  });
104
88
  }
105
89
  async createHourBank(opts) {
@@ -112,14 +96,9 @@ export class PayrollsFX {
112
96
  return await this.findHourBank(opts.id);
113
97
  }
114
98
  async searchHourBanks(opts) {
115
- return await runSearch({
99
+ return await runOwnerSearch({
100
+ ...opts,
116
101
  search: (searchOpts) => this.payrolls.searchManyHourBanks(searchOpts),
117
- query: {
118
- [OwnerIDKey]: opts.owner_id,
119
- },
120
- q: opts.q,
121
- page: opts.page,
122
- per_page: opts.per_page,
123
102
  });
124
103
  }
125
104
  async createAdjustment(opts) {
@@ -132,14 +111,9 @@ export class PayrollsFX {
132
111
  return await this.findAdjustment(opts.id);
133
112
  }
134
113
  async searchAdjustments(opts) {
135
- return await runSearch({
114
+ return await runOwnerSearch({
115
+ ...opts,
136
116
  search: (searchOpts) => this.payrolls.searchManyAdjustments(searchOpts),
137
- query: {
138
- [OwnerIDKey]: opts.owner_id,
139
- },
140
- q: opts.q,
141
- page: opts.page,
142
- per_page: opts.per_page,
143
117
  });
144
118
  }
145
119
  async createAdjustmentFolder(opts) {
@@ -152,14 +126,9 @@ export class PayrollsFX {
152
126
  return await this.findAdjustmentFolder(opts.id);
153
127
  }
154
128
  async searchAdjustmentFolders(opts) {
155
- return await runSearch({
129
+ return await runOwnerSearch({
130
+ ...opts,
156
131
  search: (searchOpts) => this.payrolls.searchManyAdjustmentFolders(searchOpts),
157
- query: {
158
- [OwnerIDKey]: opts.owner_id,
159
- },
160
- q: opts.q,
161
- page: opts.page,
162
- per_page: opts.per_page,
163
132
  });
164
133
  }
165
134
  async createAdjustmentRecord(opts) {
@@ -172,14 +141,9 @@ export class PayrollsFX {
172
141
  return await this.findAdjustmentRecord(opts.id);
173
142
  }
174
143
  async searchAdjustmentRecords(opts) {
175
- return await runSearch({
144
+ return await runOwnerSearch({
145
+ ...opts,
176
146
  search: (searchOpts) => this.payrolls.searchManyAdjustmentRecords(searchOpts),
177
- query: {
178
- [OwnerIDKey]: opts.owner_id,
179
- },
180
- q: opts.q,
181
- page: opts.page,
182
- per_page: opts.per_page,
183
147
  });
184
148
  }
185
149
  async createAdjustmentAggregate(opts) {
@@ -192,14 +156,9 @@ export class PayrollsFX {
192
156
  return await this.findAdjustmentAggregate(opts.id);
193
157
  }
194
158
  async searchAdjustmentAggregates(opts) {
195
- return await runSearch({
159
+ return await runOwnerSearch({
160
+ ...opts,
196
161
  search: (searchOpts) => this.payrolls.searchManyAdjustmentAggregates(searchOpts),
197
- query: {
198
- [OwnerIDKey]: opts.owner_id,
199
- },
200
- q: opts.q,
201
- page: opts.page,
202
- per_page: opts.per_page,
203
162
  });
204
163
  }
205
164
  async createEmployeePayConfig(opts) {
@@ -212,14 +171,9 @@ export class PayrollsFX {
212
171
  return await this.findEmployeePayConfig(opts.id);
213
172
  }
214
173
  async searchEmployeePayConfigs(opts) {
215
- return await runSearch({
174
+ return await runOwnerSearch({
175
+ ...opts,
216
176
  search: (searchOpts) => this.payrolls.searchManyEmployeePayConfigs(searchOpts),
217
- query: {
218
- [OwnerIDKey]: opts.owner_id,
219
- },
220
- q: opts.q,
221
- page: opts.page,
222
- per_page: opts.per_page,
223
177
  });
224
178
  }
225
179
  async createPayrollProgram(opts) {
@@ -232,14 +186,9 @@ export class PayrollsFX {
232
186
  return await this.findPayrollProgram(opts.id);
233
187
  }
234
188
  async searchPayrollPrograms(opts) {
235
- return await runSearch({
189
+ return await runOwnerSearch({
190
+ ...opts,
236
191
  search: (searchOpts) => this.payrolls.searchManyPayrollPrograms(searchOpts),
237
- query: {
238
- [OwnerIDKey]: opts.owner_id,
239
- },
240
- q: opts.q,
241
- page: opts.page,
242
- per_page: opts.per_page,
243
192
  });
244
193
  }
245
194
  async setAdjustmentArchived(opts) {
@@ -1,6 +1,6 @@
1
1
  import type { RoutesOperator } from "@fabriktor/client";
2
- import { type ClientAvailability, type Route, type RouteTeam, type Tag, type Tracking } from "@fabriktor/schema";
3
- import { type SearchPage } from "../core/search.js";
2
+ import type { ClientAvailability, Route, RouteTeam, Tag, Tracking } from "@fabriktor/schema";
3
+ import { type OwnerSearchOptions, type SearchPage } from "../core/search.js";
4
4
  type RouteInsertOptions = Parameters<RoutesOperator["insertOneRoute"]>[0];
5
5
  type RouteReplaceOptions = Parameters<RoutesOperator["replaceOneRoute"]>[0];
6
6
  type TagInsertOptions = Parameters<RoutesOperator["insertOneTag"]>[0];
@@ -13,12 +13,6 @@ type RouteTeamInsertOptions = Parameters<RoutesOperator["insertOneRouteTeam"]>[0
13
13
  type RouteTeamReplaceOptions = Parameters<RoutesOperator["replaceOneRouteTeam"]>[0];
14
14
  type RouteInsert = RouteInsertOptions["in"];
15
15
  type RouteAvailability = NonNullable<Awaited<ReturnType<RoutesOperator["getAvailability"]>>["value"]>;
16
- type SearchRouteRecordsOptions = {
17
- owner_id: string;
18
- q?: string;
19
- page?: number;
20
- per_page?: number;
21
- };
22
16
  export type CreateRouteOptions = {
23
17
  in: RouteInsert;
24
18
  availability: RouteAvailability;
@@ -28,7 +22,7 @@ export type CreateRouteResult = CreateValidatedRouteResult;
28
22
  export type ReplaceRouteOptions = RouteReplaceOptions;
29
23
  export type CreateTagOptions = TagInsertOptions;
30
24
  export type ReplaceTagOptions = TagReplaceOptions;
31
- export type SearchTagsOptions = SearchRouteRecordsOptions;
25
+ export type SearchTagsOptions = OwnerSearchOptions;
32
26
  export type SearchTagsPage = SearchPage<Tag>;
33
27
  export type CreateClientAvailabilityOptions = ClientAvailabilityInsertOptions;
34
28
  export type ReplaceClientAvailabilityOptions = ClientAvailabilityReplaceOptions;
@@ -36,7 +30,7 @@ export type CreateTrackingOptions = TrackingInsertOptions;
36
30
  export type ReplaceTrackingOptions = TrackingReplaceOptions;
37
31
  export type CreateRouteTeamOptions = RouteTeamInsertOptions;
38
32
  export type ReplaceRouteTeamOptions = RouteTeamReplaceOptions;
39
- export type SearchRouteTeamsOptions = SearchRouteRecordsOptions;
33
+ export type SearchRouteTeamsOptions = OwnerSearchOptions;
40
34
  export type SearchRouteTeamsPage = SearchPage<RouteTeam>;
41
35
  export type RoutesFXOptions = {
42
36
  routes: RoutesOperator;
@@ -3,10 +3,9 @@
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 { OwnerIDKey, } from "@fabriktor/schema";
7
6
  import { errResolveFailed, errValidation } from "../core/err.js";
8
7
  import { requiredOperationID } from "../core/id.js";
9
- import { runSearch } from "../core/search.js";
8
+ import { runOwnerSearch, } from "../core/search.js";
10
9
  const maxHour = 23;
11
10
  const maxMinute = 59;
12
11
  const maxMinuteOfDay = 1440;
@@ -63,14 +62,9 @@ export class RoutesFX {
63
62
  return await this.findTag(opts.id);
64
63
  }
65
64
  async searchTags(opts) {
66
- return await runSearch({
65
+ return await runOwnerSearch({
66
+ ...opts,
67
67
  search: (searchOpts) => this.routes.searchManyTags(searchOpts),
68
- query: {
69
- [OwnerIDKey]: opts.owner_id,
70
- },
71
- q: opts.q,
72
- page: opts.page,
73
- per_page: opts.per_page,
74
68
  });
75
69
  }
76
70
  async createClientAvailability(opts) {
@@ -101,14 +95,9 @@ export class RoutesFX {
101
95
  return await this.findRouteTeam(opts.id);
102
96
  }
103
97
  async searchRouteTeams(opts) {
104
- return await runSearch({
98
+ return await runOwnerSearch({
99
+ ...opts,
105
100
  search: (searchOpts) => this.routes.searchManyRouteTeams(searchOpts),
106
- query: {
107
- [OwnerIDKey]: opts.owner_id,
108
- },
109
- q: opts.q,
110
- page: opts.page,
111
- per_page: opts.per_page,
112
101
  });
113
102
  }
114
103
  async findRoute(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/fx",
3
- "version": "0.0.69",
3
+ "version": "0.0.71",
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.63",
21
- "@fabriktor/schema": "0.0.45"
20
+ "@fabriktor/client": "0.0.64",
21
+ "@fabriktor/schema": "0.0.46"
22
22
  }
23
23
  }