@pymthouse/builder-sdk 0.4.1-rc.2 → 0.4.1
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/README.md +10 -10
- package/dist/env.cjs +4 -13
- package/dist/env.cjs.map +1 -1
- package/dist/env.js +4 -13
- package/dist/env.js.map +1 -1
- package/dist/{index-B0ryx942.d.cts → index-D5wdxNYy.d.cts} +1 -1
- package/dist/{index-CvV5syf_.d.ts → index-DFJ6qcK0.d.ts} +1 -1
- package/dist/index.cjs +4 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -13
- package/dist/index.js.map +1 -1
- package/dist/{proxy-JrT6raU_.d.cts → proxy-0wa8QZIU.d.cts} +16 -2
- package/dist/{proxy-U32DFNuj.d.ts → proxy-KrA1vEmh.d.ts} +16 -2
- package/dist/signer/server.cjs +89 -72
- package/dist/signer/server.cjs.map +1 -1
- package/dist/signer/server.d.cts +2 -2
- package/dist/signer/server.d.ts +2 -2
- package/dist/signer/server.js +89 -72
- package/dist/signer/server.js.map +1 -1
- package/dist/signer/webhook/adapters/api-key.cjs +1 -1
- package/dist/signer/webhook/adapters/api-key.cjs.map +1 -1
- package/dist/signer/webhook/adapters/api-key.d.cts +1 -1
- package/dist/signer/webhook/adapters/api-key.d.ts +1 -1
- package/dist/signer/webhook/adapters/api-key.js +1 -1
- package/dist/signer/webhook/adapters/api-key.js.map +1 -1
- package/dist/signer/webhook/adapters/composite.cjs +1 -1
- package/dist/signer/webhook/adapters/composite.cjs.map +1 -1
- package/dist/signer/webhook/adapters/composite.d.cts +1 -1
- package/dist/signer/webhook/adapters/composite.d.ts +1 -1
- package/dist/signer/webhook/adapters/composite.js +1 -1
- package/dist/signer/webhook/adapters/composite.js.map +1 -1
- package/dist/signer/webhook/adapters/oidc.cjs +6 -3
- package/dist/signer/webhook/adapters/oidc.cjs.map +1 -1
- package/dist/signer/webhook/adapters/oidc.d.cts +2 -2
- package/dist/signer/webhook/adapters/oidc.d.ts +2 -2
- package/dist/signer/webhook/adapters/oidc.js +6 -3
- package/dist/signer/webhook/adapters/oidc.js.map +1 -1
- package/dist/signer/webhook/adapters/trusted-headers.cjs +1 -1
- package/dist/signer/webhook/adapters/trusted-headers.cjs.map +1 -1
- package/dist/signer/webhook/adapters/trusted-headers.d.cts +1 -1
- package/dist/signer/webhook/adapters/trusted-headers.d.ts +1 -1
- package/dist/signer/webhook/adapters/trusted-headers.js +1 -1
- package/dist/signer/webhook/adapters/trusted-headers.js.map +1 -1
- package/dist/signer/webhook.cjs +7 -71
- package/dist/signer/webhook.cjs.map +1 -1
- package/dist/signer/webhook.d.cts +5 -14
- package/dist/signer/webhook.d.ts +5 -14
- package/dist/signer/webhook.js +8 -70
- package/dist/signer/webhook.js.map +1 -1
- package/dist/{verifier-B-WFDMz6.d.cts → verifier-Be9WAjFF.d.cts} +3 -2
- package/dist/{verifier-B-WFDMz6.d.ts → verifier-Be9WAjFF.d.ts} +3 -2
- package/package.json +2 -8
- package/dist/signer/webhook/adapters/oauth1.cjs +0 -18
- package/dist/signer/webhook/adapters/oauth1.cjs.map +0 -1
- package/dist/signer/webhook/adapters/oauth1.d.cts +0 -19
- package/dist/signer/webhook/adapters/oauth1.d.ts +0 -19
- package/dist/signer/webhook/adapters/oauth1.js +0 -16
- package/dist/signer/webhook/adapters/oauth1.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { NETWORK_USD_PER_MICRO, applyRetailRateToNetworkMicros, defaultRetailRateUsd, markupPercentToRetailRateUsd, parseMarkupPercentInput, parseRetailRateUsd, retailRateUsdPerMillion, retailRateUsdToMarkupPercent } from './plan-pricing.cjs';
|
|
2
2
|
import { S as SignedTicketIngestInput, F as FetchLike, f as SignedTicketIngestResult, r as UsageByUserRow, s as UsageForExternalUser, e as UsageApiResponse, n as MeScopeUsagePayload, t as UsageByPipelineModelRow, u as UsageByPipelineModelFiatRow, O as OidcDiscoveryDocument, v as AppManifestResponse } from './types-BORaHW_x.cjs';
|
|
3
3
|
export { w as AllowancePolicy, x as AppManifestCapability, A as AppUserRecord, q as ApproveDeviceLoginInput, B as BillingProduct, y as BillingSyncState, z as BillingSyncStatus, E as CapabilityPriceRule, C as ClientCredentialsTokenResponse, D as DeviceApprovalInput, o as GetAppManifestResult, G as GetDiscoveryOptions, l as GrantSource, L as ListBillingProductsResult, p as MintSignerSessionForExternalUserInput, M as MintUserAccessTokenInput, b as MintUserAccessTokenResponse, c as MintUserSignerSessionTokenInput, a as ParsedDeviceApprovalRedirect, h as PlanSyncResult, P as PmtHouseClientOptions, H as SignerRoutingConfig, g as SignerRoutingResponse, T as TokenExchangeResponse, U as UpsertAppUserInput, i as UsageBalanceResponse, I as UsageDailyPipelineRow, d as UsageQueryInput, J as UsageTotals, k as UserAllowanceGrantInput, j as UserAllowancesResponse, K as UserCreditGrantInput, N as UserCreditsResponse, m as UserSubscriptionResponse } from './types-BORaHW_x.cjs';
|
|
4
|
-
import { S as SignerUsageSnapshot } from './proxy-
|
|
4
|
+
import { S as SignerUsageSnapshot } from './proxy-0wa8QZIU.cjs';
|
|
5
5
|
export { P as PmtHouseClient, b as buildDeviceCodeResource, n as normalizeUserCode } from './client-D1Xz-xlx.cjs';
|
|
6
6
|
export { PYMTHOUSE_NOT_CONFIGURED_MESSAGE, getBuilderApiV1BaseFromIssuerUrl, getPymthouseIssuerOrigin, getPymthouseIssuerUrlFromEnv, getPymthousePublicClientIdFromEnv, isPymthouseConfigured, readPymthouseEnv } from './config.cjs';
|
|
7
7
|
import { AuthorizationServer } from 'oauth4webapi';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { NETWORK_USD_PER_MICRO, applyRetailRateToNetworkMicros, defaultRetailRateUsd, markupPercentToRetailRateUsd, parseMarkupPercentInput, parseRetailRateUsd, retailRateUsdPerMillion, retailRateUsdToMarkupPercent } from './plan-pricing.js';
|
|
2
2
|
import { S as SignedTicketIngestInput, F as FetchLike, f as SignedTicketIngestResult, r as UsageByUserRow, s as UsageForExternalUser, e as UsageApiResponse, n as MeScopeUsagePayload, t as UsageByPipelineModelRow, u as UsageByPipelineModelFiatRow, O as OidcDiscoveryDocument, v as AppManifestResponse } from './types-BORaHW_x.js';
|
|
3
3
|
export { w as AllowancePolicy, x as AppManifestCapability, A as AppUserRecord, q as ApproveDeviceLoginInput, B as BillingProduct, y as BillingSyncState, z as BillingSyncStatus, E as CapabilityPriceRule, C as ClientCredentialsTokenResponse, D as DeviceApprovalInput, o as GetAppManifestResult, G as GetDiscoveryOptions, l as GrantSource, L as ListBillingProductsResult, p as MintSignerSessionForExternalUserInput, M as MintUserAccessTokenInput, b as MintUserAccessTokenResponse, c as MintUserSignerSessionTokenInput, a as ParsedDeviceApprovalRedirect, h as PlanSyncResult, P as PmtHouseClientOptions, H as SignerRoutingConfig, g as SignerRoutingResponse, T as TokenExchangeResponse, U as UpsertAppUserInput, i as UsageBalanceResponse, I as UsageDailyPipelineRow, d as UsageQueryInput, J as UsageTotals, k as UserAllowanceGrantInput, j as UserAllowancesResponse, K as UserCreditGrantInput, N as UserCreditsResponse, m as UserSubscriptionResponse } from './types-BORaHW_x.js';
|
|
4
|
-
import { S as SignerUsageSnapshot } from './proxy-
|
|
4
|
+
import { S as SignerUsageSnapshot } from './proxy-KrA1vEmh.js';
|
|
5
5
|
export { P as PmtHouseClient, b as buildDeviceCodeResource, n as normalizeUserCode } from './client-CauCfGa7.js';
|
|
6
6
|
export { PYMTHOUSE_NOT_CONFIGURED_MESSAGE, getBuilderApiV1BaseFromIssuerUrl, getPymthouseIssuerOrigin, getPymthouseIssuerUrlFromEnv, getPymthousePublicClientIdFromEnv, isPymthouseConfigured, readPymthouseEnv } from './config.js';
|
|
7
7
|
import { AuthorizationServer } from 'oauth4webapi';
|
package/dist/index.js
CHANGED
|
@@ -242,14 +242,8 @@ var init_fetch_json = __esm({
|
|
|
242
242
|
});
|
|
243
243
|
|
|
244
244
|
// src/signer/handler-errors.ts
|
|
245
|
-
function isPmtHouseError(error) {
|
|
246
|
-
if (error instanceof PmtHouseError) {
|
|
247
|
-
return true;
|
|
248
|
-
}
|
|
249
|
-
return error instanceof Error && typeof error.status === "number" && typeof error.code === "string";
|
|
250
|
-
}
|
|
251
245
|
function signerHandlerErrorResponse(error) {
|
|
252
|
-
if (
|
|
246
|
+
if (error instanceof PmtHouseError) {
|
|
253
247
|
return new Response(
|
|
254
248
|
JSON.stringify({
|
|
255
249
|
error: error.code,
|
|
@@ -302,9 +296,6 @@ var init_json_fields = __esm({
|
|
|
302
296
|
});
|
|
303
297
|
|
|
304
298
|
// src/signer/mint-token.ts
|
|
305
|
-
function signerJwtAudience(issuerUrl) {
|
|
306
|
-
return stripTrailingSlashes(issuerUrl);
|
|
307
|
-
}
|
|
308
299
|
function parseMintUserSignerTokenResponse(body, ttlRefreshRatio = DEFAULT_TTL_REFRESH_RATIO) {
|
|
309
300
|
const accessToken = readStringField(body, "access_token", TOKEN_RESPONSE_ERROR, "Token response");
|
|
310
301
|
const expiresIn = readExpiresIn(body, TOKEN_RESPONSE_ERROR);
|
|
@@ -331,11 +322,11 @@ function parseMintUserSignerTokenResponse(body, ttlRefreshRatio = DEFAULT_TTL_RE
|
|
|
331
322
|
lifetimeGrantedUsdMicros
|
|
332
323
|
};
|
|
333
324
|
}
|
|
334
|
-
var DEFAULT_TTL_REFRESH_RATIO, TOKEN_RESPONSE_ERROR;
|
|
325
|
+
var LIVEPEER_REMOTE_SIGNER_AUDIENCE, DEFAULT_TTL_REFRESH_RATIO, TOKEN_RESPONSE_ERROR;
|
|
335
326
|
var init_mint_token = __esm({
|
|
336
327
|
"src/signer/mint-token.ts"() {
|
|
337
|
-
init_string_utils();
|
|
338
328
|
init_json_fields();
|
|
329
|
+
LIVEPEER_REMOTE_SIGNER_AUDIENCE = "livepeer-remote-signer";
|
|
339
330
|
DEFAULT_TTL_REFRESH_RATIO = 0.8;
|
|
340
331
|
TOKEN_RESPONSE_ERROR = "invalid_token_response";
|
|
341
332
|
}
|
|
@@ -402,7 +393,7 @@ async function mintSignerTokenFromDeviceToken(options) {
|
|
|
402
393
|
code: "oidc_discovery_invalid"
|
|
403
394
|
});
|
|
404
395
|
}
|
|
405
|
-
const audience = options.audience?.trim() ||
|
|
396
|
+
const audience = options.audience?.trim() || LIVEPEER_REMOTE_SIGNER_AUDIENCE;
|
|
406
397
|
const params = new URLSearchParams({
|
|
407
398
|
grant_type: TOKEN_EXCHANGE_GRANT,
|
|
408
399
|
subject_token: options.deviceToken,
|