@cronvello/shop-sdk 0.2.2 → 0.3.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/CONTRACT_SHA256 +1 -1
- package/dist/browser.cjs +3 -3
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +3 -3
- package/dist/browser.js.map +1 -1
- package/dist/contract.cjs +1 -1
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +1 -1
- package/dist/contract.d.ts +1 -1
- package/dist/contract.js +1 -1
- package/dist/contract.js.map +1 -1
- package/dist/{error-D3Jrcd-j.d.ts → error-DZAuAQ8Z.d.ts} +2 -2
- package/dist/{error-1WqH-FhJ.d.cts → error-QHUSBOHv.d.cts} +2 -2
- package/dist/{index-DC6jGVkP.d.cts → index-CcbN4xcE.d.cts} +8 -2
- package/dist/{index-DC6jGVkP.d.ts → index-CcbN4xcE.d.ts} +8 -2
- package/dist/index.cjs +102 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -4
- package/dist/index.d.ts +76 -4
- package/dist/index.js +102 -4
- package/dist/index.js.map +1 -1
- package/dist/openapi.json +46 -1
- package/dist/server.cjs +3 -3
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +3 -3
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mb as apiRoutes } from './index-
|
|
1
|
+
import { Mb as apiRoutes } from './index-CcbN4xcE.js';
|
|
2
2
|
|
|
3
3
|
type ShopRouteKey = keyof typeof apiRoutes;
|
|
4
4
|
type ShopRoute<K extends ShopRouteKey> = (typeof apiRoutes)[K];
|
|
@@ -104,7 +104,7 @@ type ShopDiagnoseOptions = {
|
|
|
104
104
|
*/
|
|
105
105
|
declare function diagnoseShop(options?: ShopDiagnoseOptions): Promise<ShopDiagnosis>;
|
|
106
106
|
|
|
107
|
-
declare const CONTRACT_SHA256 = "
|
|
107
|
+
declare const CONTRACT_SHA256 = "32f132210ee188c28a330c9db5c6db6eaf5b7c3a65ecc041e029aca6e1335a60";
|
|
108
108
|
|
|
109
109
|
type ShopErrorDetails = {
|
|
110
110
|
status: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mb as apiRoutes } from './index-
|
|
1
|
+
import { Mb as apiRoutes } from './index-CcbN4xcE.cjs';
|
|
2
2
|
|
|
3
3
|
type ShopRouteKey = keyof typeof apiRoutes;
|
|
4
4
|
type ShopRoute<K extends ShopRouteKey> = (typeof apiRoutes)[K];
|
|
@@ -104,7 +104,7 @@ type ShopDiagnoseOptions = {
|
|
|
104
104
|
*/
|
|
105
105
|
declare function diagnoseShop(options?: ShopDiagnoseOptions): Promise<ShopDiagnosis>;
|
|
106
106
|
|
|
107
|
-
declare const CONTRACT_SHA256 = "
|
|
107
|
+
declare const CONTRACT_SHA256 = "32f132210ee188c28a330c9db5c6db6eaf5b7c3a65ecc041e029aca6e1335a60";
|
|
108
108
|
|
|
109
109
|
type ShopErrorDetails = {
|
|
110
110
|
status: number;
|
|
@@ -8351,6 +8351,12 @@ type ExternalAppsServiceStatusResponseData = {
|
|
|
8351
8351
|
authMethod: string | null;
|
|
8352
8352
|
oauthClientId: string | null;
|
|
8353
8353
|
oauthClientSecretFingerprint: string | null;
|
|
8354
|
+
credentialFingerprints: Array<{
|
|
8355
|
+
role: "api_key" | "previous_api_key" | "public_api_key" | "oauth_client_secret";
|
|
8356
|
+
fingerprint: string;
|
|
8357
|
+
current: boolean;
|
|
8358
|
+
expiresAt?: string | any | null;
|
|
8359
|
+
}>;
|
|
8354
8360
|
entitlementPath: string | null;
|
|
8355
8361
|
usageOveragePath: string | null;
|
|
8356
8362
|
};
|
|
@@ -8687,7 +8693,7 @@ declare const apiRoutes_external_apps: {
|
|
|
8687
8693
|
readonly meta: {
|
|
8688
8694
|
readonly tags: readonly ["external-apps"];
|
|
8689
8695
|
readonly summary: "Get external app registration status (B2B)";
|
|
8690
|
-
readonly description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from.";
|
|
8696
|
+
readonly description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. `credentialFingerprints` lists one such fingerprint per credential we hold for that app (api_key, previous_api_key during a rotation grace period, public_api_key, oauth_client_secret). It lets the caller locate the value in the app's runtime environment by equality instead of guessing a variable name - the name differs per app, the value does not. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from.";
|
|
8691
8697
|
};
|
|
8692
8698
|
readonly types: {
|
|
8693
8699
|
params: ExternalAppsServiceStatusParams;
|
|
@@ -25488,7 +25494,7 @@ declare const apiRoutes: {
|
|
|
25488
25494
|
readonly meta: {
|
|
25489
25495
|
readonly tags: readonly ["external-apps"];
|
|
25490
25496
|
readonly summary: "Get external app registration status (B2B)";
|
|
25491
|
-
readonly description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from.";
|
|
25497
|
+
readonly description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. `credentialFingerprints` lists one such fingerprint per credential we hold for that app (api_key, previous_api_key during a rotation grace period, public_api_key, oauth_client_secret). It lets the caller locate the value in the app's runtime environment by equality instead of guessing a variable name - the name differs per app, the value does not. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from.";
|
|
25492
25498
|
};
|
|
25493
25499
|
readonly types: {
|
|
25494
25500
|
params: ExternalAppsServiceStatusParams;
|
|
@@ -8351,6 +8351,12 @@ type ExternalAppsServiceStatusResponseData = {
|
|
|
8351
8351
|
authMethod: string | null;
|
|
8352
8352
|
oauthClientId: string | null;
|
|
8353
8353
|
oauthClientSecretFingerprint: string | null;
|
|
8354
|
+
credentialFingerprints: Array<{
|
|
8355
|
+
role: "api_key" | "previous_api_key" | "public_api_key" | "oauth_client_secret";
|
|
8356
|
+
fingerprint: string;
|
|
8357
|
+
current: boolean;
|
|
8358
|
+
expiresAt?: string | any | null;
|
|
8359
|
+
}>;
|
|
8354
8360
|
entitlementPath: string | null;
|
|
8355
8361
|
usageOveragePath: string | null;
|
|
8356
8362
|
};
|
|
@@ -8687,7 +8693,7 @@ declare const apiRoutes_external_apps: {
|
|
|
8687
8693
|
readonly meta: {
|
|
8688
8694
|
readonly tags: readonly ["external-apps"];
|
|
8689
8695
|
readonly summary: "Get external app registration status (B2B)";
|
|
8690
|
-
readonly description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from.";
|
|
8696
|
+
readonly description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. `credentialFingerprints` lists one such fingerprint per credential we hold for that app (api_key, previous_api_key during a rotation grace period, public_api_key, oauth_client_secret). It lets the caller locate the value in the app's runtime environment by equality instead of guessing a variable name - the name differs per app, the value does not. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from.";
|
|
8691
8697
|
};
|
|
8692
8698
|
readonly types: {
|
|
8693
8699
|
params: ExternalAppsServiceStatusParams;
|
|
@@ -25488,7 +25494,7 @@ declare const apiRoutes: {
|
|
|
25488
25494
|
readonly meta: {
|
|
25489
25495
|
readonly tags: readonly ["external-apps"];
|
|
25490
25496
|
readonly summary: "Get external app registration status (B2B)";
|
|
25491
|
-
readonly description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from.";
|
|
25497
|
+
readonly description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. `credentialFingerprints` lists one such fingerprint per credential we hold for that app (api_key, previous_api_key during a rotation grace period, public_api_key, oauth_client_secret). It lets the caller locate the value in the app's runtime environment by equality instead of guessing a variable name - the name differs per app, the value does not. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from.";
|
|
25492
25498
|
};
|
|
25493
25499
|
readonly types: {
|
|
25494
25500
|
params: ExternalAppsServiceStatusParams;
|
package/dist/index.cjs
CHANGED
|
@@ -2091,7 +2091,7 @@ var apiRoutes_external_apps = {
|
|
|
2091
2091
|
meta: {
|
|
2092
2092
|
tags: ["external-apps"],
|
|
2093
2093
|
summary: "Get external app registration status (B2B)",
|
|
2094
|
-
description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from."
|
|
2094
|
+
description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections. Includes authMethod and, for OAuth apps, the oauth client_id we will present to that app plus a truncated SHA-256 fingerprint of the stored client secret, so the other side can prove a rotation actually landed here. Never the secret itself. `credentialFingerprints` lists one such fingerprint per credential we hold for that app (api_key, previous_api_key during a rotation grace period, public_api_key, oauth_client_secret). It lets the caller locate the value in the app's runtime environment by equality instead of guessing a variable name - the name differs per app, the value does not. Also reports the entitlement paths we have stored, because registration is an upsert: a caller that only wants to hand us new credentials must send these back unchanged, or it silently repoints where we fetch entitlements from."
|
|
2095
2095
|
},
|
|
2096
2096
|
types: null
|
|
2097
2097
|
},
|
|
@@ -5734,10 +5734,10 @@ function createShopClient(options = {}) {
|
|
|
5734
5734
|
}
|
|
5735
5735
|
|
|
5736
5736
|
// src/contract-hash.ts
|
|
5737
|
-
var CONTRACT_SHA256 = "
|
|
5737
|
+
var CONTRACT_SHA256 = "32f132210ee188c28a330c9db5c6db6eaf5b7c3a65ecc041e029aca6e1335a60";
|
|
5738
5738
|
|
|
5739
5739
|
// src/client/diagnose.ts
|
|
5740
|
-
var SDK_VERSION = "0.
|
|
5740
|
+
var SDK_VERSION = "0.3.0" ;
|
|
5741
5741
|
async function resolveBaseUrl(options) {
|
|
5742
5742
|
const provider = options.client?.baseUrl ?? options.baseUrl ?? SHOP_API_URL;
|
|
5743
5743
|
const value = typeof provider === "function" ? await provider() : provider;
|
|
@@ -5829,6 +5829,104 @@ async function diagnoseShop(options = {}) {
|
|
|
5829
5829
|
};
|
|
5830
5830
|
}
|
|
5831
5831
|
|
|
5832
|
+
// src/capabilities.ts
|
|
5833
|
+
var SDK_VERSION2 = "0.3.0" ;
|
|
5834
|
+
var ROUTES = apiRoutes;
|
|
5835
|
+
var CLIENT_MANAGEMENT_OPS = [
|
|
5836
|
+
"external_apps_service_register",
|
|
5837
|
+
"external_apps_service_update",
|
|
5838
|
+
"external_apps_service_delete"
|
|
5839
|
+
];
|
|
5840
|
+
var CLIENT_ROTATION_OPS = ["external_apps_service_rotate_key"];
|
|
5841
|
+
var PEER_STATUS_OPS = ["external_apps_service_status"];
|
|
5842
|
+
function has(operationId) {
|
|
5843
|
+
return Object.prototype.hasOwnProperty.call(ROUTES, operationId);
|
|
5844
|
+
}
|
|
5845
|
+
function capabilityFrom(operationIds, reasonWhenMissing) {
|
|
5846
|
+
const present = operationIds.filter(has);
|
|
5847
|
+
if (present.length === operationIds.length) {
|
|
5848
|
+
return { supported: true, operations: present };
|
|
5849
|
+
}
|
|
5850
|
+
const missing = operationIds.filter((id) => !present.includes(id));
|
|
5851
|
+
return {
|
|
5852
|
+
supported: false,
|
|
5853
|
+
operations: present,
|
|
5854
|
+
reason: `${reasonWhenMissing} Fehlend im Vertrag: ${missing.join(", ")}.`
|
|
5855
|
+
};
|
|
5856
|
+
}
|
|
5857
|
+
function capabilityFromPrefix(prefix, reasonWhenMissing) {
|
|
5858
|
+
const present = Object.keys(ROUTES).filter((id) => id.startsWith(prefix));
|
|
5859
|
+
return present.length > 0 ? { supported: true, operations: present } : { supported: false, operations: [], reason: reasonWhenMissing };
|
|
5860
|
+
}
|
|
5861
|
+
function shopCapabilities() {
|
|
5862
|
+
const operationIds = Object.keys(ROUTES);
|
|
5863
|
+
const authChannels = {};
|
|
5864
|
+
for (const id of operationIds) {
|
|
5865
|
+
const channel = ROUTES[id]?.auth?.type ?? "none";
|
|
5866
|
+
authChannels[channel] = (authChannels[channel] ?? 0) + 1;
|
|
5867
|
+
}
|
|
5868
|
+
return {
|
|
5869
|
+
service: "node-shop",
|
|
5870
|
+
sdkVersion: SDK_VERSION2,
|
|
5871
|
+
contractSha256: CONTRACT_SHA256,
|
|
5872
|
+
operationCount: operationIds.length,
|
|
5873
|
+
authChannels,
|
|
5874
|
+
capabilities: {
|
|
5875
|
+
// Der Endpunkt beschreibt den Vertrag und kann deshalb nicht in ihm stehen. Er
|
|
5876
|
+
// gehoert zur Zusage dieses SDK und wird von `diagnoseShop` live geprueft.
|
|
5877
|
+
contractFingerprint: { supported: true, operations: [] },
|
|
5878
|
+
healthCheck: capabilityFrom(
|
|
5879
|
+
["app_info_health"],
|
|
5880
|
+
"Ohne Erreichbarkeits-Endpunkt bleibt nur der Umweg ueber eine echte Anfrage."
|
|
5881
|
+
),
|
|
5882
|
+
clientManagement: capabilityFrom(
|
|
5883
|
+
CLIENT_MANAGEMENT_OPS,
|
|
5884
|
+
"Ohne diese Routen kann ein Verwalter keine Anbindung fuer andere Apps einrichten."
|
|
5885
|
+
),
|
|
5886
|
+
clientRotation: capabilityFrom(
|
|
5887
|
+
CLIENT_ROTATION_OPS,
|
|
5888
|
+
"Ohne Erneuerung ist ein einmal ausgegebener Schluessel dauerhaft."
|
|
5889
|
+
),
|
|
5890
|
+
// Anders als bei orvello haengt die Gnadenfrist nicht an eigenen Routen, sondern am
|
|
5891
|
+
// Feld `gracePeriodHours` derselben Rotation: der alte Schluessel bleibt so lange
|
|
5892
|
+
// gueltig und laeuft dann von selbst ab. Das ist eine Zusage des Vertrags, aber
|
|
5893
|
+
// keine, die sich anhand einer Operation belegen laesst — deshalb steht als Beleg
|
|
5894
|
+
// die Rotation selbst und nicht eine erfundene zweite Operation.
|
|
5895
|
+
rotationGracePeriod: has("external_apps_service_rotate_key") ? { supported: true, operations: CLIENT_ROTATION_OPS } : {
|
|
5896
|
+
supported: false,
|
|
5897
|
+
operations: [],
|
|
5898
|
+
reason: "Ohne Rotation gibt es auch keine Gnadenfrist."
|
|
5899
|
+
},
|
|
5900
|
+
clientRevocation: {
|
|
5901
|
+
supported: false,
|
|
5902
|
+
operations: [],
|
|
5903
|
+
reason: "node-shop kennt keinen eigenen Widerruf. Ein Zugang wird entzogen, indem die App auf `isActive: false` gesetzt (external_apps_service_update) oder geloescht wird (external_apps_service_delete) \u2014 das erste ist reversibel, das zweite endgueltig. Ein Verwalter, der nur den Schluessel ungueltig machen will, ohne die Anbindung anzufassen, hat dafuer heute keine Operation."
|
|
5904
|
+
},
|
|
5905
|
+
peerStatus: capabilityFrom(
|
|
5906
|
+
PEER_STATUS_OPS,
|
|
5907
|
+
"Ohne Statusroute kann ein Verwalter nur raten, was der Shop ueber die App fuehrt."
|
|
5908
|
+
),
|
|
5909
|
+
entitlements: capabilityFromPrefix(
|
|
5910
|
+
"entitlements_",
|
|
5911
|
+
"Dieser Vertrag kennt keine Berechtigungs-Routen."
|
|
5912
|
+
),
|
|
5913
|
+
commerce: capabilityFromPrefix(
|
|
5914
|
+
"b2b_",
|
|
5915
|
+
"Dieser Vertrag kennt keine B2B-Routen \u2014 fremde Apps koennen darueber nichts verkaufen."
|
|
5916
|
+
),
|
|
5917
|
+
usageMetering: capabilityFromPrefix(
|
|
5918
|
+
"usage_reports_",
|
|
5919
|
+
"Dieser Vertrag kennt keine Verbrauchs-Routen."
|
|
5920
|
+
),
|
|
5921
|
+
serverSideDryRun: {
|
|
5922
|
+
supported: false,
|
|
5923
|
+
operations: [],
|
|
5924
|
+
reason: "node-shop bietet keinen serverseitigen Probelauf an. Nebenwirkungsfrei pruefbar ist der Weg trotzdem: `diagnoseShop` beweist Erreichbarkeit und Vertrag ohne zu schreiben, und `external_apps_service_status` beweist, was der Shop ueber die App fuehrt \u2014 beides beweist die Voraussetzung, nicht das Ergebnis."
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
};
|
|
5928
|
+
}
|
|
5929
|
+
|
|
5832
5930
|
exports.CONTRACT_SHA256 = CONTRACT_SHA256;
|
|
5833
5931
|
exports.SHOP_API_URL = SHOP_API_URL;
|
|
5834
5932
|
exports.ShopApiError = ShopApiError;
|
|
@@ -5885,5 +5983,6 @@ exports.apiRoutes_variant_entitlements = apiRoutes_variant_entitlements;
|
|
|
5885
5983
|
exports.apiRoutes_webhooks = apiRoutes_webhooks;
|
|
5886
5984
|
exports.createShopClient = createShopClient;
|
|
5887
5985
|
exports.diagnoseShop = diagnoseShop;
|
|
5986
|
+
exports.shopCapabilities = shopCapabilities;
|
|
5888
5987
|
//# sourceMappingURL=index.cjs.map
|
|
5889
5988
|
//# sourceMappingURL=index.cjs.map
|