@medialane/sdk 0.98.0 → 0.99.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/index.cjs +18 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/{services-BcckoQHb.d.ts → services-6lZz3hUV.d.ts} +0 -1
- package/dist/{services-DkdQoHIr.d.cts → services-CRckcKEc.d.cts} +0 -1
- package/dist/starknet/index.cjs +10 -23
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +6 -7
- package/dist/starknet/index.d.ts +6 -7
- package/dist/starknet/index.js +10 -22
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ResolvedFeeConfig, S as ServiceDefinition, a as ServiceCapability } from './services-
|
|
2
|
-
export { A as AcceptSponsorshipBidIntentParams, b as AcceptSponsorshipProposalIntentParams, c as ActivityType, d as ApiActivitiesQuery, e as ApiActivity, f as ApiActivityPrice, g as ApiAdminCollectionClaim, h as ApiAppSource, i as ApiBusinessProvisioning, j as ApiChain, k as ApiCheckoutIntentResult, l as ApiClient, m as ApiCoin, n as ApiCoinClaimResult, o as ApiCoinPrice, p as ApiCoinPrices, q as ApiCoinsQuery, r as ApiCollection, s as ApiCollectionClaim, t as ApiCollectionProfile, u as ApiCollectionSlugClaim, v as ApiCollectionsQuery, w as ApiComment, x as ApiCounterOffersQuery, y as ApiCreatorListResult, z as ApiCreatorProfile, B as ApiIntent, C as ApiIntentCreated, D as ApiKeyStatus, E as ApiMeta, F as ApiMetadataSignedUrl, G as ApiMetadataUpload, H as ApiOrder, I as ApiOrderConsideration, J as ApiOrderOffer, K as ApiOrderPrice, L as ApiOrderTokenMeta, M as ApiOrderTxHash, N as ApiOrdersQuery, O as ApiPointEvent, P as ApiPortalKey, Q as ApiPortalKeyCreated, T as ApiPortalMe, U as ApiPublicRemix, V as ApiRemixOffer, W as ApiRemixOfferPrice, X as ApiRemixOffersQuery, Y as ApiResponse, Z as ApiRewardsBadge, _ as ApiRewardsBatchEntry, $ as ApiRewardsConfig, a0 as ApiRewardsLeaderboardEntry, a1 as ApiRewardsLevel, a2 as ApiSearchCollectionResult, a3 as ApiSearchCreatorResult, a4 as ApiSearchResult, a5 as ApiSearchTokenResult, a6 as ApiToken, a7 as ApiTokenBalance, a8 as ApiTokenMetadata, a9 as ApiUsageDay, aa as ApiUserRewards, ab as ApiUserWallet, ac as ApiWalletActivity, ad as ApiWebhookCreated, ae as ApiWebhookEndpoint, af as AutoRemixOfferParams, ag as CancelOrderIntentParams, ah as ChainFilter, ai as CheckoutIntentItem, aj as ClaimConditions, ak as CollectionServiceId, al as CollectionSort, am as CollectionTokensSort, an as ConfirmRemixOfferParams, ao as ConfirmSelfRemixParams, ap as ConsiderationItem, aq as CreateCheckoutIntentParams, ar as CreateCoinIntentParams, as as CreateCollectionIntentParams, at as CreateCounterOfferIntentParams, au as CreateDropParams, av as CreateListingIntentParams, aw as CreateMembershipParams, ax as CreateMintIntentParams, ay as CreatePopCollectionParams, az as CreateRemixOfferParams, aA as CreateSponsorshipOfferIntentParams, aB as CreateSponsorshipOfferParams, aC as CreateSponsorshipProposalIntentParams, aD as CreateTicketParams, aE as CreateTierIntentParams, aF as CreateWebhookParams, aG as DropMintStatus, aH as EnforcementDeclaration, aI as FactoryFamilyServiceId, aJ as FeeConfig, aK as FeeConfigSchema, aL as FulfillOrderIntentParams, aM as IPType, aN as IntentCall, aO as IntentStatus, aP as IntentType, aQ as IpAttribute, aR as IpNftMetadata, aS as LaunchCoinIntentParams, aT as MakeOfferIntentParams, aU as MedialaneApiError, aV as MedialaneConfig, aW as MedialaneErrorCode, aX as MintMembershipsParams, aY as MintTicketsParams, aZ as OPEN_LICENSES, a_ as OfferItem, a$ as OpenLicense, b0 as Order, b1 as OrderDetails, b2 as OrderParameters, b3 as OrderStatus, b4 as PlaceSponsorshipBidIntentParams, b5 as PopBatchEligibilityItem, b6 as PopClaimStatus, b7 as PopEventType, b8 as ProposeSponsorshipParams, b9 as RejectSponsorshipProposalIntentParams, ba as RemixOfferStatus, bb as ResolvedConfig, bc as RetractSponsorshipBidIntentParams, bd as RetryOptions, be as ServiceEventDeclaration, bf as SetSponsorshipOfferOpenIntentParams, bg as SortOrder, bh as TenantPlan, bi as TierServiceId, bj as TxResult, bk as WebhookEventType, bl as WebhookStatus, bm as WithdrawSponsorshipProposalIntentParams, bn as resolveConfig, bo as resolveFeeConfig } from './services-
|
|
1
|
+
import { R as ResolvedFeeConfig, S as ServiceDefinition, a as ServiceCapability } from './services-CRckcKEc.cjs';
|
|
2
|
+
export { A as AcceptSponsorshipBidIntentParams, b as AcceptSponsorshipProposalIntentParams, c as ActivityType, d as ApiActivitiesQuery, e as ApiActivity, f as ApiActivityPrice, g as ApiAdminCollectionClaim, h as ApiAppSource, i as ApiBusinessProvisioning, j as ApiChain, k as ApiCheckoutIntentResult, l as ApiClient, m as ApiCoin, n as ApiCoinClaimResult, o as ApiCoinPrice, p as ApiCoinPrices, q as ApiCoinsQuery, r as ApiCollection, s as ApiCollectionClaim, t as ApiCollectionProfile, u as ApiCollectionSlugClaim, v as ApiCollectionsQuery, w as ApiComment, x as ApiCounterOffersQuery, y as ApiCreatorListResult, z as ApiCreatorProfile, B as ApiIntent, C as ApiIntentCreated, D as ApiKeyStatus, E as ApiMeta, F as ApiMetadataSignedUrl, G as ApiMetadataUpload, H as ApiOrder, I as ApiOrderConsideration, J as ApiOrderOffer, K as ApiOrderPrice, L as ApiOrderTokenMeta, M as ApiOrderTxHash, N as ApiOrdersQuery, O as ApiPointEvent, P as ApiPortalKey, Q as ApiPortalKeyCreated, T as ApiPortalMe, U as ApiPublicRemix, V as ApiRemixOffer, W as ApiRemixOfferPrice, X as ApiRemixOffersQuery, Y as ApiResponse, Z as ApiRewardsBadge, _ as ApiRewardsBatchEntry, $ as ApiRewardsConfig, a0 as ApiRewardsLeaderboardEntry, a1 as ApiRewardsLevel, a2 as ApiSearchCollectionResult, a3 as ApiSearchCreatorResult, a4 as ApiSearchResult, a5 as ApiSearchTokenResult, a6 as ApiToken, a7 as ApiTokenBalance, a8 as ApiTokenMetadata, a9 as ApiUsageDay, aa as ApiUserRewards, ab as ApiUserWallet, ac as ApiWalletActivity, ad as ApiWebhookCreated, ae as ApiWebhookEndpoint, af as AutoRemixOfferParams, ag as CancelOrderIntentParams, ah as ChainFilter, ai as CheckoutIntentItem, aj as ClaimConditions, ak as CollectionServiceId, al as CollectionSort, am as CollectionTokensSort, an as ConfirmRemixOfferParams, ao as ConfirmSelfRemixParams, ap as ConsiderationItem, aq as CreateCheckoutIntentParams, ar as CreateCoinIntentParams, as as CreateCollectionIntentParams, at as CreateCounterOfferIntentParams, au as CreateDropParams, av as CreateListingIntentParams, aw as CreateMembershipParams, ax as CreateMintIntentParams, ay as CreatePopCollectionParams, az as CreateRemixOfferParams, aA as CreateSponsorshipOfferIntentParams, aB as CreateSponsorshipOfferParams, aC as CreateSponsorshipProposalIntentParams, aD as CreateTicketParams, aE as CreateTierIntentParams, aF as CreateWebhookParams, aG as DropMintStatus, aH as EnforcementDeclaration, aI as FactoryFamilyServiceId, aJ as FeeConfig, aK as FeeConfigSchema, aL as FulfillOrderIntentParams, aM as IPType, aN as IntentCall, aO as IntentStatus, aP as IntentType, aQ as IpAttribute, aR as IpNftMetadata, aS as LaunchCoinIntentParams, aT as MakeOfferIntentParams, aU as MedialaneApiError, aV as MedialaneConfig, aW as MedialaneErrorCode, aX as MintMembershipsParams, aY as MintTicketsParams, aZ as OPEN_LICENSES, a_ as OfferItem, a$ as OpenLicense, b0 as Order, b1 as OrderDetails, b2 as OrderParameters, b3 as OrderStatus, b4 as PlaceSponsorshipBidIntentParams, b5 as PopBatchEligibilityItem, b6 as PopClaimStatus, b7 as PopEventType, b8 as ProposeSponsorshipParams, b9 as RejectSponsorshipProposalIntentParams, ba as RemixOfferStatus, bb as ResolvedConfig, bc as RetractSponsorshipBidIntentParams, bd as RetryOptions, be as ServiceEventDeclaration, bf as SetSponsorshipOfferOpenIntentParams, bg as SortOrder, bh as TenantPlan, bi as TierServiceId, bj as TxResult, bk as WebhookEventType, bl as WebhookStatus, bm as WithdrawSponsorshipProposalIntentParams, bn as resolveConfig, bo as resolveFeeConfig } from './services-CRckcKEc.cjs';
|
|
3
3
|
import { C as Chain } from './types-nPIXtCF5.cjs';
|
|
4
4
|
export { A as AdapterTxResult, a as AssetRef, b as CHAINS, c as ChainCoordinates, d as CoordinatesByChain, e as CreateCollectionInput, D as DEFAULT_CHAIN, E as EvmCoordinates, I as IssuanceAdapter, M as MintInput, O as OrderRef, R as RegisterOrderParams, S as SolanaCoordinates, f as StarknetCoordinates, g as StellarCoordinates, V as VenueAdapter, h as getCoordinates, i as getStarknetCoordinates } from './types-nPIXtCF5.cjs';
|
|
5
5
|
import 'zod';
|
|
@@ -432,6 +432,16 @@ interface BackendProxyConfig {
|
|
|
432
432
|
apiKey: string | undefined;
|
|
433
433
|
checkRateLimit: (ip: string) => boolean;
|
|
434
434
|
fetchImpl?: typeof fetch;
|
|
435
|
+
/**
|
|
436
|
+
* Forwards a cookie the app already sets (e.g. its own account-session
|
|
437
|
+
* cookie) as a header, so the backend can attribute cost to the calling
|
|
438
|
+
* end-user instead of only the app's shared API key. Purely additive —
|
|
439
|
+
* omitted when the cookie isn't present, never blocks the request.
|
|
440
|
+
*/
|
|
441
|
+
forwardCookie?: {
|
|
442
|
+
name: string;
|
|
443
|
+
header: string;
|
|
444
|
+
};
|
|
435
445
|
}
|
|
436
446
|
declare function createBackendProxyHandler(config: BackendProxyConfig): (req: Request) => Promise<Response>;
|
|
437
447
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ResolvedFeeConfig, S as ServiceDefinition, a as ServiceCapability } from './services-
|
|
2
|
-
export { A as AcceptSponsorshipBidIntentParams, b as AcceptSponsorshipProposalIntentParams, c as ActivityType, d as ApiActivitiesQuery, e as ApiActivity, f as ApiActivityPrice, g as ApiAdminCollectionClaim, h as ApiAppSource, i as ApiBusinessProvisioning, j as ApiChain, k as ApiCheckoutIntentResult, l as ApiClient, m as ApiCoin, n as ApiCoinClaimResult, o as ApiCoinPrice, p as ApiCoinPrices, q as ApiCoinsQuery, r as ApiCollection, s as ApiCollectionClaim, t as ApiCollectionProfile, u as ApiCollectionSlugClaim, v as ApiCollectionsQuery, w as ApiComment, x as ApiCounterOffersQuery, y as ApiCreatorListResult, z as ApiCreatorProfile, B as ApiIntent, C as ApiIntentCreated, D as ApiKeyStatus, E as ApiMeta, F as ApiMetadataSignedUrl, G as ApiMetadataUpload, H as ApiOrder, I as ApiOrderConsideration, J as ApiOrderOffer, K as ApiOrderPrice, L as ApiOrderTokenMeta, M as ApiOrderTxHash, N as ApiOrdersQuery, O as ApiPointEvent, P as ApiPortalKey, Q as ApiPortalKeyCreated, T as ApiPortalMe, U as ApiPublicRemix, V as ApiRemixOffer, W as ApiRemixOfferPrice, X as ApiRemixOffersQuery, Y as ApiResponse, Z as ApiRewardsBadge, _ as ApiRewardsBatchEntry, $ as ApiRewardsConfig, a0 as ApiRewardsLeaderboardEntry, a1 as ApiRewardsLevel, a2 as ApiSearchCollectionResult, a3 as ApiSearchCreatorResult, a4 as ApiSearchResult, a5 as ApiSearchTokenResult, a6 as ApiToken, a7 as ApiTokenBalance, a8 as ApiTokenMetadata, a9 as ApiUsageDay, aa as ApiUserRewards, ab as ApiUserWallet, ac as ApiWalletActivity, ad as ApiWebhookCreated, ae as ApiWebhookEndpoint, af as AutoRemixOfferParams, ag as CancelOrderIntentParams, ah as ChainFilter, ai as CheckoutIntentItem, aj as ClaimConditions, ak as CollectionServiceId, al as CollectionSort, am as CollectionTokensSort, an as ConfirmRemixOfferParams, ao as ConfirmSelfRemixParams, ap as ConsiderationItem, aq as CreateCheckoutIntentParams, ar as CreateCoinIntentParams, as as CreateCollectionIntentParams, at as CreateCounterOfferIntentParams, au as CreateDropParams, av as CreateListingIntentParams, aw as CreateMembershipParams, ax as CreateMintIntentParams, ay as CreatePopCollectionParams, az as CreateRemixOfferParams, aA as CreateSponsorshipOfferIntentParams, aB as CreateSponsorshipOfferParams, aC as CreateSponsorshipProposalIntentParams, aD as CreateTicketParams, aE as CreateTierIntentParams, aF as CreateWebhookParams, aG as DropMintStatus, aH as EnforcementDeclaration, aI as FactoryFamilyServiceId, aJ as FeeConfig, aK as FeeConfigSchema, aL as FulfillOrderIntentParams, aM as IPType, aN as IntentCall, aO as IntentStatus, aP as IntentType, aQ as IpAttribute, aR as IpNftMetadata, aS as LaunchCoinIntentParams, aT as MakeOfferIntentParams, aU as MedialaneApiError, aV as MedialaneConfig, aW as MedialaneErrorCode, aX as MintMembershipsParams, aY as MintTicketsParams, aZ as OPEN_LICENSES, a_ as OfferItem, a$ as OpenLicense, b0 as Order, b1 as OrderDetails, b2 as OrderParameters, b3 as OrderStatus, b4 as PlaceSponsorshipBidIntentParams, b5 as PopBatchEligibilityItem, b6 as PopClaimStatus, b7 as PopEventType, b8 as ProposeSponsorshipParams, b9 as RejectSponsorshipProposalIntentParams, ba as RemixOfferStatus, bb as ResolvedConfig, bc as RetractSponsorshipBidIntentParams, bd as RetryOptions, be as ServiceEventDeclaration, bf as SetSponsorshipOfferOpenIntentParams, bg as SortOrder, bh as TenantPlan, bi as TierServiceId, bj as TxResult, bk as WebhookEventType, bl as WebhookStatus, bm as WithdrawSponsorshipProposalIntentParams, bn as resolveConfig, bo as resolveFeeConfig } from './services-
|
|
1
|
+
import { R as ResolvedFeeConfig, S as ServiceDefinition, a as ServiceCapability } from './services-6lZz3hUV.js';
|
|
2
|
+
export { A as AcceptSponsorshipBidIntentParams, b as AcceptSponsorshipProposalIntentParams, c as ActivityType, d as ApiActivitiesQuery, e as ApiActivity, f as ApiActivityPrice, g as ApiAdminCollectionClaim, h as ApiAppSource, i as ApiBusinessProvisioning, j as ApiChain, k as ApiCheckoutIntentResult, l as ApiClient, m as ApiCoin, n as ApiCoinClaimResult, o as ApiCoinPrice, p as ApiCoinPrices, q as ApiCoinsQuery, r as ApiCollection, s as ApiCollectionClaim, t as ApiCollectionProfile, u as ApiCollectionSlugClaim, v as ApiCollectionsQuery, w as ApiComment, x as ApiCounterOffersQuery, y as ApiCreatorListResult, z as ApiCreatorProfile, B as ApiIntent, C as ApiIntentCreated, D as ApiKeyStatus, E as ApiMeta, F as ApiMetadataSignedUrl, G as ApiMetadataUpload, H as ApiOrder, I as ApiOrderConsideration, J as ApiOrderOffer, K as ApiOrderPrice, L as ApiOrderTokenMeta, M as ApiOrderTxHash, N as ApiOrdersQuery, O as ApiPointEvent, P as ApiPortalKey, Q as ApiPortalKeyCreated, T as ApiPortalMe, U as ApiPublicRemix, V as ApiRemixOffer, W as ApiRemixOfferPrice, X as ApiRemixOffersQuery, Y as ApiResponse, Z as ApiRewardsBadge, _ as ApiRewardsBatchEntry, $ as ApiRewardsConfig, a0 as ApiRewardsLeaderboardEntry, a1 as ApiRewardsLevel, a2 as ApiSearchCollectionResult, a3 as ApiSearchCreatorResult, a4 as ApiSearchResult, a5 as ApiSearchTokenResult, a6 as ApiToken, a7 as ApiTokenBalance, a8 as ApiTokenMetadata, a9 as ApiUsageDay, aa as ApiUserRewards, ab as ApiUserWallet, ac as ApiWalletActivity, ad as ApiWebhookCreated, ae as ApiWebhookEndpoint, af as AutoRemixOfferParams, ag as CancelOrderIntentParams, ah as ChainFilter, ai as CheckoutIntentItem, aj as ClaimConditions, ak as CollectionServiceId, al as CollectionSort, am as CollectionTokensSort, an as ConfirmRemixOfferParams, ao as ConfirmSelfRemixParams, ap as ConsiderationItem, aq as CreateCheckoutIntentParams, ar as CreateCoinIntentParams, as as CreateCollectionIntentParams, at as CreateCounterOfferIntentParams, au as CreateDropParams, av as CreateListingIntentParams, aw as CreateMembershipParams, ax as CreateMintIntentParams, ay as CreatePopCollectionParams, az as CreateRemixOfferParams, aA as CreateSponsorshipOfferIntentParams, aB as CreateSponsorshipOfferParams, aC as CreateSponsorshipProposalIntentParams, aD as CreateTicketParams, aE as CreateTierIntentParams, aF as CreateWebhookParams, aG as DropMintStatus, aH as EnforcementDeclaration, aI as FactoryFamilyServiceId, aJ as FeeConfig, aK as FeeConfigSchema, aL as FulfillOrderIntentParams, aM as IPType, aN as IntentCall, aO as IntentStatus, aP as IntentType, aQ as IpAttribute, aR as IpNftMetadata, aS as LaunchCoinIntentParams, aT as MakeOfferIntentParams, aU as MedialaneApiError, aV as MedialaneConfig, aW as MedialaneErrorCode, aX as MintMembershipsParams, aY as MintTicketsParams, aZ as OPEN_LICENSES, a_ as OfferItem, a$ as OpenLicense, b0 as Order, b1 as OrderDetails, b2 as OrderParameters, b3 as OrderStatus, b4 as PlaceSponsorshipBidIntentParams, b5 as PopBatchEligibilityItem, b6 as PopClaimStatus, b7 as PopEventType, b8 as ProposeSponsorshipParams, b9 as RejectSponsorshipProposalIntentParams, ba as RemixOfferStatus, bb as ResolvedConfig, bc as RetractSponsorshipBidIntentParams, bd as RetryOptions, be as ServiceEventDeclaration, bf as SetSponsorshipOfferOpenIntentParams, bg as SortOrder, bh as TenantPlan, bi as TierServiceId, bj as TxResult, bk as WebhookEventType, bl as WebhookStatus, bm as WithdrawSponsorshipProposalIntentParams, bn as resolveConfig, bo as resolveFeeConfig } from './services-6lZz3hUV.js';
|
|
3
3
|
import { C as Chain } from './types-nPIXtCF5.js';
|
|
4
4
|
export { A as AdapterTxResult, a as AssetRef, b as CHAINS, c as ChainCoordinates, d as CoordinatesByChain, e as CreateCollectionInput, D as DEFAULT_CHAIN, E as EvmCoordinates, I as IssuanceAdapter, M as MintInput, O as OrderRef, R as RegisterOrderParams, S as SolanaCoordinates, f as StarknetCoordinates, g as StellarCoordinates, V as VenueAdapter, h as getCoordinates, i as getStarknetCoordinates } from './types-nPIXtCF5.js';
|
|
5
5
|
import 'zod';
|
|
@@ -432,6 +432,16 @@ interface BackendProxyConfig {
|
|
|
432
432
|
apiKey: string | undefined;
|
|
433
433
|
checkRateLimit: (ip: string) => boolean;
|
|
434
434
|
fetchImpl?: typeof fetch;
|
|
435
|
+
/**
|
|
436
|
+
* Forwards a cookie the app already sets (e.g. its own account-session
|
|
437
|
+
* cookie) as a header, so the backend can attribute cost to the calling
|
|
438
|
+
* end-user instead of only the app's shared API key. Purely additive —
|
|
439
|
+
* omitted when the cookie isn't present, never blocks the request.
|
|
440
|
+
*/
|
|
441
|
+
forwardCookie?: {
|
|
442
|
+
name: string;
|
|
443
|
+
header: string;
|
|
444
|
+
};
|
|
435
445
|
}
|
|
436
446
|
declare function createBackendProxyHandler(config: BackendProxyConfig): (req: Request) => Promise<Response>;
|
|
437
447
|
|
package/dist/index.js
CHANGED
|
@@ -1211,8 +1211,8 @@ function formatAmount(raw, decimals) {
|
|
|
1211
1211
|
const factor = 10n ** BigInt(decimals);
|
|
1212
1212
|
const whole = value / factor;
|
|
1213
1213
|
const remainder = value % factor;
|
|
1214
|
-
const fractional = remainder.toString().padStart(decimals, "0")
|
|
1215
|
-
return
|
|
1214
|
+
const fractional = remainder.toString().padStart(decimals, "0");
|
|
1215
|
+
return `${whole}.${fractional}`;
|
|
1216
1216
|
}
|
|
1217
1217
|
function getTokenByAddress(address) {
|
|
1218
1218
|
let target = null;
|
|
@@ -1362,6 +1362,16 @@ function isSameOrigin(req) {
|
|
|
1362
1362
|
function proxyError(code, message, status) {
|
|
1363
1363
|
return Response.json({ jsonrpc: "2.0", error: { code, message }, id: null }, { status });
|
|
1364
1364
|
}
|
|
1365
|
+
function readCookie(req, name) {
|
|
1366
|
+
const raw = req.headers.get("cookie");
|
|
1367
|
+
if (!raw) return null;
|
|
1368
|
+
for (const part of raw.split(";")) {
|
|
1369
|
+
const eq = part.indexOf("=");
|
|
1370
|
+
if (eq === -1) continue;
|
|
1371
|
+
if (part.slice(0, eq).trim() === name) return part.slice(eq + 1).trim();
|
|
1372
|
+
}
|
|
1373
|
+
return null;
|
|
1374
|
+
}
|
|
1365
1375
|
function createBackendProxyHandler(config) {
|
|
1366
1376
|
const doFetch = config.fetchImpl ?? fetch;
|
|
1367
1377
|
const endpoint2 = `${config.backendUrl.replace(/\/$/, "")}/${config.path.replace(/^\//, "")}`;
|
|
@@ -1381,10 +1391,15 @@ function createBackendProxyHandler(config) {
|
|
|
1381
1391
|
} catch {
|
|
1382
1392
|
return proxyError(-32700, "Parse error", 400);
|
|
1383
1393
|
}
|
|
1394
|
+
const headers2 = { "Content-Type": "application/json", "x-api-key": config.apiKey };
|
|
1395
|
+
if (config.forwardCookie) {
|
|
1396
|
+
const value = readCookie(req, config.forwardCookie.name);
|
|
1397
|
+
if (value) headers2[config.forwardCookie.header] = value;
|
|
1398
|
+
}
|
|
1384
1399
|
try {
|
|
1385
1400
|
const upstream = await doFetch(endpoint2, {
|
|
1386
1401
|
method: "POST",
|
|
1387
|
-
headers:
|
|
1402
|
+
headers: headers2,
|
|
1388
1403
|
body: JSON.stringify(body)
|
|
1389
1404
|
});
|
|
1390
1405
|
const text = await upstream.text();
|