@fabriktor/client 0.0.33 → 0.0.35
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 +1 -25
- package/dist/src/billable/billable.js +0 -36
- package/dist/src/calls/calls.d.ts +1 -3
- package/dist/src/calls/calls.js +0 -3
- package/dist/src/chat/chat.d.ts +6 -23
- package/dist/src/chat/chat.js +2 -34
- package/dist/src/core/crud.d.ts +0 -5
- package/dist/src/core/crud.js +0 -14
- package/dist/src/core/err.d.ts +6 -0
- package/dist/src/core/err.js +8 -0
- package/dist/src/feed/feed.d.ts +1 -7
- package/dist/src/feed/feed.js +0 -9
- package/dist/src/fulfillments/fulfillments.d.ts +1 -3
- package/dist/src/fulfillments/fulfillments.js +0 -3
- package/dist/src/jobs/jobs.d.ts +1 -7
- package/dist/src/jobs/jobs.js +0 -9
- package/dist/src/marketplace/marketplace.d.ts +1 -5
- package/dist/src/marketplace/marketplace.js +0 -6
- package/dist/src/memos/memos.d.ts +1 -5
- package/dist/src/memos/memos.js +0 -6
- package/dist/src/payments/payments.d.ts +1 -17
- package/dist/src/payments/payments.js +0 -24
- package/dist/src/payrolls/payrolls.d.ts +1 -21
- package/dist/src/payrolls/payrolls.js +0 -30
- package/dist/src/preferences/preferences.d.ts +1 -19
- package/dist/src/preferences/preferences.js +0 -27
- package/dist/src/privacy/privacy.d.ts +1 -5
- package/dist/src/privacy/privacy.js +0 -6
- package/dist/src/routes/routes.d.ts +1 -11
- package/dist/src/routes/routes.js +0 -15
- package/dist/src/storage/storage.d.ts +1 -23
- package/dist/src/storage/storage.js +10 -36
- package/dist/src/timesheets/timesheets.d.ts +1 -5
- package/dist/src/timesheets/timesheets.js +0 -6
- package/package.json +1 -1
|
@@ -71,9 +71,6 @@ export class RoutesClient {
|
|
|
71
71
|
async deleteOneRoute(opts) {
|
|
72
72
|
return await this.routes.deleteOne(opts);
|
|
73
73
|
}
|
|
74
|
-
async deleteManyRoutes(opts) {
|
|
75
|
-
return await this.routes.deleteMany(opts);
|
|
76
|
-
}
|
|
77
74
|
async queryTags(opts) {
|
|
78
75
|
return await this.tags.query(opts);
|
|
79
76
|
}
|
|
@@ -89,9 +86,6 @@ export class RoutesClient {
|
|
|
89
86
|
async deleteOneTag(opts) {
|
|
90
87
|
return await this.tags.deleteOne(opts);
|
|
91
88
|
}
|
|
92
|
-
async deleteManyTags(opts) {
|
|
93
|
-
return await this.tags.deleteMany(opts);
|
|
94
|
-
}
|
|
95
89
|
async searchManyTags(opts) {
|
|
96
90
|
return await this.tags.searchMany(opts);
|
|
97
91
|
}
|
|
@@ -110,9 +104,6 @@ export class RoutesClient {
|
|
|
110
104
|
async deleteOneClientAvailability(opts) {
|
|
111
105
|
return await this.client_availabilities.deleteOne(opts);
|
|
112
106
|
}
|
|
113
|
-
async deleteManyClientAvailabilities(opts) {
|
|
114
|
-
return await this.client_availabilities.deleteMany(opts);
|
|
115
|
-
}
|
|
116
107
|
async queryTracking(opts) {
|
|
117
108
|
return await this.tracking.query(opts);
|
|
118
109
|
}
|
|
@@ -128,9 +119,6 @@ export class RoutesClient {
|
|
|
128
119
|
async deleteOneTracking(opts) {
|
|
129
120
|
return await this.tracking.deleteOne(opts);
|
|
130
121
|
}
|
|
131
|
-
async deleteManyTracking(opts) {
|
|
132
|
-
return await this.tracking.deleteMany(opts);
|
|
133
|
-
}
|
|
134
122
|
async queryRouteTeams(opts) {
|
|
135
123
|
return await this.route_teams.query(opts);
|
|
136
124
|
}
|
|
@@ -146,9 +134,6 @@ export class RoutesClient {
|
|
|
146
134
|
async deleteOneRouteTeam(opts) {
|
|
147
135
|
return await this.route_teams.deleteOne(opts);
|
|
148
136
|
}
|
|
149
|
-
async deleteManyRouteTeams(opts) {
|
|
150
|
-
return await this.route_teams.deleteMany(opts);
|
|
151
|
-
}
|
|
152
137
|
async searchManyRouteTeams(opts) {
|
|
153
138
|
return await this.route_teams.searchMany(opts);
|
|
154
139
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Object as StorageObject, type OperationResult, type PLStorageDownload, type RPStorageUpload } from "@fabriktor/schema";
|
|
2
2
|
import type { TokenProvider } from "../core/auth.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { DeleteOneOptionsCRUD, OperationResultOf } from "../core/crud.js";
|
|
4
4
|
import type { HTTPDoer } from "../core/http.js";
|
|
5
5
|
import { type MultipartDoer } from "../core/multipart.js";
|
|
6
6
|
export declare const storageCollections: readonly ["calls", "chat", "contacts", "jobs", "locations", "memos", "qr", "reports", "tickets", "users"];
|
|
@@ -26,47 +26,36 @@ export interface StorageOperator {
|
|
|
26
26
|
upload(col: StorageCollection, opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
27
27
|
download(col: StorageCollection, opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
28
28
|
deleteOne(col: StorageCollection, opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
29
|
-
deleteMany(col: StorageCollection, opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
30
29
|
uploadCalls(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
31
30
|
downloadCalls(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
32
31
|
deleteOneCallObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
33
|
-
deleteManyCallObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
34
32
|
uploadChat(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
35
33
|
downloadChat(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
36
34
|
deleteOneChatObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
37
|
-
deleteManyChatObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
38
35
|
uploadContacts(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
39
36
|
downloadContacts(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
40
37
|
deleteOneContactObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
41
|
-
deleteManyContactObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
42
38
|
uploadJobs(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
43
39
|
downloadJobs(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
44
40
|
deleteOneJobObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
45
|
-
deleteManyJobObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
46
41
|
uploadLocations(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
47
42
|
downloadLocations(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
48
43
|
deleteOneLocationObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
49
|
-
deleteManyLocationObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
50
44
|
uploadMemos(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
51
45
|
downloadMemos(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
52
46
|
deleteOneMemoObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
53
|
-
deleteManyMemoObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
54
47
|
uploadQR(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
55
48
|
downloadQR(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
56
49
|
deleteOneQRObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
57
|
-
deleteManyQRObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
58
50
|
uploadReports(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
59
51
|
downloadReports(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
60
52
|
deleteOneReportObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
61
|
-
deleteManyReportObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
62
53
|
uploadTickets(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
63
54
|
downloadTickets(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
64
55
|
deleteOneTicketObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
65
|
-
deleteManyTicketObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
66
56
|
uploadUsers(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
67
57
|
downloadUsers(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
68
58
|
deleteOneUserObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
69
|
-
deleteManyUserObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
70
59
|
}
|
|
71
60
|
export declare class StorageClient implements StorageOperator {
|
|
72
61
|
private objects;
|
|
@@ -78,47 +67,36 @@ export declare class StorageClient implements StorageOperator {
|
|
|
78
67
|
upload(col: StorageCollection, opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
79
68
|
download(col: StorageCollection, opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
80
69
|
deleteOne(col: StorageCollection, opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
81
|
-
deleteMany(col: StorageCollection, opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
82
70
|
uploadCalls(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
83
71
|
downloadCalls(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
84
72
|
deleteOneCallObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
85
|
-
deleteManyCallObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
86
73
|
uploadChat(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
87
74
|
downloadChat(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
88
75
|
deleteOneChatObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
89
|
-
deleteManyChatObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
90
76
|
uploadContacts(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
91
77
|
downloadContacts(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
92
78
|
deleteOneContactObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
93
|
-
deleteManyContactObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
94
79
|
uploadJobs(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
95
80
|
downloadJobs(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
96
81
|
deleteOneJobObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
97
|
-
deleteManyJobObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
98
82
|
uploadLocations(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
99
83
|
downloadLocations(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
100
84
|
deleteOneLocationObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
101
|
-
deleteManyLocationObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
102
85
|
uploadMemos(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
103
86
|
downloadMemos(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
104
87
|
deleteOneMemoObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
105
|
-
deleteManyMemoObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
106
88
|
uploadQR(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
107
89
|
downloadQR(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
108
90
|
deleteOneQRObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
109
|
-
deleteManyQRObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
110
91
|
uploadReports(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
111
92
|
downloadReports(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
112
93
|
deleteOneReportObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
113
|
-
deleteManyReportObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
114
94
|
uploadTickets(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
115
95
|
downloadTickets(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
116
96
|
deleteOneTicketObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
117
|
-
deleteManyTicketObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
118
97
|
uploadUsers(opts: UploadStorageOptions): Promise<OperationResultOf<RPStorageUpload>>;
|
|
119
98
|
downloadUsers(opts: DownloadStorageOptions): Promise<OperationResultOf<StorageObject[]>>;
|
|
120
99
|
deleteOneUserObject(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
121
|
-
deleteManyUserObjects(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
122
100
|
private object;
|
|
123
101
|
}
|
|
124
102
|
export declare function newStorageClient(opts: StorageClientOptions): StorageClient;
|
|
@@ -7,12 +7,14 @@ import { ColStorageCalls, ColStorageChat, ColStorageContacts, ColStorageJobs, Co
|
|
|
7
7
|
import { requiredToken } from "../core/auth.js";
|
|
8
8
|
import { withQuery } from "../core/col.js";
|
|
9
9
|
import { newCRUDClient } from "../core/crud.js";
|
|
10
|
+
import { errInvalidArgument } from "../core/err.js";
|
|
10
11
|
import { newMultipartClient } from "../core/multipart.js";
|
|
11
12
|
import { buildPath } from "../core/path.js";
|
|
12
13
|
const queryOwnerID = "owner_id";
|
|
13
14
|
const queryUploaderID = "uploader_id";
|
|
14
15
|
const queryFullQuality = "full_quality";
|
|
15
16
|
const fileFieldName = "file";
|
|
17
|
+
const msgUploadRequiresFile = "Upload requires at least one file.";
|
|
16
18
|
export const storageCollections = [
|
|
17
19
|
ColStorageCalls,
|
|
18
20
|
ColStorageChat,
|
|
@@ -48,13 +50,14 @@ export class StorageClient {
|
|
|
48
50
|
this.get_token = opts.get_token;
|
|
49
51
|
}
|
|
50
52
|
async upload(col, opts) {
|
|
53
|
+
const form = uploadForm(opts);
|
|
51
54
|
const token = await requiredToken(this.get_token);
|
|
52
55
|
return await this.multipart.do({
|
|
53
56
|
base_url: this.base_url,
|
|
54
57
|
path: uploadPath(col, opts),
|
|
55
58
|
method: HTTPMethodPost,
|
|
56
59
|
token,
|
|
57
|
-
form
|
|
60
|
+
form,
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
63
|
async download(col, opts) {
|
|
@@ -70,9 +73,6 @@ export class StorageClient {
|
|
|
70
73
|
async deleteOne(col, opts) {
|
|
71
74
|
return await this.object(col).deleteOne(opts);
|
|
72
75
|
}
|
|
73
|
-
async deleteMany(col, opts) {
|
|
74
|
-
return await this.object(col).deleteMany(opts);
|
|
75
|
-
}
|
|
76
76
|
async uploadCalls(opts) {
|
|
77
77
|
return await this.upload(ColStorageCalls, opts);
|
|
78
78
|
}
|
|
@@ -82,9 +82,6 @@ export class StorageClient {
|
|
|
82
82
|
async deleteOneCallObject(opts) {
|
|
83
83
|
return await this.deleteOne(ColStorageCalls, opts);
|
|
84
84
|
}
|
|
85
|
-
async deleteManyCallObjects(opts) {
|
|
86
|
-
return await this.deleteMany(ColStorageCalls, opts);
|
|
87
|
-
}
|
|
88
85
|
async uploadChat(opts) {
|
|
89
86
|
return await this.upload(ColStorageChat, opts);
|
|
90
87
|
}
|
|
@@ -94,9 +91,6 @@ export class StorageClient {
|
|
|
94
91
|
async deleteOneChatObject(opts) {
|
|
95
92
|
return await this.deleteOne(ColStorageChat, opts);
|
|
96
93
|
}
|
|
97
|
-
async deleteManyChatObjects(opts) {
|
|
98
|
-
return await this.deleteMany(ColStorageChat, opts);
|
|
99
|
-
}
|
|
100
94
|
async uploadContacts(opts) {
|
|
101
95
|
return await this.upload(ColStorageContacts, opts);
|
|
102
96
|
}
|
|
@@ -106,9 +100,6 @@ export class StorageClient {
|
|
|
106
100
|
async deleteOneContactObject(opts) {
|
|
107
101
|
return await this.deleteOne(ColStorageContacts, opts);
|
|
108
102
|
}
|
|
109
|
-
async deleteManyContactObjects(opts) {
|
|
110
|
-
return await this.deleteMany(ColStorageContacts, opts);
|
|
111
|
-
}
|
|
112
103
|
async uploadJobs(opts) {
|
|
113
104
|
return await this.upload(ColStorageJobs, opts);
|
|
114
105
|
}
|
|
@@ -118,9 +109,6 @@ export class StorageClient {
|
|
|
118
109
|
async deleteOneJobObject(opts) {
|
|
119
110
|
return await this.deleteOne(ColStorageJobs, opts);
|
|
120
111
|
}
|
|
121
|
-
async deleteManyJobObjects(opts) {
|
|
122
|
-
return await this.deleteMany(ColStorageJobs, opts);
|
|
123
|
-
}
|
|
124
112
|
async uploadLocations(opts) {
|
|
125
113
|
return await this.upload(ColStorageLocations, opts);
|
|
126
114
|
}
|
|
@@ -130,9 +118,6 @@ export class StorageClient {
|
|
|
130
118
|
async deleteOneLocationObject(opts) {
|
|
131
119
|
return await this.deleteOne(ColStorageLocations, opts);
|
|
132
120
|
}
|
|
133
|
-
async deleteManyLocationObjects(opts) {
|
|
134
|
-
return await this.deleteMany(ColStorageLocations, opts);
|
|
135
|
-
}
|
|
136
121
|
async uploadMemos(opts) {
|
|
137
122
|
return await this.upload(ColStorageMemos, opts);
|
|
138
123
|
}
|
|
@@ -142,9 +127,6 @@ export class StorageClient {
|
|
|
142
127
|
async deleteOneMemoObject(opts) {
|
|
143
128
|
return await this.deleteOne(ColStorageMemos, opts);
|
|
144
129
|
}
|
|
145
|
-
async deleteManyMemoObjects(opts) {
|
|
146
|
-
return await this.deleteMany(ColStorageMemos, opts);
|
|
147
|
-
}
|
|
148
130
|
async uploadQR(opts) {
|
|
149
131
|
return await this.upload(ColStorageQR, opts);
|
|
150
132
|
}
|
|
@@ -154,9 +136,6 @@ export class StorageClient {
|
|
|
154
136
|
async deleteOneQRObject(opts) {
|
|
155
137
|
return await this.deleteOne(ColStorageQR, opts);
|
|
156
138
|
}
|
|
157
|
-
async deleteManyQRObjects(opts) {
|
|
158
|
-
return await this.deleteMany(ColStorageQR, opts);
|
|
159
|
-
}
|
|
160
139
|
async uploadReports(opts) {
|
|
161
140
|
return await this.upload(ColStorageReports, opts);
|
|
162
141
|
}
|
|
@@ -166,9 +145,6 @@ export class StorageClient {
|
|
|
166
145
|
async deleteOneReportObject(opts) {
|
|
167
146
|
return await this.deleteOne(ColStorageReports, opts);
|
|
168
147
|
}
|
|
169
|
-
async deleteManyReportObjects(opts) {
|
|
170
|
-
return await this.deleteMany(ColStorageReports, opts);
|
|
171
|
-
}
|
|
172
148
|
async uploadTickets(opts) {
|
|
173
149
|
return await this.upload(ColStorageTickets, opts);
|
|
174
150
|
}
|
|
@@ -178,9 +154,6 @@ export class StorageClient {
|
|
|
178
154
|
async deleteOneTicketObject(opts) {
|
|
179
155
|
return await this.deleteOne(ColStorageTickets, opts);
|
|
180
156
|
}
|
|
181
|
-
async deleteManyTicketObjects(opts) {
|
|
182
|
-
return await this.deleteMany(ColStorageTickets, opts);
|
|
183
|
-
}
|
|
184
157
|
async uploadUsers(opts) {
|
|
185
158
|
return await this.upload(ColStorageUsers, opts);
|
|
186
159
|
}
|
|
@@ -190,13 +163,12 @@ export class StorageClient {
|
|
|
190
163
|
async deleteOneUserObject(opts) {
|
|
191
164
|
return await this.deleteOne(ColStorageUsers, opts);
|
|
192
165
|
}
|
|
193
|
-
async deleteManyUserObjects(opts) {
|
|
194
|
-
return await this.deleteMany(ColStorageUsers, opts);
|
|
195
|
-
}
|
|
196
166
|
object(col) {
|
|
197
167
|
const c = this.objects.get(col);
|
|
198
168
|
if (c === undefined) {
|
|
199
|
-
throw
|
|
169
|
+
throw errInvalidArgument({
|
|
170
|
+
msg: `Unknown storage collection: ${col}.`,
|
|
171
|
+
});
|
|
200
172
|
}
|
|
201
173
|
return c;
|
|
202
174
|
}
|
|
@@ -222,7 +194,9 @@ function storagePath(col, action) {
|
|
|
222
194
|
}
|
|
223
195
|
function uploadForm(opts) {
|
|
224
196
|
if (opts.files.length === 0) {
|
|
225
|
-
throw
|
|
197
|
+
throw errInvalidArgument({
|
|
198
|
+
msg: msgUploadRequiresFile,
|
|
199
|
+
});
|
|
226
200
|
}
|
|
227
201
|
const form = new FormData();
|
|
228
202
|
for (const f of opts.files) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type InSummary, type InWeekSheet, type OperationResult, type PLTimesheetsApprove, type PLTimesheetsSync, type Punch, type Summary, type WeekSheet } from "@fabriktor/schema";
|
|
2
2
|
import type { TokenProvider } from "../core/auth.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { DeleteOneOptionsCRUD, FindOneOptionsCRUD, OperationResultOf, QueryOptionsCRUD, ReplaceOneOptionsCRUD } from "../core/crud.js";
|
|
4
4
|
import type { HTTPDoer } from "../core/http.js";
|
|
5
5
|
export type ApproveTimesheetsOptions = PLTimesheetsApprove;
|
|
6
6
|
export type SyncTimesheetsOptions = PLTimesheetsSync;
|
|
@@ -15,12 +15,10 @@ export interface TimesheetsOperator {
|
|
|
15
15
|
findOneWeekSheet(opts: FindOneOptionsCRUD): Promise<OperationResultOf<WeekSheet>>;
|
|
16
16
|
replaceOneWeekSheet(opts: ReplaceOneOptionsCRUD<InWeekSheet>): Promise<OperationResult>;
|
|
17
17
|
deleteOneWeekSheet(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
18
|
-
deleteManyWeekSheets(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
19
18
|
querySummaries(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Summary[]>>;
|
|
20
19
|
findOneSummary(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Summary>>;
|
|
21
20
|
replaceOneSummary(opts: ReplaceOneOptionsCRUD<InSummary>): Promise<OperationResult>;
|
|
22
21
|
deleteOneSummary(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
23
|
-
deleteManySummaries(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
24
22
|
approve(opts: ApproveTimesheetsOptions): Promise<void>;
|
|
25
23
|
sync(opts: SyncTimesheetsOptions): Promise<void>;
|
|
26
24
|
punch(opts: PunchTimesheetOptions): Promise<OperationResult>;
|
|
@@ -36,12 +34,10 @@ export declare class TimesheetsClient implements TimesheetsOperator {
|
|
|
36
34
|
findOneWeekSheet(opts: FindOneOptionsCRUD): Promise<OperationResultOf<WeekSheet>>;
|
|
37
35
|
replaceOneWeekSheet(opts: ReplaceOneOptionsCRUD<InWeekSheet>): Promise<OperationResult>;
|
|
38
36
|
deleteOneWeekSheet(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
39
|
-
deleteManyWeekSheets(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
40
37
|
querySummaries(opts?: QueryOptionsCRUD): Promise<OperationResultOf<Summary[]>>;
|
|
41
38
|
findOneSummary(opts: FindOneOptionsCRUD): Promise<OperationResultOf<Summary>>;
|
|
42
39
|
replaceOneSummary(opts: ReplaceOneOptionsCRUD<InSummary>): Promise<OperationResult>;
|
|
43
40
|
deleteOneSummary(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
|
|
44
|
-
deleteManySummaries(opts?: DeleteManyOptionsCRUD): Promise<OperationResultOf<number>>;
|
|
45
41
|
approve(opts: ApproveTimesheetsOptions): Promise<void>;
|
|
46
42
|
sync(opts: SyncTimesheetsOptions): Promise<void>;
|
|
47
43
|
punch(opts: PunchTimesheetOptions): Promise<OperationResult>;
|
|
@@ -44,9 +44,6 @@ export class TimesheetsClient {
|
|
|
44
44
|
async deleteOneWeekSheet(opts) {
|
|
45
45
|
return await this.weeksheets.deleteOne(opts);
|
|
46
46
|
}
|
|
47
|
-
async deleteManyWeekSheets(opts) {
|
|
48
|
-
return await this.weeksheets.deleteMany(opts);
|
|
49
|
-
}
|
|
50
47
|
async querySummaries(opts) {
|
|
51
48
|
return await this.summaries.query(opts);
|
|
52
49
|
}
|
|
@@ -59,9 +56,6 @@ export class TimesheetsClient {
|
|
|
59
56
|
async deleteOneSummary(opts) {
|
|
60
57
|
return await this.summaries.deleteOne(opts);
|
|
61
58
|
}
|
|
62
|
-
async deleteManySummaries(opts) {
|
|
63
|
-
return await this.summaries.deleteMany(opts);
|
|
64
|
-
}
|
|
65
59
|
async approve(opts) {
|
|
66
60
|
const token = await requiredToken(this.get_token);
|
|
67
61
|
return await this.http.do({
|