@spscommerce/asst-api 4.3.0 → 4.5.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.
Files changed (38) hide show
  1. package/dist/{SpsItemIdResponse-CI_Ao86P.d.cts → SpsItemIdResponse-gAHfCzwP.d.cts} +22 -14
  2. package/dist/{SpsItemIdResponse-CI_Ao86P.d.ts → SpsItemIdResponse-gAHfCzwP.d.ts} +22 -14
  3. package/dist/{chunk-LKUGPDIT.js → chunk-BMTYM2N6.js} +33 -4
  4. package/dist/{chunk-CI3ZSIT4.js → chunk-VS3QNXZF.js} +146 -37
  5. package/dist/{chunk-55ECRTUX.js → chunk-WX4LGXJV.js} +1 -1
  6. package/dist/index.cjs +174 -40
  7. package/dist/index.d.cts +141 -14
  8. package/dist/index.d.ts +141 -14
  9. package/dist/index.js +3 -3
  10. package/dist/msw.cjs +85 -7
  11. package/dist/msw.d.cts +43 -12
  12. package/dist/msw.d.ts +43 -12
  13. package/dist/msw.js +50 -4
  14. package/dist/{zod-C41Rts8D.d.cts → zod-C-emh7a3.d.cts} +10 -46
  15. package/dist/{zod-COyz02Lh.d.ts → zod-D3Xe9bw3.d.ts} +10 -46
  16. package/dist/zod.cjs +31 -4
  17. package/dist/zod.d.cts +2 -2
  18. package/dist/zod.d.ts +2 -2
  19. package/dist/zod.js +2 -2
  20. package/package.json +2 -3
  21. package/dist/SpsItemIdResponse-0VgfCmG_.d.cts +0 -84
  22. package/dist/SpsItemIdResponse-0VgfCmG_.d.ts +0 -84
  23. package/dist/SpsItemIdResponse-s0vCXepG.d.cts +0 -74
  24. package/dist/SpsItemIdResponse-s0vCXepG.d.ts +0 -74
  25. package/dist/chunk-355LPVI6.js +0 -126
  26. package/dist/chunk-63KIELUR.js +0 -128
  27. package/dist/chunk-DK2OMRWR.js +0 -134
  28. package/dist/chunk-FCUIJXCD.js +0 -544
  29. package/dist/chunk-L4AWOEED.js +0 -4892
  30. package/dist/chunk-NFZI7D22.js +0 -544
  31. package/dist/chunk-NUUQDRHD.js +0 -4899
  32. package/dist/chunk-RPGGEEFE.js +0 -79
  33. package/dist/zod-C3fOiO-H.d.cts +0 -5900
  34. package/dist/zod-CJ6AFTQr.d.ts +0 -5900
  35. package/dist/zod-CJmsC_DX.d.cts +0 -5900
  36. package/dist/zod-CzPw-bfk.d.cts +0 -5900
  37. package/dist/zod-vDuspd-x.d.ts +0 -5900
  38. package/dist/zod-xWM6u1LJ.d.ts +0 -5900
@@ -1,79 +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
- 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
- };