@glance-il/sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/index.cjs +571 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +819 -0
- package/dist/index.d.ts +819 -0
- package/dist/index.js +562 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
// src/core/errors.ts
|
|
2
|
+
var GlanceError = class extends Error {
|
|
3
|
+
name = "GlanceError";
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
var GlanceApiError = class extends GlanceError {
|
|
10
|
+
constructor(status, message, code) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.status = status;
|
|
13
|
+
this.code = code;
|
|
14
|
+
}
|
|
15
|
+
name = "GlanceApiError";
|
|
16
|
+
};
|
|
17
|
+
var GlanceAuthenticationError = class extends GlanceApiError {
|
|
18
|
+
name = "GlanceAuthenticationError";
|
|
19
|
+
constructor(message = "Authentication failed") {
|
|
20
|
+
super(401, message, "NO_ACCESS");
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var GlanceNotFoundError = class extends GlanceApiError {
|
|
24
|
+
name = "GlanceNotFoundError";
|
|
25
|
+
constructor(message = "Resource not found", code) {
|
|
26
|
+
super(404, message, code);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var GlanceValidationError = class extends GlanceApiError {
|
|
30
|
+
constructor(message = "Validation failed", issues) {
|
|
31
|
+
super(400, message, "INVALID_FIELD");
|
|
32
|
+
this.issues = issues;
|
|
33
|
+
}
|
|
34
|
+
name = "GlanceValidationError";
|
|
35
|
+
};
|
|
36
|
+
var GlanceRateLimitError = class extends GlanceApiError {
|
|
37
|
+
name = "GlanceRateLimitError";
|
|
38
|
+
constructor(message = "Rate limit exceeded") {
|
|
39
|
+
super(429, message, "RATE_LIMIT_EXCEEDED");
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/core/http.ts
|
|
44
|
+
var HttpClient = class {
|
|
45
|
+
apiKey;
|
|
46
|
+
baseUrl;
|
|
47
|
+
timeout;
|
|
48
|
+
_fetch;
|
|
49
|
+
constructor(options) {
|
|
50
|
+
this.apiKey = options.apiKey;
|
|
51
|
+
this.baseUrl = (options.baseUrl ?? "https://api.glance.co.il").replace(/\/$/, "");
|
|
52
|
+
this.timeout = options.timeout ?? 3e4;
|
|
53
|
+
this._fetch = options.fetch ?? globalThis.fetch;
|
|
54
|
+
}
|
|
55
|
+
async get(path, query, options) {
|
|
56
|
+
return this.request("GET", path, void 0, query, options);
|
|
57
|
+
}
|
|
58
|
+
async post(path, body, options) {
|
|
59
|
+
return this.request("POST", path, body, void 0, options);
|
|
60
|
+
}
|
|
61
|
+
async put(path, body, options) {
|
|
62
|
+
return this.request("PUT", path, body, void 0, options);
|
|
63
|
+
}
|
|
64
|
+
async delete(path, options) {
|
|
65
|
+
return this.request("DELETE", path, void 0, void 0, options);
|
|
66
|
+
}
|
|
67
|
+
async request(method, path, body, query, options) {
|
|
68
|
+
let url = `${this.baseUrl}${path}`;
|
|
69
|
+
if (query) {
|
|
70
|
+
const params = new URLSearchParams();
|
|
71
|
+
for (const [key, value] of Object.entries(query)) {
|
|
72
|
+
if (value !== void 0 && value !== null) {
|
|
73
|
+
params.set(key, String(value));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const qs = params.toString();
|
|
77
|
+
if (qs) url += `?${qs}`;
|
|
78
|
+
}
|
|
79
|
+
const headers = {
|
|
80
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
81
|
+
Accept: "application/json"
|
|
82
|
+
};
|
|
83
|
+
if (body !== void 0) {
|
|
84
|
+
headers["Content-Type"] = "application/json";
|
|
85
|
+
}
|
|
86
|
+
const controller = new AbortController();
|
|
87
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
88
|
+
let signal = controller.signal;
|
|
89
|
+
if (options?.signal) {
|
|
90
|
+
if (typeof AbortSignal.any === "function") {
|
|
91
|
+
signal = AbortSignal.any([controller.signal, options.signal]);
|
|
92
|
+
} else {
|
|
93
|
+
options.signal.addEventListener("abort", () => controller.abort(), { once: true });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
const response = await this._fetch(url, {
|
|
98
|
+
method,
|
|
99
|
+
headers,
|
|
100
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0,
|
|
101
|
+
signal
|
|
102
|
+
});
|
|
103
|
+
const json = await response.json();
|
|
104
|
+
if (!response.ok) {
|
|
105
|
+
throw this.createError(response.status, json);
|
|
106
|
+
}
|
|
107
|
+
return json;
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if (error instanceof GlanceError) throw error;
|
|
110
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
111
|
+
throw new GlanceError("Request timed out");
|
|
112
|
+
}
|
|
113
|
+
throw new GlanceError(`Network error: ${error.message}`);
|
|
114
|
+
} finally {
|
|
115
|
+
clearTimeout(timeoutId);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
createError(status, json) {
|
|
119
|
+
const body = json;
|
|
120
|
+
const message = body?.error?.message ?? "Unknown error";
|
|
121
|
+
const code = body?.error?.code;
|
|
122
|
+
const issues = body?.error?.issues;
|
|
123
|
+
switch (status) {
|
|
124
|
+
case 400:
|
|
125
|
+
return new GlanceValidationError(message, issues);
|
|
126
|
+
case 401:
|
|
127
|
+
case 403:
|
|
128
|
+
return new GlanceAuthenticationError(message);
|
|
129
|
+
case 404:
|
|
130
|
+
return new GlanceNotFoundError(message, code);
|
|
131
|
+
case 429:
|
|
132
|
+
return new GlanceRateLimitError(message);
|
|
133
|
+
default:
|
|
134
|
+
return new GlanceApiError(status, message, code);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// src/resources/base.ts
|
|
140
|
+
var BaseResource = class {
|
|
141
|
+
constructor(http) {
|
|
142
|
+
this.http = http;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// src/resources/clients.ts
|
|
147
|
+
var ClientsResource = class extends BaseResource {
|
|
148
|
+
async list(params) {
|
|
149
|
+
return this.http.get("/clients", params);
|
|
150
|
+
}
|
|
151
|
+
async get(visibleId) {
|
|
152
|
+
return this.http.get(`/clients/id/${visibleId}`);
|
|
153
|
+
}
|
|
154
|
+
async create(params) {
|
|
155
|
+
return this.http.post("/clients/create", params);
|
|
156
|
+
}
|
|
157
|
+
async update(visibleId, params) {
|
|
158
|
+
return this.http.put(`/clients/edit/${visibleId}`, params);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// src/resources/contacts.ts
|
|
163
|
+
var ContactsResource = class extends BaseResource {
|
|
164
|
+
async list(params) {
|
|
165
|
+
return this.http.get("/contacts", params);
|
|
166
|
+
}
|
|
167
|
+
async get(visibleId) {
|
|
168
|
+
return this.http.get(`/contacts/id/${visibleId}`);
|
|
169
|
+
}
|
|
170
|
+
async create(params) {
|
|
171
|
+
return this.http.post("/contacts/create", params);
|
|
172
|
+
}
|
|
173
|
+
async update(visibleId, params) {
|
|
174
|
+
return this.http.put(`/contacts/edit/${visibleId}`, params);
|
|
175
|
+
}
|
|
176
|
+
async delete(visibleId) {
|
|
177
|
+
return this.http.delete(`/contacts/delete/${visibleId}`);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// src/resources/addresses.ts
|
|
182
|
+
var AddressesResource = class extends BaseResource {
|
|
183
|
+
async list(params) {
|
|
184
|
+
return this.http.get("/addresses", params);
|
|
185
|
+
}
|
|
186
|
+
async get(id) {
|
|
187
|
+
return this.http.get(`/addresses/id/${id}`);
|
|
188
|
+
}
|
|
189
|
+
async create(params) {
|
|
190
|
+
return this.http.post("/addresses/create", params);
|
|
191
|
+
}
|
|
192
|
+
async update(id, params) {
|
|
193
|
+
return this.http.put(`/addresses/${id}`, params);
|
|
194
|
+
}
|
|
195
|
+
async delete(id) {
|
|
196
|
+
return this.http.delete(`/addresses/${id}`);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// src/resources/products.ts
|
|
201
|
+
var ProductsResource = class extends BaseResource {
|
|
202
|
+
async list(params) {
|
|
203
|
+
return this.http.get("/products", params);
|
|
204
|
+
}
|
|
205
|
+
async get(id) {
|
|
206
|
+
return this.http.get(`/products/id/${id}`);
|
|
207
|
+
}
|
|
208
|
+
async getBySku(sku) {
|
|
209
|
+
return this.http.get(`/products/sku/${sku}`);
|
|
210
|
+
}
|
|
211
|
+
async create(params) {
|
|
212
|
+
return this.http.post("/products/create", params);
|
|
213
|
+
}
|
|
214
|
+
async update(id, params) {
|
|
215
|
+
return this.http.put(`/products/edit/${id}`, params);
|
|
216
|
+
}
|
|
217
|
+
async delete(id) {
|
|
218
|
+
return this.http.delete(`/products/delete/${id}`);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// src/resources/product-serials.ts
|
|
223
|
+
var ProductSerialsResource = class extends BaseResource {
|
|
224
|
+
async list(productId) {
|
|
225
|
+
return this.http.get(`/products/id/${productId}/serials`);
|
|
226
|
+
}
|
|
227
|
+
async create(productId, params) {
|
|
228
|
+
return this.http.post(`/products/id/${productId}/serials`, params);
|
|
229
|
+
}
|
|
230
|
+
async update(serialId, params) {
|
|
231
|
+
return this.http.put(`/products/serials/${serialId}`, params);
|
|
232
|
+
}
|
|
233
|
+
async delete(serialId) {
|
|
234
|
+
return this.http.delete(`/products/serials/${serialId}`);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// src/resources/warehouses.ts
|
|
239
|
+
var WarehousesResource = class extends BaseResource {
|
|
240
|
+
async list(params) {
|
|
241
|
+
return this.http.get("/warehouses", params);
|
|
242
|
+
}
|
|
243
|
+
async get(id) {
|
|
244
|
+
return this.http.get(`/warehouses/${id}`);
|
|
245
|
+
}
|
|
246
|
+
async create(params) {
|
|
247
|
+
return this.http.post("/warehouses", params);
|
|
248
|
+
}
|
|
249
|
+
async update(id, params) {
|
|
250
|
+
return this.http.put(`/warehouses/${id}`, params);
|
|
251
|
+
}
|
|
252
|
+
async delete(id) {
|
|
253
|
+
return this.http.delete(`/warehouses/${id}`);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// src/resources/inventory.ts
|
|
258
|
+
var InventoryResource = class extends BaseResource {
|
|
259
|
+
async list(params) {
|
|
260
|
+
return this.http.get("/inventory", params);
|
|
261
|
+
}
|
|
262
|
+
async get(id) {
|
|
263
|
+
return this.http.get(`/inventory/${id}`);
|
|
264
|
+
}
|
|
265
|
+
async getByProduct(productId) {
|
|
266
|
+
return this.http.get(`/inventory/product/${productId}`);
|
|
267
|
+
}
|
|
268
|
+
async create(params) {
|
|
269
|
+
return this.http.post("/inventory/create", params);
|
|
270
|
+
}
|
|
271
|
+
async update(id, params) {
|
|
272
|
+
return this.http.put(`/inventory/${id}/edit`, params);
|
|
273
|
+
}
|
|
274
|
+
async delete(id) {
|
|
275
|
+
return this.http.delete(`/inventory/${id}/delete`);
|
|
276
|
+
}
|
|
277
|
+
async adjust(params) {
|
|
278
|
+
return this.http.post("/inventory/adjust", params);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
// src/resources/inventory-movements.ts
|
|
283
|
+
var InventoryMovementsResource = class extends BaseResource {
|
|
284
|
+
async list(params) {
|
|
285
|
+
return this.http.get("/inventory/movements", params);
|
|
286
|
+
}
|
|
287
|
+
async create(params) {
|
|
288
|
+
return this.http.post("/inventory/movements/create", params);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// src/resources/documents.ts
|
|
293
|
+
var DocumentsResource = class extends BaseResource {
|
|
294
|
+
async list(params) {
|
|
295
|
+
return this.http.get("/documents", params);
|
|
296
|
+
}
|
|
297
|
+
async get(visibleId) {
|
|
298
|
+
return this.http.get(`/documents/id/${visibleId}`);
|
|
299
|
+
}
|
|
300
|
+
async create(type, params) {
|
|
301
|
+
return this.http.post(`/documents/create/${type}`, params);
|
|
302
|
+
}
|
|
303
|
+
async update(visibleId, params) {
|
|
304
|
+
return this.http.put(`/documents/edit/${visibleId}`, params);
|
|
305
|
+
}
|
|
306
|
+
async close(visibleId) {
|
|
307
|
+
return this.http.post(`/documents/close/${visibleId}`);
|
|
308
|
+
}
|
|
309
|
+
async allocate(visibleId, params) {
|
|
310
|
+
return this.http.post(`/documents/allocate/${visibleId}`, params);
|
|
311
|
+
}
|
|
312
|
+
async cancelReceipt(visibleId) {
|
|
313
|
+
return this.http.post(`/documents/cancel-receipt/${visibleId}`);
|
|
314
|
+
}
|
|
315
|
+
async getSettings(route) {
|
|
316
|
+
return this.http.get(`/documents/settings/${route}`);
|
|
317
|
+
}
|
|
318
|
+
async previewPdf(type, params) {
|
|
319
|
+
return this.http.post(`/documents/preview/${type}`, params);
|
|
320
|
+
}
|
|
321
|
+
async previewHtml(params) {
|
|
322
|
+
return this.http.post("/documents/preview/html", params);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
// src/resources/vendors.ts
|
|
327
|
+
var VendorsResource = class extends BaseResource {
|
|
328
|
+
async list(params) {
|
|
329
|
+
return this.http.get("/vendors", params);
|
|
330
|
+
}
|
|
331
|
+
async get(visibleId) {
|
|
332
|
+
return this.http.get(`/vendors/id/${visibleId}`);
|
|
333
|
+
}
|
|
334
|
+
async create(params) {
|
|
335
|
+
return this.http.post("/vendors/create", params);
|
|
336
|
+
}
|
|
337
|
+
async update(visibleId, params) {
|
|
338
|
+
return this.http.put(`/vendors/edit/${visibleId}`, params);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
// src/resources/purchase.ts
|
|
343
|
+
var PurchaseResource = class extends BaseResource {
|
|
344
|
+
async list(params) {
|
|
345
|
+
return this.http.get("/purchase", params);
|
|
346
|
+
}
|
|
347
|
+
async get(visibleId) {
|
|
348
|
+
return this.http.get(`/purchase/id/${visibleId}`);
|
|
349
|
+
}
|
|
350
|
+
async create(type, params) {
|
|
351
|
+
return this.http.post(`/purchase/create/${type}`, params);
|
|
352
|
+
}
|
|
353
|
+
async close(visibleId) {
|
|
354
|
+
return this.http.post(`/purchase/close/${visibleId}`);
|
|
355
|
+
}
|
|
356
|
+
async getSettings(route) {
|
|
357
|
+
return this.http.get(`/purchase/settings/${route}`);
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
// src/resources/expenses.ts
|
|
362
|
+
var ExpensesResource = class extends BaseResource {
|
|
363
|
+
async list(params) {
|
|
364
|
+
return this.http.get("/expenses", params);
|
|
365
|
+
}
|
|
366
|
+
async get(id) {
|
|
367
|
+
return this.http.get(`/expenses/id/${id}`);
|
|
368
|
+
}
|
|
369
|
+
async create(params) {
|
|
370
|
+
return this.http.post("/expenses/create", params);
|
|
371
|
+
}
|
|
372
|
+
async update(id, params) {
|
|
373
|
+
return this.http.put(`/expenses/edit/${id}`, params);
|
|
374
|
+
}
|
|
375
|
+
async delete(id) {
|
|
376
|
+
return this.http.delete(`/expenses/delete/${id}`);
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// src/resources/retainers.ts
|
|
381
|
+
var RetainersResource = class extends BaseResource {
|
|
382
|
+
async list(params) {
|
|
383
|
+
return this.http.get("/retainers", params);
|
|
384
|
+
}
|
|
385
|
+
async get(id) {
|
|
386
|
+
return this.http.get(`/retainers/${id}`);
|
|
387
|
+
}
|
|
388
|
+
async create(params) {
|
|
389
|
+
return this.http.post("/retainers/create", params);
|
|
390
|
+
}
|
|
391
|
+
async update(id, params) {
|
|
392
|
+
return this.http.put(`/retainers/${id}`, params);
|
|
393
|
+
}
|
|
394
|
+
async delete(id) {
|
|
395
|
+
return this.http.delete(`/retainers/${id}`);
|
|
396
|
+
}
|
|
397
|
+
async reactivate(id) {
|
|
398
|
+
return this.http.post(`/retainers/reactivate/${id}`);
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
// src/resources/reports.ts
|
|
403
|
+
var ReportsResource = class extends BaseResource {
|
|
404
|
+
async income(params) {
|
|
405
|
+
return this.http.post("/reports/income", params);
|
|
406
|
+
}
|
|
407
|
+
async expenses(params) {
|
|
408
|
+
return this.http.post("/reports/expenses", params);
|
|
409
|
+
}
|
|
410
|
+
async documents(params) {
|
|
411
|
+
return this.http.post("/reports/documents", params);
|
|
412
|
+
}
|
|
413
|
+
async maam(params) {
|
|
414
|
+
return this.http.post("/reports/maam", params);
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// src/resources/employees.ts
|
|
419
|
+
var EmployeesResource = class extends BaseResource {
|
|
420
|
+
async list(params) {
|
|
421
|
+
return this.http.get("/employees", params);
|
|
422
|
+
}
|
|
423
|
+
async get(visibleId) {
|
|
424
|
+
return this.http.get(`/employees/id/${visibleId}`);
|
|
425
|
+
}
|
|
426
|
+
async create(params) {
|
|
427
|
+
return this.http.post("/employees/create", params);
|
|
428
|
+
}
|
|
429
|
+
async update(visibleId, params) {
|
|
430
|
+
return this.http.put(`/employees/edit/${visibleId}`, params);
|
|
431
|
+
}
|
|
432
|
+
async delete(visibleId) {
|
|
433
|
+
return this.http.delete(`/employees/${visibleId}`);
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
// src/resources/files.ts
|
|
438
|
+
var FilesResource = class extends BaseResource {
|
|
439
|
+
async list(params) {
|
|
440
|
+
return this.http.get("/files", params);
|
|
441
|
+
}
|
|
442
|
+
async get(visibleId) {
|
|
443
|
+
return this.http.get(`/files/file/${visibleId}`);
|
|
444
|
+
}
|
|
445
|
+
// Note: file upload requires multipart/form-data — use the REST API directly
|
|
446
|
+
// for uploads. FormData support may be added in a future version.
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// src/resources/custom-fields.ts
|
|
450
|
+
var CustomFieldsResource = class extends BaseResource {
|
|
451
|
+
async list() {
|
|
452
|
+
return this.http.get("/custom-fields");
|
|
453
|
+
}
|
|
454
|
+
async listByType(entityType) {
|
|
455
|
+
return this.http.get(`/custom-fields/type/${entityType}`);
|
|
456
|
+
}
|
|
457
|
+
async create(params) {
|
|
458
|
+
return this.http.post("/custom-fields/create", params);
|
|
459
|
+
}
|
|
460
|
+
async update(id, params) {
|
|
461
|
+
return this.http.put(`/custom-fields/edit/${id}`, params);
|
|
462
|
+
}
|
|
463
|
+
async delete(id) {
|
|
464
|
+
return this.http.delete(`/custom-fields/delete/${id}`);
|
|
465
|
+
}
|
|
466
|
+
async getValues(entityId) {
|
|
467
|
+
return this.http.get(`/custom-fields/entities/${entityId}`);
|
|
468
|
+
}
|
|
469
|
+
async setValues(entityId, params) {
|
|
470
|
+
return this.http.post(`/custom-fields/entities/${entityId}/values`, params);
|
|
471
|
+
}
|
|
472
|
+
async getProductValues(productId) {
|
|
473
|
+
return this.http.get(`/custom-fields/products/${productId}`);
|
|
474
|
+
}
|
|
475
|
+
async setProductValues(productId, params) {
|
|
476
|
+
return this.http.post(`/custom-fields/products/${productId}/values`, params);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
// src/resources/payments.ts
|
|
481
|
+
var PaymentsResource = class extends BaseResource {
|
|
482
|
+
async charge(params) {
|
|
483
|
+
return this.http.post("/grow/payments/charge", params);
|
|
484
|
+
}
|
|
485
|
+
async refund(params) {
|
|
486
|
+
return this.http.post("/grow/payments/refund", params);
|
|
487
|
+
}
|
|
488
|
+
async listTransactions(params) {
|
|
489
|
+
return this.http.get("/grow/payments/transactions", params);
|
|
490
|
+
}
|
|
491
|
+
async getTransaction(id) {
|
|
492
|
+
return this.http.get(`/grow/payments/transactions/${id}`);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
// src/resources/settings.ts
|
|
497
|
+
var SettingsResource = class extends BaseResource {
|
|
498
|
+
async get() {
|
|
499
|
+
return this.http.get("/settings");
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
// src/client.ts
|
|
504
|
+
var GlanceClient = class {
|
|
505
|
+
clients;
|
|
506
|
+
contacts;
|
|
507
|
+
addresses;
|
|
508
|
+
products;
|
|
509
|
+
productSerials;
|
|
510
|
+
warehouses;
|
|
511
|
+
inventory;
|
|
512
|
+
inventoryMovements;
|
|
513
|
+
documents;
|
|
514
|
+
vendors;
|
|
515
|
+
purchase;
|
|
516
|
+
expenses;
|
|
517
|
+
retainers;
|
|
518
|
+
reports;
|
|
519
|
+
employees;
|
|
520
|
+
files;
|
|
521
|
+
customFields;
|
|
522
|
+
payments;
|
|
523
|
+
settings;
|
|
524
|
+
constructor(options) {
|
|
525
|
+
if (!options.apiKey) {
|
|
526
|
+
throw new Error("apiKey is required");
|
|
527
|
+
}
|
|
528
|
+
const http = new HttpClient(options);
|
|
529
|
+
this.clients = new ClientsResource(http);
|
|
530
|
+
this.contacts = new ContactsResource(http);
|
|
531
|
+
this.addresses = new AddressesResource(http);
|
|
532
|
+
this.products = new ProductsResource(http);
|
|
533
|
+
this.productSerials = new ProductSerialsResource(http);
|
|
534
|
+
this.warehouses = new WarehousesResource(http);
|
|
535
|
+
this.inventory = new InventoryResource(http);
|
|
536
|
+
this.inventoryMovements = new InventoryMovementsResource(http);
|
|
537
|
+
this.documents = new DocumentsResource(http);
|
|
538
|
+
this.vendors = new VendorsResource(http);
|
|
539
|
+
this.purchase = new PurchaseResource(http);
|
|
540
|
+
this.expenses = new ExpensesResource(http);
|
|
541
|
+
this.retainers = new RetainersResource(http);
|
|
542
|
+
this.reports = new ReportsResource(http);
|
|
543
|
+
this.employees = new EmployeesResource(http);
|
|
544
|
+
this.files = new FilesResource(http);
|
|
545
|
+
this.customFields = new CustomFieldsResource(http);
|
|
546
|
+
this.payments = new PaymentsResource(http);
|
|
547
|
+
this.settings = new SettingsResource(http);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// src/core/pagination.ts
|
|
552
|
+
function toPageResult(response) {
|
|
553
|
+
return {
|
|
554
|
+
data: response.data,
|
|
555
|
+
pagination: response.pagination,
|
|
556
|
+
hasMore: response.pagination.hasMore
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export { GlanceApiError, GlanceAuthenticationError, GlanceClient, GlanceError, GlanceNotFoundError, GlanceRateLimitError, GlanceValidationError, toPageResult };
|
|
561
|
+
//# sourceMappingURL=index.js.map
|
|
562
|
+
//# sourceMappingURL=index.js.map
|