@ptkl/sdk 0.10.1 → 1.0.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.
Files changed (135) hide show
  1. package/dist/{index.iife.js → index.0.10.js} +1206 -238
  2. package/dist/index.0.9.js +2849 -0
  3. package/dist/package.json +12 -7
  4. package/dist/v0.10/api/component.d.ts +128 -0
  5. package/dist/v0.10/api/componentUtils.d.ts +7 -0
  6. package/dist/v0.10/api/index.d.ts +22 -0
  7. package/dist/v0.10/api/integrations/dms.d.ts +469 -0
  8. package/dist/v0.10/api/integrations/minimax.d.ts +289 -0
  9. package/dist/v0.10/api/integrations/payments.d.ts +40 -0
  10. package/dist/{types → v0.10}/api/integrations.d.ts +2 -0
  11. package/dist/{types → v0.10}/api/integrationsBaseClient.d.ts +3 -0
  12. package/dist/{types → v0.10}/api/platform.d.ts +2 -2
  13. package/dist/v0.10/apiUser.d.ts +9 -0
  14. package/dist/v0.10/apps.d.ts +8 -0
  15. package/dist/v0.10/baseClient.d.ts +6 -0
  16. package/dist/{types/api → v0.10}/component.d.ts +39 -4
  17. package/dist/v0.10/componentUtils.d.ts +7 -0
  18. package/dist/v0.10/config.d.ts +14 -0
  19. package/dist/v0.10/forge.d.ts +7 -0
  20. package/dist/v0.10/functions.d.ts +23 -0
  21. package/dist/{index.cjs.js → v0.10/index.cjs.js} +1206 -238
  22. package/dist/v0.10/index.d.ts +21 -0
  23. package/dist/{index.esm.js → v0.10/index.esm.js} +1205 -235
  24. package/dist/{types/api → v0.10}/integrations/dms.d.ts +11 -1
  25. package/dist/v0.10/integrations/invoicing.d.ts +6 -0
  26. package/dist/v0.10/integrations/minimax.d.ts +289 -0
  27. package/dist/v0.10/integrations/payments.d.ts +40 -0
  28. package/dist/v0.10/integrations/serbiaUtil.d.ts +10 -0
  29. package/dist/v0.10/integrations/vpfr.d.ts +4 -0
  30. package/dist/v0.10/integrations.d.ts +22 -0
  31. package/dist/v0.10/integrationsBaseClient.d.ts +11 -0
  32. package/dist/v0.10/platform.d.ts +34 -0
  33. package/dist/v0.10/platformBaseClient.d.ts +27 -0
  34. package/dist/v0.10/project.d.ts +146 -0
  35. package/dist/v0.10/ratchet.d.ts +196 -0
  36. package/dist/v0.10/sandbox.d.ts +14 -0
  37. package/dist/v0.10/system.d.ts +4 -0
  38. package/dist/v0.10/thunder.d.ts +13 -0
  39. package/dist/v0.10/types/component.d.ts +110 -0
  40. package/dist/{types → v0.10}/types/integrations.d.ts +114 -1
  41. package/dist/v0.10/users.d.ts +69 -0
  42. package/dist/v0.10/workflow.d.ts +5 -0
  43. package/dist/v0.9/api/apiUser.d.ts +9 -0
  44. package/dist/v0.9/api/apps.d.ts +8 -0
  45. package/dist/v0.9/api/baseClient.d.ts +6 -0
  46. package/dist/v0.9/api/component.d.ts +136 -0
  47. package/dist/v0.9/api/componentUtils.d.ts +7 -0
  48. package/dist/v0.9/api/config.d.ts +14 -0
  49. package/dist/v0.9/api/forge.d.ts +7 -0
  50. package/dist/v0.9/api/functions.d.ts +23 -0
  51. package/dist/v0.9/api/index.d.ts +24 -0
  52. package/dist/v0.9/api/integrations/dms.d.ts +419 -0
  53. package/dist/v0.9/api/integrations/invoicing.d.ts +6 -0
  54. package/dist/v0.9/api/integrations/minimax.d.ts +289 -0
  55. package/dist/v0.9/api/integrations/payments.d.ts +40 -0
  56. package/dist/v0.9/api/integrations/serbiaUtil.d.ts +10 -0
  57. package/dist/v0.9/api/integrations/vpfr.d.ts +4 -0
  58. package/dist/v0.9/api/integrations.d.ts +22 -0
  59. package/dist/v0.9/api/integrationsBaseClient.d.ts +11 -0
  60. package/dist/v0.9/api/platform.d.ts +34 -0
  61. package/dist/v0.9/api/platformBaseClient.d.ts +27 -0
  62. package/dist/v0.9/api/project.d.ts +146 -0
  63. package/dist/v0.9/api/ratchet.d.ts +196 -0
  64. package/dist/v0.9/api/sandbox.d.ts +14 -0
  65. package/dist/v0.9/api/system.d.ts +4 -0
  66. package/dist/v0.9/api/thunder.d.ts +13 -0
  67. package/dist/v0.9/api/users.d.ts +69 -0
  68. package/dist/v0.9/api/workflow.d.ts +5 -0
  69. package/dist/v0.9/apiUser.d.ts +9 -0
  70. package/dist/v0.9/apps.d.ts +8 -0
  71. package/dist/v0.9/baseClient.d.ts +6 -0
  72. package/dist/v0.9/component.d.ts +128 -0
  73. package/dist/v0.9/componentUtils.d.ts +7 -0
  74. package/dist/v0.9/config.d.ts +14 -0
  75. package/dist/v0.9/forge.d.ts +7 -0
  76. package/dist/v0.9/functions.d.ts +23 -0
  77. package/dist/v0.9/index.cjs.js +21811 -0
  78. package/dist/v0.9/index.d.ts +21 -0
  79. package/dist/v0.9/index.esm.js +2820 -0
  80. package/dist/v0.9/integrations/dms.d.ts +469 -0
  81. package/dist/v0.9/integrations/invoicing.d.ts +6 -0
  82. package/dist/v0.9/integrations/minimax.d.ts +289 -0
  83. package/dist/v0.9/integrations/payments.d.ts +40 -0
  84. package/dist/v0.9/integrations/serbiaUtil.d.ts +10 -0
  85. package/dist/v0.9/integrations/vpfr.d.ts +4 -0
  86. package/dist/v0.9/integrations.d.ts +22 -0
  87. package/dist/v0.9/integrationsBaseClient.d.ts +11 -0
  88. package/dist/v0.9/platform.d.ts +34 -0
  89. package/dist/v0.9/platformBaseClient.d.ts +27 -0
  90. package/dist/v0.9/project.d.ts +146 -0
  91. package/dist/v0.9/ratchet.d.ts +196 -0
  92. package/dist/v0.9/sandbox.d.ts +14 -0
  93. package/dist/v0.9/system.d.ts +4 -0
  94. package/dist/v0.9/thunder.d.ts +13 -0
  95. package/dist/v0.9/types/component.d.ts +116 -0
  96. package/dist/v0.9/types/config.d.ts +11 -0
  97. package/dist/v0.9/types/integrations.d.ts +321 -0
  98. package/dist/v0.9/types/project.d.ts +64 -0
  99. package/dist/v0.9/types/ratchet.d.ts +38 -0
  100. package/dist/v0.9/types/users.d.ts +66 -0
  101. package/dist/v0.9/users.d.ts +69 -0
  102. package/dist/v0.9/util/detectEnv.d.ts +4 -0
  103. package/dist/v0.9/workflow.d.ts +5 -0
  104. package/package.json +12 -7
  105. package/dist/monaco.d.ts +0 -887
  106. package/dist/types/api/componentUtils.d.ts +0 -5
  107. package/dist/types/api/index.d.ts +0 -13
  108. package/dist/types/api/integrations/media.d.ts +0 -17
  109. package/dist/types/api/integrations/payments.d.ts +0 -7
  110. package/dist/types/api/roles.d.ts +0 -9
  111. package/dist/types/index.d.ts +0 -29
  112. package/dist/types/types/component.d.ts +0 -50
  113. package/dist/types/types/media.d.ts +0 -103
  114. /package/dist/{types → v0.10}/api/apiUser.d.ts +0 -0
  115. /package/dist/{types → v0.10}/api/apps.d.ts +0 -0
  116. /package/dist/{types → v0.10}/api/baseClient.d.ts +0 -0
  117. /package/dist/{types → v0.10}/api/config.d.ts +0 -0
  118. /package/dist/{types → v0.10}/api/forge.d.ts +0 -0
  119. /package/dist/{types → v0.10}/api/functions.d.ts +0 -0
  120. /package/dist/{types → v0.10}/api/integrations/invoicing.d.ts +0 -0
  121. /package/dist/{types → v0.10}/api/integrations/serbiaUtil.d.ts +0 -0
  122. /package/dist/{types → v0.10}/api/integrations/vpfr.d.ts +0 -0
  123. /package/dist/{types → v0.10}/api/platformBaseClient.d.ts +0 -0
  124. /package/dist/{types → v0.10}/api/project.d.ts +0 -0
  125. /package/dist/{types → v0.10}/api/ratchet.d.ts +0 -0
  126. /package/dist/{types → v0.10}/api/sandbox.d.ts +0 -0
  127. /package/dist/{types → v0.10}/api/system.d.ts +0 -0
  128. /package/dist/{types → v0.10}/api/thunder.d.ts +0 -0
  129. /package/dist/{types → v0.10}/api/users.d.ts +0 -0
  130. /package/dist/{types → v0.10}/api/workflow.d.ts +0 -0
  131. /package/dist/{types → v0.10}/types/config.d.ts +0 -0
  132. /package/dist/{types → v0.10}/types/project.d.ts +0 -0
  133. /package/dist/{types → v0.10}/types/ratchet.d.ts +0 -0
  134. /package/dist/{types → v0.10}/types/users.d.ts +0 -0
  135. /package/dist/{types → v0.10}/util/detectEnv.d.ts +0 -0
@@ -34,27 +34,32 @@ const isBrowser = typeof window !== "undefined" &&
34
34
  */
35
35
  class PlatformBaseClient extends BaseClient {
36
36
  constructor(options) {
37
- var _a, _b, _c;
37
+ var _a, _b, _c, _d, _e, _f, _g;
38
38
  let { env = null, token = null, host = null, } = options !== null && options !== void 0 ? options : {};
39
39
  let headers = {};
40
40
  var project_uuid = null;
41
41
  if (isBrowser) {
42
- console.log("PlatformBaseClient: running in browser context");
43
42
  if (sessionStorage.getItem('protokol_context') == "forge") {
44
43
  headers['X-Project-Env'] = (_a = sessionStorage.getItem('forge_app_env')) !== null && _a !== void 0 ? _a : "dev";
45
44
  }
46
45
  else {
47
46
  headers['X-Project-Env'] = (_b = localStorage.getItem('current_env')) !== null && _b !== void 0 ? _b : "dev";
48
47
  }
48
+ if (typeof window !== "undefined") {
49
+ // @ts-ignore
50
+ const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
51
+ host = (_c = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _c !== void 0 ? _c : host;
52
+ // @ts-ignore
53
+ env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
54
+ token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
55
+ project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
56
+ }
49
57
  }
50
- if (typeof window !== "undefined") {
51
- // @ts-ignore
52
- const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
53
- host = (_c = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _c !== void 0 ? _c : host;
54
- // @ts-ignore
55
- env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
56
- token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
57
- project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
58
+ else if (process && process.env) {
59
+ host = (_d = host !== null && host !== void 0 ? host : process.env.API_HOST) !== null && _d !== void 0 ? _d : null;
60
+ env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
61
+ token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
62
+ project_uuid = (_g = process.env.PROJECT_UUID) !== null && _g !== void 0 ? _g : null;
58
63
  }
59
64
  if (token) {
60
65
  headers['Authorization'] = `Bearer ${token}`;
@@ -81,198 +86,22 @@ class PlatformBaseClient extends BaseClient {
81
86
  }
82
87
  }
83
88
 
84
- class Functions extends PlatformBaseClient {
85
- async list() {
86
- return await this.client.get("/v1/system/function");
87
- }
88
- async get(ref) {
89
- return await this.client.get(`/v1/system/function/${ref}`);
90
- }
91
- async update(uuid, update) {
92
- return await this.client.patch(`/v1/system/function/${uuid}`, update);
93
- }
94
- /**
95
- * Run platform function
96
- *
97
- * @param id - Function ID
98
- * @param input - Input data
99
- * @param query - Query parameters
100
- * @returns - Function result
101
- *
102
- * @example
103
- * const result = await platform.function().run("myFunction", {input: { foo: "bar" }})
104
- */
105
- async run(id, d) {
106
- const { data } = await this.client.post(`/v1/system/function/run/${id}`, d.input, {
107
- params: d.query,
108
- headers: d.headers
109
- });
110
- return data;
111
- }
112
- async generateSignature(ref, env) {
113
- return await this.client.get(`/v1/system/function/signature/${env}/${ref}`);
114
- }
115
- }
116
-
117
- class APIUser extends PlatformBaseClient {
118
- async auth(username, password, project) {
119
- return this.client.post("/v1/user/api/auth", {
120
- username,
121
- password
122
- }, {
123
- headers: {
124
- "X-Project-Uuid": project
125
- }
126
- });
127
- }
128
- async newSecret(uuid) {
129
- return await this.client.post(`/v1/user/api-user/secret/${uuid}`, {});
130
- }
131
- async revokeSecret(uuid) {
132
- return await this.client.delete(`/v1/user/api-user/secret/${uuid}`);
133
- }
134
- async edit(uuid, roles) {
135
- return await this.client.patch(`/v1/user/api-user/${uuid}`, { roles });
136
- }
137
- async list() {
138
- return await this.client.get(`/v1/user/api-user`);
139
- }
140
- async get(uuid) {
141
- return await this.client.get(`/v1/user/api-user/${uuid}`);
142
- }
143
- }
144
-
145
- class Users extends PlatformBaseClient {
146
- async auth(username, password, project) {
147
- return await this.client.post("/v1/user/login", {
148
- username,
149
- password,
150
- response_type: 'token',
151
- }, {
152
- headers: {
153
- 'X-Project-Uuid': project
154
- }
155
- });
156
- }
157
- /**
158
- * Resend confirmation email
159
- * @param email User email
160
- */
161
- async resendConfirmationEmail(email) {
162
- return await this.client.post("/v1/user/send/confirmation/email", {
163
- email,
164
- });
165
- }
166
- // Password Reset (Request Only)
167
- // Note: Only the REQUEST is exposed, not the password reset completion
168
- // The actual password reset should be done through the official web interface
169
- /**
170
- * Request password reset email
171
- * This only sends an email with a reset link, does not expose or change passwords
172
- * @param email User email
173
- */
174
- async requestPasswordReset(email) {
175
- return await this.client.post("/v1/user/resetpassword", { email });
176
- }
177
- // User Profile & Management
178
- /**
179
- * Get current user's model
180
- */
181
- async getUser() {
182
- return await this.client.get("/v1/user/model");
183
- }
184
- /**
185
- * Get current user's claims
186
- */
187
- async getClaims() {
188
- return await this.client.get("/v1/user/claims");
189
- }
190
- /**
191
- * Edit user profile
192
- * @param data Profile update data
193
- */
194
- async editProfile(data) {
195
- return await this.client.post("/v1/user/profile/edit", data);
196
- }
197
- // Permissions & Roles
198
- /**
199
- * Get user permissions
200
- */
201
- async getPermissions() {
202
- return await this.client.get("/v1/user/role/permissions");
203
- }
204
- /**
205
- * Get list of available permissions
206
- */
207
- async listPermissions() {
208
- return await this.client.get("/v1/user/permissions/list");
209
- }
210
- /**
211
- * Create a new role
212
- * @param role Role data including name, permissions, workspaces, and level
213
- */
214
- async createRole(role) {
215
- return await this.client.post("/v1/user/role/create", role);
216
- }
217
- /**
218
- * Delete a role
219
- * @param uuid Role UUID
220
- */
221
- async deleteRole(uuid) {
222
- return await this.client.delete(`/v1/user/role/delete/${uuid}`);
223
- }
224
- /**
225
- * List all roles
226
- */
227
- async listRoles() {
228
- return await this.client.get(`/v1/user/role/list`);
229
- }
230
- /**
231
- * Get role details by UUID
232
- * @param uuid Role UUID
233
- */
234
- async getRoleModel(uuid) {
235
- return await this.client.get(`/v1/user/role/edit/${uuid}`);
236
- }
237
- /**
238
- * Edit a role
239
- * @param uuid Role UUID
240
- * @param data Role update data including permissions, workspaces, and level
241
- */
242
- async editRole(uuid, data) {
243
- return await this.client.post(`/v1/user/role/edit/${uuid}`, data);
244
- }
245
- /**
246
- * @deprecated Use getPermissions() instead
247
- */
248
- async permissions() {
249
- return await this.client.get(`/v1/user/role/permissions`);
250
- }
251
- }
252
-
253
- class Apps extends PlatformBaseClient {
254
- constructor(appType) {
255
- super();
256
- this.appType = appType;
257
- }
258
- async updateSettings(updateValues, ref) {
259
- const payload = { ...updateValues };
260
- return await this.client.put(`/v3/system/gateway/app-service/${this.appType}/${ref}/settings`, payload);
261
- }
262
- async download(ref, version) {
263
- return await this.client.post(`/v3/system/gateway/app-service/${this.appType}/download`, { version, uuid: ref }, { responseType: "arraybuffer" });
264
- }
265
- async upload(formData) {
266
- return await this.client.post(`/v3/system/gateway/app-service/${this.appType}/upload`, formData, {
267
- timeout: 60000
268
- });
269
- }
270
- }
271
-
272
89
  class Component extends PlatformBaseClient {
273
- constructor(ref = null) {
90
+ constructor(ref = null, options) {
91
+ var _a;
274
92
  super();
275
93
  this.ref = ref;
94
+ this.version = (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : null;
95
+ }
96
+ /**
97
+ * Get the base path for component API calls
98
+ * @private
99
+ */
100
+ getComponentPath() {
101
+ if (this.version) {
102
+ return `/v3/system/component/${this.ref}/v/${this.version}`;
103
+ }
104
+ return `/v3/system/component/${this.ref}`;
276
105
  }
277
106
  /**
278
107
  * Find method to search for models
@@ -342,7 +171,7 @@ class Component extends PlatformBaseClient {
342
171
  params[`_opt_${k}`] = opts ? opts[k] : null;
343
172
  });
344
173
  }
345
- return await this.client.get(`/v3/system/component/${this.ref}/models`, {
174
+ return await this.client.get(`${this.getComponentPath()}/models`, {
346
175
  params: params,
347
176
  headers: {
348
177
  'X-Cache': cache,
@@ -381,7 +210,7 @@ class Component extends PlatformBaseClient {
381
210
  * @returns (Promise<Model>)
382
211
  */
383
212
  async get(uuid) {
384
- return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}`);
213
+ return await this.client.get(`${this.getComponentPath()}/model/${uuid}`);
385
214
  }
386
215
  /**
387
216
  * Update model by uuid
@@ -391,7 +220,7 @@ class Component extends PlatformBaseClient {
391
220
  * @returns
392
221
  */
393
222
  async update(uuid, data, options) {
394
- return await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
223
+ return await this.client.post(`${this.getComponentPath()}/model/${uuid}`, {
395
224
  data,
396
225
  options,
397
226
  });
@@ -404,9 +233,9 @@ class Component extends PlatformBaseClient {
404
233
  * @returns
405
234
  */
406
235
  async updateMany(data, options) {
407
- return await this.client.post(`/v3/system/component/${this.ref}/models/bulk`, {
236
+ return await this.client.patch(`${this.getComponentPath()}/models/bulk`, {
408
237
  data,
409
- options,
238
+ options
410
239
  });
411
240
  }
412
241
  /**
@@ -417,7 +246,7 @@ class Component extends PlatformBaseClient {
417
246
  * @returns
418
247
  */
419
248
  async modify(filters, data, options) {
420
- return await this.client.patch(`/v3/system/component/${this.ref}/modify/model`, {
249
+ return await this.client.patch(`${this.getComponentPath()}/modify/model`, {
421
250
  filters,
422
251
  data,
423
252
  options,
@@ -432,20 +261,84 @@ class Component extends PlatformBaseClient {
432
261
  * @returns
433
262
  */
434
263
  async concurrentUpdate(uuid, version, data, options) {
435
- return await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
264
+ return await this.client.post(`${this.getComponentPath()}/model/${uuid}`, {
436
265
  version: version,
437
266
  data,
438
267
  options,
439
268
  });
440
269
  }
441
270
  async create(model) {
442
- return await this.client.post(`/v3/system/component/${this.ref}/model`, model);
271
+ return await this.client.post(`${this.getComponentPath()}/model`, model);
443
272
  }
444
273
  async delete(uuid) {
445
- return await this.client.delete(`/v3/system/component/${this.ref}/model/${uuid}`);
274
+ return await this.client.delete(`${this.getComponentPath()}/model/${uuid}`);
446
275
  }
447
- async aggregate(pipeline) {
448
- return await this.client.post(`/v3/system/component/${this.ref}/aggregate`, pipeline);
276
+ /**
277
+ * Execute aggregate pipeline with optional streaming support
278
+ *
279
+ * Returns a chainable object that allows both buffered and streaming modes.
280
+ * Call .onData() to enable streaming mode, or await directly for buffered mode.
281
+ *
282
+ * @param {FindAggregateParams} pipeline - MongoDB aggregation pipeline
283
+ *
284
+ * @returns {AggregateChainable} Chainable object with streaming methods and Promise interface
285
+ *
286
+ * @example
287
+ * ```typescript
288
+ * // Buffered response (default, up to 5K documents)
289
+ * const result = await component.aggregate([{ $match: { status: 'active' } }]);
290
+ * console.log(result.data); // All results at once
291
+ *
292
+ * // Streaming response (up to 25K documents)
293
+ * await component.aggregate([{ $match: { status: 'active' } }])
294
+ * .onData((doc) => console.log('Received:', doc))
295
+ * .onError((err) => console.error('Error:', err))
296
+ * .onEnd(() => console.log('Stream complete'));
297
+ * ```
298
+ */
299
+ aggregate(pipeline) {
300
+ let onDataCallback = () => { };
301
+ let onErrorCallback;
302
+ let onEndCallback;
303
+ let isStreaming = false;
304
+ let streamPromise = null;
305
+ const chainable = {
306
+ onData: (callback) => {
307
+ onDataCallback = callback;
308
+ isStreaming = true;
309
+ return chainable;
310
+ },
311
+ onError: (callback) => {
312
+ onErrorCallback = callback;
313
+ return chainable;
314
+ },
315
+ onEnd: (callback) => {
316
+ onEndCallback = callback;
317
+ return chainable;
318
+ },
319
+ then: (resolve, reject) => {
320
+ if (isStreaming) {
321
+ if (!streamPromise) {
322
+ const handler = {
323
+ onData: onDataCallback,
324
+ onError: onErrorCallback,
325
+ onEnd: onEndCallback
326
+ };
327
+ streamPromise = this._streamNDJSON(`${this.getComponentPath()}/aggregate`, {
328
+ 'Accept': 'application/x-ndjson',
329
+ 'Content-Type': 'application/json'
330
+ }, handler, pipeline);
331
+ }
332
+ return streamPromise.then(resolve, reject);
333
+ }
334
+ return this.client.post(`${this.getComponentPath()}/aggregate`, pipeline)
335
+ .then(resolve, reject);
336
+ },
337
+ catch: (reject) => {
338
+ return chainable.then(undefined, reject);
339
+ }
340
+ };
341
+ return chainable;
449
342
  }
450
343
  async settings() {
451
344
  return await this.client.get(`/v3/system/component/settings/${this.ref}`);
@@ -463,18 +356,281 @@ class Component extends PlatformBaseClient {
463
356
  });
464
357
  }
465
358
  async workflow(event, input) {
466
- return await this.client.post(`/v3/system/component/${this.ref}/workflow/event`, {
359
+ return await this.client.post(`${this.getComponentPath()}/workflow/event`, {
467
360
  event,
468
361
  input
469
362
  });
470
363
  }
471
364
  async function(name, input) {
472
- return await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, {
365
+ return await this.client.post(`${this.getComponentPath()}/function/${name}`, {
473
366
  data: input
474
367
  });
475
368
  }
476
369
  async revisions(uuid) {
477
- return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}/revisions`);
370
+ return await this.client.get(`${this.getComponentPath()}/model/${uuid}/revisions`);
371
+ }
372
+ /**
373
+ * Internal method to handle NDJSON streaming responses
374
+ *
375
+ * @private
376
+ */
377
+ async _streamNDJSON(url, headers, handler, body) {
378
+ try {
379
+ const config = {
380
+ headers,
381
+ responseType: 'stream'
382
+ };
383
+ const response = await this.client.post(url, body, config);
384
+ const stream = response.data;
385
+ let buffer = '';
386
+ return new Promise((resolve, reject) => {
387
+ stream.on('data', (chunk) => {
388
+ buffer += chunk.toString();
389
+ // Process complete lines (separated by newlines)
390
+ const lines = buffer.split('\n');
391
+ buffer = lines.pop() || ''; // Keep incomplete line in buffer
392
+ for (const line of lines) {
393
+ if (line.trim()) {
394
+ try {
395
+ const document = JSON.parse(line);
396
+ const result = handler.onData(document);
397
+ // Support async callbacks
398
+ if (result instanceof Promise) {
399
+ result.catch((err) => {
400
+ if (handler.onError) {
401
+ handler.onError(err);
402
+ }
403
+ });
404
+ }
405
+ }
406
+ catch (err) {
407
+ if (handler.onError) {
408
+ handler.onError(err);
409
+ }
410
+ }
411
+ }
412
+ }
413
+ });
414
+ stream.on('end', () => {
415
+ // Process any remaining data in buffer
416
+ if (buffer.trim()) {
417
+ try {
418
+ const document = JSON.parse(buffer);
419
+ handler.onData(document);
420
+ }
421
+ catch (err) {
422
+ if (handler.onError) {
423
+ handler.onError(err);
424
+ }
425
+ }
426
+ }
427
+ if (handler.onEnd) {
428
+ handler.onEnd();
429
+ }
430
+ resolve();
431
+ });
432
+ stream.on('error', (err) => {
433
+ if (handler.onError) {
434
+ handler.onError(err);
435
+ }
436
+ reject(err);
437
+ });
438
+ });
439
+ }
440
+ catch (err) {
441
+ if (handler.onError) {
442
+ handler.onError(err);
443
+ }
444
+ throw err;
445
+ }
446
+ }
447
+ }
448
+
449
+ class Functions extends PlatformBaseClient {
450
+ async list() {
451
+ return await this.client.get("/v1/system/function");
452
+ }
453
+ async get(ref) {
454
+ return await this.client.get(`/v1/system/function/${ref}`);
455
+ }
456
+ async update(uuid, update) {
457
+ return await this.client.patch(`/v1/system/function/${uuid}`, update);
458
+ }
459
+ /**
460
+ * Run platform function
461
+ *
462
+ * @param id - Function ID
463
+ * @param input - Input data
464
+ * @param query - Query parameters
465
+ * @returns - Function result
466
+ *
467
+ * @example
468
+ * const result = await platform.function().run("myFunction", {input: { foo: "bar" }})
469
+ */
470
+ async run(id, d) {
471
+ const { data } = await this.client.post(`/v1/system/function/run/${id}`, d.input, {
472
+ params: d.query,
473
+ headers: d.headers
474
+ });
475
+ return data;
476
+ }
477
+ async generateSignature(ref, env) {
478
+ return await this.client.get(`/v1/system/function/signature/${env}/${ref}`);
479
+ }
480
+ }
481
+
482
+ class APIUser extends PlatformBaseClient {
483
+ async auth(username, password, project) {
484
+ return this.client.post("/v1/user/api/auth", {
485
+ username,
486
+ password
487
+ }, {
488
+ headers: {
489
+ "X-Project-Uuid": project
490
+ }
491
+ });
492
+ }
493
+ async newSecret(uuid) {
494
+ return await this.client.post(`/v1/user/api-user/secret/${uuid}`, {});
495
+ }
496
+ async revokeSecret(uuid) {
497
+ return await this.client.delete(`/v1/user/api-user/secret/${uuid}`);
498
+ }
499
+ async edit(uuid, roles) {
500
+ return await this.client.patch(`/v1/user/api-user/${uuid}`, { roles });
501
+ }
502
+ async list() {
503
+ return await this.client.get(`/v1/user/api-user`);
504
+ }
505
+ async get(uuid) {
506
+ return await this.client.get(`/v1/user/api-user/${uuid}`);
507
+ }
508
+ }
509
+
510
+ class Users extends PlatformBaseClient {
511
+ async auth(username, password, project) {
512
+ return await this.client.post("/v1/user/login", {
513
+ username,
514
+ password,
515
+ response_type: 'token',
516
+ }, {
517
+ headers: {
518
+ 'X-Project-Uuid': project
519
+ }
520
+ });
521
+ }
522
+ /**
523
+ * Resend confirmation email
524
+ * @param email User email
525
+ */
526
+ async resendConfirmationEmail(email) {
527
+ return await this.client.post("/v1/user/send/confirmation/email", {
528
+ email,
529
+ });
530
+ }
531
+ // Password Reset (Request Only)
532
+ // Note: Only the REQUEST is exposed, not the password reset completion
533
+ // The actual password reset should be done through the official web interface
534
+ /**
535
+ * Request password reset email
536
+ * This only sends an email with a reset link, does not expose or change passwords
537
+ * @param email User email
538
+ */
539
+ async requestPasswordReset(email) {
540
+ return await this.client.post("/v1/user/resetpassword", { email });
541
+ }
542
+ // User Profile & Management
543
+ /**
544
+ * Get current user's model
545
+ */
546
+ async getUser() {
547
+ return await this.client.get("/v1/user/model");
548
+ }
549
+ /**
550
+ * Get current user's claims
551
+ */
552
+ async getClaims() {
553
+ return await this.client.get("/v1/user/claims");
554
+ }
555
+ /**
556
+ * Edit user profile
557
+ * @param data Profile update data
558
+ */
559
+ async editProfile(data) {
560
+ return await this.client.post("/v1/user/profile/edit", data);
561
+ }
562
+ // Permissions & Roles
563
+ /**
564
+ * Get user permissions
565
+ */
566
+ async getPermissions() {
567
+ return await this.client.get("/v1/user/role/permissions");
568
+ }
569
+ /**
570
+ * Get list of available permissions
571
+ */
572
+ async listPermissions() {
573
+ return await this.client.get("/v1/user/permissions/list");
574
+ }
575
+ /**
576
+ * Create a new role
577
+ * @param role Role data including name, permissions, workspaces, and level
578
+ */
579
+ async createRole(role) {
580
+ return await this.client.post("/v1/user/role/create", role);
581
+ }
582
+ /**
583
+ * Delete a role
584
+ * @param uuid Role UUID
585
+ */
586
+ async deleteRole(uuid) {
587
+ return await this.client.delete(`/v1/user/role/delete/${uuid}`);
588
+ }
589
+ /**
590
+ * List all roles
591
+ */
592
+ async listRoles() {
593
+ return await this.client.get(`/v1/user/role/list`);
594
+ }
595
+ /**
596
+ * Get role details by UUID
597
+ * @param uuid Role UUID
598
+ */
599
+ async getRoleModel(uuid) {
600
+ return await this.client.get(`/v1/user/role/edit/${uuid}`);
601
+ }
602
+ /**
603
+ * Edit a role
604
+ * @param uuid Role UUID
605
+ * @param data Role update data including permissions, workspaces, and level
606
+ */
607
+ async editRole(uuid, data) {
608
+ return await this.client.post(`/v1/user/role/edit/${uuid}`, data);
609
+ }
610
+ /**
611
+ * @deprecated Use getPermissions() instead
612
+ */
613
+ async permissions() {
614
+ return await this.client.get(`/v1/user/role/permissions`);
615
+ }
616
+ }
617
+
618
+ class Apps extends PlatformBaseClient {
619
+ constructor(appType) {
620
+ super();
621
+ this.appType = appType;
622
+ }
623
+ async updateSettings(updateValues, ref) {
624
+ const payload = { ...updateValues };
625
+ return await this.client.put(`/v3/system/gateway/app-service/${this.appType}/${ref}/settings`, payload);
626
+ }
627
+ async download(ref, version) {
628
+ return await this.client.post(`/v3/system/gateway/app-service/${this.appType}/download`, { version, uuid: ref }, { responseType: "arraybuffer" });
629
+ }
630
+ async upload(formData) {
631
+ return await this.client.post(`/v3/system/gateway/app-service/${this.appType}/upload`, formData, {
632
+ timeout: 60000
633
+ });
478
634
  }
479
635
  }
480
636
 
@@ -1009,8 +1165,8 @@ class Platform extends PlatformBaseClient {
1009
1165
  forge() {
1010
1166
  return (new Forge()).setClient(this.client);
1011
1167
  }
1012
- component(ref) {
1013
- return (new Component(ref)).setClient(this.client);
1168
+ component(ref, options) {
1169
+ return (new Component(ref, options)).setClient(this.client);
1014
1170
  }
1015
1171
  componentUtils() {
1016
1172
  return (new ComponentUtils()).setClient(this.client);
@@ -1065,8 +1221,8 @@ class Invoicing extends PlatformBaseClient {
1065
1221
 
1066
1222
  class IntegrationsBaseClient extends BaseClient {
1067
1223
  constructor(options) {
1068
- var _a, _b, _c;
1069
- let { env = null, token, host, } = options !== null && options !== void 0 ? options : {};
1224
+ var _a, _b, _c, _d, _e, _f, _g;
1225
+ let { env = null, token = null, host = null, } = options !== null && options !== void 0 ? options : {};
1070
1226
  let headers = {};
1071
1227
  var project_uuid = null;
1072
1228
  if (isBrowser) {
@@ -1076,16 +1232,22 @@ class IntegrationsBaseClient extends BaseClient {
1076
1232
  else {
1077
1233
  headers['X-Project-Env'] = (_b = localStorage.getItem('current_env')) !== null && _b !== void 0 ? _b : "dev";
1078
1234
  }
1235
+ if (typeof window !== "undefined") {
1236
+ // @ts-ignore
1237
+ const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
1238
+ host = (_c = __global_env__.INTEGRATION_API) !== null && _c !== void 0 ? _c : host;
1239
+ // @ts-ignore
1240
+ token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
1241
+ // @ts-ignore
1242
+ env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
1243
+ project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
1244
+ }
1079
1245
  }
1080
- if (typeof window !== "undefined") {
1081
- // @ts-ignore
1082
- const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
1083
- host = (_c = __global_env__.INTEGRATION_API) !== null && _c !== void 0 ? _c : host;
1084
- // @ts-ignore
1085
- token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
1086
- // @ts-ignore
1087
- env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
1088
- project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
1246
+ else if (process && process.env) {
1247
+ host = (_d = host !== null && host !== void 0 ? host : process.env.API_HOST) !== null && _d !== void 0 ? _d : null;
1248
+ env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
1249
+ token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
1250
+ project_uuid = (_g = process.env.PROJECT_UUID) !== null && _g !== void 0 ? _g : null;
1089
1251
  }
1090
1252
  if (token) {
1091
1253
  headers['Authorization'] = `Bearer ${token}`;
@@ -1105,6 +1267,9 @@ class IntegrationsBaseClient extends BaseClient {
1105
1267
  withCredentials: true,
1106
1268
  });
1107
1269
  super(client);
1270
+ this.env = null;
1271
+ this.token = null;
1272
+ this.host = null;
1108
1273
  }
1109
1274
  }
1110
1275
 
@@ -1343,6 +1508,38 @@ class DMS extends IntegrationsBaseClient {
1343
1508
  async dirs(data) {
1344
1509
  return await this.request("POST", `media/library/dirs`, { data });
1345
1510
  }
1511
+ // ===================================================================
1512
+ // Document Methods
1513
+ // ===================================================================
1514
+ async createDocument(payload) {
1515
+ return this.requestv2('POST', 'documents/document', { data: payload });
1516
+ }
1517
+ async getDocument(path) {
1518
+ return this.requestv2('GET', `documents/document/${path}`);
1519
+ }
1520
+ async getDocumentRaw(path) {
1521
+ return this.requestv2('GET', `documents/document/${path}`, {
1522
+ headers: { Accept: 'application/pdoc' }
1523
+ });
1524
+ }
1525
+ async updateDocument(payload) {
1526
+ return this.requestv2('PATCH', 'documents/document', { data: payload });
1527
+ }
1528
+ async deleteDocument(path) {
1529
+ return this.requestv2('DELETE', `documents/document/${path}`);
1530
+ }
1531
+ async listDocuments(params) {
1532
+ return this.requestv2('GET', 'documents/list', { params });
1533
+ }
1534
+ async listDeletedDocuments(params) {
1535
+ return this.requestv2('GET', 'documents/list/__deleted__', { params });
1536
+ }
1537
+ async restoreDocument(payload) {
1538
+ return this.requestv2('POST', 'documents/restore', { data: payload });
1539
+ }
1540
+ async createDocumentComment(payload) {
1541
+ return this.requestv2('POST', 'documents/document/comment', { data: payload });
1542
+ }
1346
1543
  async fillPdf(data) {
1347
1544
  const { input_path, output_path, output_pdf = false, output_type, output_file_name, replace, form_data, forms } = data;
1348
1545
  const responseType = output_pdf ? 'arraybuffer' : 'json';
@@ -1828,6 +2025,13 @@ class DMS extends IntegrationsBaseClient {
1828
2025
  ...params
1829
2026
  });
1830
2027
  }
2028
+ async requestv2(method, endpoint, params) {
2029
+ return await this.client.request({
2030
+ method,
2031
+ url: `/v2/dms/${endpoint}`,
2032
+ ...params
2033
+ });
2034
+ }
1831
2035
  async requestv1(method, endpoint, params) {
1832
2036
  return await this.client.request({
1833
2037
  method: method,
@@ -1875,19 +2079,781 @@ class VPFR extends IntegrationsBaseClient {
1875
2079
  }
1876
2080
 
1877
2081
  class Payments extends IntegrationsBaseClient {
1878
- async getTransactions(user) {
1879
- return await this.client.get(`/karadjordje/v1/payment/${user}/list`);
2082
+ async getTransactions(userId, params) {
2083
+ return await this.client.get(`/karadjordje/v1/payment/${userId}/list`, {
2084
+ params,
2085
+ });
2086
+ }
2087
+ async getTransaction(provider, userId, transactionId) {
2088
+ return await this.client.get(`/karadjordje/v1/payment/${provider}/${userId}/getTransaction`, {
2089
+ params: { transactionId },
2090
+ });
1880
2091
  }
1881
2092
  async settings(provider) {
1882
2093
  return await this.client.get(`/karadjordje/v1/payment/${provider}/settings`);
1883
2094
  }
2095
+ async deactivatePaymentLink(provider, user, transactionId) {
2096
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/deactivate/${transactionId}`);
2097
+ }
2098
+ async voidTransaction(provider, user, transactionId) {
2099
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/void/${transactionId}`);
2100
+ }
2101
+ async refund(provider, user, transactionId) {
2102
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/refund/${transactionId}`);
2103
+ }
1884
2104
  async getPaymentLink(provider, user, options) {
1885
- var _a;
1886
- return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
1887
- totalAmount: options.totalAmount.toString(),
1888
- description: options.description,
1889
- redirectUrl: (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : null,
1890
- });
2105
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, options);
2106
+ }
2107
+ async getTokenRequestLink(provider, user, options) {
2108
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getTokenRequestLink`, options);
2109
+ }
2110
+ async directPayUsingToken(provider, user, options) {
2111
+ return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/directPayUsingToken`, options);
2112
+ }
2113
+ }
2114
+
2115
+ class Minimax extends IntegrationsBaseClient {
2116
+ async settings() {
2117
+ return await this.client.get(`/karadjordje/v1/minimax/settings`);
2118
+ }
2119
+ async getAccounts(userId, organisationId, params) {
2120
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/accounts`;
2121
+ return await this.client.get(path, { params });
2122
+ }
2123
+ async getAccount(userId, organisationId, accountId) {
2124
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/accounts/${accountId}`;
2125
+ return await this.client.get(path);
2126
+ }
2127
+ async getAccountByCode(userId, organisationId, code) {
2128
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/accounts/code(${code})`;
2129
+ return await this.client.get(path);
2130
+ }
2131
+ async getAccountByContent(userId, organisationId, content) {
2132
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/accounts/content(${content})`;
2133
+ return await this.client.get(path);
2134
+ }
2135
+ async getAccountsForSync(userId, organisationId, params) {
2136
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/accounts/synccandidates`;
2137
+ return await this.client.get(path, { params });
2138
+ }
2139
+ /** ADDRESSES */
2140
+ async getAddresses(userId, organisationId, customerId, params) {
2141
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/addresses`;
2142
+ return await this.client.get(path, { params });
2143
+ }
2144
+ async newAddress(userId, organisationId, customerId, address) {
2145
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/addresses`;
2146
+ return await this.client.post(path, address);
2147
+ }
2148
+ async deleteAddress(userId, organisationId, customerId, addressId) {
2149
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/addresses/${addressId}`;
2150
+ return await this.client.delete(path);
2151
+ }
2152
+ async getAddress(userId, organisationId, customerId, addressId) {
2153
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/addresses/${addressId}`;
2154
+ return await this.client.get(path);
2155
+ }
2156
+ async updateAddress(userId, organisationId, customerId, address) {
2157
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/addresses/${address.AddressId}`;
2158
+ return await this.client.put(path, address);
2159
+ }
2160
+ async getAddressesForSync(userId, organisationId, customerId, params) {
2161
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/addresses/synccandidates`;
2162
+ return await this.client.get(path, { params });
2163
+ }
2164
+ /** ANALYTICS */
2165
+ async getAnalytics(userId, organisationId, params) {
2166
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/analytics`;
2167
+ return await this.client.get(path, { params });
2168
+ }
2169
+ async newAnalytic(userId, organisationId, analytic) {
2170
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/analytics`;
2171
+ return await this.client.post(path, analytic);
2172
+ }
2173
+ async deleteAnalytic(userId, organisationId, analyticId) {
2174
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/analytics/${analyticId}`;
2175
+ return await this.client.delete(path);
2176
+ }
2177
+ async getAnalytic(userId, organisationId, analyticId) {
2178
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/analytics/${analyticId}`;
2179
+ return await this.client.get(path);
2180
+ }
2181
+ async updateAnalytic(userId, organisationId, analytic) {
2182
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/analytics/${analytic.AnalyticId}`;
2183
+ return await this.client.put(path, analytic);
2184
+ }
2185
+ async getAnalyticsForSync(userId, organisationId, params) {
2186
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/analytics/synccandidates`;
2187
+ return await this.client.get(path, { params });
2188
+ }
2189
+ /** BANK ACCOUNTS */
2190
+ async getBankAccounts(userId, organisationId, customerId, params) {
2191
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/bankAccounts`;
2192
+ return await this.client.get(path, { params });
2193
+ }
2194
+ async newBankAccount(userId, organisationId, customerId, bankAccount) {
2195
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/bankAccounts`;
2196
+ return await this.client.post(path, bankAccount);
2197
+ }
2198
+ async deleteBankAccount(userId, organisationId, customerId, bankAccountId) {
2199
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/bankAccounts/${bankAccountId}`;
2200
+ return await this.client.delete(path);
2201
+ }
2202
+ async getBankAccount(userId, organisationId, customerId, bankAccountId) {
2203
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/bankAccounts/${bankAccountId}`;
2204
+ return await this.client.get(path);
2205
+ }
2206
+ async updateBankAccount(userId, organisationId, customerId, bankAccount) {
2207
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/addresses/${bankAccount.BankAccountId}`;
2208
+ return await this.client.put(path, bankAccount);
2209
+ }
2210
+ async getBankAccountsForSync(userId, organisationId, customerId, params) {
2211
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/bankAccounts/synccandidates`;
2212
+ return await this.client.get(path, { params });
2213
+ }
2214
+ /** CONTACTS */
2215
+ async getCustomerContacts(userId, organisationId, customerId, params) {
2216
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/contacts`;
2217
+ return await this.client.get(path, { params });
2218
+ }
2219
+ async newContact(userId, organisationId, customerId, contact) {
2220
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/contacts`;
2221
+ return await this.client.post(path, contact);
2222
+ }
2223
+ async deleteContact(userId, organisationId, customerId, contactId) {
2224
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/contacts/${contactId}`;
2225
+ return await this.client.delete(path);
2226
+ }
2227
+ async getContact(userId, organisationId, customerId, contactId) {
2228
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/contacts/${contactId}`;
2229
+ return await this.client.get(path);
2230
+ }
2231
+ async updateContact(userId, organisationId, customerId, contact) {
2232
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/addresses/${contact.ContactId}`;
2233
+ return await this.client.put(path, contact);
2234
+ }
2235
+ async getContacts(userId, organisationId, params) {
2236
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/contacts`;
2237
+ return await this.client.get(path, { params });
2238
+ }
2239
+ async getContactForSync(userId, organisationId, customerId, params) {
2240
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}/contacts/synccandidates`;
2241
+ return await this.client.get(path, { params });
2242
+ }
2243
+ /** COUNTRIES */
2244
+ async getCountries(userId, organisationId, params) {
2245
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/countries`;
2246
+ return await this.client.get(path, { params });
2247
+ }
2248
+ async getCountry(userId, organisationId, countryId) {
2249
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/countries/${countryId}`;
2250
+ return await this.client.get(path);
2251
+ }
2252
+ async getCountryByCode(userId, organisationId, code) {
2253
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/countries/code(${code})`;
2254
+ return await this.client.get(path);
2255
+ }
2256
+ async getCountriesForSync(userId, organisationId, params) {
2257
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/countries/synccandidates`;
2258
+ return await this.client.get(path, { params });
2259
+ }
2260
+ /** CURRENCIES */
2261
+ async getCurrencies(userId, organisationId, params) {
2262
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/currencies`;
2263
+ return await this.client.get(path, { params });
2264
+ }
2265
+ async getCurrency(userId, organisationId, currencyId) {
2266
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/currencies/${currencyId}`;
2267
+ return await this.client.get(path);
2268
+ }
2269
+ async getCurrencyByDate(userId, organisationId, date) {
2270
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/currencies/date(${date.toISOString()})`;
2271
+ return await this.client.get(path);
2272
+ }
2273
+ async getCurrencyByCode(userId, organisationId, code) {
2274
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/currencies/code(${code})`;
2275
+ return await this.client.get(path);
2276
+ }
2277
+ async getCurrenciesForSync(userId, organisationId, params) {
2278
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/currencies/synccandidates`;
2279
+ return await this.client.get(path, { params });
2280
+ }
2281
+ /** CUSTOMERS */
2282
+ async getCustomers(userId, organisationId, params) {
2283
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers`;
2284
+ return await this.client.get(path, { params });
2285
+ }
2286
+ async newCustomer(userId, organisationId, customer) {
2287
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers`;
2288
+ return await this.client.post(path, customer);
2289
+ }
2290
+ async deleteCusomter(userId, organisationId, customerId) {
2291
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}`;
2292
+ return await this.client.delete(path);
2293
+ }
2294
+ async getCustomer(userId, organisationId, customerId) {
2295
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customerId}`;
2296
+ return await this.client.get(path);
2297
+ }
2298
+ async updateCustomer(userId, organisationId, customer) {
2299
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/${customer.CustomerId}`;
2300
+ return await this.client.put(path, customer);
2301
+ }
2302
+ async getCustomerByCode(userId, organisationId, code) {
2303
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/code(${code})`;
2304
+ return await this.client.get(path);
2305
+ }
2306
+ async newCustomerByTaxNumber(userId, organisationId, taxNumber) {
2307
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/addbytaxnumber(${taxNumber})`;
2308
+ return await this.client.post(path, {});
2309
+ }
2310
+ async getCustomersForSync(userId, organisationId, params) {
2311
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/customers/synccandidates`;
2312
+ return await this.client.get(path, { params });
2313
+ }
2314
+ /** DASHBOARDS */
2315
+ async getDashboardsData(userId, organisationId) {
2316
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/dashboards`;
2317
+ return await this.client.get(path);
2318
+ }
2319
+ /** DOCUMENTS */
2320
+ async getDocuments(userId, organisationId, params) {
2321
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents`;
2322
+ return await this.client.get(path, { params });
2323
+ }
2324
+ async newDocument(userId, organisationId, document) {
2325
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents`;
2326
+ return await this.client.post(path, document);
2327
+ }
2328
+ async deleteDocument(userId, organisationId, documentId) {
2329
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents/${documentId}`;
2330
+ return await this.client.delete(path);
2331
+ }
2332
+ async getDocument(userId, organisationId, documentId) {
2333
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents/${documentId}`;
2334
+ return await this.client.get(path);
2335
+ }
2336
+ async updateDocument(userId, organisationId, document) {
2337
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents/${document.DocumentId}`;
2338
+ return await this.client.put(path, document);
2339
+ }
2340
+ async deleteDocumentAttachment(userId, organisationId, documentId, documentAttachmentId) {
2341
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents/${documentId}/attachments/${documentAttachmentId}`;
2342
+ return await this.client.delete(path);
2343
+ }
2344
+ async getDocumentAttachment(userId, organisationId, documentId, documentAttachmentId) {
2345
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents/${documentId}/attachments/${documentAttachmentId}`;
2346
+ return await this.client.get(path);
2347
+ }
2348
+ async updateDocumentAttachment(userId, organisationId, documentId, documentAttachment) {
2349
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents/${documentId}/attachments/${documentAttachment.DocumentAttachmentId}`;
2350
+ return await this.client.put(path, documentAttachment);
2351
+ }
2352
+ async newDocumentAttachment(userId, organisationId, documentId, documentAttachment) {
2353
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents/${documentId}/attachments`;
2354
+ return await this.client.post(path, documentAttachment);
2355
+ }
2356
+ async getDocumentsForSync(userId, organisationId, params) {
2357
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/documents/synccandidates`;
2358
+ return await this.client.get(path, { params });
2359
+ }
2360
+ /** DOCUMENT NUMBERINGS */
2361
+ async getDocumentNumberings(userId, organisationId, params) {
2362
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/document-numbering`;
2363
+ return await this.client.get(path, { params });
2364
+ }
2365
+ async getDocumentNumbering(userId, organisationId, documentNumberingId) {
2366
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/document-numbering/${documentNumberingId}`;
2367
+ return await this.client.get(path);
2368
+ }
2369
+ /** EFAKTURA */
2370
+ async getEFakturaList(userId, params) {
2371
+ const path = `/karadjordje/v1/minimax/${userId}/api/efaktura/list`;
2372
+ return await this.client.get(path, { params });
2373
+ }
2374
+ /** EMPLOYEES */
2375
+ async getEmployees(userId, organisationId, params) {
2376
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/employees`;
2377
+ return await this.client.get(path, { params });
2378
+ }
2379
+ async newEmployee(userId, organisationId, employee) {
2380
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/employees`;
2381
+ return await this.client.post(path, employee);
2382
+ }
2383
+ async deleteEmployee(userId, organisationId, employeeId) {
2384
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/employees/${employeeId}`;
2385
+ return await this.client.delete(path);
2386
+ }
2387
+ async getEmployee(userId, organisationId, employeeId) {
2388
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/employees/${employeeId}`;
2389
+ return await this.client.get(path);
2390
+ }
2391
+ async updateEmployee(userId, organisationId, employee) {
2392
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/employees/${employee.EmployeeId}`;
2393
+ return await this.client.put(path, employee);
2394
+ }
2395
+ async getEmployeesForSync(userId, organisationId, params) {
2396
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/employees/synccandidates`;
2397
+ return await this.client.get(path, { params });
2398
+ }
2399
+ /** EXCHANGE RATES */
2400
+ async getExchangeRate(userId, organisationId, currencyId) {
2401
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/exchange-rates/${currencyId}`;
2402
+ return await this.client.get(path);
2403
+ }
2404
+ async getExchangeRateByCode(userId, organisationId, currencyCode) {
2405
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/exchange-rates/code(${currencyCode})`;
2406
+ return await this.client.get(path);
2407
+ }
2408
+ /** INBOX */
2409
+ async getInboxes(userId, organisationId, params) {
2410
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/inbox`;
2411
+ return await this.client.get(path, { params });
2412
+ }
2413
+ async newInbox(userId, organisationId, inbox) {
2414
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/inbox`;
2415
+ return await this.client.post(path, inbox);
2416
+ }
2417
+ async deleteInbox(userId, organisationId, inboxId) {
2418
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/inbox/${inboxId}`;
2419
+ return await this.client.delete(path);
2420
+ }
2421
+ async getInbox(userId, organisationId, inboxId) {
2422
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/inbox/${inboxId}`;
2423
+ return await this.client.get(path);
2424
+ }
2425
+ async newInboxAttachment(userId, organisationId, inboxId, inboxAttachment) {
2426
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/inbox/${inboxId}`;
2427
+ return await this.client.post(path, inboxAttachment);
2428
+ }
2429
+ async deleteInboxAttachment(userId, organisationId, inboxId, inboxAttachmentId) {
2430
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/inbox/${inboxId}/attachments/${inboxAttachmentId}`;
2431
+ return await this.client.delete(path);
2432
+ }
2433
+ async actionOnInbox(userId, organisationId, inboxId, action) {
2434
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/inbox/${inboxId}/actions/${action}`;
2435
+ return await this.client.put(path, {});
2436
+ }
2437
+ /** ISSUED INVOICE */
2438
+ async getIssuedInvoices(userId, organisationId, params) {
2439
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoices`;
2440
+ return await this.client.get(path, { params });
2441
+ }
2442
+ async newIssuedInvoice(userId, organisationId, issuedInvoice) {
2443
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoices`;
2444
+ return await this.client.post(path, issuedInvoice);
2445
+ }
2446
+ async deleteIssuedInvoice(userId, organisationId, issuedInvoiceId) {
2447
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoices/${issuedInvoiceId}`;
2448
+ return await this.client.delete(path);
2449
+ }
2450
+ async getIssuedInvoice(userId, organisationId, issuedInvoiceId) {
2451
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoices/${issuedInvoiceId}`;
2452
+ return await this.client.get(path);
2453
+ }
2454
+ async updateIssuedInvoice(userId, organisationId, issuedInvoice) {
2455
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoices/${issuedInvoice.IssuedInvoiceId}`;
2456
+ return await this.client.put(path, issuedInvoice);
2457
+ }
2458
+ async actionOnIssuedInvoice(userId, organisationId, issuedInvoiceId, action) {
2459
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoices/${issuedInvoiceId}/actions/${action}`;
2460
+ return await this.client.put(path, {});
2461
+ }
2462
+ async getIssuedInvoicesForSync(userId, organisationId, params) {
2463
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoices/synccandidates`;
2464
+ return await this.client.get(path, { params });
2465
+ }
2466
+ async getPaymentMethodsOnIssuedInvoices(userId, organisationId, params) {
2467
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoices/paymentmethods`;
2468
+ return await this.client.get(path, { params });
2469
+ }
2470
+ /** ISSUED INVOICE POSTING */
2471
+ async getIssuedInvoicePostings(userId, organisationId, params) {
2472
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoicepostings`;
2473
+ return await this.client.get(path, { params });
2474
+ }
2475
+ async newIssuedInvoicePosting(userId, organisationId, issuedInvoicePosting) {
2476
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoicepostings`;
2477
+ return await this.client.post(path, issuedInvoicePosting);
2478
+ }
2479
+ async deleteIssuedInvoicePosting(userId, organisationId, issuedInvoicePostingId) {
2480
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoicepostings/${issuedInvoicePostingId}`;
2481
+ return await this.client.delete(path);
2482
+ }
2483
+ async getIssuedInvoicePosting(userId, organisationId, issuedInvoicePostingId) {
2484
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoicepostings/${issuedInvoicePostingId}`;
2485
+ return await this.client.get(path);
2486
+ }
2487
+ async getPaymentMethodsOnIssuedInvoicePostings(userId, organisationId, params) {
2488
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoicepostings/paymentmethods`;
2489
+ return await this.client.get(path, { params });
2490
+ }
2491
+ async actionOnIssuedInvoicePosting(userId, organisationId, issuedInvoicePostingId, action) {
2492
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/issuedinvoicepostings/${issuedInvoicePostingId}/actions/${action}`;
2493
+ return await this.client.put(path, {});
2494
+ }
2495
+ /** ITEMS */
2496
+ async getItems(userId, organisationId, params) {
2497
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items`;
2498
+ return await this.client.get(path, { params });
2499
+ }
2500
+ async newItem(userId, organisationId, item) {
2501
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items`;
2502
+ return await this.client.post(path, item);
2503
+ }
2504
+ async deleteItem(userId, organisationId, itemId) {
2505
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items/${itemId}`;
2506
+ return await this.client.delete(path);
2507
+ }
2508
+ async getItem(userId, organisationId, itemId) {
2509
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items/${itemId}`;
2510
+ return await this.client.get(path);
2511
+ }
2512
+ async updateItem(userId, organisationId, item) {
2513
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items/${item.ItemId}`;
2514
+ return await this.client.put(path, item);
2515
+ }
2516
+ async getItemByCode(userId, organisationId, code) {
2517
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items/code(${code})`;
2518
+ return await this.client.get(path);
2519
+ }
2520
+ async getItemSettings(userId, organisationId, code) {
2521
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items/settings`;
2522
+ return await this.client.get(path);
2523
+ }
2524
+ async getItemData(userId, organisationId, params) {
2525
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items/itemsdata`;
2526
+ return await this.client.get(path, { params });
2527
+ }
2528
+ async getItemPricelist(userId, organisationId, params) {
2529
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items/pricelists`;
2530
+ return await this.client.get(path, { params });
2531
+ }
2532
+ async getItemsForSync(userId, organisationId, params) {
2533
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/items/synccandidates`;
2534
+ return await this.client.get(path, { params });
2535
+ }
2536
+ /** JOURNALS */
2537
+ async getJournals(userId, organisationId, params) {
2538
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals`;
2539
+ return await this.client.get(path, { params });
2540
+ }
2541
+ async newJournal(userId, organisationId, journal) {
2542
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals`;
2543
+ return await this.client.post(path, journal);
2544
+ }
2545
+ async deleteJournal(userId, organisationId, journalId) {
2546
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/${journalId}`;
2547
+ return await this.client.delete(path);
2548
+ }
2549
+ async getJournal(userId, organisationId, journalId) {
2550
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/${journalId}`;
2551
+ return await this.client.get(path);
2552
+ }
2553
+ async updateJournal(userId, organisationId, journal) {
2554
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/${journal.JournalId}`;
2555
+ return await this.client.put(path, journal);
2556
+ }
2557
+ async deleteJournalVatEntry(userId, organisationId, journalId, vatId) {
2558
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/${journalId}/vat/${vatId}`;
2559
+ return await this.client.delete(path);
2560
+ }
2561
+ async getJournalVatEntry(userId, organisationId, journalId, vatId) {
2562
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/${journalId}/vat/${vatId}`;
2563
+ return await this.client.get(path);
2564
+ }
2565
+ async updateJournalVatEntry(userId, organisationId, journalId, vatEntry) {
2566
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/${journalId}/vat/${vatEntry.VatEntryId}`;
2567
+ return await this.client.put(path, vatEntry);
2568
+ }
2569
+ async newJournalVatEntry(userId, organisationId, journalId, vatEntry) {
2570
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/${journalId}/vat`;
2571
+ return await this.client.post(path, vatEntry);
2572
+ }
2573
+ async getJournalsForSync(userId, organisationId, params) {
2574
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/synccandidates`;
2575
+ return await this.client.get(path, { params });
2576
+ }
2577
+ async getJournalsInVODStandard(userId, organisationId, params) {
2578
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/vodstandard`;
2579
+ return await this.client.get(path, { params });
2580
+ }
2581
+ async getJournalEntries(userId, organisationId, params) {
2582
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journals/journal-entries`;
2583
+ return await this.client.get(path, { params });
2584
+ }
2585
+ /** JOURNAL TYPES */
2586
+ async getJournalTypes(userId, organisationId, params) {
2587
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journaltypes`;
2588
+ return await this.client.get(path, { params });
2589
+ }
2590
+ async getJournalType(userId, organisationId, journalTypeId) {
2591
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journaltypes/${journalTypeId}`;
2592
+ return await this.client.get(path);
2593
+ }
2594
+ async getJournalTypeByCode(userId, organisationId, code) {
2595
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journaltypes/code(${code})`;
2596
+ return await this.client.get(path);
2597
+ }
2598
+ async getJournalTypesForSync(userId, organisationId, params) {
2599
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/journaltypes/synccandidates`;
2600
+ return await this.client.get(path, { params });
2601
+ }
2602
+ /** ORDERS */
2603
+ async getOrders(userId, organisationId, params) {
2604
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/orders`;
2605
+ return await this.client.get(path, { params });
2606
+ }
2607
+ async newOrder(userId, organisationId, order) {
2608
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/orders`;
2609
+ return await this.client.post(path, order);
2610
+ }
2611
+ async deleteOrder(userId, organisationId, orderId) {
2612
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/orders/${orderId}`;
2613
+ return await this.client.delete(path);
2614
+ }
2615
+ async getOrder(userId, organisationId, orderId) {
2616
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/orders/${orderId}`;
2617
+ return await this.client.get(path);
2618
+ }
2619
+ async updateOrder(userId, organisationId, order) {
2620
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/orders/${order.OrderId}`;
2621
+ return await this.client.put(path, order);
2622
+ }
2623
+ async actionGetOnOrder(userId, organisationId, orderId, action, params) {
2624
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/orders/${orderId}/actions/${action}`;
2625
+ return await this.client.get(path, { params });
2626
+ }
2627
+ async actionPutOnOrder(userId, organisationId, orderId, action, params) {
2628
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/orders/${orderId}/actions/${action}`;
2629
+ return await this.client.put(path, {}, { params });
2630
+ }
2631
+ async getOrdersForSync(userId, organisationId, params) {
2632
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/orders/synccandidates`;
2633
+ return await this.client.get(path, { params });
2634
+ }
2635
+ /** ORGANISATIONS */
2636
+ async getOrganisation(userId, organisationId) {
2637
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}`;
2638
+ return await this.client.get(path);
2639
+ }
2640
+ async getAllOrganisations(userId, params) {
2641
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/allOrgs`;
2642
+ return await this.client.get(path, { params });
2643
+ }
2644
+ /** OUTBOX */
2645
+ async getAllOuboxes(userId, organisationId, params) {
2646
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/outbox`;
2647
+ return await this.client.get(path, { params });
2648
+ }
2649
+ async getOutbox(userId, organisationId, outboxId) {
2650
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/outbox/${outboxId}`;
2651
+ return await this.client.get(path);
2652
+ }
2653
+ /** PAYMENT METHODS */
2654
+ async getPaymentMethods(userId, organisationId, params) {
2655
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/paymentmethods`;
2656
+ return await this.client.get(path, { params });
2657
+ }
2658
+ /** PAYROLL SETTINGS */
2659
+ async getPayrollSettingsByCode(userId, code) {
2660
+ const path = `/karadjordje/v1/minimax/${userId}/api/payrollsettings/${code}`;
2661
+ return await this.client.get(path);
2662
+ }
2663
+ /** POSTAL CODE */
2664
+ async getPostalCodesByCountry(userId, organisationId, countryId, params) {
2665
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/postalcodes/countries/${countryId}`;
2666
+ return await this.client.get(path, { params });
2667
+ }
2668
+ async getPostalCode(userId, organisationId, postalCodeId) {
2669
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/postalcodes/${postalCodeId}`;
2670
+ return await this.client.get(path);
2671
+ }
2672
+ async getPostalCodesForSync(userId, organisationId, params) {
2673
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/postalcodes/synccandidates`;
2674
+ return await this.client.get(path, { params });
2675
+ }
2676
+ /** PRODUCT GROUPS */
2677
+ async getProductGroups(userId, organisationId, params) {
2678
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/productGroups`;
2679
+ return await this.client.get(path, { params });
2680
+ }
2681
+ async newProductGroup(userId, organisationId, productGroup) {
2682
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/productGroups`;
2683
+ return await this.client.post(path, productGroup);
2684
+ }
2685
+ async deleteProductGroup(userId, organisationId, productGroupId) {
2686
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/productGroups/${productGroupId}`;
2687
+ return await this.client.delete(path);
2688
+ }
2689
+ async getProductGroup(userId, organisationId, productGroupId) {
2690
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/productGroups/${productGroupId}`;
2691
+ return await this.client.get(path);
2692
+ }
2693
+ async updateProductGroup(userId, organisationId, productGroup) {
2694
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/productGroups/${productGroup.ProductGroupId}`;
2695
+ return await this.client.put(path, productGroup);
2696
+ }
2697
+ async getProductGroupsForSync(userId, organisationId, params) {
2698
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/productGroups/synccandidates`;
2699
+ return await this.client.get(path, { params });
2700
+ }
2701
+ /** PURPOSE CODE */
2702
+ async getPurposeCodes(userId, organisationId, params) {
2703
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/purpose-codes`;
2704
+ return await this.client.get(path, { params });
2705
+ }
2706
+ async getPurposeCode(userId, organisationId, purposeCodeId) {
2707
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/purpose-codes/${purposeCodeId}`;
2708
+ return await this.client.get(path);
2709
+ }
2710
+ async getPurposeCodeByCode(userId, organisationId, code) {
2711
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/purpose-codes/code(${code})`;
2712
+ return await this.client.get(path);
2713
+ }
2714
+ async getPurposeCodesForSync(userId, organisationId, params) {
2715
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/purpose-codes/synccandidates`;
2716
+ return await this.client.get(path, { params });
2717
+ }
2718
+ /** RECEIVED INVOICES */
2719
+ async deleteReceivedInvoice(userId, organisationId, receivedInvoiceId) {
2720
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/receivedinvoices/${receivedInvoiceId}`;
2721
+ return await this.client.delete(path);
2722
+ }
2723
+ async getReceivedInvoice(userId, organisationId, receivedInvoiceId) {
2724
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/receivedinvoices/${receivedInvoiceId}`;
2725
+ return await this.client.get(path);
2726
+ }
2727
+ async updateReceivedInvoice(userId, organisationId, receivedInvoice) {
2728
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/receivedinvoices/${receivedInvoice.ReceivedInvoiceId}`;
2729
+ return await this.client.put(path, receivedInvoice);
2730
+ }
2731
+ async getReceivedInvoices(userId, organisationId, params) {
2732
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/receivedinvoices`;
2733
+ return await this.client.get(path, { params });
2734
+ }
2735
+ async newReceivedInvoice(userId, organisationId, receivedInvoice) {
2736
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/receivedinvoices`;
2737
+ return await this.client.post(path, receivedInvoice);
2738
+ }
2739
+ async getReceivedInvoicesAttachments(userId, organisationId, receivedInvoiceId, params) {
2740
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/receivedinvoices/${receivedInvoiceId}/attachments`;
2741
+ return await this.client.get(path, { params });
2742
+ }
2743
+ async newReceivedInvoiceAttachment(userId, organisationId, receivedInvoiceId, attachment) {
2744
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/receivedinvoices/${receivedInvoiceId}/attachments`;
2745
+ return await this.client.post(path, attachment);
2746
+ }
2747
+ /** REPORT TEMPLATES */
2748
+ async getReportTemplates(userId, organisationId, params) {
2749
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/report-templates`;
2750
+ return await this.client.get(path, { params });
2751
+ }
2752
+ async getReportTemplate(userId, organisationId, reportTemplateId) {
2753
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/report-templates/${reportTemplateId}`;
2754
+ return await this.client.get(path);
2755
+ }
2756
+ async getReportTemplatesForSync(userId, organisationId, params) {
2757
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/report-templates/synccandidates`;
2758
+ return await this.client.get(path, { params });
2759
+ }
2760
+ /** STOCK */
2761
+ async getStock(userId, organisationId, params) {
2762
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/stocks`;
2763
+ return await this.client.get(path, { params });
2764
+ }
2765
+ async getStockForItem(userId, organisationId, itemId) {
2766
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/stocks/${itemId}`;
2767
+ return await this.client.get(path);
2768
+ }
2769
+ /** STOCK ENTRIES */
2770
+ async getStockEntries(userId, organisationId, params) {
2771
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/stockentry`;
2772
+ return await this.client.get(path, { params });
2773
+ }
2774
+ async newStockEntry(userId, organisationId, stockEntry) {
2775
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/stockentry`;
2776
+ return await this.client.post(path, stockEntry);
2777
+ }
2778
+ async deleteStockEntry(userId, organisationId, stockEntryId) {
2779
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/stockentry/${stockEntryId}`;
2780
+ return await this.client.delete(path);
2781
+ }
2782
+ async getStockEntry(userId, organisationId, stockEntryId) {
2783
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/stockentry/${stockEntryId}`;
2784
+ return await this.client.get(path);
2785
+ }
2786
+ async updateStockEntry(userId, organisationId, stockEntry) {
2787
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/stockentry/${stockEntry.StockEntryId}`;
2788
+ return await this.client.post(path, stockEntry);
2789
+ }
2790
+ async actionGetOnStockEntry(userId, organisationId, stockEntryId, action, params) {
2791
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/stockentry/${stockEntryId}/actions/${action}`;
2792
+ return await this.client.get(path, { params });
2793
+ }
2794
+ async actionPutOnStockEntry(userId, organisationId, stockEntryId, action, params) {
2795
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/stockentry/${stockEntryId}/actions/${action}`;
2796
+ return await this.client.put(path, {}, { params });
2797
+ }
2798
+ /** USERS */
2799
+ async getCurrentUser(userId) {
2800
+ const path = `/karadjordje/v1/minimax/${userId}/api/currentuser/profile`;
2801
+ return await this.client.get(path);
2802
+ }
2803
+ async getCurrentUserOrgs(userId) {
2804
+ const path = `/karadjordje/v1/minimax/${userId}/api/currentuser/orgs`;
2805
+ return await this.client.get(path);
2806
+ }
2807
+ /** VAT ACCOUNTING TYPES */
2808
+ async getVatAccountingTypes(userId, organisationId, params) {
2809
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/vataccountingtypes`;
2810
+ return await this.client.get(path, { params });
2811
+ }
2812
+ async getVatAccountingTypesForSync(userId, organisationId, params) {
2813
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/vataccountingtypes/synccandidates`;
2814
+ return await this.client.get(path, { params });
2815
+ }
2816
+ /** VAT RATES */
2817
+ async getVatRates(userId, organisationId, params) {
2818
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/vatrates`;
2819
+ return await this.client.get(path, { params });
2820
+ }
2821
+ async getVatRate(userId, organisationId, vatRateId) {
2822
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/vatrates/${vatRateId}`;
2823
+ return await this.client.get(path);
2824
+ }
2825
+ async getVatRateByCode(userId, organisationId, code) {
2826
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/vatrates/code(${code})`;
2827
+ return await this.client.get(path);
2828
+ }
2829
+ async getVatRatesForSync(userId, organisationId, params) {
2830
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/vatrates/synccandidates`;
2831
+ return await this.client.get(path, { params });
2832
+ }
2833
+ /** WAREHOUSES */
2834
+ async getWarehouses(userId, organisationId, params) {
2835
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/warehouses`;
2836
+ return await this.client.get(path, { params });
2837
+ }
2838
+ async newWarehouse(userId, organisationId, warehouse) {
2839
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/warehouses`;
2840
+ return await this.client.post(path, warehouse);
2841
+ }
2842
+ async deleteWarehouse(userId, organisationId, warehouseId) {
2843
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/warehouses/${warehouseId}`;
2844
+ return await this.client.delete(path);
2845
+ }
2846
+ async getWarehouse(userId, organisationId, warehouseId) {
2847
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/warehouses/${warehouseId}`;
2848
+ return await this.client.get(path);
2849
+ }
2850
+ async updateWarehouse(userId, organisationId, warehouse) {
2851
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/warehouses/${warehouse.WarehouseId}`;
2852
+ return await this.client.put(path, warehouse);
2853
+ }
2854
+ async getWarehousesForSync(userId, organisationId, params) {
2855
+ const path = `/karadjordje/v1/minimax/${userId}/api/orgs/${organisationId}/warehouses/synccandidates`;
2856
+ return await this.client.get(path, { params });
1891
2857
  }
1892
2858
  }
1893
2859
 
@@ -1901,6 +2867,7 @@ class Integrations extends IntegrationsBaseClient {
1901
2867
  'protokol-dms': new DMS().setClient(this.client),
1902
2868
  'serbia-utilities': new SerbiaUtil().setClient(this.client),
1903
2869
  'protokol-payments': new Payments().setClient(this.client),
2870
+ 'protokol-minimax': new Minimax().setClient(this.client),
1904
2871
  };
1905
2872
  }
1906
2873
  getSerbiaUtilities() {
@@ -1918,6 +2885,9 @@ class Integrations extends IntegrationsBaseClient {
1918
2885
  getPayments() {
1919
2886
  return this.getInterfaceOf('protokol-payments');
1920
2887
  }
2888
+ getMinimax() {
2889
+ return this.getInterfaceOf('protokol-minimax');
2890
+ }
1921
2891
  async isInstalled(id) {
1922
2892
  const { data } = await this.client.get("/v1/integrations");
1923
2893
  return data.find((i) => i.id == id) !== undefined;
@@ -1932,4 +2902,4 @@ class Integrations extends IntegrationsBaseClient {
1932
2902
  }
1933
2903
  }
1934
2904
 
1935
- export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Payments, Project, Ratchet, Sandbox, SerbiaUtil, System, Thunder, Users as User, VPFR, Workflow, Platform as default };
2905
+ export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Payments, Platform, Project, Ratchet, Sandbox, SerbiaUtil, System, Thunder, Users, VPFR, Workflow };