@spscommerce/asst-api 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CI3ZSIT4.js → chunk-V2XRXJIJ.js} +129 -33
- package/dist/{chunk-RPGGEEFE.js → chunk-WODMKML4.js} +1 -1
- package/dist/{chunk-LKUGPDIT.js → chunk-YT2B4UAK.js} +33 -0
- package/dist/index.cjs +157 -32
- package/dist/index.d.cts +127 -11
- package/dist/index.d.ts +127 -11
- package/dist/index.js +3 -3
- package/dist/msw.cjs +70 -1
- package/dist/msw.d.cts +27 -6
- package/dist/msw.d.ts +27 -6
- package/dist/msw.js +36 -3
- package/dist/zod.cjs +31 -0
- package/dist/zod.d.cts +1 -1
- package/dist/zod.d.ts +1 -1
- package/dist/zod.js +2 -2
- package/package.json +1 -1
- package/dist/SpsItemIdResponse-0VgfCmG_.d.cts +0 -84
- package/dist/SpsItemIdResponse-0VgfCmG_.d.ts +0 -84
- package/dist/SpsItemIdResponse-CI_Ao86P.d.cts +0 -87
- package/dist/SpsItemIdResponse-CI_Ao86P.d.ts +0 -87
- package/dist/chunk-355LPVI6.js +0 -126
- package/dist/chunk-55ECRTUX.js +0 -79
- package/dist/chunk-63KIELUR.js +0 -128
- package/dist/chunk-DK2OMRWR.js +0 -134
- package/dist/chunk-FCUIJXCD.js +0 -544
- package/dist/chunk-L4AWOEED.js +0 -4892
- package/dist/chunk-NFZI7D22.js +0 -544
- package/dist/chunk-NUUQDRHD.js +0 -4899
- package/dist/zod-C3fOiO-H.d.cts +0 -5900
- package/dist/zod-CJ6AFTQr.d.ts +0 -5900
- package/dist/zod-CJmsC_DX.d.cts +0 -5900
- package/dist/zod-CzPw-bfk.d.cts +0 -5900
- package/dist/zod-vDuspd-x.d.ts +0 -5900
- package/dist/zod-xWM6u1LJ.d.ts +0 -5900
- package/dist/{zod-C41Rts8D.d.cts → zod-CJ7lvFQH.d.cts} +44 -44
- package/dist/{zod-COyz02Lh.d.ts → zod-j6CrX5vY.d.ts} +44 -44
package/dist/zod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
envSchema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WODMKML4.js";
|
|
4
4
|
import {
|
|
5
5
|
attrProdTypeSchema,
|
|
6
6
|
attributeDetailSchema,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
tradingPartnerStageV2Schema,
|
|
63
63
|
userAccountSchema,
|
|
64
64
|
vendorPartnerAttGroupsSchema
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-YT2B4UAK.js";
|
|
66
66
|
|
|
67
67
|
// lib/exports/models/ExportType.ts
|
|
68
68
|
var exportTypeEnum = external_exports.enum(["ALL", "UPDATES", "DELTAS_UPDATE", "NO_BUYER_PART_NUMBER"]);
|
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": "4.
|
|
6
|
+
"version": "4.4.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as ky from 'ky';
|
|
2
|
-
import { Options } from 'ky';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
declare const baseUrlsSchema: z.ZodObject<{
|
|
6
|
-
local: z.ZodLiteral<"https://localhost:8443/">;
|
|
7
|
-
test: z.ZodLiteral<"https://integration.api.spscommerce.com/assortment/gateway/">;
|
|
8
|
-
prod: z.ZodLiteral<"https://api.spscommerce.com/assortment/gateway/">;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
local: "https://localhost:8443/";
|
|
11
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/";
|
|
12
|
-
prod: "https://api.spscommerce.com/assortment/gateway/";
|
|
13
|
-
}, {
|
|
14
|
-
local: "https://localhost:8443/";
|
|
15
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/";
|
|
16
|
-
prod: "https://api.spscommerce.com/assortment/gateway/";
|
|
17
|
-
}>;
|
|
18
|
-
type BaseUrls = z.infer<typeof baseUrlsSchema>;
|
|
19
|
-
declare const BASE_URLS: BaseUrls;
|
|
20
|
-
declare const envSchema: z.ZodEnum<["local", "test", "prod"]>;
|
|
21
|
-
type Env = z.infer<typeof envSchema>;
|
|
22
|
-
type AsstUrl = BaseUrls[Env];
|
|
23
|
-
interface AsstClientOptions extends Options {
|
|
24
|
-
prefixUrl?: AsstUrl;
|
|
25
|
-
}
|
|
26
|
-
type Input = string | URL | Request;
|
|
27
|
-
type Listener = (config: AsstClientOptions) => void;
|
|
28
|
-
declare class AsstClient {
|
|
29
|
-
#private;
|
|
30
|
-
constructor(options?: AsstClientOptions);
|
|
31
|
-
/**
|
|
32
|
-
* Set company type that will be automatically added to all requests
|
|
33
|
-
* @param companyType Company type to add to all requests (e.g., 'RETAILER', 'SUPPLIER')
|
|
34
|
-
*/
|
|
35
|
-
setCompanyType(companyType: string | undefined): this;
|
|
36
|
-
/**
|
|
37
|
-
* Get the current company type
|
|
38
|
-
* @returns Current company type or undefined if not set
|
|
39
|
-
*/
|
|
40
|
-
getCompanyType(): string | undefined;
|
|
41
|
-
updateConfig(options: AsstClientOptions): void;
|
|
42
|
-
getBaseUrl(): AsstUrl;
|
|
43
|
-
/**
|
|
44
|
-
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
45
|
-
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
46
|
-
* @returns Function to unsubscribe to config changes
|
|
47
|
-
*/
|
|
48
|
-
subscribeToConfigChange(listener: Listener): () => boolean;
|
|
49
|
-
get(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
50
|
-
post(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
51
|
-
put(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
52
|
-
patch(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
53
|
-
head(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
54
|
-
delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
type Hierarchy = {
|
|
58
|
-
id: string;
|
|
59
|
-
name?: string | null;
|
|
60
|
-
description?: string | null;
|
|
61
|
-
type?: string | null;
|
|
62
|
-
child?: Hierarchy | null;
|
|
63
|
-
};
|
|
64
|
-
type ItemHierarchyResponse = {
|
|
65
|
-
itemHierarchies: Array<{
|
|
66
|
-
itemId: string;
|
|
67
|
-
hierarchies: Array<Hierarchy>;
|
|
68
|
-
}>;
|
|
69
|
-
};
|
|
70
|
-
declare const itemHierarchyResponseSchema: z.ZodType<ItemHierarchyResponse>;
|
|
71
|
-
|
|
72
|
-
declare const spsItemIdResponseSchema: z.ZodObject<{
|
|
73
|
-
id: z.ZodString;
|
|
74
|
-
ref: z.ZodString;
|
|
75
|
-
}, "strip", z.ZodTypeAny, {
|
|
76
|
-
id: string;
|
|
77
|
-
ref: string;
|
|
78
|
-
}, {
|
|
79
|
-
id: string;
|
|
80
|
-
ref: string;
|
|
81
|
-
}>;
|
|
82
|
-
type SpsItemIdResponse = z.infer<typeof spsItemIdResponseSchema>;
|
|
83
|
-
|
|
84
|
-
export { AsstClient as A, BASE_URLS as B, type Env as E, type ItemHierarchyResponse as I, type SpsItemIdResponse as S, type AsstClientOptions as a, type AsstUrl as b, envSchema as e, itemHierarchyResponseSchema as i, spsItemIdResponseSchema as s };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as ky from 'ky';
|
|
2
|
-
import { Options } from 'ky';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
declare const baseUrlsSchema: z.ZodObject<{
|
|
6
|
-
local: z.ZodLiteral<"https://localhost:8443/">;
|
|
7
|
-
test: z.ZodLiteral<"https://integration.api.spscommerce.com/assortment/gateway/">;
|
|
8
|
-
prod: z.ZodLiteral<"https://api.spscommerce.com/assortment/gateway/">;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
local: "https://localhost:8443/";
|
|
11
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/";
|
|
12
|
-
prod: "https://api.spscommerce.com/assortment/gateway/";
|
|
13
|
-
}, {
|
|
14
|
-
local: "https://localhost:8443/";
|
|
15
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/";
|
|
16
|
-
prod: "https://api.spscommerce.com/assortment/gateway/";
|
|
17
|
-
}>;
|
|
18
|
-
type BaseUrls = z.infer<typeof baseUrlsSchema>;
|
|
19
|
-
declare const BASE_URLS: BaseUrls;
|
|
20
|
-
declare const envSchema: z.ZodEnum<["local", "test", "prod"]>;
|
|
21
|
-
type Env = z.infer<typeof envSchema>;
|
|
22
|
-
type AsstUrl = BaseUrls[Env];
|
|
23
|
-
interface AsstClientOptions extends Options {
|
|
24
|
-
prefixUrl?: AsstUrl;
|
|
25
|
-
}
|
|
26
|
-
type Input = string | URL | Request;
|
|
27
|
-
type Listener = (config: AsstClientOptions) => void;
|
|
28
|
-
declare class AsstClient {
|
|
29
|
-
#private;
|
|
30
|
-
constructor(options?: AsstClientOptions);
|
|
31
|
-
/**
|
|
32
|
-
* Set company type that will be automatically added to all requests
|
|
33
|
-
* @param companyType Company type to add to all requests (e.g., 'RETAILER', 'SUPPLIER')
|
|
34
|
-
*/
|
|
35
|
-
setCompanyType(companyType: string | undefined): this;
|
|
36
|
-
/**
|
|
37
|
-
* Get the current company type
|
|
38
|
-
* @returns Current company type or undefined if not set
|
|
39
|
-
*/
|
|
40
|
-
getCompanyType(): string | undefined;
|
|
41
|
-
updateConfig(options: AsstClientOptions): void;
|
|
42
|
-
getBaseUrl(): AsstUrl;
|
|
43
|
-
/**
|
|
44
|
-
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
45
|
-
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
46
|
-
* @returns Function to unsubscribe to config changes
|
|
47
|
-
*/
|
|
48
|
-
subscribeToConfigChange(listener: Listener): () => boolean;
|
|
49
|
-
get(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
50
|
-
post(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
51
|
-
put(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
52
|
-
patch(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
53
|
-
head(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
54
|
-
delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
type Hierarchy = {
|
|
58
|
-
id: string;
|
|
59
|
-
name?: string | null;
|
|
60
|
-
description?: string | null;
|
|
61
|
-
type?: string | null;
|
|
62
|
-
child?: Hierarchy | null;
|
|
63
|
-
};
|
|
64
|
-
type ItemHierarchyResponse = {
|
|
65
|
-
itemHierarchies: Array<{
|
|
66
|
-
itemId: string;
|
|
67
|
-
hierarchies: Array<Hierarchy>;
|
|
68
|
-
}>;
|
|
69
|
-
};
|
|
70
|
-
declare const itemHierarchyResponseSchema: z.ZodType<ItemHierarchyResponse>;
|
|
71
|
-
|
|
72
|
-
declare const spsItemIdResponseSchema: z.ZodObject<{
|
|
73
|
-
id: z.ZodString;
|
|
74
|
-
ref: z.ZodString;
|
|
75
|
-
}, "strip", z.ZodTypeAny, {
|
|
76
|
-
id: string;
|
|
77
|
-
ref: string;
|
|
78
|
-
}, {
|
|
79
|
-
id: string;
|
|
80
|
-
ref: string;
|
|
81
|
-
}>;
|
|
82
|
-
type SpsItemIdResponse = z.infer<typeof spsItemIdResponseSchema>;
|
|
83
|
-
|
|
84
|
-
export { AsstClient as A, BASE_URLS as B, type Env as E, type ItemHierarchyResponse as I, type SpsItemIdResponse as S, type AsstClientOptions as a, type AsstUrl as b, envSchema as e, itemHierarchyResponseSchema as i, spsItemIdResponseSchema as s };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as ky from 'ky';
|
|
2
|
-
import { Options } from 'ky';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
declare const companyTypeEnumSchema: z.ZodEnum<["RETAILER", "SUPPLIER"]>;
|
|
6
|
-
type CompanyType = z.infer<typeof companyTypeEnumSchema>;
|
|
7
|
-
|
|
8
|
-
declare const baseUrlsSchema: z.ZodObject<{
|
|
9
|
-
local: z.ZodLiteral<"https://localhost:8443/">;
|
|
10
|
-
test: z.ZodLiteral<"https://integration.api.spscommerce.com/assortment/gateway/">;
|
|
11
|
-
prod: z.ZodLiteral<"https://api.spscommerce.com/assortment/gateway/">;
|
|
12
|
-
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
local: "https://localhost:8443/";
|
|
14
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/";
|
|
15
|
-
prod: "https://api.spscommerce.com/assortment/gateway/";
|
|
16
|
-
}, {
|
|
17
|
-
local: "https://localhost:8443/";
|
|
18
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/";
|
|
19
|
-
prod: "https://api.spscommerce.com/assortment/gateway/";
|
|
20
|
-
}>;
|
|
21
|
-
type BaseUrls = z.infer<typeof baseUrlsSchema>;
|
|
22
|
-
declare const BASE_URLS: BaseUrls;
|
|
23
|
-
declare const envSchema: z.ZodEnum<["local", "test", "prod"]>;
|
|
24
|
-
type Env = z.infer<typeof envSchema>;
|
|
25
|
-
type AsstUrl = BaseUrls[Env];
|
|
26
|
-
interface AsstClientOptions extends Options {
|
|
27
|
-
prefixUrl?: AsstUrl;
|
|
28
|
-
}
|
|
29
|
-
type Input = string | URL | Request;
|
|
30
|
-
type Listener = (config: AsstClientOptions) => void;
|
|
31
|
-
declare class AsstClient {
|
|
32
|
-
#private;
|
|
33
|
-
constructor(options?: AsstClientOptions);
|
|
34
|
-
/**
|
|
35
|
-
* Set company type that will be automatically added to all requests
|
|
36
|
-
* @param companyType Company type to add to all requests ('RETAILER' | 'SUPPLIER')
|
|
37
|
-
*/
|
|
38
|
-
setCompanyType(companyType: CompanyType | undefined): this;
|
|
39
|
-
/**
|
|
40
|
-
* Get the current company type
|
|
41
|
-
* @returns Current company type or undefined if not set
|
|
42
|
-
*/
|
|
43
|
-
getCompanyType(): CompanyType | undefined;
|
|
44
|
-
updateConfig(options: AsstClientOptions): void;
|
|
45
|
-
getBaseUrl(): AsstUrl;
|
|
46
|
-
/**
|
|
47
|
-
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
48
|
-
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
49
|
-
* @returns Function to unsubscribe to config changes
|
|
50
|
-
*/
|
|
51
|
-
subscribeToConfigChange(listener: Listener): () => boolean;
|
|
52
|
-
get(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
53
|
-
post(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
54
|
-
put(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
55
|
-
patch(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
56
|
-
head(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
57
|
-
delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
type Hierarchy = {
|
|
61
|
-
id: string;
|
|
62
|
-
name?: string | null;
|
|
63
|
-
description?: string | null;
|
|
64
|
-
type?: string | null;
|
|
65
|
-
child?: Hierarchy | null;
|
|
66
|
-
};
|
|
67
|
-
type ItemHierarchyResponse = {
|
|
68
|
-
itemHierarchies: Array<{
|
|
69
|
-
itemId: string;
|
|
70
|
-
hierarchies: Array<Hierarchy>;
|
|
71
|
-
}>;
|
|
72
|
-
};
|
|
73
|
-
declare const itemHierarchyResponseSchema: z.ZodType<ItemHierarchyResponse>;
|
|
74
|
-
|
|
75
|
-
declare const spsItemIdResponseSchema: z.ZodObject<{
|
|
76
|
-
id: z.ZodString;
|
|
77
|
-
ref: z.ZodString;
|
|
78
|
-
}, "strip", z.ZodTypeAny, {
|
|
79
|
-
id: string;
|
|
80
|
-
ref: string;
|
|
81
|
-
}, {
|
|
82
|
-
id: string;
|
|
83
|
-
ref: string;
|
|
84
|
-
}>;
|
|
85
|
-
type SpsItemIdResponse = z.infer<typeof spsItemIdResponseSchema>;
|
|
86
|
-
|
|
87
|
-
export { AsstClient as A, BASE_URLS as B, type CompanyType as C, type Env as E, type ItemHierarchyResponse as I, type SpsItemIdResponse as S, type AsstClientOptions as a, type AsstUrl as b, companyTypeEnumSchema as c, envSchema as e, itemHierarchyResponseSchema as i, spsItemIdResponseSchema as s };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as ky from 'ky';
|
|
2
|
-
import { Options } from 'ky';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
declare const companyTypeEnumSchema: z.ZodEnum<["RETAILER", "SUPPLIER"]>;
|
|
6
|
-
type CompanyType = z.infer<typeof companyTypeEnumSchema>;
|
|
7
|
-
|
|
8
|
-
declare const baseUrlsSchema: z.ZodObject<{
|
|
9
|
-
local: z.ZodLiteral<"https://localhost:8443/">;
|
|
10
|
-
test: z.ZodLiteral<"https://integration.api.spscommerce.com/assortment/gateway/">;
|
|
11
|
-
prod: z.ZodLiteral<"https://api.spscommerce.com/assortment/gateway/">;
|
|
12
|
-
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
local: "https://localhost:8443/";
|
|
14
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/";
|
|
15
|
-
prod: "https://api.spscommerce.com/assortment/gateway/";
|
|
16
|
-
}, {
|
|
17
|
-
local: "https://localhost:8443/";
|
|
18
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/";
|
|
19
|
-
prod: "https://api.spscommerce.com/assortment/gateway/";
|
|
20
|
-
}>;
|
|
21
|
-
type BaseUrls = z.infer<typeof baseUrlsSchema>;
|
|
22
|
-
declare const BASE_URLS: BaseUrls;
|
|
23
|
-
declare const envSchema: z.ZodEnum<["local", "test", "prod"]>;
|
|
24
|
-
type Env = z.infer<typeof envSchema>;
|
|
25
|
-
type AsstUrl = BaseUrls[Env];
|
|
26
|
-
interface AsstClientOptions extends Options {
|
|
27
|
-
prefixUrl?: AsstUrl;
|
|
28
|
-
}
|
|
29
|
-
type Input = string | URL | Request;
|
|
30
|
-
type Listener = (config: AsstClientOptions) => void;
|
|
31
|
-
declare class AsstClient {
|
|
32
|
-
#private;
|
|
33
|
-
constructor(options?: AsstClientOptions);
|
|
34
|
-
/**
|
|
35
|
-
* Set company type that will be automatically added to all requests
|
|
36
|
-
* @param companyType Company type to add to all requests ('RETAILER' | 'SUPPLIER')
|
|
37
|
-
*/
|
|
38
|
-
setCompanyType(companyType: CompanyType | undefined): this;
|
|
39
|
-
/**
|
|
40
|
-
* Get the current company type
|
|
41
|
-
* @returns Current company type or undefined if not set
|
|
42
|
-
*/
|
|
43
|
-
getCompanyType(): CompanyType | undefined;
|
|
44
|
-
updateConfig(options: AsstClientOptions): void;
|
|
45
|
-
getBaseUrl(): AsstUrl;
|
|
46
|
-
/**
|
|
47
|
-
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
48
|
-
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
49
|
-
* @returns Function to unsubscribe to config changes
|
|
50
|
-
*/
|
|
51
|
-
subscribeToConfigChange(listener: Listener): () => boolean;
|
|
52
|
-
get(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
53
|
-
post(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
54
|
-
put(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
55
|
-
patch(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
56
|
-
head(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
57
|
-
delete(url: Input, options?: AsstClientOptions): ky.ResponsePromise;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
type Hierarchy = {
|
|
61
|
-
id: string;
|
|
62
|
-
name?: string | null;
|
|
63
|
-
description?: string | null;
|
|
64
|
-
type?: string | null;
|
|
65
|
-
child?: Hierarchy | null;
|
|
66
|
-
};
|
|
67
|
-
type ItemHierarchyResponse = {
|
|
68
|
-
itemHierarchies: Array<{
|
|
69
|
-
itemId: string;
|
|
70
|
-
hierarchies: Array<Hierarchy>;
|
|
71
|
-
}>;
|
|
72
|
-
};
|
|
73
|
-
declare const itemHierarchyResponseSchema: z.ZodType<ItemHierarchyResponse>;
|
|
74
|
-
|
|
75
|
-
declare const spsItemIdResponseSchema: z.ZodObject<{
|
|
76
|
-
id: z.ZodString;
|
|
77
|
-
ref: z.ZodString;
|
|
78
|
-
}, "strip", z.ZodTypeAny, {
|
|
79
|
-
id: string;
|
|
80
|
-
ref: string;
|
|
81
|
-
}, {
|
|
82
|
-
id: string;
|
|
83
|
-
ref: string;
|
|
84
|
-
}>;
|
|
85
|
-
type SpsItemIdResponse = z.infer<typeof spsItemIdResponseSchema>;
|
|
86
|
-
|
|
87
|
-
export { AsstClient as A, BASE_URLS as B, type CompanyType as C, type Env as E, type ItemHierarchyResponse as I, type SpsItemIdResponse as S, type AsstClientOptions as a, type AsstUrl as b, companyTypeEnumSchema as c, envSchema as e, itemHierarchyResponseSchema as i, spsItemIdResponseSchema as s };
|
package/dist/chunk-355LPVI6.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
external_exports
|
|
3
|
-
} from "./chunk-L4AWOEED.js";
|
|
4
|
-
|
|
5
|
-
// lib/asstClient.ts
|
|
6
|
-
import ky from "ky";
|
|
7
|
-
var baseUrlsSchema = external_exports.object({
|
|
8
|
-
local: external_exports.literal("https://localhost:8443/"),
|
|
9
|
-
test: external_exports.literal(
|
|
10
|
-
"https://integration.api.spscommerce.com/assortment/gateway/"
|
|
11
|
-
),
|
|
12
|
-
prod: external_exports.literal("https://api.spscommerce.com/assortment/gateway/")
|
|
13
|
-
});
|
|
14
|
-
var BASE_URLS = {
|
|
15
|
-
local: "https://localhost:8443/",
|
|
16
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/",
|
|
17
|
-
prod: "https://api.spscommerce.com/assortment/gateway/"
|
|
18
|
-
};
|
|
19
|
-
var envSchema = baseUrlsSchema.keyof();
|
|
20
|
-
var initialConfig = {
|
|
21
|
-
prefixUrl: BASE_URLS["test"],
|
|
22
|
-
retry: 0
|
|
23
|
-
};
|
|
24
|
-
var AsstClient = class {
|
|
25
|
-
#client = ky.create(initialConfig);
|
|
26
|
-
#baseUrl = BASE_URLS["test"];
|
|
27
|
-
#listeners = /* @__PURE__ */ new Set();
|
|
28
|
-
#currentConfig = initialConfig;
|
|
29
|
-
#companyType;
|
|
30
|
-
constructor(options) {
|
|
31
|
-
if (options) {
|
|
32
|
-
this.updateConfig(options);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Set company type that will be automatically added to all requests
|
|
37
|
-
* @param companyType Company type to add to all requests (e.g., 'RETAILER', 'SUPPLIER')
|
|
38
|
-
*/
|
|
39
|
-
setCompanyType(companyType) {
|
|
40
|
-
this.#companyType = companyType;
|
|
41
|
-
return this;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Get the current company type
|
|
45
|
-
* @returns Current company type or undefined if not set
|
|
46
|
-
*/
|
|
47
|
-
getCompanyType() {
|
|
48
|
-
return this.#companyType;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Private method to merge companyType with existing searchParams
|
|
52
|
-
*/
|
|
53
|
-
#mergeCompanyTypeParam(options = {}) {
|
|
54
|
-
if (!this.#companyType) return options;
|
|
55
|
-
const mergedOptions = { ...options };
|
|
56
|
-
let searchParams;
|
|
57
|
-
if (options.searchParams) {
|
|
58
|
-
if (options.searchParams instanceof URLSearchParams) {
|
|
59
|
-
searchParams = new URLSearchParams(options.searchParams);
|
|
60
|
-
} else if (typeof options.searchParams === "string") {
|
|
61
|
-
searchParams = new URLSearchParams(options.searchParams);
|
|
62
|
-
} else {
|
|
63
|
-
searchParams = new URLSearchParams();
|
|
64
|
-
Object.entries(options.searchParams).forEach(([key, value]) => {
|
|
65
|
-
if (Array.isArray(value)) {
|
|
66
|
-
value.forEach((v) => searchParams.append(key, String(v)));
|
|
67
|
-
} else if (value !== void 0 && value !== null) {
|
|
68
|
-
searchParams.append(key, String(value));
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
searchParams = new URLSearchParams();
|
|
74
|
-
}
|
|
75
|
-
if (!searchParams.has("companyType")) {
|
|
76
|
-
searchParams.set("companyType", this.#companyType);
|
|
77
|
-
}
|
|
78
|
-
mergedOptions.searchParams = searchParams;
|
|
79
|
-
return mergedOptions;
|
|
80
|
-
}
|
|
81
|
-
updateConfig(options) {
|
|
82
|
-
this.#client = this.#client.extend(options);
|
|
83
|
-
this.#currentConfig = options;
|
|
84
|
-
if (options.prefixUrl) {
|
|
85
|
-
this.#baseUrl = options.prefixUrl;
|
|
86
|
-
}
|
|
87
|
-
this.#listeners.forEach((listener) => listener(options));
|
|
88
|
-
}
|
|
89
|
-
getBaseUrl() {
|
|
90
|
-
return this.#baseUrl;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Subscribe to config changes. The callback will be immediately invoked with the current config.
|
|
94
|
-
* @param subscriptionCallback Function that will be called with the new config every time it is changed
|
|
95
|
-
* @returns Function to unsubscribe to config changes
|
|
96
|
-
*/
|
|
97
|
-
subscribeToConfigChange(listener) {
|
|
98
|
-
this.#listeners.add(listener);
|
|
99
|
-
listener(this.#currentConfig);
|
|
100
|
-
return () => this.#listeners.delete(listener);
|
|
101
|
-
}
|
|
102
|
-
get(url, options) {
|
|
103
|
-
return this.#client.get(url, this.#mergeCompanyTypeParam(options));
|
|
104
|
-
}
|
|
105
|
-
post(url, options) {
|
|
106
|
-
return this.#client.post(url, this.#mergeCompanyTypeParam(options));
|
|
107
|
-
}
|
|
108
|
-
put(url, options) {
|
|
109
|
-
return this.#client.put(url, this.#mergeCompanyTypeParam(options));
|
|
110
|
-
}
|
|
111
|
-
patch(url, options) {
|
|
112
|
-
return this.#client.patch(url, this.#mergeCompanyTypeParam(options));
|
|
113
|
-
}
|
|
114
|
-
head(url, options) {
|
|
115
|
-
return this.#client.head(url, this.#mergeCompanyTypeParam(options));
|
|
116
|
-
}
|
|
117
|
-
delete(url, options) {
|
|
118
|
-
return this.#client.delete(url, this.#mergeCompanyTypeParam(options));
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export {
|
|
123
|
-
BASE_URLS,
|
|
124
|
-
envSchema,
|
|
125
|
-
AsstClient
|
|
126
|
-
};
|
package/dist/chunk-55ECRTUX.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
external_exports
|
|
3
|
-
} from "./chunk-LKUGPDIT.js";
|
|
4
|
-
|
|
5
|
-
// lib/asstClient.ts
|
|
6
|
-
import ky from "ky";
|
|
7
|
-
var baseUrlsSchema = external_exports.object({
|
|
8
|
-
local: external_exports.literal("https://localhost:8443/"),
|
|
9
|
-
test: external_exports.literal(
|
|
10
|
-
"https://integration.api.spscommerce.com/assortment/gateway/"
|
|
11
|
-
),
|
|
12
|
-
prod: external_exports.literal("https://api.spscommerce.com/assortment/gateway/")
|
|
13
|
-
});
|
|
14
|
-
var BASE_URLS = {
|
|
15
|
-
local: "https://localhost:8443/",
|
|
16
|
-
test: "https://integration.api.spscommerce.com/assortment/gateway/",
|
|
17
|
-
prod: "https://api.spscommerce.com/assortment/gateway/"
|
|
18
|
-
};
|
|
19
|
-
var envSchema = baseUrlsSchema.keyof();
|
|
20
|
-
var initialConfig = {
|
|
21
|
-
prefixUrl: BASE_URLS["test"],
|
|
22
|
-
retry: 0
|
|
23
|
-
};
|
|
24
|
-
var AsstClient = class {
|
|
25
|
-
#client = ky.create(initialConfig);
|
|
26
|
-
#baseUrl = BASE_URLS["test"];
|
|
27
|
-
#listeners = /* @__PURE__ */ new Set();
|
|
28
|
-
#currentConfig = initialConfig;
|
|
29
|
-
constructor(options) {
|
|
30
|
-
if (options) {
|
|
31
|
-
this.updateConfig(options);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
updateConfig(options) {
|
|
35
|
-
this.#client = this.#client.extend(options);
|
|
36
|
-
this.#currentConfig = options;
|
|
37
|
-
if (options.prefixUrl) {
|
|
38
|
-
this.#baseUrl = options.prefixUrl;
|
|
39
|
-
}
|
|
40
|
-
this.#listeners.forEach((listener) => listener(options));
|
|
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
|
-
* @returns Function to unsubscribe to config changes
|
|
49
|
-
*/
|
|
50
|
-
subscribeToConfigChange(listener) {
|
|
51
|
-
this.#listeners.add(listener);
|
|
52
|
-
listener(this.#currentConfig);
|
|
53
|
-
return () => this.#listeners.delete(listener);
|
|
54
|
-
}
|
|
55
|
-
get(url, options) {
|
|
56
|
-
return this.#client.get(url, options);
|
|
57
|
-
}
|
|
58
|
-
post(url, options) {
|
|
59
|
-
return this.#client.post(url, options);
|
|
60
|
-
}
|
|
61
|
-
put(url, options) {
|
|
62
|
-
return this.#client.put(url, options);
|
|
63
|
-
}
|
|
64
|
-
patch(url, options) {
|
|
65
|
-
return this.#client.patch(url, options);
|
|
66
|
-
}
|
|
67
|
-
head(url, options) {
|
|
68
|
-
return this.#client.head(url, options);
|
|
69
|
-
}
|
|
70
|
-
delete(url, options) {
|
|
71
|
-
return this.#client.delete(url, options);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export {
|
|
76
|
-
BASE_URLS,
|
|
77
|
-
envSchema,
|
|
78
|
-
AsstClient
|
|
79
|
-
};
|