@spscommerce/asst-api 0.0.1-beta.6 → 0.0.1-beta.8

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.
Files changed (47) hide show
  1. package/dist/ItemErrorDetails-1614b511.d.ts +3137 -0
  2. package/dist/ItemErrorDetailsResult-c12c4eac.d.ts +3032 -0
  3. package/dist/{chunk-D3ML6E4G.js → chunk-3JRE7YYE.js} +805 -16
  4. package/dist/chunk-OVOZIZA2.js +326 -0
  5. package/dist/index.cjs +814 -28
  6. package/dist/index.d.ts +86 -46
  7. package/dist/index.js +18 -5
  8. package/dist/msw.cjs +926 -63
  9. package/dist/msw.d.ts +582 -75
  10. package/dist/msw.js +246 -54
  11. package/dist/zod.cjs +719 -17
  12. package/dist/zod.d.ts +3 -2
  13. package/dist/zod.js +103 -55
  14. package/package.json +3 -4
  15. package/dist/ImportsStatus-52d26b01.d.ts +0 -134
  16. package/dist/ImportsStatusEnum-22c03a0b.d.ts +0 -51
  17. package/dist/ItemCategoriesSearch-1bb945de.d.ts +0 -275
  18. package/dist/ItemCategoriesSearch-44b87663.d.ts +0 -318
  19. package/dist/ItemCategoriesSearch-e0870a34.d.ts +0 -318
  20. package/dist/ItemCategoriesSearch-e3298650.d.ts +0 -319
  21. package/dist/ItemCategoriesSearch-ec43591f.d.ts +0 -319
  22. package/dist/ItemCategory-14816deb.d.ts +0 -99
  23. package/dist/ItemCategory-768179bd.d.ts +0 -99
  24. package/dist/TradingPartnerAccessByCompanyId-29866586.d.ts +0 -97
  25. package/dist/TradingPartnerAccessByCompanyId-43f83fb6.d.ts +0 -130
  26. package/dist/TradingPartnerAccessByCompanyId-479e3e57.d.ts +0 -124
  27. package/dist/TradingPartnerAccessByCompanyId-53b868a8.d.ts +0 -125
  28. package/dist/TradingPartnerAccessByCompanyId-b227f0c5.d.ts +0 -125
  29. package/dist/TradingPartnerAccessByCompanyId-e7a1d443.d.ts +0 -129
  30. package/dist/asstClient-f6a1693a.d.ts +0 -29
  31. package/dist/chunk-3FMMM7IS.js +0 -80
  32. package/dist/chunk-6ZNFOWTV.js +0 -78
  33. package/dist/chunk-7HCJJATJ.js +0 -40
  34. package/dist/chunk-B7B2ACF4.js +0 -3794
  35. package/dist/chunk-F3KCLICG.js +0 -77
  36. package/dist/chunk-FS6LHGAR.js +0 -87
  37. package/dist/chunk-GDFX3WTX.js +0 -78
  38. package/dist/chunk-LGP22FRF.js +0 -0
  39. package/dist/chunk-LYMGZWSR.js +0 -80
  40. package/dist/chunk-N2OYWNHF.js +0 -80
  41. package/dist/chunk-OA6PO3QG.js +0 -78
  42. package/dist/chunk-OBXZRDPY.js +0 -77
  43. package/dist/chunk-OI47EFQH.js +0 -82
  44. package/dist/chunk-RNUSCCKB.js +0 -183
  45. package/dist/chunk-T3UCSW2B.js +0 -81
  46. package/dist/chunk-XMNYZGXF.js +0 -84
  47. package/dist/chunk-YCQUK6KV.js +0 -85
@@ -1,125 +0,0 @@
1
- import * as ky_universal from 'ky-universal';
2
- import { Options } from 'ky';
3
- import { z } from 'zod';
4
-
5
- declare const BASE_URLS: {
6
- readonly local: "https://localhost:8443";
7
- readonly test: "https://integration.api.spscommerce.com/assortment/gateway";
8
- readonly prod: "https://api.spscommerce.com/assortment/gateway";
9
- };
10
- type Env = keyof typeof BASE_URLS;
11
- type AsstUrl = typeof BASE_URLS[Env];
12
- interface AsstClientOptions extends Options {
13
- prefixUrl?: AsstUrl;
14
- }
15
- type Input = string | URL | Request;
16
- declare class AsstClient {
17
- #private;
18
- constructor(options: AsstClientOptions);
19
- updateConfig(options: AsstClientOptions): void;
20
- getBaseUrl(): AsstUrl;
21
- subscribeToConfigChange(subscriptionCallback: (newConfig: AsstClientOptions) => void): AsstClientOptions;
22
- unsubscribeToConfigChange(): void;
23
- get(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
24
- post(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
25
- put(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
26
- patch(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
27
- head(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
28
- delete(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
29
- }
30
-
31
- declare const vendorPartnerAttGroupsSchema: z.ZodObject<{
32
- partnerCompanyId: z.ZodNumber;
33
- partnerCompanyName: z.ZodString;
34
- partnerAttributeGroups: z.ZodArray<z.ZodNumber, "many">;
35
- }, "strip", z.ZodTypeAny, {
36
- partnerCompanyId: number;
37
- partnerCompanyName: string;
38
- partnerAttributeGroups: number[];
39
- }, {
40
- partnerCompanyId: number;
41
- partnerCompanyName: string;
42
- partnerAttributeGroups: number[];
43
- }>;
44
- type VendorPartnerAttGroups = z.infer<typeof vendorPartnerAttGroupsSchema>;
45
-
46
- declare const attrProdTypeSchema: z.ZodObject<{
47
- attrProdTypeId: z.ZodNumber;
48
- productType: z.ZodString;
49
- description: z.ZodString;
50
- createdDate: z.ZodNumber;
51
- createdBy: z.ZodString;
52
- modifiedDate: z.ZodOptional<z.ZodNumber>;
53
- modifiedBy: z.ZodOptional<z.ZodString>;
54
- retailerId: z.ZodOptional<z.ZodNumber>;
55
- }, "strip", z.ZodTypeAny, {
56
- description: string;
57
- attrProdTypeId: number;
58
- productType: string;
59
- createdDate: number;
60
- createdBy: string;
61
- modifiedDate?: number | undefined;
62
- modifiedBy?: string | undefined;
63
- retailerId?: number | undefined;
64
- }, {
65
- description: string;
66
- attrProdTypeId: number;
67
- productType: string;
68
- createdDate: number;
69
- createdBy: string;
70
- modifiedDate?: number | undefined;
71
- modifiedBy?: string | undefined;
72
- retailerId?: number | undefined;
73
- }>;
74
- type AttrProdType = z.infer<typeof attrProdTypeSchema>;
75
-
76
- declare const tradingPartnerAccessByCompanyIdSchema: z.ZodObject<{
77
- companyId: z.ZodNumber;
78
- companyType: z.ZodString;
79
- identityOrgId: z.ZodString;
80
- companyName: z.ZodString;
81
- count: z.ZodNumber;
82
- connections: z.ZodArray<z.ZodObject<{
83
- catalog_id: z.ZodNumber;
84
- catalog_name: z.ZodString;
85
- partner_company_name: z.ZodString;
86
- partner_company_id: z.ZodNumber;
87
- }, "strip", z.ZodTypeAny, {
88
- catalog_id: number;
89
- catalog_name: string;
90
- partner_company_name: string;
91
- partner_company_id: number;
92
- }, {
93
- catalog_id: number;
94
- catalog_name: string;
95
- partner_company_name: string;
96
- partner_company_id: number;
97
- }>, "many">;
98
- }, "strip", z.ZodTypeAny, {
99
- count: number;
100
- companyId: number;
101
- companyType: string;
102
- identityOrgId: string;
103
- companyName: string;
104
- connections: {
105
- catalog_id: number;
106
- catalog_name: string;
107
- partner_company_name: string;
108
- partner_company_id: number;
109
- }[];
110
- }, {
111
- count: number;
112
- companyId: number;
113
- companyType: string;
114
- identityOrgId: string;
115
- companyName: string;
116
- connections: {
117
- catalog_id: number;
118
- catalog_name: string;
119
- partner_company_name: string;
120
- partner_company_id: number;
121
- }[];
122
- }>;
123
- type TradingPartnerAccessByCompanyId = z.infer<typeof tradingPartnerAccessByCompanyIdSchema>;
124
-
125
- export { AsstClient as A, BASE_URLS as B, Env as E, TradingPartnerAccessByCompanyId as T, VendorPartnerAttGroups as V, AttrProdType as a, AsstClientOptions as b, AsstUrl as c, attrProdTypeSchema as d };
@@ -1,129 +0,0 @@
1
- import * as ky_universal from 'ky-universal';
2
- import { Options } from 'ky';
3
- import { z } from 'zod';
4
-
5
- declare const BASE_URLS: {
6
- readonly local: "https://localhost:8443";
7
- readonly test: "https://integration.api.spscommerce.com/assortment/gateway";
8
- readonly prod: "https://api.spscommerce.com/assortment/gateway";
9
- };
10
- type Env = keyof typeof BASE_URLS;
11
- type AsstUrl = typeof BASE_URLS[Env];
12
- interface AsstClientOptions extends Options {
13
- prefixUrl?: AsstUrl;
14
- }
15
- type Input = string | URL | Request;
16
- declare class AsstClient {
17
- #private;
18
- constructor(options: AsstClientOptions);
19
- updateConfig(options: AsstClientOptions): void;
20
- getBaseUrl(): AsstUrl;
21
- /**
22
- * Subscribe to config changes. The callback will be immediately invoked with the current config.
23
- * @param subscriptionCallback Function that will be called with the new config every time it is changed
24
- */
25
- subscribeToConfigChange(subscriptionCallback: (newConfig: AsstClientOptions) => void): void;
26
- unsubscribeToConfigChange(): void;
27
- get(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
28
- post(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
29
- put(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
30
- patch(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
31
- head(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
32
- delete(url: Input, options?: AsstClientOptions): ky_universal.ResponsePromise;
33
- }
34
-
35
- declare const vendorPartnerAttGroupsSchema: z.ZodObject<{
36
- partnerCompanyId: z.ZodNumber;
37
- partnerCompanyName: z.ZodString;
38
- partnerAttributeGroups: z.ZodArray<z.ZodNumber, "many">;
39
- }, "strip", z.ZodTypeAny, {
40
- partnerCompanyId: number;
41
- partnerCompanyName: string;
42
- partnerAttributeGroups: number[];
43
- }, {
44
- partnerCompanyId: number;
45
- partnerCompanyName: string;
46
- partnerAttributeGroups: number[];
47
- }>;
48
- type VendorPartnerAttGroups = z.infer<typeof vendorPartnerAttGroupsSchema>;
49
-
50
- declare const attrProdTypeSchema: z.ZodObject<{
51
- attrProdTypeId: z.ZodNumber;
52
- productType: z.ZodString;
53
- description: z.ZodString;
54
- createdDate: z.ZodNumber;
55
- createdBy: z.ZodString;
56
- modifiedDate: z.ZodOptional<z.ZodNumber>;
57
- modifiedBy: z.ZodOptional<z.ZodString>;
58
- retailerId: z.ZodOptional<z.ZodNumber>;
59
- }, "strip", z.ZodTypeAny, {
60
- description: string;
61
- attrProdTypeId: number;
62
- productType: string;
63
- createdDate: number;
64
- createdBy: string;
65
- modifiedDate?: number | undefined;
66
- modifiedBy?: string | undefined;
67
- retailerId?: number | undefined;
68
- }, {
69
- description: string;
70
- attrProdTypeId: number;
71
- productType: string;
72
- createdDate: number;
73
- createdBy: string;
74
- modifiedDate?: number | undefined;
75
- modifiedBy?: string | undefined;
76
- retailerId?: number | undefined;
77
- }>;
78
- type AttrProdType = z.infer<typeof attrProdTypeSchema>;
79
-
80
- declare const tradingPartnerAccessByCompanyIdSchema: z.ZodObject<{
81
- companyId: z.ZodNumber;
82
- companyType: z.ZodString;
83
- identityOrgId: z.ZodString;
84
- companyName: z.ZodString;
85
- count: z.ZodNumber;
86
- connections: z.ZodArray<z.ZodObject<{
87
- catalog_id: z.ZodNumber;
88
- catalog_name: z.ZodString;
89
- partner_company_name: z.ZodString;
90
- partner_company_id: z.ZodNumber;
91
- }, "strip", z.ZodTypeAny, {
92
- catalog_id: number;
93
- catalog_name: string;
94
- partner_company_name: string;
95
- partner_company_id: number;
96
- }, {
97
- catalog_id: number;
98
- catalog_name: string;
99
- partner_company_name: string;
100
- partner_company_id: number;
101
- }>, "many">;
102
- }, "strip", z.ZodTypeAny, {
103
- count: number;
104
- companyId: number;
105
- companyType: string;
106
- identityOrgId: string;
107
- companyName: string;
108
- connections: {
109
- catalog_id: number;
110
- catalog_name: string;
111
- partner_company_name: string;
112
- partner_company_id: number;
113
- }[];
114
- }, {
115
- count: number;
116
- companyId: number;
117
- companyType: string;
118
- identityOrgId: string;
119
- companyName: string;
120
- connections: {
121
- catalog_id: number;
122
- catalog_name: string;
123
- partner_company_name: string;
124
- partner_company_id: number;
125
- }[];
126
- }>;
127
- type TradingPartnerAccessByCompanyId = z.infer<typeof tradingPartnerAccessByCompanyIdSchema>;
128
-
129
- export { AsstClient as A, BASE_URLS as B, Env as E, TradingPartnerAccessByCompanyId as T, VendorPartnerAttGroups as V, AttrProdType as a, AsstClientOptions as b, AsstUrl as c, attrProdTypeSchema as d };
@@ -1,29 +0,0 @@
1
- import * as ky from 'ky';
2
- import { Options } from 'ky';
3
-
4
- declare const BASE_URLS: {
5
- readonly local: "https://localhost:8443";
6
- readonly test: "https://integration.api.spscommerce.com/assortment/gateway";
7
- readonly prod: "https://api.spscommerce.com/assortment/gateway";
8
- };
9
- type Env = keyof typeof BASE_URLS;
10
- type AsstUrl = typeof BASE_URLS[Env];
11
- interface AsstClientOptions extends Options {
12
- prefixUrl?: AsstUrl;
13
- }
14
- type Input = string | URL | Request;
15
- declare class AsstClient {
16
- #private;
17
- constructor(options: AsstClientOptions);
18
- updateConfig(options: AsstClientOptions): void;
19
- getBaseUrl(): AsstUrl;
20
- subscribeToConfigChange(subscriptionCallback: (newConfig: AsstClientOptions) => void): void;
21
- get(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
22
- post(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
23
- put(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
24
- patch(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
25
- head(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
26
- delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
27
- }
28
-
29
- export { AsstClient as A, BASE_URLS as B, Env as E, AsstClientOptions as a, AsstUrl as b };
@@ -1,80 +0,0 @@
1
- import {
2
- z
3
- } from "./chunk-D3ML6E4G.js";
4
-
5
- // lib/asstClient.ts
6
- import ky from "ky-universal";
7
- var baseUrlsSchema = z.object({
8
- local: z.literal("https://localhost:8443"),
9
- test: z.literal("https://integration.api.spscommerce.com/assortment/gateway"),
10
- prod: z.literal("https://api.spscommerce.com/assortment/gateway")
11
- });
12
- var BASE_URLS = {
13
- local: "https://localhost:8443",
14
- test: "https://integration.api.spscommerce.com/assortment/gateway",
15
- prod: "https://api.spscommerce.com/assortment/gateway"
16
- };
17
- var envSchema = baseUrlsSchema.keyof();
18
- var AsstClient = class {
19
- #client = ky.create({
20
- prefixUrl: BASE_URLS["test"],
21
- retry: 0
22
- });
23
- #baseUrl = BASE_URLS["test"];
24
- #subscriptionCallback;
25
- #currentConfig = {};
26
- constructor(options) {
27
- console.log(`AsstClient created! Config: ${JSON.stringify(options)}`);
28
- if (options) {
29
- this.updateConfig(options);
30
- }
31
- }
32
- updateConfig(options) {
33
- this.#client = this.#client.extend(options);
34
- this.#currentConfig = options;
35
- if (options.prefixUrl) {
36
- this.#baseUrl = options.prefixUrl;
37
- }
38
- if (this.#subscriptionCallback) {
39
- this.#subscriptionCallback(options);
40
- }
41
- }
42
- getBaseUrl() {
43
- return this.#baseUrl;
44
- }
45
- /**
46
- * Subscribe to config changes. The callback will be immediately invoked with the current config.
47
- * @param subscriptionCallback Function that will be called with the new config every time it is changed
48
- */
49
- subscribeToConfigChange(subscriptionCallback) {
50
- this.#subscriptionCallback = subscriptionCallback;
51
- subscriptionCallback(this.#currentConfig);
52
- }
53
- unsubscribeToConfigChange() {
54
- this.#subscriptionCallback = void 0;
55
- }
56
- get(url, options) {
57
- return this.#client.get(url, options);
58
- }
59
- post(url, options) {
60
- return this.#client.post(url, options);
61
- }
62
- put(url, options) {
63
- return this.#client.put(url, options);
64
- }
65
- patch(url, options) {
66
- return this.#client.patch(url, options);
67
- }
68
- head(url, options) {
69
- return this.#client.head(url, options);
70
- }
71
- delete(url, options) {
72
- return this.#client.delete(url, options);
73
- }
74
- };
75
-
76
- export {
77
- BASE_URLS,
78
- envSchema,
79
- AsstClient
80
- };
@@ -1,78 +0,0 @@
1
- import {
2
- z
3
- } from "./chunk-D3ML6E4G.js";
4
-
5
- // lib/asstClient.ts
6
- import ky from "ky-universal";
7
- var baseUrlsSchema = z.object({
8
- local: z.literal("https://localhost:8443"),
9
- test: z.literal("https://integration.api.spscommerce.com/assortment/gateway"),
10
- prod: z.literal("https://api.spscommerce.com/assortment/gateway")
11
- });
12
- var BASE_URLS = {
13
- local: "https://localhost:8443",
14
- test: "https://integration.api.spscommerce.com/assortment/gateway",
15
- prod: "https://api.spscommerce.com/assortment/gateway"
16
- };
17
- var envSchema = baseUrlsSchema.keyof();
18
- var initialConfig = {
19
- prefixUrl: BASE_URLS["test"],
20
- retry: 0
21
- };
22
- var AsstClient = class {
23
- #client = ky.create(initialConfig);
24
- #baseUrl = BASE_URLS["test"];
25
- #listeners = /* @__PURE__ */ new Set();
26
- // #subscriptionCallback?: (config: AsstClientOptions) => void;
27
- #currentConfig = initialConfig;
28
- constructor(options) {
29
- if (options) {
30
- this.updateConfig(options);
31
- }
32
- }
33
- updateConfig(options) {
34
- this.#client = this.#client.extend(options);
35
- this.#currentConfig = options;
36
- if (options.prefixUrl) {
37
- this.#baseUrl = options.prefixUrl;
38
- }
39
- this.#listeners.forEach((listener) => listener(options));
40
- }
41
- getBaseUrl() {
42
- return this.#baseUrl;
43
- }
44
- /**
45
- * Subscribe to config changes. The callback will be immediately invoked with the current config.
46
- * @param subscriptionCallback Function that will be called with the new config every time it is changed
47
- * @returns Function to unsubscribe to config changes
48
- */
49
- subscribeToConfigChange(listener) {
50
- this.#listeners.add(listener);
51
- listener(this.#currentConfig);
52
- return () => this.#listeners.delete(listener);
53
- }
54
- get(url, options) {
55
- return this.#client.get(url, options);
56
- }
57
- post(url, options) {
58
- return this.#client.post(url, options);
59
- }
60
- put(url, options) {
61
- return this.#client.put(url, options);
62
- }
63
- patch(url, options) {
64
- return this.#client.patch(url, options);
65
- }
66
- head(url, options) {
67
- return this.#client.head(url, options);
68
- }
69
- delete(url, options) {
70
- return this.#client.delete(url, options);
71
- }
72
- };
73
-
74
- export {
75
- BASE_URLS,
76
- envSchema,
77
- AsstClient
78
- };
@@ -1,40 +0,0 @@
1
- import {
2
- importErrorsSchema,
3
- importSchema,
4
- importsStatusSchema,
5
- z
6
- } from "./chunk-B7B2ACF4.js";
7
-
8
- // lib/imports/index.ts
9
- var BASE_URL = "imports";
10
- function createImportsApi(client) {
11
- async function getImportErrors(importId, params, signal) {
12
- const data = await client.get(`${BASE_URL}/${importId}/errors`, { searchParams: params, signal }).json();
13
- return importErrorsSchema.parse(data);
14
- }
15
- async function getImports(params, signal) {
16
- const data = await client.get(`${BASE_URL}`, {
17
- searchParams: params,
18
- signal
19
- }).json();
20
- return importSchema.parse(data);
21
- }
22
- async function getImportsStatus(signal) {
23
- const data = await client.get(`${BASE_URL}/status`, { signal }).json();
24
- return z.array(importsStatusSchema).parse(data);
25
- }
26
- async function uploadImport(file) {
27
- await client.post(`${BASE_URL}`, { body: file });
28
- }
29
- return {
30
- getImportErrors,
31
- getImports,
32
- getImportsStatus,
33
- uploadImport
34
- };
35
- }
36
-
37
- export {
38
- BASE_URL,
39
- createImportsApi
40
- };