@spscommerce/asst-api 0.0.1-beta.5 → 0.0.1-beta.7

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.cjs CHANGED
@@ -32,11 +32,18 @@ var lib_exports = {};
32
32
  __export(lib_exports, {
33
33
  AsstClient: () => AsstClient,
34
34
  BASE_URLS: () => BASE_URLS,
35
+ createAttributesApi: () => createAttributesApi,
35
36
  createCategoriesApi: () => createCategoriesApi,
37
+ createCompanyFeaturesApi: () => createCompanyFeaturesApi,
38
+ createErrorsApi: () => createErrorsApi,
36
39
  createExportsApi: () => createExportsApi,
37
40
  createImportsApi: () => createImportsApi,
41
+ createItemsApi: () => createItemsApi,
42
+ createLocaleApi: () => createLocaleApi,
38
43
  createProductTypesApi: () => createProductTypesApi,
39
- createTradingPartnerAccessApi: () => createTradingPartnerAccessApi
44
+ createSpreadsheetTemplateApi: () => createSpreadsheetTemplateApi,
45
+ createTradingPartnerAccessApi: () => createTradingPartnerAccessApi,
46
+ createWhoAmIApi: () => createWhoAmIApi
40
47
  });
41
48
  module.exports = __toCommonJS(lib_exports);
42
49
 
@@ -3794,11 +3801,11 @@ var AsstClient = class {
3794
3801
 
3795
3802
  // lib/imports/models/ImportDetail.ts
3796
3803
  var importDetailSchema = z.object({
3797
- completedAt: z.nullable(z.number()),
3804
+ completedAt: z.number().nullish(),
3798
3805
  errorCount: z.number(),
3799
3806
  importId: z.number(),
3800
3807
  name: z.string(),
3801
- startedAt: z.nullable(z.string()),
3808
+ startedAt: z.string().nullish(),
3802
3809
  status: z.string(),
3803
3810
  uploadedAt: z.string()
3804
3811
  });
@@ -3811,7 +3818,7 @@ var importSchema = z.object({
3811
3818
 
3812
3819
  // lib/imports/models/ImportError.ts
3813
3820
  var importErrorSchema = z.object({
3814
- attribute: z.string(),
3821
+ attribute: z.string().nullish(),
3815
3822
  description: z.string(),
3816
3823
  importErrorId: z.number(),
3817
3824
  row: z.number()
@@ -3837,15 +3844,15 @@ var importStatusEnumSchema = z.enum([
3837
3844
 
3838
3845
  // lib/imports/models/ImportsStatus.ts
3839
3846
  var importsStatusSchema = z.object({
3840
- completedAt: z.nullable(z.string()).optional(),
3841
- docInEventId: z.nullable(z.string()).optional(),
3842
- errorCount: z.nullable(z.number()).optional(),
3847
+ completedAt: z.string().nullish(),
3848
+ docInEventId: z.string().nullish(),
3849
+ errorCount: z.number().nullish(),
3843
3850
  importId: z.number(),
3844
- invalidItemCount: z.nullable(z.number()).optional(),
3851
+ invalidItemCount: z.number().nullish(),
3845
3852
  name: z.string(),
3846
3853
  status: importStatusEnumSchema,
3847
- totalItemCount: z.nullable(z.number()).optional(),
3848
- validItemCount: z.nullable(z.number()).optional()
3854
+ totalItemCount: z.number().nullish(),
3855
+ validItemCount: z.number().nullish()
3849
3856
  });
3850
3857
 
3851
3858
  // lib/imports/models/VendorPartnerAttGroups.ts
@@ -3865,7 +3872,6 @@ var generateImportTemplateParamsSchema = z.object({
3865
3872
  });
3866
3873
 
3867
3874
  // lib/imports/index.ts
3868
- var import_query_string = __toESM(require("query-string"), 1);
3869
3875
  var BASE_URL = "imports";
3870
3876
  function createImportsApi(client) {
3871
3877
  async function getImportErrors(importId, params, signal) {
@@ -3891,12 +3897,8 @@ function createImportsApi(client) {
3891
3897
  return z.array(vendorPartnerAttGroupsSchema).parse(data);
3892
3898
  }
3893
3899
  async function generateImportTemplate(params) {
3894
- const searchParams = params ? import_query_string.default.stringify(params, {
3895
- arrayFormat: "comma",
3896
- skipEmptyString: true
3897
- }) : void 0;
3898
3900
  const response = await client.get(`${BASE_URL}/template/generate`, {
3899
- searchParams,
3901
+ searchParams: params,
3900
3902
  headers: {
3901
3903
  Accept: "application/octet-stream"
3902
3904
  }
@@ -3926,13 +3928,37 @@ function createImportsApi(client) {
3926
3928
  }
3927
3929
 
3928
3930
  // lib/exports/index.ts
3929
- var BASE_URL2 = "v2/exports";
3931
+ var BASE_URL2 = "exports";
3932
+ var BASE_URL_V2 = "v2/exports";
3930
3933
  function createExportsApi(client) {
3931
3934
  async function createExport(data) {
3932
- await client.post(`${BASE_URL2}/add`, { json: data });
3935
+ await client.post(`${BASE_URL_V2}/add`, { json: data });
3936
+ }
3937
+ async function downloadItems(params) {
3938
+ const searchParams = { ...params, ids: params.ids.join(",") };
3939
+ const response = await client.get(`${BASE_URL2}/spreadsheet/by-item`, {
3940
+ searchParams,
3941
+ headers: {
3942
+ Accept: "application/octet-stream"
3943
+ }
3944
+ });
3945
+ const disposition = response.headers.get("content-disposition") || "";
3946
+ const filename = disposition.match(/filename="(.+)"/)?.[1];
3947
+ const downloadUrl = window.URL.createObjectURL(
3948
+ new Blob([await response.blob()])
3949
+ );
3950
+ const link = document.createElement("a");
3951
+ link.href = downloadUrl;
3952
+ if (filename) {
3953
+ link.download = filename;
3954
+ }
3955
+ document.body.appendChild(link);
3956
+ link.click();
3957
+ link.remove();
3933
3958
  }
3934
3959
  return {
3935
- createExport
3960
+ createExport,
3961
+ downloadItems
3936
3962
  };
3937
3963
  }
3938
3964
 
@@ -3949,11 +3975,10 @@ var attrProdTypeSchema = z.object({
3949
3975
  });
3950
3976
 
3951
3977
  // lib/productTypes/index.ts
3952
- var import_query_string2 = __toESM(require("query-string"), 1);
3953
3978
  var BASE_URL3 = "product-types";
3954
3979
  function createProductTypesApi(client) {
3955
3980
  async function getProductTypes(params, signal) {
3956
- const searchParams = params ? import_query_string2.default.stringify(params, { arrayFormat: "comma" }) : void 0;
3981
+ const searchParams = params ? { retailerIds: params.retailerIds.join(",") } : void 0;
3957
3982
  const data = await client.get(`${BASE_URL3}/all`, {
3958
3983
  searchParams,
3959
3984
  signal
@@ -4003,13 +4028,13 @@ var itemCategorySchema = z.object({
4003
4028
  companyId: z.number(),
4004
4029
  name: z.string(),
4005
4030
  isActive: z.number(),
4006
- createdDate: z.nullable(z.number()),
4007
- categorytimestamp: z.nullable(z.number()),
4031
+ createdDate: z.number().nullish(),
4032
+ categorytimestamp: z.number().nullish(),
4008
4033
  typeId: z.number(),
4009
4034
  type: z.string(),
4010
- categorykey: z.optional(z.string()),
4011
- description: z.nullable(z.string()).optional(),
4012
- categoryCatalogName: z.nullable(z.string()).optional()
4035
+ categorykey: z.string().nullish(),
4036
+ description: z.string().nullish(),
4037
+ categoryCatalogName: z.string().nullish()
4013
4038
  });
4014
4039
 
4015
4040
  // lib/categories/models/ItemCategoriesSearch.ts
@@ -4044,13 +4069,774 @@ function createCategoriesApi(client) {
4044
4069
  }
4045
4070
  return { getCatalogs, getProductCodes, getSelectionCodes };
4046
4071
  }
4072
+
4073
+ // lib/attributes/models/AttributeMetaData.ts
4074
+ var attributeMetaDataSchema = z.object({
4075
+ dbName: z.string(),
4076
+ label: z.string(),
4077
+ group: z.string(),
4078
+ aliases: z.array(z.string()),
4079
+ orderBy: z.string().or(z.number()),
4080
+ type: z.string(),
4081
+ storageType: z.string(),
4082
+ rsxPath: z.string(),
4083
+ indexed: z.boolean(),
4084
+ repeatable: z.boolean(),
4085
+ extended: z.boolean(),
4086
+ hybrid: z.boolean(),
4087
+ userVisible: z.boolean(),
4088
+ retailerOwnedId: z.number().nullish()
4089
+ });
4090
+
4091
+ // lib/attributes/models/AttributeSummary.ts
4092
+ var attributeSummarySchema = z.object({
4093
+ attributeId: z.number(),
4094
+ attributeName: z.string(),
4095
+ displayName: z.string(),
4096
+ modifiedBy: z.string(),
4097
+ modifiedDate: z.number(),
4098
+ retailerOwnedId: z.number().nullish(),
4099
+ clusterAttrGroupId: z.number().nullish(),
4100
+ attributeType: z.string()
4101
+ });
4102
+
4103
+ // lib/attributes/models/AttributesByCompany.ts
4104
+ var attributesByCompanySchema = z.object({
4105
+ next: z.string().nullish(),
4106
+ previous: z.string().nullish(),
4107
+ count: z.number(),
4108
+ results: z.array(attributeSummarySchema)
4109
+ });
4110
+
4111
+ // lib/attributes/models/AttrDatatypeNameEnum.ts
4112
+ var attrDatatypeNameEnumSchema = z.enum([
4113
+ "TEXT",
4114
+ "SET",
4115
+ "INTEGER",
4116
+ "FLOAT",
4117
+ "BOOLEAN",
4118
+ "DATE",
4119
+ "KEYVALUE",
4120
+ "STRING",
4121
+ "REAL"
4122
+ ]);
4123
+
4124
+ // lib/attributes/models/AttributeGroup.ts
4125
+ var attributeGroupSchema = z.object({
4126
+ attrGroupId: z.number(),
4127
+ attrGroupType: z.object({
4128
+ attrGroupTypeId: z.number(),
4129
+ groupTypeName: z.string(),
4130
+ primary: z.boolean(),
4131
+ restricted: z.boolean()
4132
+ }),
4133
+ attrGroupTypeId: z.number(),
4134
+ groupName: z.string(),
4135
+ isDefault: z.boolean(),
4136
+ orderWeight: z.number(),
4137
+ primary: z.boolean()
4138
+ });
4139
+
4140
+ // lib/attributes/models/AttributeDefinition.ts
4141
+ var parentAttributeSchema = z.object({
4142
+ attrDataTypeId: z.number(),
4143
+ attrDatatype: z.object({
4144
+ attrDatatypeId: z.number(),
4145
+ datatypeName: attrDatatypeNameEnumSchema,
4146
+ displayOnly: z.boolean()
4147
+ }),
4148
+ attrGroupId: z.number(),
4149
+ attrGroups: z.array(attributeGroupSchema),
4150
+ attrRoundId: z.number(),
4151
+ attrStorageId: z.number(),
4152
+ attributeId: z.number(),
4153
+ attributeName: z.string(),
4154
+ createdBy: z.string(),
4155
+ createdDate: z.number(),
4156
+ description: z.string().optional(),
4157
+ displayName: z.string(),
4158
+ modifiedDate: z.number(),
4159
+ orderWeight: z.number(),
4160
+ parentAttributeId: z.number().optional(),
4161
+ primaryAttrGroup: attributeGroupSchema
4162
+ });
4163
+ var attributeDefinitionSchema = z.object({
4164
+ attrDataTypeId: z.number(),
4165
+ attrDatatype: z.object({
4166
+ attrDatatypeId: z.number(),
4167
+ datatypeName: attrDatatypeNameEnumSchema,
4168
+ displayOnly: z.boolean()
4169
+ }),
4170
+ attrGroupId: z.number(),
4171
+ attrGroups: z.array(attributeGroupSchema),
4172
+ attrRestrictions: z.array(
4173
+ z.object({
4174
+ attrRestrictId: z.number(),
4175
+ ignoreGlobal: z.boolean().optional(),
4176
+ isDefault: z.boolean(),
4177
+ isEssential: z.boolean(),
4178
+ locale: z.string(),
4179
+ mandatory: z.boolean(),
4180
+ repeatable: z.boolean(),
4181
+ minLength: z.number().optional(),
4182
+ maxLength: z.number().optional()
4183
+ })
4184
+ ),
4185
+ attrRoundId: z.number(),
4186
+ attrStorage: z.object({
4187
+ attrStorageId: z.number(),
4188
+ storageName: z.string()
4189
+ }),
4190
+ attrStorageId: z.number(),
4191
+ attrValues: z.array(
4192
+ z.object({
4193
+ attrKeyPair: z.string(),
4194
+ attrValueId: z.number().optional(),
4195
+ isDefault: z.boolean(),
4196
+ locale: z.string(),
4197
+ value: z.string()
4198
+ })
4199
+ ).optional(),
4200
+ attributeId: z.number(),
4201
+ attributeName: z.string(),
4202
+ createdBy: z.string(),
4203
+ createdDate: z.number(),
4204
+ description: z.string().optional(),
4205
+ displayName: z.string(),
4206
+ modifiedDate: z.number(),
4207
+ orderWeight: z.number().optional(),
4208
+ parentAttribute: parentAttributeSchema.optional(),
4209
+ parentAttributeId: z.number().optional(),
4210
+ primaryAttrGroup: attributeGroupSchema
4211
+ });
4212
+
4213
+ // lib/attributes/models/AttributeValidValues.ts
4214
+ var attributeValidValuesSchema = z.object({
4215
+ value: z.string(),
4216
+ isDefault: z.boolean(),
4217
+ locale: z.string(),
4218
+ createdBy: z.string(),
4219
+ createdDate: z.number(),
4220
+ modifiedDate: z.number(),
4221
+ modifiedBy: z.string(),
4222
+ attributeId: z.number(),
4223
+ attrValueId: z.number(),
4224
+ attrKeyPair: z.string()
4225
+ });
4226
+
4227
+ // lib/attributes/index.ts
4228
+ var BASE_URL6 = "attributes";
4229
+ function createAttributesApi(client) {
4230
+ async function getAllAttributes(signal) {
4231
+ const data = await client.get(`${BASE_URL6}`, { signal }).json();
4232
+ return z.array(attributeMetaDataSchema).parse(data);
4233
+ }
4234
+ async function getAllAttributesByCompany(params, signal) {
4235
+ const data = await client.get(`${BASE_URL6}/company`, {
4236
+ searchParams: params,
4237
+ signal
4238
+ }).json();
4239
+ return attributesByCompanySchema.parse(data);
4240
+ }
4241
+ async function getAttributesExtensiveInfo(signal) {
4242
+ const data = await client.get(`${BASE_URL6}/registry/editui`, { signal }).json();
4243
+ return z.array(attributeDefinitionSchema).parse(data);
4244
+ }
4245
+ async function getAttributeValidValues(attributeDbName, signal) {
4246
+ const data = await client.get(`${BASE_URL6}/registry/attribute/${attributeDbName}/values`, {
4247
+ signal
4248
+ }).json();
4249
+ return z.array(attributeValidValuesSchema).parse(data);
4250
+ }
4251
+ return {
4252
+ getAllAttributes,
4253
+ getAllAttributesByCompany,
4254
+ getAttributesExtensiveInfo,
4255
+ getAttributeValidValues
4256
+ };
4257
+ }
4258
+
4259
+ // lib/locale/models/Locale.ts
4260
+ var localeSchema = z.object({
4261
+ localeCode: z.string(),
4262
+ localeDescription: z.string()
4263
+ });
4264
+
4265
+ // lib/locale/index.ts
4266
+ var BASE_URL7 = "locale";
4267
+ function createLocaleApi(client) {
4268
+ async function getLocale(signal) {
4269
+ const data = await client.get(`${BASE_URL7}`, { signal }).json();
4270
+ return z.array(localeSchema).parse(data);
4271
+ }
4272
+ return {
4273
+ getLocale
4274
+ };
4275
+ }
4276
+
4277
+ // lib/spreadsheetTemplate/models/SpreadsheetTemplateCompany.ts
4278
+ var spreadsheetTemplateCompanySchema = z.object({
4279
+ companyName: z.string(),
4280
+ companyId: z.number(),
4281
+ createdAt: z.number()
4282
+ });
4283
+
4284
+ // lib/spreadsheetTemplate/models/SpreadsheetTemplate.ts
4285
+ var spreadsheetTemplateSchema = z.object({
4286
+ id: z.number(),
4287
+ fileLocation: z.string(),
4288
+ name: z.string(),
4289
+ templateType: z.string(),
4290
+ maxItemsPerDoc: z.number(),
4291
+ companies: z.array(spreadsheetTemplateCompanySchema),
4292
+ createdBy: z.string().nullish(),
4293
+ createdAt: z.number().nullish(),
4294
+ modifiedBy: z.string().nullish(),
4295
+ modifiedAt: z.number().nullish()
4296
+ });
4297
+
4298
+ // lib/spreadsheetTemplate/index.ts
4299
+ var BASE_URL8 = "templates";
4300
+ function createSpreadsheetTemplateApi(client) {
4301
+ async function getTemplates(signal) {
4302
+ const data = await client.get(`${BASE_URL8}`, { signal }).json();
4303
+ return z.array(spreadsheetTemplateSchema).parse(data);
4304
+ }
4305
+ return {
4306
+ getTemplates
4307
+ };
4308
+ }
4309
+
4310
+ // lib/whoami/models/IdentityServiceDatetimePreferences.ts
4311
+ var identityServiceDatetimePreferencesSchema = z.object({
4312
+ DATE_TIME: z.string(),
4313
+ TIME: z.string(),
4314
+ SHORT_DATE: z.string(),
4315
+ LONG_DATETIME: z.string(),
4316
+ LONG_TIME: z.string(),
4317
+ DATE: z.string()
4318
+ });
4319
+
4320
+ // lib/whoami/models/IdentityServiceOrganizationMetadata.ts
4321
+ var identityServiceOrganizationMetadataSchema = z.object({
4322
+ namespace: z.string(),
4323
+ key: z.string(),
4324
+ value: z.string()
4325
+ });
4326
+
4327
+ // lib/whoami/models/IdentityServiceOrganization.ts
4328
+ var identityServiceOrganizationSchema = z.object({
4329
+ organization_name: z.string(),
4330
+ organization_site: z.string(),
4331
+ namespace: z.string(),
4332
+ id: z.string(),
4333
+ permissions: z.array(z.string()).optional(),
4334
+ metadata: identityServiceOrganizationMetadataSchema.optional()
4335
+ });
4336
+
4337
+ // lib/whoami/models/IdentityServicePreferences.ts
4338
+ var identityServicePreferencesSchema = z.object({
4339
+ locale: z.string(),
4340
+ timezone: z.string(),
4341
+ cpUpgrade: z.string().optional(),
4342
+ language: z.array(z.string()),
4343
+ datetime: identityServiceDatetimePreferencesSchema
4344
+ });
4345
+
4346
+ // lib/whoami/models/IdentityServiceUser.ts
4347
+ var identityServiceUserSchema = z.object({
4348
+ id: z.string(),
4349
+ email: z.string(),
4350
+ first_name: z.string(),
4351
+ last_name: z.string(),
4352
+ job_title: z.string(),
4353
+ externally_managed: z.boolean(),
4354
+ city: z.string(),
4355
+ name: z.string(),
4356
+ state: z.string(),
4357
+ country: z.string(),
4358
+ user_type: z.string(),
4359
+ token_type: z.string(),
4360
+ avatar_image_id: z.string(),
4361
+ avatar_image_url: z.string(),
4362
+ origin_avatar_image_id: z.string(),
4363
+ bio: z.string(),
4364
+ phone_number: z.string(),
4365
+ twitter_handle: z.string(),
4366
+ linkedin_url: z.string(),
4367
+ description: z.string().optional(),
4368
+ preferences: identityServicePreferencesSchema,
4369
+ roles: z.array(z.string()),
4370
+ organization: identityServiceOrganizationSchema,
4371
+ password: z.string(),
4372
+ verified: z.boolean()
4373
+ });
4374
+
4375
+ // lib/whoami/models/RegisteredService.ts
4376
+ var registeredServiceSchema = z.object({
4377
+ serviceId: z.number(),
4378
+ identityServiceId: z.number(),
4379
+ name: z.string(),
4380
+ isActive: z.boolean()
4381
+ });
4382
+
4383
+ // lib/whoami/models/UserAccount.ts
4384
+ var userAccountSchema = z.object({
4385
+ identityUser: identityServiceUserSchema,
4386
+ companyId: z.number(),
4387
+ companyName: z.string(),
4388
+ name: z.string(),
4389
+ assortmentPartnerCompanyId: z.number().nullish(),
4390
+ retailer: z.boolean(),
4391
+ supplier: z.boolean(),
4392
+ registeredService: registeredServiceSchema,
4393
+ uniqueAttributes: z.array(z.string()),
4394
+ admin: z.boolean(),
4395
+ adminToolUser: z.boolean(),
4396
+ attributeRegistryAdmin: z.boolean(),
4397
+ attributeRegistryDev: z.boolean(),
4398
+ attributeRegistryRsx: z.boolean(),
4399
+ attributeRegistryUser: z.boolean(),
4400
+ attributeRegistryViewer: z.boolean()
4401
+ });
4402
+
4403
+ // lib/whoami/index.ts
4404
+ var BASE_URL9 = "whoami";
4405
+ function createWhoAmIApi(client) {
4406
+ async function whoAmI(signal) {
4407
+ const data = await client.get(`${BASE_URL9}`, { signal }).json();
4408
+ return userAccountSchema.parse(data);
4409
+ }
4410
+ return {
4411
+ whoAmI
4412
+ };
4413
+ }
4414
+
4415
+ // lib/companyFeatures/index.ts
4416
+ var BASE_URL10 = "feature";
4417
+ function createCompanyFeaturesApi(client) {
4418
+ async function checkIfStageItemSetupIsEnabled(signal) {
4419
+ const data = await client.get(`${BASE_URL10}/isphaseditemsetupenabled`, {
4420
+ signal
4421
+ }).json();
4422
+ return z.boolean().parse(data);
4423
+ }
4424
+ return {
4425
+ checkIfStageItemSetupIsEnabled
4426
+ };
4427
+ }
4428
+
4429
+ // lib/items/models/ItemHeader.ts
4430
+ var itemHeaderSchema = z.object({
4431
+ status: z.string().optional(),
4432
+ catalogName: z.string(),
4433
+ productCodeName: z.string(),
4434
+ selectionCodeName: z.string(),
4435
+ gtin: z.string(),
4436
+ upc: z.string(),
4437
+ ean: z.string(),
4438
+ isbn: z.string(),
4439
+ partNumber: z.string(),
4440
+ lastUpdatedDateString: z.string(),
4441
+ companyId: z.string(),
4442
+ itemInfoId: z.string()
4443
+ });
4444
+
4445
+ // lib/items/models/PhaseEnum.ts
4446
+ var phaseEnumSchema = z.enum([
4447
+ "CORE",
4448
+ "CORE_PLUS",
4449
+ "CORE_ADVANCED",
4450
+ "ENRICHED",
4451
+ "STANDARD_REQUIREMENTS"
4452
+ ]);
4453
+
4454
+ // lib/items/models/TradingPartnerStage.ts
4455
+ var tradingPartnerStageSchema = z.object({
4456
+ companyId: z.number(),
4457
+ companyName: z.string(),
4458
+ stage: z.nullable(phaseEnumSchema),
4459
+ isValid: z.boolean()
4460
+ });
4461
+
4462
+ // lib/items/models/ItemMap.ts
4463
+ var itemMapSchema = z.object({
4464
+ rn: z.number().optional(),
4465
+ iteminfoid: z.string(),
4466
+ tradingPartnerStages: z.array(tradingPartnerStageSchema).optional(),
4467
+ gtin: z.string().nullish(),
4468
+ catalogname: z.string().nullish(),
4469
+ isbn: z.string().nullish(),
4470
+ lastupdateddatestring: z.string().nullish(),
4471
+ upc: z.string().nullish(),
4472
+ productcodename: z.string().nullish(),
4473
+ ean: z.string().nullish(),
4474
+ selectioncodename: z.string().nullish(),
4475
+ createddatestring: z.string().nullish(),
4476
+ partnumber: z.string().nullish(),
4477
+ consumeravailabledatestring: z.string().nullish(),
4478
+ status: z.string().nullish(),
4479
+ nrfcolorcode: z.array(z.string()).nullish(),
4480
+ nrfsizecode: z.string().nullish(),
4481
+ productcolordescription: z.array(z.string()).nullish(),
4482
+ productsizedescription: z.array(z.string()).nullish()
4483
+ });
4484
+
4485
+ // lib/items/models/ItemTable.ts
4486
+ var itemTableSchema = z.object({
4487
+ headers: itemHeaderSchema,
4488
+ itemMaps: z.array(itemMapSchema)
4489
+ });
4490
+
4491
+ // lib/items/models/ItemSearchView.ts
4492
+ var itemSearchViewSchema = z.object({
4493
+ itemTable: itemTableSchema,
4494
+ hasNext: z.boolean(),
4495
+ count: z.number()
4496
+ });
4497
+
4498
+ // lib/exports/models/ExportType.ts
4499
+ var exportTypeEnum = z.enum(["ALL", "UPDATES", "DELTAS_UPDATE", "NO_BUYER_PART_NUMBER"]);
4500
+
4501
+ // lib/exports/models/ExportFrequency.ts
4502
+ var exportFrequencyEnum = z.enum([
4503
+ "IMMEDIATE",
4504
+ "ONETIME",
4505
+ "DAILY",
4506
+ "WEEKLY",
4507
+ "MONTHLY"
4508
+ ]);
4509
+
4510
+ // lib/exports/models/ExportDayOfWeek.ts
4511
+ var exportDayOfWeekEnum = z.enum([
4512
+ "MON",
4513
+ "TUE",
4514
+ "WED",
4515
+ "THU",
4516
+ "FRI",
4517
+ "SAT",
4518
+ "SUN"
4519
+ ]);
4520
+
4521
+ // lib/exports/models/Export.ts
4522
+ var exportSchema = z.object({
4523
+ exportName: z.string(),
4524
+ exportDescription: z.string(),
4525
+ isActive: z.boolean(),
4526
+ exportType: exportTypeEnum,
4527
+ exportFrequency: exportFrequencyEnum,
4528
+ includeValidAttributes: z.optional(z.boolean()),
4529
+ dayOfMonth: z.optional(z.number()),
4530
+ dayOfWeek: z.optional(exportDayOfWeekEnum),
4531
+ hourOfDay: z.optional(z.number()),
4532
+ date: z.optional(z.string()),
4533
+ catalogIds: z.optional(z.array(z.number())),
4534
+ itemInfoIds: z.optional(z.array(z.number())),
4535
+ excludeItemInfoIds: z.optional(z.array(z.number())),
4536
+ selectionCodeIds: z.optional(z.array(z.number())),
4537
+ productCodeIds: z.optional(z.array(z.number())),
4538
+ productTypes: z.optional(z.array(z.string())),
4539
+ deliveryType: z.optional(z.string()),
4540
+ spreadsheetTemplateId: z.optional(z.number()),
4541
+ emailAddresses: z.optional(z.array(z.string())),
4542
+ subjectLine: z.optional(z.string()),
4543
+ additionalLocales: z.optional(z.array(z.string()))
4544
+ });
4545
+
4546
+ // lib/exports/models/DownloadItemsParams.ts
4547
+ var downLoadItemsParamsSchema = z.object({
4548
+ "multi-sheet": z.boolean(),
4549
+ ids: z.array(z.string())
4550
+ });
4551
+
4552
+ // lib/errors/models/ItemErrorDetails.ts
4553
+ var itemErrorDetailsSchema = z.object({
4554
+ errorMessage: z.string(),
4555
+ attributeName: z.string(),
4556
+ tradingPartnerNames: z.array(z.string()),
4557
+ phases: z.array(phaseEnumSchema),
4558
+ attributeDbNames: z.array(z.string()),
4559
+ tradingPartnerStages: z.array(tradingPartnerStageSchema),
4560
+ repeatableGroupId: z.string().nullish()
4561
+ });
4562
+
4563
+ // lib/errors/models/ItemErrorDetailsResult.ts
4564
+ var itemErrorDetailsResultSchema = z.object({
4565
+ itemInfoId: z.number(),
4566
+ upc: z.string().nullish(),
4567
+ isbn: z.string().nullish(),
4568
+ gtin: z.string().nullish(),
4569
+ partnumber: z.string().nullish(),
4570
+ ean: z.string().nullish(),
4571
+ itemName: z.string().nullable(),
4572
+ itemErrorDetails: z.array(itemErrorDetailsSchema)
4573
+ });
4574
+
4575
+ // lib/items/models/AttributeDetail.ts
4576
+ var attributeDetailSchema = z.object({
4577
+ type: attrDatatypeNameEnumSchema,
4578
+ name: z.string(),
4579
+ value: z.string().or(z.number()).or(z.array(z.string())).or(z.array(z.number())).nullable(),
4580
+ label: z.string(),
4581
+ group: z.string(),
4582
+ orderBy: z.number().or(z.string()).nullish()
4583
+ });
4584
+
4585
+ // lib/items/models/CategoryEnum.ts
4586
+ var categoryEnumSchema = z.enum([
4587
+ "AKA",
4588
+ "CATALOG",
4589
+ "EXPORT",
4590
+ "LABEL",
4591
+ "LEGACY_PRODUCT_TYPE",
4592
+ "PRODUCT_CLASSIFICATION",
4593
+ "PRODUCT_CODE",
4594
+ "SELECTION_CODE",
4595
+ "TAXONOMY_ROOT"
4596
+ ]);
4597
+
4598
+ // lib/items/models/ComponentDetails.ts
4599
+ var componentDetailsSchema = z.object({
4600
+ itemInfoId: z.number(),
4601
+ description: z.string(),
4602
+ saleable: z.boolean(),
4603
+ valid: z.boolean(),
4604
+ uniqueCriteria: z.array(
4605
+ z.object({
4606
+ name: z.string(),
4607
+ value: z.string()
4608
+ })
4609
+ )
4610
+ });
4611
+
4612
+ // lib/items/models/RepeatableGroup.ts
4613
+ var repeatableGroupSchema = z.object({
4614
+ repeatableGroupId: z.string(),
4615
+ repeatableNumber: z.number()
4616
+ });
4617
+
4618
+ // lib/items/models/GroupedAttributeList.ts
4619
+ var groupedAttributeListSchema = z.object({
4620
+ type: z.string(),
4621
+ rows: z.array(z.array(attributeDetailSchema)),
4622
+ repeatableGroups: z.array(repeatableGroupSchema)
4623
+ });
4624
+
4625
+ // lib/items/models/GroupedAttributes.ts
4626
+ var groupedAttributesSchema = z.object({
4627
+ type: z.string(),
4628
+ attributes: z.array(attributeDetailSchema),
4629
+ attributeGroups: z.array(groupedAttributeListSchema)
4630
+ });
4631
+
4632
+ // lib/items/models/HierarchyCategory.ts
4633
+ var hierarchyCategorySchema = z.object({
4634
+ name: z.string(),
4635
+ description: z.string().nullish(),
4636
+ id: z.number(),
4637
+ companyId: z.number(),
4638
+ type: categoryEnumSchema
4639
+ });
4640
+
4641
+ // lib/items/models/HierarchyDetails.ts
4642
+ var hierarchyDetailsSchema = z.object({
4643
+ catalogs: z.array(hierarchyCategorySchema),
4644
+ selectionCodes: z.array(hierarchyCategorySchema),
4645
+ productCodes: z.array(hierarchyCategorySchema)
4646
+ });
4647
+
4648
+ // lib/items/models/PackComponentItemInfo.ts
4649
+ var packComponentItemInfoSchema = z.object({
4650
+ companyid: z.number(),
4651
+ createddate: z.number(),
4652
+ isServiceApi: z.boolean(),
4653
+ isactive: z.number(),
4654
+ isvalid: z.number(),
4655
+ itemType: z.string(),
4656
+ iteminfoid: z.number(),
4657
+ itemtimestamp: z.number(),
4658
+ serviceId: z.number(),
4659
+ attributes: z.record(z.string(), z.string().or(z.array(z.string())))
4660
+ });
4661
+
4662
+ // lib/items/models/ItemPrice.ts
4663
+ var itemPriceSchema = z.object({
4664
+ amount: z.number(),
4665
+ currency: z.string(),
4666
+ id: z.number().nullish(),
4667
+ priceDivision: z.string().nullish(),
4668
+ iteminfoid: z.number().nullish(),
4669
+ startdate: z.string().nullish(),
4670
+ enddate: z.string().nullish(),
4671
+ qualifier: z.string(),
4672
+ region: z.string().nullish(),
4673
+ regionqualifier: z.string().nullish(),
4674
+ regiondescription: z.string().nullish(),
4675
+ partnercompanyid: z.string().nullish(),
4676
+ itempricetimestamp: z.number().nullish(),
4677
+ range_type: z.string().nullish(),
4678
+ date_range_type: z.string().nullish(),
4679
+ min_range: z.number().nullish(),
4680
+ gtin: z.string().nullish(),
4681
+ priceConditionDescription: z.string().nullish(),
4682
+ priceUnitQuantity: z.number().nullish(),
4683
+ priceUnitQuantityUOM: z.string().nullish()
4684
+ });
4685
+
4686
+ // lib/items/models/PackComponentDetails.ts
4687
+ var packComponentDetailsSchema = z.object({
4688
+ itemInfo: packComponentItemInfoSchema,
4689
+ itemPrices: z.array(itemPriceSchema)
4690
+ });
4691
+
4692
+ // lib/items/models/GroupedItem.ts
4693
+ var groupedItemSchema = z.object({
4694
+ iteminfoid: z.number(),
4695
+ companyid: z.number(),
4696
+ status: z.string(),
4697
+ createdDate: z.string(),
4698
+ lastUpdatedDate: z.string(),
4699
+ identifiers: z.record(z.string(), z.any()),
4700
+ hierarchyDetails: hierarchyDetailsSchema,
4701
+ groupedAttributes: z.array(groupedAttributesSchema),
4702
+ packComponentDetails: z.array(packComponentDetailsSchema),
4703
+ childComponentDetails: z.array(componentDetailsSchema),
4704
+ parentComponentDetails: z.array(componentDetailsSchema),
4705
+ locales: z.array(z.string())
4706
+ });
4707
+
4708
+ // lib/items/models/ItemDetailView.ts
4709
+ var itemDetailViewSchema = z.object({
4710
+ item: groupedItemSchema
4711
+ });
4712
+
4713
+ // lib/items/models/Bulb.ts
4714
+ var bulbSchema = z.object({
4715
+ iteminfoid: z.number(),
4716
+ id: z.number(),
4717
+ shape: z.string(),
4718
+ position: z.number(),
4719
+ quantity: z.number(),
4720
+ basetype: z.string(),
4721
+ maxwatt: z.number(),
4722
+ createdat: z.string(),
4723
+ modifiedat: z.string(),
4724
+ bulbtype: z.string(),
4725
+ bulbincluded: z.string(),
4726
+ bulbsize: z.string(),
4727
+ replacementbulb: z.string(),
4728
+ threewaybulb: z.string()
4729
+ });
4730
+
4731
+ // lib/items/models/PackComponent.ts
4732
+ var packComponentSchema = z.object({
4733
+ itemInfoId: z.number().nullish(),
4734
+ attributes: z.record(z.string(), z.string().or(z.array(z.string()))),
4735
+ prices: z.array(itemPriceSchema)
4736
+ });
4737
+
4738
+ // lib/items/models/MediaItem.ts
4739
+ var mediaItemSchema = z.object({
4740
+ id: z.number(),
4741
+ iteminfoid: z.number(),
4742
+ medianame: z.string(),
4743
+ height: z.number().nullish(),
4744
+ filename: z.string(),
4745
+ mediafilename: z.string().nullish(),
4746
+ description: z.string().nullish(),
4747
+ filesize: z.number().nullish(),
4748
+ format: z.string().nullish(),
4749
+ orientation: z.string().nullish(),
4750
+ pixeldensity: z.string().nullish(),
4751
+ purpose: z.string().nullish(),
4752
+ width: z.number().nullish(),
4753
+ mediatype: z.string(),
4754
+ mediaviewtype: z.string().nullish(),
4755
+ compressionquality: z.string().nullish(),
4756
+ thumbnailflag: z.string().nullish()
4757
+ });
4758
+
4759
+ // lib/items/models/ItemDetail.ts
4760
+ var itemDetailSchema = z.object({
4761
+ attributes: z.record(z.string(), z.any()),
4762
+ clusters: z.record(
4763
+ z.string(),
4764
+ z.array(
4765
+ z.object({
4766
+ itemInfoAttributes: z.record(
4767
+ z.string(),
4768
+ z.string().or(z.number()).or(z.boolean())
4769
+ )
4770
+ })
4771
+ )
4772
+ ),
4773
+ prices: z.array(itemPriceSchema),
4774
+ bulbs: z.array(bulbSchema),
4775
+ media: z.array(mediaItemSchema),
4776
+ packs: z.array(packComponentSchema)
4777
+ });
4778
+
4779
+ // lib/items/index.ts
4780
+ var BASE_URL11 = "items";
4781
+ function createItemsApi(client) {
4782
+ async function searchItems(params, signal) {
4783
+ const searchParams = params ? `limit=${params.limit}&offset=${params.offset}` + (params.url ? `&${params.url}` : "") : void 0;
4784
+ const data = await client.get(`${BASE_URL11}`, { searchParams, signal }).json();
4785
+ return itemSearchViewSchema.parse(data);
4786
+ }
4787
+ async function getItem(itemId, locale = "en-US", signal) {
4788
+ const data = await client.get(`${BASE_URL11}/${itemId}`, { searchParams: { locale }, signal }).json();
4789
+ return itemDetailViewSchema.parse(data);
4790
+ }
4791
+ async function updateItem(itemId, item) {
4792
+ client.put(`${BASE_URL11}/details/${itemId}`, { json: { item } }).json();
4793
+ }
4794
+ async function deleteItem(itemId) {
4795
+ await client.delete(`${BASE_URL11}/${itemId}`);
4796
+ }
4797
+ async function deleteItems(itemIds) {
4798
+ const params = new URLSearchParams();
4799
+ itemIds.forEach((id) => {
4800
+ params.append("items", id);
4801
+ });
4802
+ await client.delete(`${BASE_URL11}/items`, { searchParams: params });
4803
+ }
4804
+ return {
4805
+ searchItems,
4806
+ getItem,
4807
+ updateItem,
4808
+ deleteItem,
4809
+ deleteItems
4810
+ };
4811
+ }
4812
+
4813
+ // lib/errors/index.ts
4814
+ var BASE_URL12 = "errors";
4815
+ function createErrorsApi(client) {
4816
+ async function getInvalidItemErrorDetails(itemInfoId, signal) {
4817
+ const data = await client.get(`${BASE_URL12}/items/${itemInfoId}`, {
4818
+ signal
4819
+ }).json();
4820
+ return itemErrorDetailsResultSchema.parse(data);
4821
+ }
4822
+ return {
4823
+ getInvalidItemErrorDetails
4824
+ };
4825
+ }
4047
4826
  // Annotate the CommonJS export names for ESM import in node:
4048
4827
  0 && (module.exports = {
4049
4828
  AsstClient,
4050
4829
  BASE_URLS,
4830
+ createAttributesApi,
4051
4831
  createCategoriesApi,
4832
+ createCompanyFeaturesApi,
4833
+ createErrorsApi,
4052
4834
  createExportsApi,
4053
4835
  createImportsApi,
4836
+ createItemsApi,
4837
+ createLocaleApi,
4054
4838
  createProductTypesApi,
4055
- createTradingPartnerAccessApi
4839
+ createSpreadsheetTemplateApi,
4840
+ createTradingPartnerAccessApi,
4841
+ createWhoAmIApi
4056
4842
  });