@cronvello/shop-sdk 0.1.0 → 0.2.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.
@@ -1,4 +1,4 @@
1
- import { M6 as apiRoutes } from './index-CIpUb0vL.cjs';
1
+ import { Mb as apiRoutes } from './index-DC6jGVkP.cjs';
2
2
 
3
3
  type ShopRouteKey = keyof typeof apiRoutes;
4
4
  type ShopRoute<K extends ShopRouteKey> = (typeof apiRoutes)[K];
@@ -53,6 +53,59 @@ interface ShopClient {
53
53
  /** Stable production endpoint used when no override or resolver is supplied. */
54
54
  declare const SHOP_API_URL = "https://node-shop-production-86b7.up.railway.app";
55
55
 
56
+ /**
57
+ * `match` — the deployment reports exactly the contract compiled into this SDK.
58
+ * `drift` — it reports a different one. The types here are a lie about that
59
+ * deployment; requests can fail on shapes the compiler called fine.
60
+ * `unknown` — nobody could be asked (offline, 503, or a node-shop old enough not
61
+ * to serve the endpoint yet). Explicitly NOT the same as `match`.
62
+ */
63
+ type ShopContractStatus = "match" | "drift" | "unknown";
64
+ type ShopDiagnosis = {
65
+ /**
66
+ * True only when the contract was actually VERIFIED to match. `unknown` is
67
+ * false on purpose: a green light that means "could not check" is exactly the
68
+ * failure this whole mechanism exists to remove.
69
+ */
70
+ ok: boolean;
71
+ baseUrl: string | null;
72
+ sdkVersion: string;
73
+ reachable: boolean;
74
+ contract: {
75
+ status: ShopContractStatus;
76
+ sdk: string;
77
+ live: string | null;
78
+ files: number | null;
79
+ };
80
+ /** Plain sentences, safe to log or show. Empty when `ok` is true. */
81
+ problems: string[];
82
+ checkedAt: string;
83
+ };
84
+ type ShopDiagnoseOptions = {
85
+ /** Preferred: reuses the client's own base URL, including a dynamic resolver. */
86
+ client?: Pick<ShopClient, "baseUrl">;
87
+ baseUrl?: BaseUrlProvider;
88
+ fetch?: typeof globalThis.fetch;
89
+ timeoutMs?: number;
90
+ signal?: AbortSignal;
91
+ };
92
+ /**
93
+ * Ask a running node-shop which contract it speaks and compare it to the one
94
+ * this SDK was built against.
95
+ *
96
+ * Read-only, unauthenticated, and cheap — meant to sit behind a consumer's own
97
+ * health endpoint so the answer is a fact anyone can pull, rather than something
98
+ * a person has to remember to check after a release.
99
+ *
100
+ * Never throws for an operational reason: an unreachable shop is a RESULT
101
+ * (`reachable: false`), not an exception, so a health route cannot accidentally
102
+ * turn a diagnosis into a 500. Only a genuinely unusable base URL throws
103
+ * (`ShopConfigurationError`), because that is a wiring mistake, not a state.
104
+ */
105
+ declare function diagnoseShop(options?: ShopDiagnoseOptions): Promise<ShopDiagnosis>;
106
+
107
+ declare const CONTRACT_SHA256 = "05f34929e71fb2fcb3a4c04707facca22ee46f8960a4cc47ce0a3f1a6df36056";
108
+
56
109
  type ShopErrorDetails = {
57
110
  status: number;
58
111
  method: string;
@@ -75,4 +128,4 @@ declare class ShopConfigurationError extends Error {
75
128
  constructor(message: string);
76
129
  }
77
130
 
78
- export { type BaseUrlProvider as B, type HeaderProvider as H, type MaybePromise as M, type ShopClientOptions as S, type ShopClient as a, SHOP_API_URL as b, ShopApiError as c, type ShopAuthType as d, ShopConfigurationError as e, type ShopRequestContext as f, type ShopRequestOptions as g, type ShopRoute as h, type ShopRouteAuth as i, type ShopRouteBody as j, type ShopRouteInput as k, type ShopRouteKey as l, type ShopRouteMethod as m, type ShopRouteParams as n, type ShopRouteQuery as o, type ShopRouteResponse as p, type ShopRouteResponseData as q };
131
+ export { type BaseUrlProvider as B, CONTRACT_SHA256 as C, type HeaderProvider as H, type MaybePromise as M, type ShopClientOptions as S, type ShopClient as a, SHOP_API_URL as b, ShopApiError as c, type ShopAuthType as d, ShopConfigurationError as e, type ShopContractStatus as f, type ShopDiagnoseOptions as g, type ShopDiagnosis as h, type ShopRequestContext as i, type ShopRequestOptions as j, type ShopRoute as k, type ShopRouteAuth as l, type ShopRouteBody as m, type ShopRouteInput as n, type ShopRouteKey as o, type ShopRouteMethod as p, type ShopRouteParams as q, type ShopRouteQuery as r, type ShopRouteResponse as s, type ShopRouteResponseData as t, diagnoseShop as u };
@@ -1,4 +1,4 @@
1
- import { M6 as apiRoutes } from './index-CIpUb0vL.js';
1
+ import { Mb as apiRoutes } from './index-DC6jGVkP.js';
2
2
 
3
3
  type ShopRouteKey = keyof typeof apiRoutes;
4
4
  type ShopRoute<K extends ShopRouteKey> = (typeof apiRoutes)[K];
@@ -53,6 +53,59 @@ interface ShopClient {
53
53
  /** Stable production endpoint used when no override or resolver is supplied. */
54
54
  declare const SHOP_API_URL = "https://node-shop-production-86b7.up.railway.app";
55
55
 
56
+ /**
57
+ * `match` — the deployment reports exactly the contract compiled into this SDK.
58
+ * `drift` — it reports a different one. The types here are a lie about that
59
+ * deployment; requests can fail on shapes the compiler called fine.
60
+ * `unknown` — nobody could be asked (offline, 503, or a node-shop old enough not
61
+ * to serve the endpoint yet). Explicitly NOT the same as `match`.
62
+ */
63
+ type ShopContractStatus = "match" | "drift" | "unknown";
64
+ type ShopDiagnosis = {
65
+ /**
66
+ * True only when the contract was actually VERIFIED to match. `unknown` is
67
+ * false on purpose: a green light that means "could not check" is exactly the
68
+ * failure this whole mechanism exists to remove.
69
+ */
70
+ ok: boolean;
71
+ baseUrl: string | null;
72
+ sdkVersion: string;
73
+ reachable: boolean;
74
+ contract: {
75
+ status: ShopContractStatus;
76
+ sdk: string;
77
+ live: string | null;
78
+ files: number | null;
79
+ };
80
+ /** Plain sentences, safe to log or show. Empty when `ok` is true. */
81
+ problems: string[];
82
+ checkedAt: string;
83
+ };
84
+ type ShopDiagnoseOptions = {
85
+ /** Preferred: reuses the client's own base URL, including a dynamic resolver. */
86
+ client?: Pick<ShopClient, "baseUrl">;
87
+ baseUrl?: BaseUrlProvider;
88
+ fetch?: typeof globalThis.fetch;
89
+ timeoutMs?: number;
90
+ signal?: AbortSignal;
91
+ };
92
+ /**
93
+ * Ask a running node-shop which contract it speaks and compare it to the one
94
+ * this SDK was built against.
95
+ *
96
+ * Read-only, unauthenticated, and cheap — meant to sit behind a consumer's own
97
+ * health endpoint so the answer is a fact anyone can pull, rather than something
98
+ * a person has to remember to check after a release.
99
+ *
100
+ * Never throws for an operational reason: an unreachable shop is a RESULT
101
+ * (`reachable: false`), not an exception, so a health route cannot accidentally
102
+ * turn a diagnosis into a 500. Only a genuinely unusable base URL throws
103
+ * (`ShopConfigurationError`), because that is a wiring mistake, not a state.
104
+ */
105
+ declare function diagnoseShop(options?: ShopDiagnoseOptions): Promise<ShopDiagnosis>;
106
+
107
+ declare const CONTRACT_SHA256 = "05f34929e71fb2fcb3a4c04707facca22ee46f8960a4cc47ce0a3f1a6df36056";
108
+
56
109
  type ShopErrorDetails = {
57
110
  status: number;
58
111
  method: string;
@@ -75,4 +128,4 @@ declare class ShopConfigurationError extends Error {
75
128
  constructor(message: string);
76
129
  }
77
130
 
78
- export { type BaseUrlProvider as B, type HeaderProvider as H, type MaybePromise as M, type ShopClientOptions as S, type ShopClient as a, SHOP_API_URL as b, ShopApiError as c, type ShopAuthType as d, ShopConfigurationError as e, type ShopRequestContext as f, type ShopRequestOptions as g, type ShopRoute as h, type ShopRouteAuth as i, type ShopRouteBody as j, type ShopRouteInput as k, type ShopRouteKey as l, type ShopRouteMethod as m, type ShopRouteParams as n, type ShopRouteQuery as o, type ShopRouteResponse as p, type ShopRouteResponseData as q };
131
+ export { type BaseUrlProvider as B, CONTRACT_SHA256 as C, type HeaderProvider as H, type MaybePromise as M, type ShopClientOptions as S, type ShopClient as a, SHOP_API_URL as b, ShopApiError as c, type ShopAuthType as d, ShopConfigurationError as e, type ShopContractStatus as f, type ShopDiagnoseOptions as g, type ShopDiagnosis as h, type ShopRequestContext as i, type ShopRequestOptions as j, type ShopRoute as k, type ShopRouteAuth as l, type ShopRouteBody as m, type ShopRouteInput as n, type ShopRouteKey as o, type ShopRouteMethod as p, type ShopRouteParams as q, type ShopRouteQuery as r, type ShopRouteResponse as s, type ShopRouteResponseData as t, diagnoseShop as u };