@cronvello/shop-sdk 0.2.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.
- package/CONTRACT_SHA256 +1 -1
- package/dist/browser.cjs +17 -4
- 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 +17 -4
- package/dist/browser.js.map +1 -1
- package/dist/contract.cjs +15 -2
- 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 +15 -2
- package/dist/contract.js.map +1 -1
- package/dist/{error-C5_qRXMp.d.cts → error-1WqH-FhJ.d.cts} +2 -2
- package/dist/{error-Do0kyiZ6.d.ts → error-D3Jrcd-j.d.ts} +2 -2
- package/dist/{index-CIpUb0vL.d.cts → index-DC6jGVkP.d.cts} +85 -5
- package/dist/{index-CIpUb0vL.d.ts → index-DC6jGVkP.d.ts} +85 -5
- package/dist/index.cjs +17 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/dist/openapi.json +193 -3
- package/dist/server.cjs +17 -4
- 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 +17 -4
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/openapi.json
CHANGED
|
@@ -30672,6 +30672,141 @@
|
|
|
30672
30672
|
"x-transport": "https"
|
|
30673
30673
|
}
|
|
30674
30674
|
},
|
|
30675
|
+
"/external-apps/service/rotate-key/:appId": {
|
|
30676
|
+
"post": {
|
|
30677
|
+
"operationId": "external_apps_service_rotate_key",
|
|
30678
|
+
"tags": [
|
|
30679
|
+
"external-apps"
|
|
30680
|
+
],
|
|
30681
|
+
"summary": "Rotate external app api key (B2B zero-downtime)",
|
|
30682
|
+
"description": "Rotates the API key of an external app. The previous key remains valid during the specified gracePeriodHours (default: 2h) to prevent downtime during deployments. Authenticated via backend-to-backend API key.",
|
|
30683
|
+
"responses": {
|
|
30684
|
+
"200": {
|
|
30685
|
+
"description": "JSON response",
|
|
30686
|
+
"content": {
|
|
30687
|
+
"application/json": {
|
|
30688
|
+
"schema": {
|
|
30689
|
+
"type": "object",
|
|
30690
|
+
"properties": {
|
|
30691
|
+
"success": {
|
|
30692
|
+
"type": "boolean"
|
|
30693
|
+
},
|
|
30694
|
+
"message": {
|
|
30695
|
+
"anyOf": [
|
|
30696
|
+
{
|
|
30697
|
+
"type": "string"
|
|
30698
|
+
},
|
|
30699
|
+
{
|
|
30700
|
+
"type": "null"
|
|
30701
|
+
}
|
|
30702
|
+
]
|
|
30703
|
+
},
|
|
30704
|
+
"data": {
|
|
30705
|
+
"anyOf": [
|
|
30706
|
+
{
|
|
30707
|
+
"type": "object",
|
|
30708
|
+
"properties": {
|
|
30709
|
+
"appId": {
|
|
30710
|
+
"type": "string"
|
|
30711
|
+
},
|
|
30712
|
+
"name": {
|
|
30713
|
+
"type": "string"
|
|
30714
|
+
},
|
|
30715
|
+
"newApiKey": {
|
|
30716
|
+
"type": "string"
|
|
30717
|
+
},
|
|
30718
|
+
"previousApiKeyMasked": {
|
|
30719
|
+
"anyOf": [
|
|
30720
|
+
{
|
|
30721
|
+
"type": "string"
|
|
30722
|
+
},
|
|
30723
|
+
{
|
|
30724
|
+
"type": "null"
|
|
30725
|
+
}
|
|
30726
|
+
]
|
|
30727
|
+
},
|
|
30728
|
+
"previousApiKeyExpiresAt": {
|
|
30729
|
+
"anyOf": [
|
|
30730
|
+
{
|
|
30731
|
+
"type": "string"
|
|
30732
|
+
},
|
|
30733
|
+
{
|
|
30734
|
+
"type": "null"
|
|
30735
|
+
}
|
|
30736
|
+
]
|
|
30737
|
+
},
|
|
30738
|
+
"gracePeriodHours": {
|
|
30739
|
+
"type": "number"
|
|
30740
|
+
}
|
|
30741
|
+
},
|
|
30742
|
+
"required": [
|
|
30743
|
+
"appId",
|
|
30744
|
+
"name",
|
|
30745
|
+
"newApiKey",
|
|
30746
|
+
"previousApiKeyMasked",
|
|
30747
|
+
"previousApiKeyExpiresAt",
|
|
30748
|
+
"gracePeriodHours"
|
|
30749
|
+
],
|
|
30750
|
+
"additionalProperties": false
|
|
30751
|
+
},
|
|
30752
|
+
{
|
|
30753
|
+
"type": "null"
|
|
30754
|
+
}
|
|
30755
|
+
]
|
|
30756
|
+
}
|
|
30757
|
+
},
|
|
30758
|
+
"required": [
|
|
30759
|
+
"success",
|
|
30760
|
+
"data"
|
|
30761
|
+
],
|
|
30762
|
+
"additionalProperties": false
|
|
30763
|
+
}
|
|
30764
|
+
}
|
|
30765
|
+
}
|
|
30766
|
+
}
|
|
30767
|
+
},
|
|
30768
|
+
"parameters": [
|
|
30769
|
+
{
|
|
30770
|
+
"name": "appId",
|
|
30771
|
+
"in": "path",
|
|
30772
|
+
"required": true,
|
|
30773
|
+
"schema": {
|
|
30774
|
+
"type": "string",
|
|
30775
|
+
"minLength": 1
|
|
30776
|
+
}
|
|
30777
|
+
}
|
|
30778
|
+
],
|
|
30779
|
+
"requestBody": {
|
|
30780
|
+
"required": true,
|
|
30781
|
+
"content": {
|
|
30782
|
+
"application/json": {
|
|
30783
|
+
"schema": {
|
|
30784
|
+
"type": "object",
|
|
30785
|
+
"properties": {
|
|
30786
|
+
"newApiKey": {
|
|
30787
|
+
"type": "string",
|
|
30788
|
+
"minLength": 8
|
|
30789
|
+
},
|
|
30790
|
+
"gracePeriodHours": {
|
|
30791
|
+
"type": "number",
|
|
30792
|
+
"minimum": 0.1,
|
|
30793
|
+
"maximum": 168,
|
|
30794
|
+
"default": 2
|
|
30795
|
+
}
|
|
30796
|
+
},
|
|
30797
|
+
"additionalProperties": false
|
|
30798
|
+
}
|
|
30799
|
+
}
|
|
30800
|
+
}
|
|
30801
|
+
},
|
|
30802
|
+
"security": [
|
|
30803
|
+
{
|
|
30804
|
+
"xApiKey": []
|
|
30805
|
+
}
|
|
30806
|
+
],
|
|
30807
|
+
"x-transport": "https"
|
|
30808
|
+
}
|
|
30809
|
+
},
|
|
30675
30810
|
"/external-apps/service/delete/:appId": {
|
|
30676
30811
|
"delete": {
|
|
30677
30812
|
"operationId": "external_apps_service_delete",
|
|
@@ -30748,7 +30883,7 @@
|
|
|
30748
30883
|
"external-apps"
|
|
30749
30884
|
],
|
|
30750
30885
|
"summary": "Get external app registration status (B2B)",
|
|
30751
|
-
"description": "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections.",
|
|
30886
|
+
"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.",
|
|
30752
30887
|
"responses": {
|
|
30753
30888
|
"200": {
|
|
30754
30889
|
"description": "JSON response",
|
|
@@ -30803,6 +30938,56 @@
|
|
|
30803
30938
|
"type": "null"
|
|
30804
30939
|
}
|
|
30805
30940
|
]
|
|
30941
|
+
},
|
|
30942
|
+
"authMethod": {
|
|
30943
|
+
"anyOf": [
|
|
30944
|
+
{
|
|
30945
|
+
"type": "string"
|
|
30946
|
+
},
|
|
30947
|
+
{
|
|
30948
|
+
"type": "null"
|
|
30949
|
+
}
|
|
30950
|
+
]
|
|
30951
|
+
},
|
|
30952
|
+
"oauthClientId": {
|
|
30953
|
+
"anyOf": [
|
|
30954
|
+
{
|
|
30955
|
+
"type": "string"
|
|
30956
|
+
},
|
|
30957
|
+
{
|
|
30958
|
+
"type": "null"
|
|
30959
|
+
}
|
|
30960
|
+
]
|
|
30961
|
+
},
|
|
30962
|
+
"oauthClientSecretFingerprint": {
|
|
30963
|
+
"anyOf": [
|
|
30964
|
+
{
|
|
30965
|
+
"type": "string"
|
|
30966
|
+
},
|
|
30967
|
+
{
|
|
30968
|
+
"type": "null"
|
|
30969
|
+
}
|
|
30970
|
+
]
|
|
30971
|
+
},
|
|
30972
|
+
"entitlementPath": {
|
|
30973
|
+
"anyOf": [
|
|
30974
|
+
{
|
|
30975
|
+
"type": "string"
|
|
30976
|
+
},
|
|
30977
|
+
{
|
|
30978
|
+
"type": "null"
|
|
30979
|
+
}
|
|
30980
|
+
]
|
|
30981
|
+
},
|
|
30982
|
+
"usageOveragePath": {
|
|
30983
|
+
"anyOf": [
|
|
30984
|
+
{
|
|
30985
|
+
"type": "string"
|
|
30986
|
+
},
|
|
30987
|
+
{
|
|
30988
|
+
"type": "null"
|
|
30989
|
+
}
|
|
30990
|
+
]
|
|
30806
30991
|
}
|
|
30807
30992
|
},
|
|
30808
30993
|
"required": [
|
|
@@ -30810,7 +30995,12 @@
|
|
|
30810
30995
|
"isActive",
|
|
30811
30996
|
"isLive",
|
|
30812
30997
|
"lastFetchedAt",
|
|
30813
|
-
"lastFetchSuccess"
|
|
30998
|
+
"lastFetchSuccess",
|
|
30999
|
+
"authMethod",
|
|
31000
|
+
"oauthClientId",
|
|
31001
|
+
"oauthClientSecretFingerprint",
|
|
31002
|
+
"entitlementPath",
|
|
31003
|
+
"usageOveragePath"
|
|
30814
31004
|
],
|
|
30815
31005
|
"additionalProperties": false
|
|
30816
31006
|
},
|
|
@@ -37402,7 +37592,7 @@
|
|
|
37402
37592
|
"b2b"
|
|
37403
37593
|
],
|
|
37404
37594
|
"summary": "Create B2B dynamic checkout session",
|
|
37405
|
-
"description": "Creates a Stripe checkout session with dynamic price_data for trusted external apps. Supports mixed carts (one-time + recurring). Auth: Bearer BACKEND_TO_BACKEND_API_KEY.",
|
|
37595
|
+
"description": "Creates a Stripe checkout session with dynamic price_data for trusted external apps. Supports mixed carts (one-time + recurring). Auth: Bearer BACKEND_TO_BACKEND_API_KEY or App-Scoped API Key.",
|
|
37406
37596
|
"responses": {
|
|
37407
37597
|
"200": {
|
|
37408
37598
|
"description": "JSON response",
|
package/dist/server.cjs
CHANGED
|
@@ -498,7 +498,7 @@ var apiRoutes_b2b = {
|
|
|
498
498
|
meta: {
|
|
499
499
|
tags: ["b2b"],
|
|
500
500
|
summary: "Create B2B dynamic checkout session",
|
|
501
|
-
description: "Creates a Stripe checkout session with dynamic price_data for trusted external apps. Supports mixed carts (one-time + recurring). Auth: Bearer BACKEND_TO_BACKEND_API_KEY.",
|
|
501
|
+
description: "Creates a Stripe checkout session with dynamic price_data for trusted external apps. Supports mixed carts (one-time + recurring). Auth: Bearer BACKEND_TO_BACKEND_API_KEY or App-Scoped API Key.",
|
|
502
502
|
bodyContentType: "application/json",
|
|
503
503
|
validated: { "params": false, "query": false, "body": true }
|
|
504
504
|
},
|
|
@@ -1710,6 +1710,19 @@ var apiRoutes_external_apps = {
|
|
|
1710
1710
|
},
|
|
1711
1711
|
types: null
|
|
1712
1712
|
},
|
|
1713
|
+
"external_apps_service_rotate_key": {
|
|
1714
|
+
method: "POST",
|
|
1715
|
+
path: "/external-apps/service/rotate-key/:appId",
|
|
1716
|
+
auth: { "type": "x_api_key_https" },
|
|
1717
|
+
meta: {
|
|
1718
|
+
tags: ["external-apps"],
|
|
1719
|
+
summary: "Rotate external app api key (B2B zero-downtime)",
|
|
1720
|
+
description: "Rotates the API key of an external app. The previous key remains valid during the specified gracePeriodHours (default: 2h) to prevent downtime during deployments. Authenticated via backend-to-backend API key.",
|
|
1721
|
+
bodyContentType: "application/json",
|
|
1722
|
+
validated: { "params": true, "query": true, "body": true }
|
|
1723
|
+
},
|
|
1724
|
+
types: null
|
|
1725
|
+
},
|
|
1713
1726
|
"external_apps_service_delete": {
|
|
1714
1727
|
method: "DELETE",
|
|
1715
1728
|
path: "/external-apps/service/delete/:appId",
|
|
@@ -1729,7 +1742,7 @@ var apiRoutes_external_apps = {
|
|
|
1729
1742
|
meta: {
|
|
1730
1743
|
tags: ["external-apps"],
|
|
1731
1744
|
summary: "Get external app registration status (B2B)",
|
|
1732
|
-
description: "Returns registration status for an app identified by its string appId. Used by AMP to discover existing connections."
|
|
1745
|
+
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."
|
|
1733
1746
|
},
|
|
1734
1747
|
types: null
|
|
1735
1748
|
},
|
|
@@ -5372,10 +5385,10 @@ function createShopClient(options = {}) {
|
|
|
5372
5385
|
}
|
|
5373
5386
|
|
|
5374
5387
|
// src/contract-hash.ts
|
|
5375
|
-
var CONTRACT_SHA256 = "
|
|
5388
|
+
var CONTRACT_SHA256 = "05f34929e71fb2fcb3a4c04707facca22ee46f8960a4cc47ce0a3f1a6df36056";
|
|
5376
5389
|
|
|
5377
5390
|
// src/client/diagnose.ts
|
|
5378
|
-
var SDK_VERSION = "0.2.
|
|
5391
|
+
var SDK_VERSION = "0.2.2" ;
|
|
5379
5392
|
async function resolveBaseUrl(options) {
|
|
5380
5393
|
const provider = options.client?.baseUrl ?? options.baseUrl ?? SHOP_API_URL;
|
|
5381
5394
|
const value = typeof provider === "function" ? await provider() : provider;
|