@spscommerce/asst-api 5.2.0 → 5.3.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.
@@ -357,6 +357,19 @@ function createWhoAmIApi(client) {
357
357
 
358
358
  // lib/companyFeatures/index.ts
359
359
  var BASE_URL10 = "feature";
360
+ var companyFeatureSchema = external_exports.object({
361
+ /**
362
+ * Validated as a string at runtime so that unknown feature types returned by the
363
+ * backend (e.g., after a backend-only deploy) never cause a ZodError. The TypeScript
364
+ * type is narrowed to `FeatureType` so callers still get compile-time checking when
365
+ * comparing against known values.
366
+ */
367
+ type: external_exports.string(),
368
+ display: external_exports.string(),
369
+ active: external_exports.boolean(),
370
+ assortmentSystemInstanceId: external_exports.string().nullish(),
371
+ defaultCatalogId: external_exports.number().nullish()
372
+ });
360
373
  function createCompanyFeaturesApi(client, companyType) {
361
374
  function getSearchParams() {
362
375
  return companyType && { companyType };
@@ -368,12 +381,17 @@ function createCompanyFeaturesApi(client, companyType) {
368
381
  }).json();
369
382
  return external_exports.boolean().parse(data);
370
383
  }
384
+ async function getFeaturesForCompany(companyId, signal) {
385
+ const data = await client.get(`${BASE_URL10}/company/${companyId}`, { signal }).json();
386
+ return external_exports.array(companyFeatureSchema).parse(data);
387
+ }
371
388
  async function enableFeatureForCompany(featureKey, companyId) {
372
389
  await client.put(`${BASE_URL10}/${featureKey}/company/${companyId}/enable`);
373
390
  }
374
391
  return {
375
392
  checkIfStageItemSetupIsEnabled,
376
- enableFeatureForCompany
393
+ enableFeatureForCompany,
394
+ getFeaturesForCompany
377
395
  };
378
396
  }
379
397
 
@@ -701,6 +719,7 @@ export {
701
719
  BASE_URL9,
702
720
  createWhoAmIApi,
703
721
  BASE_URL10,
722
+ companyFeatureSchema,
704
723
  createCompanyFeaturesApi,
705
724
  BASE_URL11,
706
725
  createFeatureFlagsApi,
package/dist/index.cjs CHANGED
@@ -4845,6 +4845,19 @@ function createWhoAmIApi(client) {
4845
4845
 
4846
4846
  // lib/companyFeatures/index.ts
4847
4847
  var BASE_URL10 = "feature";
4848
+ var companyFeatureSchema = external_exports.object({
4849
+ /**
4850
+ * Validated as a string at runtime so that unknown feature types returned by the
4851
+ * backend (e.g., after a backend-only deploy) never cause a ZodError. The TypeScript
4852
+ * type is narrowed to `FeatureType` so callers still get compile-time checking when
4853
+ * comparing against known values.
4854
+ */
4855
+ type: external_exports.string(),
4856
+ display: external_exports.string(),
4857
+ active: external_exports.boolean(),
4858
+ assortmentSystemInstanceId: external_exports.string().nullish(),
4859
+ defaultCatalogId: external_exports.number().nullish()
4860
+ });
4848
4861
  function createCompanyFeaturesApi(client, companyType) {
4849
4862
  function getSearchParams() {
4850
4863
  return companyType && { companyType };
@@ -4856,12 +4869,17 @@ function createCompanyFeaturesApi(client, companyType) {
4856
4869
  }).json();
4857
4870
  return external_exports.boolean().parse(data);
4858
4871
  }
4872
+ async function getFeaturesForCompany(companyId, signal) {
4873
+ const data = await client.get(`${BASE_URL10}/company/${companyId}`, { signal }).json();
4874
+ return external_exports.array(companyFeatureSchema).parse(data);
4875
+ }
4859
4876
  async function enableFeatureForCompany(featureKey, companyId) {
4860
4877
  await client.put(`${BASE_URL10}/${featureKey}/company/${companyId}/enable`);
4861
4878
  }
4862
4879
  return {
4863
4880
  checkIfStageItemSetupIsEnabled,
4864
- enableFeatureForCompany
4881
+ enableFeatureForCompany,
4882
+ getFeaturesForCompany
4865
4883
  };
4866
4884
  }
4867
4885
 
package/dist/index.d.cts CHANGED
@@ -330,8 +330,37 @@ type ApplicationType = z.infer<typeof applicationTypeSchema>;
330
330
  * match the backend enum values in the CompanyFeatures service. If this list
331
331
  * grows significantly, we should consider moving these to their own constants file or
332
332
  * generating them from the backend.
333
+ *
334
+ * Defined as a const tuple so that both the `FeatureType` union and the Zod schema
335
+ * share a single source of truth — adding a value here automatically widens both.
333
336
  */
334
- type FeatureType = "RETAILERAPI" | "DELTASUPDATEEXPORT" | "ASSORTMENTUIDASHBOARD" | "PHASEDITEMSETUP" | "PUBLICIMAGEACCESS" | "SINGLEHIERARCHYBYITEM" | "DELTAPRICEEXPORT";
337
+ type FeatureType = "RETAILERAPI" | "DELTASUPDATEEXPORT" | "ASSORTMENTUIDASHBOARD" | "PHASEDITEMSETUP" | "PUBLICIMAGEACCESS" | "SINGLEHIERARCHYBYITEM" | "DELTAPRICEEXPORT" | "ASSORTMENTXREF";
338
+ declare const companyFeatureSchema: z.ZodObject<{
339
+ /**
340
+ * Validated as a string at runtime so that unknown feature types returned by the
341
+ * backend (e.g., after a backend-only deploy) never cause a ZodError. The TypeScript
342
+ * type is narrowed to `FeatureType` so callers still get compile-time checking when
343
+ * comparing against known values.
344
+ */
345
+ type: z.ZodString;
346
+ display: z.ZodString;
347
+ active: z.ZodBoolean;
348
+ assortmentSystemInstanceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
349
+ defaultCatalogId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
350
+ }, "strip", z.ZodTypeAny, {
351
+ type: string;
352
+ active: boolean;
353
+ display: string;
354
+ assortmentSystemInstanceId?: string | null | undefined;
355
+ defaultCatalogId?: number | null | undefined;
356
+ }, {
357
+ type: string;
358
+ active: boolean;
359
+ display: string;
360
+ assortmentSystemInstanceId?: string | null | undefined;
361
+ defaultCatalogId?: number | null | undefined;
362
+ }>;
363
+ type CompanyFeature = z.infer<typeof companyFeatureSchema>;
335
364
  /**
336
365
  * Initialize Company Features Api functions
337
366
  * @param client Assortment Client instance
@@ -341,6 +370,7 @@ type FeatureType = "RETAILERAPI" | "DELTASUPDATEEXPORT" | "ASSORTMENTUIDASHBOARD
341
370
  declare function createCompanyFeaturesApi(client: AsstClient, companyType?: CompanyType): {
342
371
  checkIfStageItemSetupIsEnabled: (signal?: AbortSignal) => Promise<boolean>;
343
372
  enableFeatureForCompany: (featureKey: FeatureType, companyId: number) => Promise<void>;
373
+ getFeaturesForCompany: (companyId: number, signal?: AbortSignal) => Promise<CompanyFeature[]>;
344
374
  };
345
375
 
346
376
  interface FlagOptions {
@@ -961,4 +991,4 @@ declare function createRulesManagementApi(client: AsstClient): {
961
991
  activateRule: (ruleId: string, request: ActivateRuleRequestDto, signal?: AbortSignal) => Promise<void>;
962
992
  };
963
993
 
964
- export { type ActivateRuleRequestDto, type ApplicationType, AsstClient, AttrProdType, type CatalogBriefResponse, type CatalogCreateRequest, type CatalogCreateResponse, type CatalogSearchParams, type CategoriesApi, Company, CompanyBriefByOrg, type CompanyRelationship, CompanyRelationshipUpsertBody, CompanySearch, CompanySearchParams, CompanyType, DownLoadItemsParams, Export, type FeatureType, type FlagOptions, type FlattenedItemIdentifiers, GenerateImportTemplateParams, type GetItemErrorSummaryParams, Import, ImportsStatus, ItemCategoriesSearch, ItemDetail, ItemDetailView, ItemErrorDetailsResult, ItemErrorDetailsResultV2, ItemErrorSummaryResultV2, ItemHierarchyResponse, type ItemOrgStageDetails, type ItemOrgStatus, ItemPartner, ItemSearchView, type ItemStatus, type ItemStatusResponse, type ItemStatusV2, type ItemStatusV2Response, type ItemsApi, Locale, type OrgSummary, type RetailerTradingPartnerStages, SpreadsheetTemplate, SpsItemIdResponse, type Stage, TradingPartnerAccessByCompanyId, type UniqueCriteriaOptions, UserAccount, VendorPartnerAttGroups, createCategoriesApi, createCompaniesApi, createCompanyFeaturesApi, createErrorsApi, createErrorsApiV2, createExportsApi, createFeatureFlagsApi, createImportsApi, createItemsApi, createItemsApiV2, createLocaleApi, createProductTypesApi, createRulesManagementApi, createSpreadsheetTemplateApi, createTradingPartnerAccessApi, createTradingPartnerSettingsApi, createUniqueCriteriaApi, createWhoAmIApi };
994
+ export { type ActivateRuleRequestDto, type ApplicationType, AsstClient, AttrProdType, type CatalogBriefResponse, type CatalogCreateRequest, type CatalogCreateResponse, type CatalogSearchParams, type CategoriesApi, Company, CompanyBriefByOrg, type CompanyFeature, type CompanyRelationship, CompanyRelationshipUpsertBody, CompanySearch, CompanySearchParams, CompanyType, DownLoadItemsParams, Export, type FeatureType, type FlagOptions, type FlattenedItemIdentifiers, GenerateImportTemplateParams, type GetItemErrorSummaryParams, Import, ImportsStatus, ItemCategoriesSearch, ItemDetail, ItemDetailView, ItemErrorDetailsResult, ItemErrorDetailsResultV2, ItemErrorSummaryResultV2, ItemHierarchyResponse, type ItemOrgStageDetails, type ItemOrgStatus, ItemPartner, ItemSearchView, type ItemStatus, type ItemStatusResponse, type ItemStatusV2, type ItemStatusV2Response, type ItemsApi, Locale, type OrgSummary, type RetailerTradingPartnerStages, SpreadsheetTemplate, SpsItemIdResponse, type Stage, TradingPartnerAccessByCompanyId, type UniqueCriteriaOptions, UserAccount, VendorPartnerAttGroups, createCategoriesApi, createCompaniesApi, createCompanyFeaturesApi, createErrorsApi, createErrorsApiV2, createExportsApi, createFeatureFlagsApi, createImportsApi, createItemsApi, createItemsApiV2, createLocaleApi, createProductTypesApi, createRulesManagementApi, createSpreadsheetTemplateApi, createTradingPartnerAccessApi, createTradingPartnerSettingsApi, createUniqueCriteriaApi, createWhoAmIApi };
package/dist/index.d.ts CHANGED
@@ -330,8 +330,37 @@ type ApplicationType = z.infer<typeof applicationTypeSchema>;
330
330
  * match the backend enum values in the CompanyFeatures service. If this list
331
331
  * grows significantly, we should consider moving these to their own constants file or
332
332
  * generating them from the backend.
333
+ *
334
+ * Defined as a const tuple so that both the `FeatureType` union and the Zod schema
335
+ * share a single source of truth — adding a value here automatically widens both.
333
336
  */
334
- type FeatureType = "RETAILERAPI" | "DELTASUPDATEEXPORT" | "ASSORTMENTUIDASHBOARD" | "PHASEDITEMSETUP" | "PUBLICIMAGEACCESS" | "SINGLEHIERARCHYBYITEM" | "DELTAPRICEEXPORT";
337
+ type FeatureType = "RETAILERAPI" | "DELTASUPDATEEXPORT" | "ASSORTMENTUIDASHBOARD" | "PHASEDITEMSETUP" | "PUBLICIMAGEACCESS" | "SINGLEHIERARCHYBYITEM" | "DELTAPRICEEXPORT" | "ASSORTMENTXREF";
338
+ declare const companyFeatureSchema: z.ZodObject<{
339
+ /**
340
+ * Validated as a string at runtime so that unknown feature types returned by the
341
+ * backend (e.g., after a backend-only deploy) never cause a ZodError. The TypeScript
342
+ * type is narrowed to `FeatureType` so callers still get compile-time checking when
343
+ * comparing against known values.
344
+ */
345
+ type: z.ZodString;
346
+ display: z.ZodString;
347
+ active: z.ZodBoolean;
348
+ assortmentSystemInstanceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
349
+ defaultCatalogId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
350
+ }, "strip", z.ZodTypeAny, {
351
+ type: string;
352
+ active: boolean;
353
+ display: string;
354
+ assortmentSystemInstanceId?: string | null | undefined;
355
+ defaultCatalogId?: number | null | undefined;
356
+ }, {
357
+ type: string;
358
+ active: boolean;
359
+ display: string;
360
+ assortmentSystemInstanceId?: string | null | undefined;
361
+ defaultCatalogId?: number | null | undefined;
362
+ }>;
363
+ type CompanyFeature = z.infer<typeof companyFeatureSchema>;
335
364
  /**
336
365
  * Initialize Company Features Api functions
337
366
  * @param client Assortment Client instance
@@ -341,6 +370,7 @@ type FeatureType = "RETAILERAPI" | "DELTASUPDATEEXPORT" | "ASSORTMENTUIDASHBOARD
341
370
  declare function createCompanyFeaturesApi(client: AsstClient, companyType?: CompanyType): {
342
371
  checkIfStageItemSetupIsEnabled: (signal?: AbortSignal) => Promise<boolean>;
343
372
  enableFeatureForCompany: (featureKey: FeatureType, companyId: number) => Promise<void>;
373
+ getFeaturesForCompany: (companyId: number, signal?: AbortSignal) => Promise<CompanyFeature[]>;
344
374
  };
345
375
 
346
376
  interface FlagOptions {
@@ -961,4 +991,4 @@ declare function createRulesManagementApi(client: AsstClient): {
961
991
  activateRule: (ruleId: string, request: ActivateRuleRequestDto, signal?: AbortSignal) => Promise<void>;
962
992
  };
963
993
 
964
- export { type ActivateRuleRequestDto, type ApplicationType, AsstClient, AttrProdType, type CatalogBriefResponse, type CatalogCreateRequest, type CatalogCreateResponse, type CatalogSearchParams, type CategoriesApi, Company, CompanyBriefByOrg, type CompanyRelationship, CompanyRelationshipUpsertBody, CompanySearch, CompanySearchParams, CompanyType, DownLoadItemsParams, Export, type FeatureType, type FlagOptions, type FlattenedItemIdentifiers, GenerateImportTemplateParams, type GetItemErrorSummaryParams, Import, ImportsStatus, ItemCategoriesSearch, ItemDetail, ItemDetailView, ItemErrorDetailsResult, ItemErrorDetailsResultV2, ItemErrorSummaryResultV2, ItemHierarchyResponse, type ItemOrgStageDetails, type ItemOrgStatus, ItemPartner, ItemSearchView, type ItemStatus, type ItemStatusResponse, type ItemStatusV2, type ItemStatusV2Response, type ItemsApi, Locale, type OrgSummary, type RetailerTradingPartnerStages, SpreadsheetTemplate, SpsItemIdResponse, type Stage, TradingPartnerAccessByCompanyId, type UniqueCriteriaOptions, UserAccount, VendorPartnerAttGroups, createCategoriesApi, createCompaniesApi, createCompanyFeaturesApi, createErrorsApi, createErrorsApiV2, createExportsApi, createFeatureFlagsApi, createImportsApi, createItemsApi, createItemsApiV2, createLocaleApi, createProductTypesApi, createRulesManagementApi, createSpreadsheetTemplateApi, createTradingPartnerAccessApi, createTradingPartnerSettingsApi, createUniqueCriteriaApi, createWhoAmIApi };
994
+ export { type ActivateRuleRequestDto, type ApplicationType, AsstClient, AttrProdType, type CatalogBriefResponse, type CatalogCreateRequest, type CatalogCreateResponse, type CatalogSearchParams, type CategoriesApi, Company, CompanyBriefByOrg, type CompanyFeature, type CompanyRelationship, CompanyRelationshipUpsertBody, CompanySearch, CompanySearchParams, CompanyType, DownLoadItemsParams, Export, type FeatureType, type FlagOptions, type FlattenedItemIdentifiers, GenerateImportTemplateParams, type GetItemErrorSummaryParams, Import, ImportsStatus, ItemCategoriesSearch, ItemDetail, ItemDetailView, ItemErrorDetailsResult, ItemErrorDetailsResultV2, ItemErrorSummaryResultV2, ItemHierarchyResponse, type ItemOrgStageDetails, type ItemOrgStatus, ItemPartner, ItemSearchView, type ItemStatus, type ItemStatusResponse, type ItemStatusV2, type ItemStatusV2Response, type ItemsApi, Locale, type OrgSummary, type RetailerTradingPartnerStages, SpreadsheetTemplate, SpsItemIdResponse, type Stage, TradingPartnerAccessByCompanyId, type UniqueCriteriaOptions, UserAccount, VendorPartnerAttGroups, createCategoriesApi, createCompaniesApi, createCompanyFeaturesApi, createErrorsApi, createErrorsApiV2, createExportsApi, createFeatureFlagsApi, createImportsApi, createItemsApi, createItemsApiV2, createLocaleApi, createProductTypesApi, createRulesManagementApi, createSpreadsheetTemplateApi, createTradingPartnerAccessApi, createTradingPartnerSettingsApi, createUniqueCriteriaApi, createWhoAmIApi };
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  createTradingPartnerSettingsApi,
18
18
  createUniqueCriteriaApi,
19
19
  createWhoAmIApi
20
- } from "./chunk-ZC44MAMI.js";
20
+ } from "./chunk-35CHQUKC.js";
21
21
  import {
22
22
  AsstClient,
23
23
  BASE_URLS,
package/dist/msw.cjs CHANGED
@@ -5352,6 +5352,19 @@ var import_msw13 = require("msw");
5352
5352
 
5353
5353
  // lib/companyFeatures/index.ts
5354
5354
  var BASE_URL13 = "feature";
5355
+ var companyFeatureSchema = external_exports.object({
5356
+ /**
5357
+ * Validated as a string at runtime so that unknown feature types returned by the
5358
+ * backend (e.g., after a backend-only deploy) never cause a ZodError. The TypeScript
5359
+ * type is narrowed to `FeatureType` so callers still get compile-time checking when
5360
+ * comparing against known values.
5361
+ */
5362
+ type: external_exports.string(),
5363
+ display: external_exports.string(),
5364
+ active: external_exports.boolean(),
5365
+ assortmentSystemInstanceId: external_exports.string().nullish(),
5366
+ defaultCatalogId: external_exports.number().nullish()
5367
+ });
5355
5368
 
5356
5369
  // lib/companyFeatures/mockHandlers.ts
5357
5370
  function createCompanyFeaturesApiHandlers(client) {
@@ -5361,8 +5374,15 @@ function createCompanyFeaturesApiHandlers(client) {
5361
5374
  }) {
5362
5375
  return import_msw13.http.get(`${client.getBaseUrl()}${BASE_URL13}/isphaseditemsetupenabled`, resolver);
5363
5376
  }
5377
+ function getFeaturesForCompany(resolver = (_info) => {
5378
+ const data = (0, import_zod_mock12.generateMock)(external_exports.array(companyFeatureSchema));
5379
+ return import_msw13.HttpResponse.json(data);
5380
+ }) {
5381
+ return import_msw13.http.get(`${client.getBaseUrl()}${BASE_URL13}/company/:companyId`, resolver);
5382
+ }
5364
5383
  return {
5365
- checkIfStageItemSetupIsEnabled
5384
+ checkIfStageItemSetupIsEnabled,
5385
+ getFeaturesForCompany
5366
5386
  };
5367
5387
  }
5368
5388
 
package/dist/msw.d.cts CHANGED
@@ -634,6 +634,7 @@ declare function createSpreadsheetTemplateApiHandlers(client: AsstClient): {
634
634
  */
635
635
  declare function createCompanyFeaturesApiHandlers(client: AsstClient): {
636
636
  checkIfStageItemSetupIsEnabled: (resolver?: ResponseResolver) => msw.HttpHandler;
637
+ getFeaturesForCompany: (resolver?: ResponseResolver) => msw.HttpHandler;
637
638
  };
638
639
 
639
640
  /**
package/dist/msw.d.ts CHANGED
@@ -634,6 +634,7 @@ declare function createSpreadsheetTemplateApiHandlers(client: AsstClient): {
634
634
  */
635
635
  declare function createCompanyFeaturesApiHandlers(client: AsstClient): {
636
636
  checkIfStageItemSetupIsEnabled: (resolver?: ResponseResolver) => msw.HttpHandler;
637
+ getFeaturesForCompany: (resolver?: ResponseResolver) => msw.HttpHandler;
637
638
  };
638
639
 
639
640
  /**
package/dist/msw.js CHANGED
@@ -19,8 +19,9 @@ import {
19
19
  BASE_URL9,
20
20
  BASE_URL_V2,
21
21
  FlattenedItemIdentifierKeysSchema,
22
+ companyFeatureSchema,
22
23
  retailerTradingPartnerStages
23
- } from "./chunk-ZC44MAMI.js";
24
+ } from "./chunk-35CHQUKC.js";
24
25
  import {
25
26
  attrProdTypeSchema,
26
27
  catalogBriefResponseSchema,
@@ -458,8 +459,15 @@ function createCompanyFeaturesApiHandlers(client) {
458
459
  }) {
459
460
  return http13.get(`${client.getBaseUrl()}${BASE_URL10}/isphaseditemsetupenabled`, resolver);
460
461
  }
462
+ function getFeaturesForCompany(resolver = (_info) => {
463
+ const data = generateMock12(external_exports.array(companyFeatureSchema));
464
+ return HttpResponse13.json(data);
465
+ }) {
466
+ return http13.get(`${client.getBaseUrl()}${BASE_URL10}/company/:companyId`, resolver);
467
+ }
461
468
  return {
462
- checkIfStageItemSetupIsEnabled
469
+ checkIfStageItemSetupIsEnabled,
470
+ getFeaturesForCompany
463
471
  };
464
472
  }
465
473
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Assortment Api is a collection of HTTP functions to use Assortment endpoints",
4
4
  "author": "Assortment",
5
5
  "repository": "https://github.com/SPSCommerce/assortment-main/tree/main/ui/packages/asst-api",
6
- "version": "5.2.0",
6
+ "version": "5.3.0",
7
7
  "files": [
8
8
  "dist"
9
9
  ],