@marteye/studiojs 1.1.36 → 1.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +349 -66
- package/dist/index.esm.js +177 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +177 -55
- package/dist/index.js.map +1 -1
- package/dist/net/http.d.ts +1 -0
- package/dist/resources/adjustments.d.ts +2 -0
- package/dist/resources/contacts.d.ts +28 -0
- package/dist/resources/cph.d.ts +6 -0
- package/dist/resources/customers.d.ts +56 -2
- package/dist/resources/extras.d.ts +32 -0
- package/dist/resources/invoices.d.ts +1 -1
- package/dist/resources/payments.d.ts +1 -1
- package/dist/resources/payouts.d.ts +1 -1
- package/dist/resources/productCodes.d.ts +2 -0
- package/dist/resources/saleTemplates.d.ts +30 -0
- package/dist/resources/sales.d.ts +1 -0
- package/dist/resources.d.ts +53 -4
- package/dist/studio.d.ts +54 -5
- package/dist/types.d.ts +110 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64,6 +64,9 @@ function SimpleHttpClient(baseUrl, apiKey, fetch, defaultTimeout, debug = false)
|
|
|
64
64
|
post: async (path, body) => {
|
|
65
65
|
return request("POST", path, body);
|
|
66
66
|
},
|
|
67
|
+
patch: async (path, body) => {
|
|
68
|
+
return request("PATCH", path, body);
|
|
69
|
+
},
|
|
67
70
|
delete: async (path) => {
|
|
68
71
|
return request("DELETE", path);
|
|
69
72
|
},
|
|
@@ -71,7 +74,7 @@ function SimpleHttpClient(baseUrl, apiKey, fetch, defaultTimeout, debug = false)
|
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
// Path: studiojs/src/resources/markets.ts
|
|
74
|
-
function create$
|
|
77
|
+
function create$k(_) {
|
|
75
78
|
const actions = {
|
|
76
79
|
/***
|
|
77
80
|
* This is used to construct the action from the request body
|
|
@@ -101,7 +104,7 @@ function create$g(_) {
|
|
|
101
104
|
return actions;
|
|
102
105
|
}
|
|
103
106
|
|
|
104
|
-
function create$
|
|
107
|
+
function create$j(httpClient) {
|
|
105
108
|
return {
|
|
106
109
|
list: async (marketId) => {
|
|
107
110
|
return httpClient.get(`/${marketId}/adjustments`);
|
|
@@ -109,13 +112,36 @@ function create$f(httpClient) {
|
|
|
109
112
|
get: async (marketId, id) => {
|
|
110
113
|
return httpClient.get(`/${marketId}/adjustments/${id}`);
|
|
111
114
|
},
|
|
115
|
+
create: async (marketId, data) => {
|
|
116
|
+
return httpClient.post(`/${marketId}/adjustments`, data);
|
|
117
|
+
},
|
|
118
|
+
update: async (marketId, id, data) => {
|
|
119
|
+
return httpClient.post(`/${marketId}/adjustments/${id}`, data);
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function create$i(httpClient) {
|
|
125
|
+
return {
|
|
126
|
+
list: async (marketId) => {
|
|
127
|
+
return httpClient.get(`/${marketId}/extras`);
|
|
128
|
+
},
|
|
129
|
+
get: async (marketId, id) => {
|
|
130
|
+
return httpClient.get(`/${marketId}/extras/${id}`);
|
|
131
|
+
},
|
|
132
|
+
create: async (marketId, data) => {
|
|
133
|
+
return httpClient.post(`/${marketId}/extras`, data);
|
|
134
|
+
},
|
|
135
|
+
update: async (marketId, id, data) => {
|
|
136
|
+
return httpClient.post(`/${marketId}/extras/${id}`, data);
|
|
137
|
+
},
|
|
112
138
|
};
|
|
113
139
|
}
|
|
114
140
|
|
|
115
141
|
/***
|
|
116
142
|
* Bidder applications
|
|
117
143
|
*/
|
|
118
|
-
function create$
|
|
144
|
+
function create$h(httpClient) {
|
|
119
145
|
let applications = {
|
|
120
146
|
/**
|
|
121
147
|
* List applications for a market with optional filtering
|
|
@@ -182,7 +208,7 @@ function create$e(httpClient) {
|
|
|
182
208
|
}
|
|
183
209
|
|
|
184
210
|
// Path: studiojs/src/resources/markets.ts
|
|
185
|
-
function create$
|
|
211
|
+
function create$g(httpClient) {
|
|
186
212
|
let customers = {
|
|
187
213
|
list: async (marketId, lastId) => {
|
|
188
214
|
let params = {};
|
|
@@ -200,6 +226,9 @@ function create$d(httpClient) {
|
|
|
200
226
|
create: async (marketId, customerData) => {
|
|
201
227
|
return httpClient.post(`/${marketId}/customers`, customerData);
|
|
202
228
|
},
|
|
229
|
+
update: async (marketId, customerId, customerData) => {
|
|
230
|
+
return httpClient.post(`/${marketId}/customers/${customerId}`, customerData);
|
|
231
|
+
},
|
|
203
232
|
/**
|
|
204
233
|
* Get a customer by their account number
|
|
205
234
|
* @param marketId - ID of the market the customer belongs to
|
|
@@ -5016,7 +5045,7 @@ const uploadSingleFile = async (input, token) => {
|
|
|
5016
5045
|
};
|
|
5017
5046
|
|
|
5018
5047
|
// Multipart Upload for Media to the MARTEYE Media Service
|
|
5019
|
-
function create$
|
|
5048
|
+
function create$f() {
|
|
5020
5049
|
const files = {
|
|
5021
5050
|
uploadSingleFile: async (input, token) => {
|
|
5022
5051
|
return await uploadSingleFile(input, token);
|
|
@@ -5031,7 +5060,7 @@ function create$c() {
|
|
|
5031
5060
|
return files;
|
|
5032
5061
|
}
|
|
5033
5062
|
|
|
5034
|
-
function create$
|
|
5063
|
+
function create$e(httpClient) {
|
|
5035
5064
|
const invoices = {
|
|
5036
5065
|
/**
|
|
5037
5066
|
* List all invoices for a market with pagination
|
|
@@ -5059,7 +5088,7 @@ function create$b(httpClient) {
|
|
|
5059
5088
|
return invoices;
|
|
5060
5089
|
}
|
|
5061
5090
|
|
|
5062
|
-
function create$
|
|
5091
|
+
function create$d(httpClient) {
|
|
5063
5092
|
return {
|
|
5064
5093
|
create: async (marketId, saleId, lotId, data) => {
|
|
5065
5094
|
return httpClient.post(`/${marketId}/sales/${saleId}/lots/${lotId}/items`, data);
|
|
@@ -5076,7 +5105,7 @@ function create$a(httpClient) {
|
|
|
5076
5105
|
/**
|
|
5077
5106
|
* Defines the possible status values for a lot in a sale
|
|
5078
5107
|
*/
|
|
5079
|
-
function create$
|
|
5108
|
+
function create$c(httpClient) {
|
|
5080
5109
|
return {
|
|
5081
5110
|
get: async (marketId, saleId, lotId) => {
|
|
5082
5111
|
return httpClient.get(`/${marketId}/sales/${saleId}/lots/${lotId}`);
|
|
@@ -5096,7 +5125,7 @@ function create$9(httpClient) {
|
|
|
5096
5125
|
};
|
|
5097
5126
|
}
|
|
5098
5127
|
|
|
5099
|
-
function create$
|
|
5128
|
+
function create$b(httpClient) {
|
|
5100
5129
|
const markets = {
|
|
5101
5130
|
get: async (marketId) => {
|
|
5102
5131
|
return httpClient.get(`/${marketId}`);
|
|
@@ -5118,7 +5147,7 @@ function create$8(httpClient) {
|
|
|
5118
5147
|
return markets;
|
|
5119
5148
|
}
|
|
5120
5149
|
|
|
5121
|
-
function create$
|
|
5150
|
+
function create$a(httpClient) {
|
|
5122
5151
|
const payments = {
|
|
5123
5152
|
/**
|
|
5124
5153
|
* List all payments for a market with pagination
|
|
@@ -5146,7 +5175,7 @@ function create$7(httpClient) {
|
|
|
5146
5175
|
return payments;
|
|
5147
5176
|
}
|
|
5148
5177
|
|
|
5149
|
-
function create$
|
|
5178
|
+
function create$9(httpClient) {
|
|
5150
5179
|
const payouts = {
|
|
5151
5180
|
/**
|
|
5152
5181
|
* List all payouts for a market with pagination
|
|
@@ -5174,7 +5203,7 @@ function create$6(httpClient) {
|
|
|
5174
5203
|
return payouts;
|
|
5175
5204
|
}
|
|
5176
5205
|
|
|
5177
|
-
function create$
|
|
5206
|
+
function create$8(httpClient) {
|
|
5178
5207
|
return {
|
|
5179
5208
|
list: async (marketId) => {
|
|
5180
5209
|
return httpClient.get(`/${marketId}/product_codes`);
|
|
@@ -5182,10 +5211,16 @@ function create$5(httpClient) {
|
|
|
5182
5211
|
get: async (marketId, id) => {
|
|
5183
5212
|
return httpClient.get(`/${marketId}/product_codes/${id}`);
|
|
5184
5213
|
},
|
|
5214
|
+
create: async (marketId, data) => {
|
|
5215
|
+
return httpClient.post(`/${marketId}/product_codes`, data);
|
|
5216
|
+
},
|
|
5217
|
+
update: async (marketId, id, data) => {
|
|
5218
|
+
return httpClient.post(`/${marketId}/product_codes/${id}`, data);
|
|
5219
|
+
},
|
|
5185
5220
|
};
|
|
5186
5221
|
}
|
|
5187
5222
|
|
|
5188
|
-
function create$
|
|
5223
|
+
function create$7(httpClient) {
|
|
5189
5224
|
return {
|
|
5190
5225
|
get: async (marketId, saleId) => {
|
|
5191
5226
|
return httpClient.get(`/${marketId}/sales/${saleId}`);
|
|
@@ -5202,7 +5237,27 @@ function create$4(httpClient) {
|
|
|
5202
5237
|
};
|
|
5203
5238
|
}
|
|
5204
5239
|
|
|
5205
|
-
function create$
|
|
5240
|
+
function create$6(httpClient) {
|
|
5241
|
+
return {
|
|
5242
|
+
list: async (marketId) => {
|
|
5243
|
+
return httpClient.get(`/${marketId}/sale-templates`);
|
|
5244
|
+
},
|
|
5245
|
+
get: async (marketId, templateId) => {
|
|
5246
|
+
return httpClient.get(`/${marketId}/sale-templates/${templateId}`);
|
|
5247
|
+
},
|
|
5248
|
+
create: async (marketId, body) => {
|
|
5249
|
+
return httpClient.post(`/${marketId}/sale-templates`, body);
|
|
5250
|
+
},
|
|
5251
|
+
update: async (marketId, templateId, body) => {
|
|
5252
|
+
return httpClient.post(`/${marketId}/sale-templates/${templateId}`, body);
|
|
5253
|
+
},
|
|
5254
|
+
delete: async (marketId, templateId) => {
|
|
5255
|
+
return httpClient.delete(`/${marketId}/sale-templates/${templateId}`);
|
|
5256
|
+
},
|
|
5257
|
+
};
|
|
5258
|
+
}
|
|
5259
|
+
|
|
5260
|
+
function create$5(httpClient) {
|
|
5206
5261
|
let search = {
|
|
5207
5262
|
/**
|
|
5208
5263
|
* Search for documents within a market
|
|
@@ -5217,7 +5272,7 @@ function create$3(httpClient) {
|
|
|
5217
5272
|
return search;
|
|
5218
5273
|
}
|
|
5219
5274
|
|
|
5220
|
-
function create$
|
|
5275
|
+
function create$4(httpClient) {
|
|
5221
5276
|
return {
|
|
5222
5277
|
get: async (marketId) => {
|
|
5223
5278
|
return httpClient.get(`/${marketId}/settings`);
|
|
@@ -5225,7 +5280,7 @@ function create$2(httpClient) {
|
|
|
5225
5280
|
};
|
|
5226
5281
|
}
|
|
5227
5282
|
|
|
5228
|
-
function create$
|
|
5283
|
+
function create$3(httpClient) {
|
|
5229
5284
|
return {
|
|
5230
5285
|
list: async (marketId) => {
|
|
5231
5286
|
return httpClient.get(`/${marketId}/tax_rates`);
|
|
@@ -5237,7 +5292,7 @@ function create$1(httpClient) {
|
|
|
5237
5292
|
}
|
|
5238
5293
|
|
|
5239
5294
|
// Path: studiojs/src/resources/markets.ts
|
|
5240
|
-
function create(_) {
|
|
5295
|
+
function create$2(_) {
|
|
5241
5296
|
const webhooks = {
|
|
5242
5297
|
/***
|
|
5243
5298
|
* This is used to construct the webhook event from the request body
|
|
@@ -5272,25 +5327,60 @@ function create(_) {
|
|
|
5272
5327
|
return webhooks;
|
|
5273
5328
|
}
|
|
5274
5329
|
|
|
5330
|
+
function create$1(httpClient) {
|
|
5331
|
+
return {
|
|
5332
|
+
lookup: async (marketId, cph) => httpClient.get(`/${marketId}/cph`, { cph }),
|
|
5333
|
+
};
|
|
5334
|
+
}
|
|
5335
|
+
|
|
5336
|
+
function create(httpClient) {
|
|
5337
|
+
return {
|
|
5338
|
+
list: async (marketId, customerId, params) => {
|
|
5339
|
+
const query = {};
|
|
5340
|
+
if (params === null || params === void 0 ? void 0 : params.lastId)
|
|
5341
|
+
query.lastId = params.lastId;
|
|
5342
|
+
if (params === null || params === void 0 ? void 0 : params.limit)
|
|
5343
|
+
query.limit = params.limit;
|
|
5344
|
+
return httpClient.get(`/${marketId}/customers/${customerId}/contacts`, query);
|
|
5345
|
+
},
|
|
5346
|
+
get: async (marketId, customerId, contactId) => {
|
|
5347
|
+
return httpClient.get(`/${marketId}/customers/${customerId}/contacts/${contactId}`);
|
|
5348
|
+
},
|
|
5349
|
+
create: async (marketId, customerId, payload) => {
|
|
5350
|
+
return httpClient.post(`/${marketId}/customers/${customerId}/contacts`, payload);
|
|
5351
|
+
},
|
|
5352
|
+
update: async (marketId, customerId, contactId, payload) => {
|
|
5353
|
+
return httpClient.post(`/${marketId}/customers/${customerId}/contacts/${contactId}`, payload);
|
|
5354
|
+
},
|
|
5355
|
+
delete: async (marketId, customerId, contactId) => {
|
|
5356
|
+
return httpClient.delete(`/${marketId}/customers/${customerId}/contacts/${contactId}`);
|
|
5357
|
+
},
|
|
5358
|
+
};
|
|
5359
|
+
}
|
|
5360
|
+
|
|
5275
5361
|
function resources(httpClient) {
|
|
5276
5362
|
return {
|
|
5277
|
-
markets: create$
|
|
5278
|
-
sales: create$
|
|
5279
|
-
lots: create$
|
|
5280
|
-
lotitems: create$
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5363
|
+
markets: create$b(httpClient),
|
|
5364
|
+
sales: create$7(httpClient),
|
|
5365
|
+
lots: create$c(httpClient),
|
|
5366
|
+
lotitems: create$d(httpClient),
|
|
5367
|
+
cph: create$1(httpClient),
|
|
5368
|
+
webhooks: create$2(),
|
|
5369
|
+
actions: create$k(),
|
|
5370
|
+
bidderApplications: create$h(httpClient),
|
|
5371
|
+
settings: create$4(httpClient),
|
|
5372
|
+
adjustments: create$j(httpClient),
|
|
5373
|
+
extras: create$i(httpClient),
|
|
5374
|
+
productCodes: create$8(httpClient),
|
|
5375
|
+
saleTemplates: create$6(httpClient),
|
|
5376
|
+
taxRates: create$3(httpClient),
|
|
5377
|
+
customers: create$g(httpClient),
|
|
5378
|
+
invoices: create$e(httpClient),
|
|
5379
|
+
payments: create$a(httpClient),
|
|
5380
|
+
payouts: create$9(httpClient),
|
|
5381
|
+
search: create$5(httpClient),
|
|
5382
|
+
files: create$f(),
|
|
5383
|
+
contacts: create(httpClient),
|
|
5294
5384
|
};
|
|
5295
5385
|
}
|
|
5296
5386
|
|
|
@@ -5601,32 +5691,64 @@ EarTag.countryCodes = {
|
|
|
5601
5691
|
BE: "056",
|
|
5602
5692
|
};
|
|
5603
5693
|
|
|
5694
|
+
/**
|
|
5695
|
+
* Extract the smallest lot number for sorting purposes.
|
|
5696
|
+
* Handles formats:
|
|
5697
|
+
* - Simple: "7" -> 7
|
|
5698
|
+
* - Alpha suffix: "7A" -> 7
|
|
5699
|
+
* - Range: "7-9" -> 7
|
|
5700
|
+
* - Range with alpha: "7A-9A" -> 7
|
|
5701
|
+
* - With gaps: "7-8, 10" -> 7
|
|
5702
|
+
* - Complex: "7A-8A, 10B" -> 7
|
|
5703
|
+
*/
|
|
5704
|
+
function extractMinLotNumber(lotNumber) {
|
|
5705
|
+
// Handle empty/null
|
|
5706
|
+
if (!lotNumber)
|
|
5707
|
+
return { num: null, alpha: "" };
|
|
5708
|
+
// Split by comma first (handles "7-8, 10" format), flexible with whitespace
|
|
5709
|
+
let segments = lotNumber.split(/\s*,\s*/);
|
|
5710
|
+
let minNum = null;
|
|
5711
|
+
let minAlpha = "";
|
|
5712
|
+
for (let segment of segments) {
|
|
5713
|
+
// Split by hyphen (handles "7-9" range format), flexible with whitespace
|
|
5714
|
+
let rangeParts = segment.split(/\s*-\s*/);
|
|
5715
|
+
for (let part of rangeParts) {
|
|
5716
|
+
// Extract number and alpha from each part (e.g., "7A" -> 7, "A")
|
|
5717
|
+
let match = part.trim().match(/^(\d+)(\D*)$/);
|
|
5718
|
+
if (match) {
|
|
5719
|
+
let num = parseInt(match[1], 10);
|
|
5720
|
+
let alpha = match[2] || "";
|
|
5721
|
+
if (minNum === null ||
|
|
5722
|
+
num < minNum ||
|
|
5723
|
+
(num === minNum && alpha < minAlpha)) {
|
|
5724
|
+
minNum = num;
|
|
5725
|
+
minAlpha = alpha;
|
|
5726
|
+
}
|
|
5727
|
+
}
|
|
5728
|
+
}
|
|
5729
|
+
}
|
|
5730
|
+
return { num: minNum, alpha: minAlpha };
|
|
5731
|
+
}
|
|
5604
5732
|
function lotComparator(a, b) {
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
// If neither
|
|
5608
|
-
if (
|
|
5733
|
+
let aMin = extractMinLotNumber(a.lotNumber);
|
|
5734
|
+
let bMin = extractMinLotNumber(b.lotNumber);
|
|
5735
|
+
// If neither has numbers, fall back to string comparison
|
|
5736
|
+
if (aMin.num === null && bMin.num === null) {
|
|
5609
5737
|
return a.lotNumber.localeCompare(b.lotNumber);
|
|
5610
5738
|
}
|
|
5611
|
-
// If only one
|
|
5612
|
-
if (
|
|
5739
|
+
// If only one has numbers, the one without comes first
|
|
5740
|
+
if (aMin.num === null)
|
|
5613
5741
|
return -1;
|
|
5614
|
-
if (
|
|
5742
|
+
if (bMin.num === null)
|
|
5615
5743
|
return 1;
|
|
5616
|
-
//
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
// Compare
|
|
5620
|
-
if (
|
|
5621
|
-
return
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
const bAlpha = (bMatch === null || bMatch === void 0 ? void 0 : bMatch[2]) || "";
|
|
5625
|
-
// Compare by length first (shorter comes first)
|
|
5626
|
-
if (aAlpha.length !== bAlpha.length)
|
|
5627
|
-
return aAlpha.length - bAlpha.length;
|
|
5628
|
-
// Then compare alphabetically
|
|
5629
|
-
return aAlpha.localeCompare(bAlpha);
|
|
5744
|
+
// Compare numeric parts
|
|
5745
|
+
if (aMin.num !== bMin.num)
|
|
5746
|
+
return aMin.num - bMin.num;
|
|
5747
|
+
// Compare alpha suffixes by length then alphabetically
|
|
5748
|
+
if (aMin.alpha.length !== bMin.alpha.length) {
|
|
5749
|
+
return aMin.alpha.length - bMin.alpha.length;
|
|
5750
|
+
}
|
|
5751
|
+
return aMin.alpha.localeCompare(bMin.alpha);
|
|
5630
5752
|
}
|
|
5631
5753
|
function sortByLotNumber(lots) {
|
|
5632
5754
|
return [...lots].sort(lotComparator);
|