@spscommerce/asst-api 5.2.0 → 5.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
- import { A as AsstClient, I as ItemHierarchyResponse, a as CompanyType, S as SpsItemIdResponse, C as CompanyBriefByOrg } from './SpsItemIdResponse-CSZKx_Tz.js';
2
- export { b as AsstClientOptions, c as AsstUrl, B as BASE_URLS, E as Env, e as envSchema } from './SpsItemIdResponse-CSZKx_Tz.js';
3
- import { I as Import, a as ImportsStatus, V as VendorPartnerAttGroups, G as GenerateImportTemplateParams, E as Export, D as DownLoadItemsParams, A as AttrProdType, T as TradingPartnerAccessByCompanyId, C as CompanyRelationshipUpsertBody, b as ItemPartner, c as ItemCategoriesSearch, L as Locale, S as SpreadsheetTemplate, U as UserAccount, d as ItemSearchView, e as ItemDetailView, f as ItemDetail, g as ItemErrorDetailsResult, h as ItemErrorSummaryResultV2, i as ItemErrorDetailsResultV2 } from './zod-DOSs4Eg9.js';
4
- export { j as AttributeDetail, B as Bulb, k as CategoryEnum, l as ComponentDetails, m as Connection, n as ExportDayOfWeek, o as ExportFrequency, p as ExportType, q as GroupedAttributeList, r as GroupedAttributes, s as GroupedItem, H as HierarchyCategory, t as HierarchyDetails, u as IdentityServiceDatetimePreferences, v as IdentityServiceOrganization, w as IdentityServiceOrganizationMetadata, x as IdentityServicePreferences, y as IdentityServiceUser, z as ImportDetails, F as ImportError, J as ImportErrors, K as ImportStatusEnum, M as ItemCategory, N as ItemErrorDetails, O as ItemErrorDetailsV2, P as ItemErrorSummaryV2, Q as ItemHeader, R as ItemMap, W as ItemPrice, X as ItemTable, Y as MediaItem, Z as PRODUCT_CODE_DEFAULT_VALUE, _ as PackComponent, $ as PackComponentDetails, a0 as PackComponentItemInfo, a1 as PhaseEnum, a2 as RegisteredService, a3 as RepeatableGroup, a4 as SELECTION_CODE_DEFAULT_VALUE, a5 as SpreadsheetTemplateCompany, a6 as TradingPartnerStage, a7 as TradingPartnerStageV2 } from './zod-DOSs4Eg9.js';
1
+ import { A as AsstClient, I as ItemHierarchyResponse, a as CompanyType, S as SpsItemIdResponse, C as CompanyBriefByOrg } from './SpsItemIdResponse-Duo9fy_R.js';
2
+ export { b as AsstClientOptions, c as AsstUrl, B as BASE_URLS, E as Env, e as envSchema } from './SpsItemIdResponse-Duo9fy_R.js';
3
+ import { I as Import, a as ImportsStatus, V as VendorPartnerAttGroups, G as GenerateImportTemplateParams, E as Export, D as DownLoadItemsParams, A as AttrProdType, T as TradingPartnerAccessByCompanyId, C as CompanyRelationshipUpsertBody, b as ItemPartner, c as ItemCategoriesSearch, L as Locale, S as SpreadsheetTemplate, U as UserAccount, d as ItemSearchView, e as ItemDetailView, f as ItemDetail, g as ItemErrorDetailsResult, h as ItemErrorSummaryResultV2, i as ItemErrorDetailsResultV2 } from './zod-f4vmP6zY.js';
4
+ export { j as AttributeDetail, B as Bulb, k as CategoryEnum, l as ComponentDetails, m as Connection, n as ExportDayOfWeek, o as ExportFrequency, p as ExportType, q as GroupedAttributeList, r as GroupedAttributes, s as GroupedItem, H as HierarchyCategory, t as HierarchyDetails, u as IdentityServiceDatetimePreferences, v as IdentityServiceOrganization, w as IdentityServiceOrganizationMetadata, x as IdentityServicePreferences, y as IdentityServiceUser, z as ImportDetails, F as ImportError, J as ImportErrors, K as ImportStatusEnum, M as ItemCategory, N as ItemErrorDetails, O as ItemErrorDetailsV2, P as ItemErrorSummaryV2, Q as ItemHeader, R as ItemMap, W as ItemPrice, X as ItemTable, Y as MediaItem, Z as PRODUCT_CODE_DEFAULT_VALUE, _ as PackComponent, $ as PackComponentDetails, a0 as PackComponentItemInfo, a1 as PhaseEnum, a2 as RegisteredService, a3 as RepeatableGroup, a4 as SELECTION_CODE_DEFAULT_VALUE, a5 as SpreadsheetTemplateCompany, a6 as TradingPartnerStage, a7 as TradingPartnerStageV2 } from './zod-f4vmP6zY.js';
5
5
  import { z } from 'zod';
6
6
  import { b as CompanySearchParams, C as CompanySearch, a as Company } from './CompanySearch-7_L0_02Y.js';
7
7
  import 'ky';
@@ -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.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as msw from 'msw';
2
2
  import { ResponseResolver, HttpResponseResolver, HttpHandler } from 'msw';
3
- import { A as AsstClient, I as ItemHierarchyResponse, S as SpsItemIdResponse, C as CompanyBriefByOrg } from './SpsItemIdResponse-CSZKx_Tz.js';
3
+ import { A as AsstClient, I as ItemHierarchyResponse, S as SpsItemIdResponse, C as CompanyBriefByOrg } from './SpsItemIdResponse-Duo9fy_R.js';
4
4
  import { z } from 'zod';
5
5
  import { C as CompanySearch, a as Company } from './CompanySearch-7_L0_02Y.js';
6
6
  import 'ky';
@@ -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
 
@@ -1,4 +1,4 @@
1
- import './SpsItemIdResponse-CSZKx_Tz.cjs';
1
+ import './SpsItemIdResponse-Duo9fy_R.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const importSchema: z.ZodObject<{
package/dist/zod.cjs CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // lib/zod.ts
@@ -98,9 +88,6 @@ __export(zod_exports, {
98
88
  });
99
89
  module.exports = __toCommonJS(zod_exports);
100
90
 
101
- // lib/asstClient.ts
102
- var import_ky = __toESM(require("ky"), 1);
103
-
104
91
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
105
92
  var external_exports = {};
106
93
  __export(external_exports, {
package/dist/zod.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as companyBriefByOrgSchema, e as envSchema, i as itemHierarchyResponseSchema, s as spsItemIdResponseSchema } from './SpsItemIdResponse-CSZKx_Tz.js';
2
- export { a8 as attrProdTypeSchema, a9 as attributeDetailSchema, aa as bulbSchema, ab as categoryEnumSchema, ac as categoryTypeSchema, ad as companyRelationshipUpsertBodySchema, ae as componentDetailsSchema, af as connectionSchema, ag as downLoadItemsParamsSchema, ah as exportDayOfWeekEnum, ai as exportFrequencyEnum, aj as exportSchema, ak as exportTypeEnum, al as generateImportTemplateParamsSchema, am as groupedAttributeListSchema, an as groupedAttributesSchema, ao as groupedItemSchema, ap as hierarchyCategorySchema, aq as hierarchyDetailsSchema, ar as identityServiceDatetimePreferencesSchema, as as identityServiceOrganizationMetadataSchema, at as identityServiceOrganizationSchema, au as identityServicePreferencesSchema, av as identityServiceUserSchema, aw as importDetailSchema, ax as importErrorSchema, ay as importErrorsSchema, az as importSchema, aA as importStatusEnumSchema, aB as importsStatusSchema, aC as itemCategoriesSearchSchema, aD as itemCategorySchema, aE as itemDetailSchema, aF as itemDetailViewSchema, aG as itemErrorDetailsResultSchema, aH as itemErrorDetailsResultV2Schema, aI as itemErrorDetailsSchema, aJ as itemErrorDetailsV2Schema, aK as itemErrorSummaryResultV2Schema, aL as itemErrorSummaryV2Schema, aM as itemHeaderSchema, aN as itemMapSchema, aO as itemPartnerSchema, aP as itemPriceSchema, aQ as itemSearchViewSchema, aR as itemTableSchema, aS as localeSchema, aT as mediaItemSchema, aU as packComponentDetailsSchema, aV as packComponentItemInfoSchema, aW as packComponentSchema, aX as phaseEnumSchema, aY as registeredServiceSchema, aZ as repeatableGroupSchema, a_ as spreadsheetTemplateCompanySchema, a$ as spreadsheetTemplateSchema, b0 as tradingPartnerAccessByCompanyIdSchema, b1 as tradingPartnerStageSchema, b2 as tradingPartnerStageV2Schema, b3 as userAccountSchema, b4 as vendorPartnerAttGroupsSchema } from './zod-DOSs4Eg9.js';
1
+ export { d as companyBriefByOrgSchema, e as envSchema, i as itemHierarchyResponseSchema, s as spsItemIdResponseSchema } from './SpsItemIdResponse-Duo9fy_R.js';
2
+ export { a8 as attrProdTypeSchema, a9 as attributeDetailSchema, aa as bulbSchema, ab as categoryEnumSchema, ac as categoryTypeSchema, ad as companyRelationshipUpsertBodySchema, ae as componentDetailsSchema, af as connectionSchema, ag as downLoadItemsParamsSchema, ah as exportDayOfWeekEnum, ai as exportFrequencyEnum, aj as exportSchema, ak as exportTypeEnum, al as generateImportTemplateParamsSchema, am as groupedAttributeListSchema, an as groupedAttributesSchema, ao as groupedItemSchema, ap as hierarchyCategorySchema, aq as hierarchyDetailsSchema, ar as identityServiceDatetimePreferencesSchema, as as identityServiceOrganizationMetadataSchema, at as identityServiceOrganizationSchema, au as identityServicePreferencesSchema, av as identityServiceUserSchema, aw as importDetailSchema, ax as importErrorSchema, ay as importErrorsSchema, az as importSchema, aA as importStatusEnumSchema, aB as importsStatusSchema, aC as itemCategoriesSearchSchema, aD as itemCategorySchema, aE as itemDetailSchema, aF as itemDetailViewSchema, aG as itemErrorDetailsResultSchema, aH as itemErrorDetailsResultV2Schema, aI as itemErrorDetailsSchema, aJ as itemErrorDetailsV2Schema, aK as itemErrorSummaryResultV2Schema, aL as itemErrorSummaryV2Schema, aM as itemHeaderSchema, aN as itemMapSchema, aO as itemPartnerSchema, aP as itemPriceSchema, aQ as itemSearchViewSchema, aR as itemTableSchema, aS as localeSchema, aT as mediaItemSchema, aU as packComponentDetailsSchema, aV as packComponentItemInfoSchema, aW as packComponentSchema, aX as phaseEnumSchema, aY as registeredServiceSchema, aZ as repeatableGroupSchema, a_ as spreadsheetTemplateCompanySchema, a$ as spreadsheetTemplateSchema, b0 as tradingPartnerAccessByCompanyIdSchema, b1 as tradingPartnerStageSchema, b2 as tradingPartnerStageV2Schema, b3 as userAccountSchema, b4 as vendorPartnerAttGroupsSchema } from './zod-f4vmP6zY.js';
3
3
  import 'zod';
4
4
  import 'ky';
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.2",
7
7
  "files": [
8
8
  "dist"
9
9
  ],
@@ -27,11 +27,6 @@
27
27
  "require": "./dist/zod.cjs"
28
28
  }
29
29
  },
30
- "scripts": {
31
- "example": "vite",
32
- "build": "tsup",
33
- "build:watch": "tsup --watch"
34
- },
35
30
  "peerDependencies": {
36
31
  "@anatine/zod-mock": "^3.13.4",
37
32
  "@faker-js/faker": "^8.4.1",
@@ -56,10 +51,14 @@
56
51
  "vite": "^6.2.6"
57
52
  },
58
53
  "dependencies": {
59
- "ky": "0.25.1",
60
- "ky-universal": "0.8.2"
54
+ "ky": "^1.7.2"
61
55
  },
62
56
  "msw": {
63
57
  "workerDirectory": "public"
58
+ },
59
+ "scripts": {
60
+ "example": "vite",
61
+ "build": "tsup",
62
+ "build:watch": "tsup --watch"
64
63
  }
65
- }
64
+ }
@@ -1,313 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- declare const companySchema: z.ZodObject<{
4
- active: z.ZodBoolean;
5
- companyId: z.ZodNumber;
6
- companyTypes: z.ZodArray<z.ZodEnum<["SUPPLIER", "RETAILER"]>, "many">;
7
- createdAt: z.ZodNullable<z.ZodNumber>;
8
- features: z.ZodArray<z.ZodObject<{
9
- active: z.ZodBoolean;
10
- createdBy: z.ZodNullable<z.ZodString>;
11
- createdDate: z.ZodNullable<z.ZodNumber>;
12
- display: z.ZodString;
13
- modifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
- modifiedDate: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
15
- type: z.ZodString;
16
- }, "strip", z.ZodTypeAny, {
17
- type: string;
18
- active: boolean;
19
- createdBy: string | null;
20
- createdDate: number | null;
21
- display: string;
22
- modifiedBy?: string | null | undefined;
23
- modifiedDate?: number | null | undefined;
24
- }, {
25
- type: string;
26
- active: boolean;
27
- createdBy: string | null;
28
- createdDate: number | null;
29
- display: string;
30
- modifiedBy?: string | null | undefined;
31
- modifiedDate?: number | null | undefined;
32
- }>, "many">;
33
- identity: z.ZodObject<{
34
- orgId: z.ZodNullable<z.ZodString>;
35
- service: z.ZodNullable<z.ZodObject<{
36
- name: z.ZodString;
37
- }, "strip", z.ZodTypeAny, {
38
- name: string;
39
- }, {
40
- name: string;
41
- }>>;
42
- }, "strip", z.ZodTypeAny, {
43
- orgId: string | null;
44
- service: {
45
- name: string;
46
- } | null;
47
- }, {
48
- orgId: string | null;
49
- service: {
50
- name: string;
51
- } | null;
52
- }>;
53
- modifiedAt: z.ZodNullable<z.ZodNumber>;
54
- name: z.ZodString;
55
- relationships: z.ZodArray<z.ZodObject<{
56
- active: z.ZodBoolean;
57
- application: z.ZodArray<z.ZodObject<{
58
- application: z.ZodEnum<["ASSORTMENT", "ITEM-XREF", "TEST-ORDER-GENERATOR"]>;
59
- relationshipApplicationId: z.ZodNumber;
60
- }, "strip", z.ZodTypeAny, {
61
- application: "ASSORTMENT" | "ITEM-XREF" | "TEST-ORDER-GENERATOR";
62
- relationshipApplicationId: number;
63
- }, {
64
- application: "ASSORTMENT" | "ITEM-XREF" | "TEST-ORDER-GENERATOR";
65
- relationshipApplicationId: number;
66
- }>, "many">;
67
- catalog: z.ZodArray<z.ZodObject<{
68
- active: z.ZodBoolean;
69
- catalogId: z.ZodNumber;
70
- itemPartnerId: z.ZodNumber;
71
- }, "strip", z.ZodTypeAny, {
72
- active: boolean;
73
- catalogId: number;
74
- itemPartnerId: number;
75
- }, {
76
- active: boolean;
77
- catalogId: number;
78
- itemPartnerId: number;
79
- }>, "many">;
80
- company: z.ZodObject<{
81
- companyId: z.ZodNumber;
82
- companyTypes: z.ZodArray<z.ZodEnum<["SUPPLIER", "RETAILER"]>, "many">;
83
- dc4Id: z.ZodNullable<z.ZodNumber>;
84
- name: z.ZodString;
85
- orgId: z.ZodString;
86
- }, "strip", z.ZodTypeAny, {
87
- companyId: number;
88
- name: string;
89
- orgId: string;
90
- companyTypes: ("SUPPLIER" | "RETAILER")[];
91
- dc4Id: number | null;
92
- }, {
93
- companyId: number;
94
- name: string;
95
- orgId: string;
96
- companyTypes: ("SUPPLIER" | "RETAILER")[];
97
- dc4Id: number | null;
98
- }>;
99
- createdAt: z.ZodNumber;
100
- modifiedAt: z.ZodNullable<z.ZodNumber>;
101
- relationshipId: z.ZodNumber;
102
- }, "strip", z.ZodTypeAny, {
103
- application: {
104
- application: "ASSORTMENT" | "ITEM-XREF" | "TEST-ORDER-GENERATOR";
105
- relationshipApplicationId: number;
106
- }[];
107
- active: boolean;
108
- catalog: {
109
- active: boolean;
110
- catalogId: number;
111
- itemPartnerId: number;
112
- }[];
113
- company: {
114
- companyId: number;
115
- name: string;
116
- orgId: string;
117
- companyTypes: ("SUPPLIER" | "RETAILER")[];
118
- dc4Id: number | null;
119
- };
120
- createdAt: number;
121
- modifiedAt: number | null;
122
- relationshipId: number;
123
- }, {
124
- application: {
125
- application: "ASSORTMENT" | "ITEM-XREF" | "TEST-ORDER-GENERATOR";
126
- relationshipApplicationId: number;
127
- }[];
128
- active: boolean;
129
- catalog: {
130
- active: boolean;
131
- catalogId: number;
132
- itemPartnerId: number;
133
- }[];
134
- company: {
135
- companyId: number;
136
- name: string;
137
- orgId: string;
138
- companyTypes: ("SUPPLIER" | "RETAILER")[];
139
- dc4Id: number | null;
140
- };
141
- createdAt: number;
142
- modifiedAt: number | null;
143
- relationshipId: number;
144
- }>, "many">;
145
- uniqueAttributes: z.ZodArray<z.ZodString, "many">;
146
- }, "strip", z.ZodTypeAny, {
147
- companyId: number;
148
- name: string;
149
- companyTypes: ("SUPPLIER" | "RETAILER")[];
150
- active: boolean;
151
- createdAt: number | null;
152
- modifiedAt: number | null;
153
- features: {
154
- type: string;
155
- active: boolean;
156
- createdBy: string | null;
157
- createdDate: number | null;
158
- display: string;
159
- modifiedBy?: string | null | undefined;
160
- modifiedDate?: number | null | undefined;
161
- }[];
162
- identity: {
163
- orgId: string | null;
164
- service: {
165
- name: string;
166
- } | null;
167
- };
168
- relationships: {
169
- application: {
170
- application: "ASSORTMENT" | "ITEM-XREF" | "TEST-ORDER-GENERATOR";
171
- relationshipApplicationId: number;
172
- }[];
173
- active: boolean;
174
- catalog: {
175
- active: boolean;
176
- catalogId: number;
177
- itemPartnerId: number;
178
- }[];
179
- company: {
180
- companyId: number;
181
- name: string;
182
- orgId: string;
183
- companyTypes: ("SUPPLIER" | "RETAILER")[];
184
- dc4Id: number | null;
185
- };
186
- createdAt: number;
187
- modifiedAt: number | null;
188
- relationshipId: number;
189
- }[];
190
- uniqueAttributes: string[];
191
- }, {
192
- companyId: number;
193
- name: string;
194
- companyTypes: ("SUPPLIER" | "RETAILER")[];
195
- active: boolean;
196
- createdAt: number | null;
197
- modifiedAt: number | null;
198
- features: {
199
- type: string;
200
- active: boolean;
201
- createdBy: string | null;
202
- createdDate: number | null;
203
- display: string;
204
- modifiedBy?: string | null | undefined;
205
- modifiedDate?: number | null | undefined;
206
- }[];
207
- identity: {
208
- orgId: string | null;
209
- service: {
210
- name: string;
211
- } | null;
212
- };
213
- relationships: {
214
- application: {
215
- application: "ASSORTMENT" | "ITEM-XREF" | "TEST-ORDER-GENERATOR";
216
- relationshipApplicationId: number;
217
- }[];
218
- active: boolean;
219
- catalog: {
220
- active: boolean;
221
- catalogId: number;
222
- itemPartnerId: number;
223
- }[];
224
- company: {
225
- companyId: number;
226
- name: string;
227
- orgId: string;
228
- companyTypes: ("SUPPLIER" | "RETAILER")[];
229
- dc4Id: number | null;
230
- };
231
- createdAt: number;
232
- modifiedAt: number | null;
233
- relationshipId: number;
234
- }[];
235
- uniqueAttributes: string[];
236
- }>;
237
- type Company = z.infer<typeof companySchema>;
238
-
239
- declare const companySearchParamsSchema: z.ZodObject<{
240
- name: z.ZodOptional<z.ZodString>;
241
- companyIds: z.ZodOptional<z.ZodString>;
242
- orgId: z.ZodOptional<z.ZodString>;
243
- catalogName: z.ZodOptional<z.ZodString>;
244
- catalogIds: z.ZodOptional<z.ZodString>;
245
- type: z.ZodOptional<z.ZodEnum<["SUPPLIER", "RETAILER"]>>;
246
- }, "strip", z.ZodTypeAny, {
247
- type?: "SUPPLIER" | "RETAILER" | undefined;
248
- name?: string | undefined;
249
- orgId?: string | undefined;
250
- companyIds?: string | undefined;
251
- catalogName?: string | undefined;
252
- catalogIds?: string | undefined;
253
- }, {
254
- type?: "SUPPLIER" | "RETAILER" | undefined;
255
- name?: string | undefined;
256
- orgId?: string | undefined;
257
- companyIds?: string | undefined;
258
- catalogName?: string | undefined;
259
- catalogIds?: string | undefined;
260
- }>;
261
- declare const companySearchSchema: z.ZodObject<{
262
- id: z.ZodString;
263
- organizationName: z.ZodString;
264
- description: z.ZodString;
265
- orgId: z.ZodOptional<z.ZodString>;
266
- roles: z.ZodArray<z.ZodEnum<["SUPPLIER", "RETAILER"]>, "many">;
267
- connections: z.ZodNumber;
268
- uniqueCriteria: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
269
- serviceName: z.ZodString;
270
- catalogs: z.ZodArray<z.ZodObject<{
271
- categoryId: z.ZodNumber;
272
- categoryName: z.ZodString;
273
- }, "strip", z.ZodTypeAny, {
274
- categoryId: number;
275
- categoryName: string;
276
- }, {
277
- categoryId: number;
278
- categoryName: string;
279
- }>, "many">;
280
- application: z.ZodOptional<z.ZodArray<z.ZodEnum<["ASSORTMENT", "ITEM-XREF", "TEST-ORDER-GENERATOR"]>, "many">>;
281
- }, "strip", z.ZodTypeAny, {
282
- id: string;
283
- organizationName: string;
284
- description: string;
285
- roles: ("SUPPLIER" | "RETAILER")[];
286
- connections: number;
287
- serviceName: string;
288
- catalogs: {
289
- categoryId: number;
290
- categoryName: string;
291
- }[];
292
- orgId?: string | undefined;
293
- application?: ("ASSORTMENT" | "ITEM-XREF" | "TEST-ORDER-GENERATOR")[] | undefined;
294
- uniqueCriteria?: string[] | undefined;
295
- }, {
296
- id: string;
297
- organizationName: string;
298
- description: string;
299
- roles: ("SUPPLIER" | "RETAILER")[];
300
- connections: number;
301
- serviceName: string;
302
- catalogs: {
303
- categoryId: number;
304
- categoryName: string;
305
- }[];
306
- orgId?: string | undefined;
307
- application?: ("ASSORTMENT" | "ITEM-XREF" | "TEST-ORDER-GENERATOR")[] | undefined;
308
- uniqueCriteria?: string[] | undefined;
309
- }>;
310
- type CompanySearchParams = z.infer<typeof companySearchParamsSchema>;
311
- type CompanySearch = z.infer<typeof companySearchSchema>;
312
-
313
- export type { CompanySearch as C, Company as a, CompanySearchParams as b };
@@ -1,102 +0,0 @@
1
- import { z } from 'zod';
2
- import * as ky from 'ky';
3
- import { Options } from 'ky';
4
-
5
- declare const companyBriefByOrgSchema: z.ZodObject<{
6
- companyId: z.ZodNumber;
7
- name: z.ZodString;
8
- orgId: z.ZodString;
9
- companyTypes: z.ZodArray<z.ZodEnum<["SUPPLIER", "RETAILER"]>, "many">;
10
- dc4Id: z.ZodNumber;
11
- }, "strip", z.ZodTypeAny, {
12
- companyId: number;
13
- name: string;
14
- orgId: string;
15
- companyTypes: ("SUPPLIER" | "RETAILER")[];
16
- dc4Id: number;
17
- }, {
18
- companyId: number;
19
- name: string;
20
- orgId: string;
21
- companyTypes: ("SUPPLIER" | "RETAILER")[];
22
- dc4Id: number;
23
- }>;
24
- type CompanyBriefByOrg = z.infer<typeof companyBriefByOrgSchema>;
25
-
26
- declare const companyTypeSchema: z.ZodEnum<["SUPPLIER", "RETAILER"]>;
27
- type CompanyType = z.infer<typeof companyTypeSchema>;
28
-
29
- declare const baseUrlsSchema: z.ZodObject<{
30
- local: z.ZodLiteral<"https://localhost:8443/">;
31
- test: z.ZodLiteral<"https://integration.api.spscommerce.com/assortment/gateway/">;
32
- prod: z.ZodLiteral<"https://api.spscommerce.com/assortment/gateway/">;
33
- }, "strip", z.ZodTypeAny, {
34
- local: "https://localhost:8443/";
35
- test: "https://integration.api.spscommerce.com/assortment/gateway/";
36
- prod: "https://api.spscommerce.com/assortment/gateway/";
37
- }, {
38
- local: "https://localhost:8443/";
39
- test: "https://integration.api.spscommerce.com/assortment/gateway/";
40
- prod: "https://api.spscommerce.com/assortment/gateway/";
41
- }>;
42
- type BaseUrls = z.infer<typeof baseUrlsSchema>;
43
- declare const BASE_URLS: BaseUrls;
44
- declare const envSchema: z.ZodEnum<["local", "test", "prod"]>;
45
- type Env = z.infer<typeof envSchema>;
46
- type AsstUrl = BaseUrls[Env];
47
- type GetTokenFn = () => Promise<string | null>;
48
- interface AsstClientOptions extends Options {
49
- prefixUrl?: AsstUrl;
50
- tokenFn?: GetTokenFn;
51
- }
52
- type Input = string | URL | Request;
53
- type Listener = (config: AsstClientOptions) => void;
54
- declare class AsstClient {
55
- #private;
56
- constructor(options?: AsstClientOptions);
57
- updateConfig({ tokenFn, ...options }: AsstClientOptions): void;
58
- updateCompanyType(companyType: CompanyType): void;
59
- getBaseUrl(): AsstUrl;
60
- getCompanyType(): CompanyType;
61
- /**
62
- * Subscribe to config changes. The callback will be immediately invoked with the current config.
63
- * @param subscriptionCallback Function that will be called with the new config every time it is changed
64
- * @returns Function to unsubscribe to config changes
65
- */
66
- subscribeToConfigChange(listener: Listener): () => boolean;
67
- get(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
68
- post(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
69
- put(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
70
- patch(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
71
- head(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
72
- delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
73
- }
74
-
75
- type Hierarchy = {
76
- id: string;
77
- name?: string | null;
78
- description?: string | null;
79
- type?: string | null;
80
- child?: Hierarchy | null;
81
- };
82
- type ItemHierarchyResponse = {
83
- itemHierarchies: Array<{
84
- itemId: string;
85
- hierarchies: Array<Hierarchy>;
86
- }>;
87
- };
88
- declare const itemHierarchyResponseSchema: z.ZodType<ItemHierarchyResponse>;
89
-
90
- declare const spsItemIdResponseSchema: z.ZodObject<{
91
- id: z.ZodString;
92
- ref: z.ZodString;
93
- }, "strip", z.ZodTypeAny, {
94
- id: string;
95
- ref: string;
96
- }, {
97
- id: string;
98
- ref: string;
99
- }>;
100
- type SpsItemIdResponse = z.infer<typeof spsItemIdResponseSchema>;
101
-
102
- export { AsstClient as A, BASE_URLS as B, type CompanyBriefByOrg as C, type Env as E, type ItemHierarchyResponse as I, type SpsItemIdResponse as S, type CompanyType as a, type AsstClientOptions as b, type AsstUrl as c, companyBriefByOrgSchema as d, envSchema as e, itemHierarchyResponseSchema as i, spsItemIdResponseSchema as s };