@viu/emporix-sdk 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2974,8 +2974,442 @@ var UnitHandlingService = class {
2974
2974
  }
2975
2975
  };
2976
2976
 
2977
+ // src/services/catalog.ts
2978
+ var SERVICE21 = { kind: "service" };
2979
+ var CatalogService = class {
2980
+ constructor(ctx) {
2981
+ this.ctx = ctx;
2982
+ }
2983
+ ctx;
2984
+ base() {
2985
+ return `/catalog/${this.ctx.tenant}/catalogs`;
2986
+ }
2987
+ /** List catalogs (filtered/sorted). */
2988
+ async listCatalogs(query = {}, auth2 = SERVICE21) {
2989
+ return this.ctx.http.request({
2990
+ method: "GET",
2991
+ path: this.base(),
2992
+ auth: auth2,
2993
+ ...Object.keys(query).length ? { query } : {}
2994
+ });
2995
+ }
2996
+ /** Retrieve a catalog by id. */
2997
+ async getCatalog(catalogId, auth2 = SERVICE21) {
2998
+ return this.ctx.http.request({
2999
+ method: "GET",
3000
+ path: `${this.base()}/${encodeURIComponent(catalogId)}`,
3001
+ auth: auth2
3002
+ });
3003
+ }
3004
+ /** Retrieve all catalogs that contain a category. */
3005
+ async getCatalogsForCategory(categoryId, auth2 = SERVICE21) {
3006
+ return this.ctx.http.request({
3007
+ method: "GET",
3008
+ path: `${this.base()}/categories/${encodeURIComponent(categoryId)}`,
3009
+ auth: auth2
3010
+ });
3011
+ }
3012
+ /** Create a catalog. */
3013
+ async createCatalog(input, auth2 = SERVICE21) {
3014
+ return this.ctx.http.request({ method: "POST", path: this.base(), auth: auth2, body: input });
3015
+ }
3016
+ /** Upsert a catalog by id (`PUT`). */
3017
+ async updateCatalog(catalogId, input, auth2 = SERVICE21) {
3018
+ return this.ctx.http.request({
3019
+ method: "PUT",
3020
+ path: `${this.base()}/${encodeURIComponent(catalogId)}`,
3021
+ auth: auth2,
3022
+ body: input
3023
+ });
3024
+ }
3025
+ /** Partially update a catalog by id (`PATCH`). */
3026
+ async patchCatalog(catalogId, patch, auth2 = SERVICE21) {
3027
+ await this.ctx.http.request({
3028
+ method: "PATCH",
3029
+ path: `${this.base()}/${encodeURIComponent(catalogId)}`,
3030
+ auth: auth2,
3031
+ body: patch
3032
+ });
3033
+ }
3034
+ /** Remove a catalog by id. */
3035
+ async deleteCatalog(catalogId, auth2 = SERVICE21) {
3036
+ await this.ctx.http.request({
3037
+ method: "DELETE",
3038
+ path: `${this.base()}/${encodeURIComponent(catalogId)}`,
3039
+ auth: auth2
3040
+ });
3041
+ }
3042
+ };
3043
+
3044
+ // src/services/vendor.ts
3045
+ var SERVICE22 = { kind: "service" };
3046
+ var VendorService = class {
3047
+ constructor(ctx) {
3048
+ this.ctx = ctx;
3049
+ }
3050
+ ctx;
3051
+ base() {
3052
+ return `/vendor/${this.ctx.tenant}`;
3053
+ }
3054
+ // --- Vendors ---
3055
+ /** List all vendors. */
3056
+ async listVendors(query = {}, auth2 = SERVICE22) {
3057
+ return this.ctx.http.request({
3058
+ method: "GET",
3059
+ path: `${this.base()}/vendors`,
3060
+ auth: auth2,
3061
+ ...Object.keys(query).length ? { query } : {}
3062
+ });
3063
+ }
3064
+ /** Retrieve a vendor by id. */
3065
+ async getVendor(vendorId, auth2 = SERVICE22) {
3066
+ return this.ctx.http.request({
3067
+ method: "GET",
3068
+ path: `${this.base()}/vendors/${encodeURIComponent(vendorId)}`,
3069
+ auth: auth2
3070
+ });
3071
+ }
3072
+ /** Search vendors (`POST /vendors/search`). */
3073
+ async searchVendors(query, auth2 = SERVICE22) {
3074
+ return this.ctx.http.request({
3075
+ method: "POST",
3076
+ path: `${this.base()}/vendors/search`,
3077
+ auth: auth2,
3078
+ body: query
3079
+ });
3080
+ }
3081
+ /** Create a vendor. */
3082
+ async createVendor(input, auth2 = SERVICE22) {
3083
+ return this.ctx.http.request({ method: "POST", path: `${this.base()}/vendors`, auth: auth2, body: input });
3084
+ }
3085
+ /** Upsert a vendor by id (`PUT`). */
3086
+ async updateVendor(vendorId, input, auth2 = SERVICE22) {
3087
+ await this.ctx.http.request({
3088
+ method: "PUT",
3089
+ path: `${this.base()}/vendors/${encodeURIComponent(vendorId)}`,
3090
+ auth: auth2,
3091
+ body: input
3092
+ });
3093
+ }
3094
+ /** Delete a vendor by id. */
3095
+ async deleteVendor(vendorId, auth2 = SERVICE22) {
3096
+ await this.ctx.http.request({
3097
+ method: "DELETE",
3098
+ path: `${this.base()}/vendors/${encodeURIComponent(vendorId)}`,
3099
+ auth: auth2
3100
+ });
3101
+ }
3102
+ // --- Vendor locations ---
3103
+ /** List all vendor locations. */
3104
+ async listVendorLocations(query = {}, auth2 = SERVICE22) {
3105
+ return this.ctx.http.request({
3106
+ method: "GET",
3107
+ path: `${this.base()}/locations`,
3108
+ auth: auth2,
3109
+ ...Object.keys(query).length ? { query } : {}
3110
+ });
3111
+ }
3112
+ /** Retrieve a vendor location by id. */
3113
+ async getVendorLocation(locationId, auth2 = SERVICE22) {
3114
+ return this.ctx.http.request({
3115
+ method: "GET",
3116
+ path: `${this.base()}/locations/${encodeURIComponent(locationId)}`,
3117
+ auth: auth2
3118
+ });
3119
+ }
3120
+ /** Create a vendor location. */
3121
+ async createVendorLocation(input, auth2 = SERVICE22) {
3122
+ return this.ctx.http.request({ method: "POST", path: `${this.base()}/locations`, auth: auth2, body: input });
3123
+ }
3124
+ /** Upsert a vendor location by id (`PUT`). */
3125
+ async updateVendorLocation(locationId, input, auth2 = SERVICE22) {
3126
+ await this.ctx.http.request({
3127
+ method: "PUT",
3128
+ path: `${this.base()}/locations/${encodeURIComponent(locationId)}`,
3129
+ auth: auth2,
3130
+ body: input
3131
+ });
3132
+ }
3133
+ /** Delete a vendor location by id. */
3134
+ async deleteVendorLocation(locationId, auth2 = SERVICE22) {
3135
+ await this.ctx.http.request({
3136
+ method: "DELETE",
3137
+ path: `${this.base()}/locations/${encodeURIComponent(locationId)}`,
3138
+ auth: auth2
3139
+ });
3140
+ }
3141
+ };
3142
+
3143
+ // src/services/pick-pack.ts
3144
+ var SERVICE23 = { kind: "service" };
3145
+ var PickPackService = class {
3146
+ constructor(ctx) {
3147
+ this.ctx = ctx;
3148
+ }
3149
+ ctx;
3150
+ base() {
3151
+ return `/pick-pack/${this.ctx.tenant}`;
3152
+ }
3153
+ orderPath(orderId) {
3154
+ return `${this.base()}/orders/${encodeURIComponent(orderId)}`;
3155
+ }
3156
+ /** List packlist orders. */
3157
+ async listOrders(query = {}, auth2 = SERVICE23) {
3158
+ return this.ctx.http.request({
3159
+ method: "GET",
3160
+ path: `${this.base()}/orders`,
3161
+ auth: auth2,
3162
+ ...Object.keys(query).length ? { query } : {}
3163
+ });
3164
+ }
3165
+ /** Retrieve a packlist order by id. */
3166
+ async getOrder(orderId, auth2 = SERVICE23) {
3167
+ return this.ctx.http.request({ method: "GET", path: this.orderPath(orderId), auth: auth2 });
3168
+ }
3169
+ /** Update an order's status (`PATCH`). Returns an acknowledgement. */
3170
+ async updateOrder(orderId, change, auth2 = SERVICE23) {
3171
+ return this.ctx.http.request({ method: "PATCH", path: this.orderPath(orderId), auth: auth2, body: change });
3172
+ }
3173
+ /** Finish an order. Returns an acknowledgement. */
3174
+ async finishOrder(orderId, auth2 = SERVICE23) {
3175
+ return this.ctx.http.request({ method: "POST", path: `${this.orderPath(orderId)}/finish`, auth: auth2 });
3176
+ }
3177
+ /** List order cycles (ids). */
3178
+ async listOrderCycles(query = {}, auth2 = SERVICE23) {
3179
+ return this.ctx.http.request({
3180
+ method: "GET",
3181
+ path: `${this.base()}/orderCycles`,
3182
+ auth: auth2,
3183
+ ...Object.keys(query).length ? { query } : {}
3184
+ });
3185
+ }
3186
+ /** Add an assignee to an order. Returns an acknowledgement. */
3187
+ async addAssignee(orderId, assignee, auth2 = SERVICE23) {
3188
+ return this.ctx.http.request({ method: "POST", path: `${this.orderPath(orderId)}/assignees`, auth: auth2, body: assignee });
3189
+ }
3190
+ /** Remove an assignee from an order. */
3191
+ async removeAssignee(orderId, assigneeId, auth2 = SERVICE23) {
3192
+ await this.ctx.http.request({
3193
+ method: "DELETE",
3194
+ path: `${this.orderPath(orderId)}/assignees/${encodeURIComponent(assigneeId)}`,
3195
+ auth: auth2
3196
+ });
3197
+ }
3198
+ /** Update packaging products for an order (`PUT`). Returns an acknowledgement. */
3199
+ async updatePackaging(orderId, change, auth2 = SERVICE23) {
3200
+ return this.ctx.http.request({ method: "PUT", path: `${this.orderPath(orderId)}/packaging`, auth: auth2, body: change });
3201
+ }
3202
+ /** Create a packing event. Returns an acknowledgement. */
3203
+ async createEvent(event, auth2 = SERVICE23) {
3204
+ return this.ctx.http.request({ method: "POST", path: `${this.base()}/events`, auth: auth2, body: event });
3205
+ }
3206
+ /** List packing events. */
3207
+ async listEvents(query = {}, auth2 = SERVICE23) {
3208
+ return this.ctx.http.request({
3209
+ method: "GET",
3210
+ path: `${this.base()}/events`,
3211
+ auth: auth2,
3212
+ ...Object.keys(query).length ? { query } : {}
3213
+ });
3214
+ }
3215
+ /** Trigger an order recalculation. Returns the created job's id. */
3216
+ async triggerRecalculation(input, auth2 = SERVICE23) {
3217
+ return this.ctx.http.request({
3218
+ method: "POST",
3219
+ path: `${this.base()}/jobs/recalculations`,
3220
+ auth: auth2,
3221
+ body: input
3222
+ });
3223
+ }
3224
+ /** Retrieve a recalculation job by id. */
3225
+ async getRecalculationJob(jobId, auth2 = SERVICE23) {
3226
+ return this.ctx.http.request({
3227
+ method: "GET",
3228
+ path: `${this.base()}/jobs/recalculations/${encodeURIComponent(jobId)}`,
3229
+ auth: auth2
3230
+ });
3231
+ }
3232
+ };
3233
+
3234
+ // src/services/customer-admin.ts
3235
+ var SERVICE24 = { kind: "service" };
3236
+ var CustomerAdminService = class {
3237
+ constructor(ctx) {
3238
+ this.ctx = ctx;
3239
+ }
3240
+ ctx;
3241
+ base() {
3242
+ return `/customer/${this.ctx.tenant}/customers`;
3243
+ }
3244
+ customerPath(customerNumber) {
3245
+ return `${this.base()}/${encodeURIComponent(customerNumber)}`;
3246
+ }
3247
+ addressPath(customerNumber, addressId) {
3248
+ return `${this.customerPath(customerNumber)}/addresses/${encodeURIComponent(addressId)}`;
3249
+ }
3250
+ // --- Customers ---
3251
+ /** List customers. */
3252
+ async listCustomers(query = {}, auth2 = SERVICE24) {
3253
+ return this.ctx.http.request({
3254
+ method: "GET",
3255
+ path: this.base(),
3256
+ auth: auth2,
3257
+ ...Object.keys(query).length ? { query } : {}
3258
+ });
3259
+ }
3260
+ /** Search customers (`POST /customers/search`). */
3261
+ async searchCustomers(query, auth2 = SERVICE24) {
3262
+ return this.ctx.http.request({ method: "POST", path: `${this.base()}/search`, auth: auth2, body: query });
3263
+ }
3264
+ /** Retrieve a customer profile by number. */
3265
+ async getCustomer(customerNumber, auth2 = SERVICE24) {
3266
+ return this.ctx.http.request({ method: "GET", path: this.customerPath(customerNumber), auth: auth2 });
3267
+ }
3268
+ /** Create a customer. */
3269
+ async createCustomer(input, auth2 = SERVICE24) {
3270
+ return this.ctx.http.request({ method: "POST", path: this.base(), auth: auth2, body: input });
3271
+ }
3272
+ /** Upsert a customer profile by number (`PUT`). */
3273
+ async upsertCustomer(customerNumber, input, auth2 = SERVICE24) {
3274
+ return this.ctx.http.request({ method: "PUT", path: this.customerPath(customerNumber), auth: auth2, body: input });
3275
+ }
3276
+ /** Partially update a customer profile (`PATCH`). */
3277
+ async patchCustomer(customerNumber, patch, auth2 = SERVICE24) {
3278
+ await this.ctx.http.request({ method: "PATCH", path: this.customerPath(customerNumber), auth: auth2, body: patch });
3279
+ }
3280
+ /** Delete a customer profile. */
3281
+ async deleteCustomer(customerNumber, auth2 = SERVICE24) {
3282
+ await this.ctx.http.request({ method: "DELETE", path: this.customerPath(customerNumber), auth: auth2 });
3283
+ }
3284
+ // --- Addresses ---
3285
+ /** List a customer's addresses. */
3286
+ async listAddresses(customerNumber, auth2 = SERVICE24) {
3287
+ return this.ctx.http.request({
3288
+ method: "GET",
3289
+ path: `${this.customerPath(customerNumber)}/addresses`,
3290
+ auth: auth2
3291
+ });
3292
+ }
3293
+ /** Retrieve one address. */
3294
+ async getAddress(customerNumber, addressId, auth2 = SERVICE24) {
3295
+ return this.ctx.http.request({ method: "GET", path: this.addressPath(customerNumber, addressId), auth: auth2 });
3296
+ }
3297
+ /** Add an address. */
3298
+ async addAddress(customerNumber, input, auth2 = SERVICE24) {
3299
+ return this.ctx.http.request({
3300
+ method: "POST",
3301
+ path: `${this.customerPath(customerNumber)}/addresses`,
3302
+ auth: auth2,
3303
+ body: input
3304
+ });
3305
+ }
3306
+ /** Upsert an address by id (`PUT`). */
3307
+ async upsertAddress(customerNumber, addressId, input, auth2 = SERVICE24) {
3308
+ return this.ctx.http.request({ method: "PUT", path: this.addressPath(customerNumber, addressId), auth: auth2, body: input });
3309
+ }
3310
+ /** Partially update an address by id (`PATCH`). */
3311
+ async patchAddress(customerNumber, addressId, patch, auth2 = SERVICE24) {
3312
+ await this.ctx.http.request({ method: "PATCH", path: this.addressPath(customerNumber, addressId), auth: auth2, body: patch });
3313
+ }
3314
+ /** Delete an address by id. */
3315
+ async deleteAddress(customerNumber, addressId, auth2 = SERVICE24) {
3316
+ await this.ctx.http.request({ method: "DELETE", path: this.addressPath(customerNumber, addressId), auth: auth2 });
3317
+ }
3318
+ /** Add tags to an address (`?tags=` query). */
3319
+ async addAddressTags(customerNumber, addressId, tags, auth2 = SERVICE24) {
3320
+ await this.ctx.http.request({
3321
+ method: "POST",
3322
+ path: `${this.addressPath(customerNumber, addressId)}/tags`,
3323
+ auth: auth2,
3324
+ query: { tags: tags.join(",") }
3325
+ });
3326
+ }
3327
+ /** Remove tags from an address (`?tags=` query). */
3328
+ async removeAddressTags(customerNumber, addressId, tags, auth2 = SERVICE24) {
3329
+ await this.ctx.http.request({
3330
+ method: "DELETE",
3331
+ path: `${this.addressPath(customerNumber, addressId)}/tags`,
3332
+ auth: auth2,
3333
+ query: { tags: tags.join(",") }
3334
+ });
3335
+ }
3336
+ };
3337
+
3338
+ // src/services/approval.ts
3339
+ var SERVICE25 = { kind: "service" };
3340
+ var ApprovalService = class {
3341
+ constructor(ctx) {
3342
+ this.ctx = ctx;
3343
+ }
3344
+ ctx;
3345
+ base() {
3346
+ return `/approval/${this.ctx.tenant}`;
3347
+ }
3348
+ /** List approvals (paged via `pageNumber`/`pageSize`/`sort`/`q`). Returns an array. */
3349
+ async listApprovals(query = {}, auth2 = SERVICE25) {
3350
+ return this.ctx.http.request({
3351
+ method: "GET",
3352
+ path: `${this.base()}/approvals`,
3353
+ auth: auth2,
3354
+ ...Object.keys(query).length ? { query } : {}
3355
+ });
3356
+ }
3357
+ /** Retrieve a single approval by id. */
3358
+ async getApproval(approvalId, auth2 = SERVICE25) {
3359
+ return this.ctx.http.request({
3360
+ method: "GET",
3361
+ path: `${this.base()}/approvals/${encodeURIComponent(approvalId)}`,
3362
+ auth: auth2
3363
+ });
3364
+ }
3365
+ /** Create an approval request (cart or quote). Returns the created `{ id }`. */
3366
+ async createApproval(input, auth2 = SERVICE25) {
3367
+ return this.ctx.http.request({
3368
+ method: "POST",
3369
+ path: `${this.base()}/approvals`,
3370
+ auth: auth2,
3371
+ body: input
3372
+ });
3373
+ }
3374
+ /** Approve/reject/amend an approval via a JSON-Patch op-array (`PATCH`). */
3375
+ async updateApproval(approvalId, ops, auth2 = SERVICE25) {
3376
+ await this.ctx.http.request({
3377
+ method: "PATCH",
3378
+ path: `${this.base()}/approvals/${encodeURIComponent(approvalId)}`,
3379
+ auth: auth2,
3380
+ body: ops
3381
+ });
3382
+ }
3383
+ /** Delete an approval by id. */
3384
+ async deleteApproval(approvalId, auth2 = SERVICE25) {
3385
+ await this.ctx.http.request({
3386
+ method: "DELETE",
3387
+ path: `${this.base()}/approvals/${encodeURIComponent(approvalId)}`,
3388
+ auth: auth2
3389
+ });
3390
+ }
3391
+ /** Check whether an operation on a resource is permitted / needs approval. */
3392
+ async checkPermitted(input, auth2 = SERVICE25) {
3393
+ return this.ctx.http.request({
3394
+ method: "POST",
3395
+ path: `${this.base()}/approval/permitted`,
3396
+ auth: auth2,
3397
+ body: input
3398
+ });
3399
+ }
3400
+ /** Search for users eligible to approve a resource. Returns an array. */
3401
+ async searchApprovers(input, auth2 = SERVICE25) {
3402
+ return this.ctx.http.request({
3403
+ method: "POST",
3404
+ path: `${this.base()}/search/users`,
3405
+ auth: auth2,
3406
+ body: input
3407
+ });
3408
+ }
3409
+ };
3410
+
2977
3411
  // package.json
2978
- var version = "2.4.0";
3412
+ var version = "2.5.0";
2979
3413
 
2980
3414
  // src/version.ts
2981
3415
  var SDK_VERSION = version;
@@ -3021,6 +3455,11 @@ var EmporixClient = class {
3021
3455
  sepaExport;
3022
3456
  indexing;
3023
3457
  units;
3458
+ catalogs;
3459
+ vendors;
3460
+ pickPack;
3461
+ customerAdmin;
3462
+ approvals;
3024
3463
  /** The validated tenant this client is bound to. */
3025
3464
  tenant;
3026
3465
  /**
@@ -3112,6 +3551,11 @@ var EmporixClient = class {
3112
3551
  this.sepaExport = new SepaExportService(mk("sepa-export"));
3113
3552
  this.indexing = new IndexingService(mk("indexing"));
3114
3553
  this.units = new UnitHandlingService(mk("unit-handling"));
3554
+ this.catalogs = new CatalogService(mk("catalog"));
3555
+ this.vendors = new VendorService(mk("vendor"));
3556
+ this.pickPack = new PickPackService(mk("pick-pack"));
3557
+ this.customerAdmin = new CustomerAdminService(mk("customer-admin"));
3558
+ this.approvals = new ApprovalService(mk("approval"));
3115
3559
  }
3116
3560
  /** Sets the runtime log level globally or for one service. */
3117
3561
  setLogLevel(level, opts = {}) {
@@ -3123,6 +3567,6 @@ var EmporixClient = class {
3123
3567
  }
3124
3568
  };
3125
3569
 
3126
- export { AiService, BrandService, ClientConfigService, CountryService, CouponService, CurrencyService, DEFAULT_HOST, DefaultTokenProvider, EmporixClient, FeeService, HttpClient, IndexingService, LEVEL, LabelService, LevelResolver, RagIndexerService, ReturnsService, RewardPointsService, SchemaService, SepaExportService, SequentialIdService, SessionContextService, ShippingService, ShoppingListService, SiteService, TaxService, TenantConfigService, UnitHandlingService, WebhookService, auth, createConsoleLogger, createNoopLogger, redact, resolveToken, validateConfig };
3570
+ export { AiService, ApprovalService, BrandService, CatalogService, ClientConfigService, CountryService, CouponService, CurrencyService, CustomerAdminService, DEFAULT_HOST, DefaultTokenProvider, EmporixClient, FeeService, HttpClient, IndexingService, LEVEL, LabelService, LevelResolver, PickPackService, RagIndexerService, ReturnsService, RewardPointsService, SchemaService, SepaExportService, SequentialIdService, SessionContextService, ShippingService, ShoppingListService, SiteService, TaxService, TenantConfigService, UnitHandlingService, VendorService, WebhookService, auth, createConsoleLogger, createNoopLogger, redact, resolveToken, validateConfig };
3127
3571
  //# sourceMappingURL=index.js.map
3128
3572
  //# sourceMappingURL=index.js.map