@paid-ai/paid-node 0.5.0 → 1.0.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/README.md +11 -11
- package/dist/cjs/BaseClient.d.ts +39 -0
- package/dist/cjs/BaseClient.js +62 -0
- package/dist/cjs/Client.d.ts +30 -93
- package/dist/cjs/Client.js +19 -128
- package/dist/cjs/api/errors/BadRequestError.d.ts +2 -5
- package/dist/cjs/api/errors/BadRequestError.js +6 -4
- package/dist/cjs/api/errors/ForbiddenError.d.ts +2 -5
- package/dist/cjs/api/errors/ForbiddenError.js +6 -4
- package/dist/cjs/api/errors/InternalServerError.d.ts +2 -5
- package/dist/cjs/api/errors/InternalServerError.js +6 -4
- package/dist/cjs/api/errors/NotFoundError.d.ts +2 -5
- package/dist/cjs/api/errors/NotFoundError.js +6 -4
- package/dist/cjs/api/errors/index.d.ts +2 -2
- package/dist/cjs/api/errors/index.js +2 -2
- package/dist/cjs/api/index.d.ts +1 -1
- package/dist/cjs/api/index.js +1 -1
- package/dist/cjs/api/resources/agents/client/Client.d.ts +25 -43
- package/dist/cjs/api/resources/agents/client/Client.js +98 -191
- package/dist/cjs/api/resources/agents/client/requests/AgentCreate.d.ts +0 -3
- package/dist/cjs/api/resources/agents/client/requests/AgentCreate.js +1 -3
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/contacts/client/Client.d.ts +21 -39
- package/dist/cjs/api/resources/contacts/client/Client.js +76 -149
- package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.d.ts +1 -4
- package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.js +1 -3
- package/dist/cjs/api/resources/contacts/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/customers/client/Client.d.ts +111 -49
- package/dist/cjs/api/resources/customers/client/Client.js +374 -276
- package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.d.ts +17 -5
- package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.js +1 -3
- package/dist/cjs/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.d.ts +14 -0
- package/dist/cjs/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.d.ts +18 -0
- package/dist/cjs/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.js +3 -0
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.ts +4 -15
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.js +1 -3
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.ts +4 -15
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.js +1 -3
- package/dist/cjs/api/resources/customers/client/requests/index.d.ts +5 -3
- package/dist/cjs/api/resources/customers/index.d.ts +1 -0
- package/dist/cjs/api/resources/customers/index.js +1 -0
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementRequestView.d.ts +5 -0
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementRequestView.js +8 -0
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementResponse.js +3 -0
- package/dist/cjs/api/resources/customers/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/customers/types/index.js +18 -0
- package/dist/cjs/api/resources/index.d.ts +12 -11
- package/dist/cjs/api/resources/index.js +16 -15
- package/dist/cjs/api/resources/orders/client/Client.d.ts +100 -39
- package/dist/cjs/api/resources/orders/client/Client.js +300 -124
- package/dist/cjs/api/resources/orders/client/requests/CancelRenewalRequest.d.ts +13 -0
- package/dist/cjs/api/resources/orders/client/requests/CancelRenewalRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +1 -4
- package/dist/cjs/api/resources/orders/client/requests/OrderCreate.js +1 -3
- package/dist/cjs/api/resources/orders/client/requests/OrdersActivateAndPayRequest.d.ts +13 -0
- package/dist/cjs/api/resources/orders/client/requests/OrdersActivateAndPayRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/ProrationUpgradeRequest.d.ts +24 -0
- package/dist/cjs/api/resources/orders/client/requests/ProrationUpgradeRequest.js +3 -0
- package/dist/cjs/api/resources/orders/client/requests/index.d.ts +4 -1
- package/dist/cjs/api/resources/orders/resources/index.d.ts +1 -1
- package/dist/cjs/api/resources/orders/resources/index.js +4 -4
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +11 -29
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +21 -44
- package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts +1 -4
- package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.js +1 -3
- package/dist/cjs/api/resources/orders/resources/lines/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/plans/client/Client.d.ts +14 -32
- package/dist/cjs/api/resources/plans/client/Client.js +51 -102
- package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.d.ts +5 -18
- package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.js +1 -3
- package/dist/cjs/api/resources/plans/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/products/client/Client.d.ts +25 -43
- package/dist/cjs/api/resources/products/client/Client.js +98 -191
- package/dist/cjs/api/resources/products/client/requests/ProductCreate.d.ts +1 -4
- package/dist/cjs/api/resources/products/client/requests/ProductCreate.js +1 -3
- package/dist/cjs/api/resources/products/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/products/client/requests/index.js +3 -0
- package/dist/cjs/api/resources/traces/client/Client.d.ts +10 -28
- package/dist/cjs/api/resources/traces/client/Client.js +32 -71
- package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.d.ts +8 -27
- package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.js +1 -3
- package/dist/cjs/api/resources/traces/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/usage/client/Client.d.ts +14 -32
- package/dist/cjs/api/resources/usage/client/Client.js +44 -87
- package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.d.ts +0 -3
- package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.js +1 -3
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.d.ts +1 -4
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.js +1 -3
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.ts +1 -4
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.js +1 -3
- package/dist/cjs/api/resources/usage/client/requests/index.d.ts +3 -3
- package/dist/cjs/api/resources/usage/index.d.ts +1 -1
- package/dist/cjs/api/resources/usage/index.js +1 -1
- package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.d.ts +0 -3
- package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.js +1 -3
- package/dist/cjs/api/types/Address.d.ts +0 -3
- package/dist/cjs/api/types/Address.js +1 -3
- package/dist/cjs/api/types/Agent.d.ts +1 -4
- package/dist/cjs/api/types/Agent.js +1 -3
- package/dist/cjs/api/types/AgentAttribute.d.ts +1 -4
- package/dist/cjs/api/types/AgentAttribute.js +1 -3
- package/dist/cjs/api/types/AgentPricePoint.d.ts +1 -4
- package/dist/cjs/api/types/AgentPricePoint.js +1 -3
- package/dist/cjs/api/types/AgentPricePointTiers.d.ts +0 -3
- package/dist/cjs/api/types/AgentPricePointTiers.js +1 -3
- package/dist/cjs/api/types/AgentUpdate.d.ts +1 -4
- package/dist/cjs/api/types/AgentUpdate.js +1 -3
- package/dist/cjs/api/types/ApiError.d.ts +0 -3
- package/dist/cjs/api/types/ApiError.js +1 -3
- package/dist/cjs/api/types/BillingFrequency.d.ts +1 -4
- package/dist/cjs/api/types/BillingFrequency.js +1 -3
- package/dist/cjs/api/types/CancelRenewalResponse.d.ts +15 -0
- package/dist/cjs/api/types/CancelRenewalResponse.js +3 -0
- package/dist/cjs/api/types/ChargeType.d.ts +1 -4
- package/dist/cjs/api/types/ChargeType.js +1 -3
- package/dist/cjs/api/types/Contact.d.ts +1 -4
- package/dist/cjs/api/types/Contact.js +1 -3
- package/dist/cjs/api/types/ContactCreateForCustomer.d.ts +15 -0
- package/dist/cjs/api/types/ContactCreateForCustomer.js +3 -0
- package/dist/cjs/api/types/CostAmount.d.ts +0 -3
- package/dist/cjs/api/types/CostAmount.js +1 -3
- package/dist/cjs/api/types/CostTrace.d.ts +1 -4
- package/dist/cjs/api/types/CostTrace.js +1 -3
- package/dist/cjs/api/types/CostTracesResponse.d.ts +1 -4
- package/dist/cjs/api/types/CostTracesResponse.js +1 -3
- package/dist/cjs/api/types/CreationSource.d.ts +1 -4
- package/dist/cjs/api/types/CreationSource.js +1 -3
- package/dist/cjs/api/types/CreationState.d.ts +1 -4
- package/dist/cjs/api/types/CreationState.js +1 -3
- package/dist/cjs/api/types/Customer.d.ts +1 -4
- package/dist/cjs/api/types/Customer.js +1 -3
- package/dist/cjs/api/types/CustomerUpdate.d.ts +1 -4
- package/dist/cjs/api/types/CustomerUpdate.js +1 -3
- package/dist/cjs/api/types/EntitlementUsage.d.ts +0 -3
- package/dist/cjs/api/types/EntitlementUsage.js +1 -3
- package/dist/cjs/api/types/Error_.d.ts +1 -4
- package/dist/cjs/api/types/Error_.js +1 -3
- package/dist/cjs/api/types/Invoice.d.ts +40 -0
- package/dist/cjs/api/types/Invoice.js +14 -0
- package/dist/cjs/api/types/Order.d.ts +1 -4
- package/dist/cjs/api/types/Order.js +1 -3
- package/dist/cjs/api/types/OrderLine.d.ts +1 -4
- package/dist/cjs/api/types/OrderLine.js +1 -3
- package/dist/cjs/api/types/OrderLineAttribute.d.ts +1 -4
- package/dist/cjs/api/types/OrderLineAttribute.js +1 -3
- package/dist/cjs/api/types/OrderLineAttributeCreateOne.d.ts +0 -3
- package/dist/cjs/api/types/OrderLineAttributeCreateOne.js +1 -3
- package/dist/cjs/api/types/OrderLineAttributePricing.d.ts +1 -4
- package/dist/cjs/api/types/OrderLineAttributePricing.js +1 -3
- package/dist/cjs/api/types/OrderLineCreate.d.ts +1 -4
- package/dist/cjs/api/types/OrderLineCreate.js +1 -3
- package/dist/cjs/api/types/PaginationMeta.d.ts +0 -3
- package/dist/cjs/api/types/PaginationMeta.js +1 -3
- package/dist/cjs/api/types/PaymentMethod.d.ts +54 -0
- package/dist/cjs/api/types/PaymentMethod.js +20 -0
- package/dist/cjs/api/types/Plan.d.ts +3 -3
- package/dist/cjs/api/types/Plan.js +1 -3
- package/dist/cjs/api/types/PlanGroup.d.ts +1 -4
- package/dist/cjs/api/types/PlanGroup.js +1 -3
- package/dist/cjs/api/types/PricePoint.d.ts +1 -4
- package/dist/cjs/api/types/PricePoint.js +1 -3
- package/dist/cjs/api/types/Pricing.d.ts +1 -4
- package/dist/cjs/api/types/Pricing.js +1 -3
- package/dist/cjs/api/types/PricingModelType.d.ts +1 -4
- package/dist/cjs/api/types/PricingModelType.js +1 -3
- package/dist/cjs/api/types/Product.d.ts +3 -8
- package/dist/cjs/api/types/Product.js +2 -3
- package/dist/cjs/api/types/ProductUpdate.d.ts +2 -5
- package/dist/cjs/api/types/ProductUpdate.js +1 -3
- package/dist/cjs/api/types/ProrationAttributeUpdate.d.ts +11 -0
- package/dist/cjs/api/types/ProrationAttributeUpdate.js +3 -0
- package/dist/cjs/api/types/ProrationDetail.d.ts +16 -0
- package/dist/cjs/api/types/ProrationDetail.js +3 -0
- package/dist/cjs/api/types/ProrationUpgradeResponse.d.ts +22 -0
- package/dist/cjs/api/types/ProrationUpgradeResponse.js +3 -0
- package/dist/cjs/api/types/Salutation.d.ts +1 -4
- package/dist/cjs/api/types/Salutation.js +1 -3
- package/dist/cjs/api/types/Signal.d.ts +0 -3
- package/dist/cjs/api/types/Signal.js +1 -3
- package/dist/cjs/api/types/SignalV2.d.ts +0 -3
- package/dist/cjs/api/types/SignalV2.js +1 -3
- package/dist/cjs/api/types/TaxExemptStatus.d.ts +1 -4
- package/dist/cjs/api/types/TaxExemptStatus.js +1 -3
- package/dist/cjs/api/types/Tier.d.ts +0 -3
- package/dist/cjs/api/types/Tier.js +1 -3
- package/dist/cjs/api/types/Trace.d.ts +1 -4
- package/dist/cjs/api/types/Trace.js +1 -3
- package/dist/cjs/api/types/TracesResponse.d.ts +1 -4
- package/dist/cjs/api/types/TracesResponse.js +1 -3
- package/dist/cjs/api/types/UsagePaginationMeta.d.ts +0 -3
- package/dist/cjs/api/types/UsagePaginationMeta.js +1 -3
- package/dist/cjs/api/types/UsageSummariesResponse.d.ts +1 -4
- package/dist/cjs/api/types/UsageSummariesResponse.js +1 -3
- package/dist/cjs/api/types/UsageSummary.d.ts +0 -3
- package/dist/cjs/api/types/UsageSummary.js +1 -3
- package/dist/cjs/api/types/index.d.ts +33 -26
- package/dist/cjs/api/types/index.js +33 -26
- package/dist/cjs/auth/BearerAuthProvider.d.ts +20 -0
- package/dist/cjs/{core/fetcher/stream-wrappers/chooseStreamWrapper.js → auth/BearerAuthProvider.js} +34 -14
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +7 -0
- package/dist/cjs/core/auth/AuthProvider.js +2 -0
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.js +5 -4
- package/dist/cjs/core/auth/BearerToken.d.ts +3 -1
- package/dist/cjs/core/auth/BearerToken.js +7 -6
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/cjs/core/auth/index.d.ts +3 -0
- package/dist/cjs/core/auth/index.js +3 -1
- package/dist/cjs/core/base64.d.ts +2 -0
- package/dist/cjs/core/base64.js +26 -0
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +17 -0
- package/dist/cjs/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +19 -0
- package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/{esm/core/fetcher/stream-wrappers/chooseStreamWrapper.mjs → cjs/core/fetcher/EndpointSupplier.js} +10 -11
- package/dist/cjs/core/fetcher/Fetcher.d.ts +15 -7
- package/dist/cjs/core/fetcher/Fetcher.js +210 -14
- package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +1 -1
- package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -1
- package/dist/cjs/core/fetcher/createRequestUrl.js +3 -7
- package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +45 -0
- package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -4
- package/dist/cjs/core/fetcher/getFetchFn.js +1 -52
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
- package/dist/cjs/core/fetcher/getResponseBody.js +42 -27
- package/dist/cjs/core/fetcher/index.d.ts +7 -4
- package/dist/cjs/core/fetcher/index.js +7 -5
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +2 -4
- package/dist/cjs/core/fetcher/requestWithRetries.js +35 -8
- package/dist/cjs/core/fetcher/signals.d.ts +1 -7
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/headers.d.ts +2 -3
- package/dist/cjs/core/headers.js +6 -4
- package/dist/cjs/core/index.d.ts +4 -1
- package/dist/cjs/core/index.js +27 -1
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/{wrapper/BatchUsage.js → core/logging/exports.js} +10 -27
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/runtime/runtime.js +11 -11
- package/dist/cjs/core/url/encodePathParam.d.ts +1 -0
- package/dist/cjs/core/url/encodePathParam.js +21 -0
- package/dist/cjs/core/url/index.d.ts +3 -0
- package/dist/cjs/core/url/index.js +9 -0
- package/dist/cjs/core/url/join.d.ts +1 -0
- package/dist/cjs/core/url/join.js +68 -0
- package/dist/cjs/core/url/qs.d.ts +6 -0
- package/dist/cjs/core/url/qs.js +64 -0
- package/dist/cjs/environments.d.ts +0 -3
- package/dist/cjs/environments.js +1 -3
- package/dist/cjs/errors/PaidError.d.ts +1 -4
- package/dist/cjs/errors/PaidError.js +7 -5
- package/dist/cjs/errors/PaidTimeoutError.d.ts +0 -3
- package/dist/cjs/errors/PaidTimeoutError.js +6 -4
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/cjs/errors/handleNonStatusCodeError.js +65 -0
- package/dist/cjs/exports.d.ts +1 -0
- package/dist/cjs/exports.js +17 -0
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +2 -3
- package/dist/cjs/integrations/adapters/expressjs/base-adapter.d.ts +8 -5
- package/dist/cjs/integrations/adapters/expressjs/base-adapter.js +6 -11
- package/dist/cjs/integrations/adapters/expressjs/routes.d.ts +14 -12
- package/dist/cjs/integrations/adapters/expressjs/routes.js +18 -9
- package/dist/cjs/integrations/adapters/nextjs/base-adapter.d.ts +3 -2
- package/dist/cjs/integrations/adapters/nextjs/routes.d.ts +13 -11
- package/dist/cjs/integrations/adapters/nextjs/routes.js +18 -9
- package/dist/cjs/integrations/controllers/billing.d.ts +3 -17
- package/dist/cjs/integrations/controllers/contacts.d.ts +1 -1
- package/dist/cjs/integrations/controllers/customers.d.ts +2 -2
- package/dist/cjs/integrations/controllers/invoices.d.ts +2 -6
- package/dist/cjs/integrations/controllers/orders.d.ts +1 -5
- package/dist/cjs/integrations/controllers/provision-users.d.ts +1 -1
- package/dist/cjs/integrations/utils/create-adapter.d.ts +2 -1
- package/dist/cjs/integrations/utils/create-adapter.js +2 -1
- package/dist/cjs/tracing/autoInstrumentation.js +5 -5
- package/dist/cjs/tracing/spanProcessor.d.ts +2 -2
- package/dist/cjs/tracing/spanProcessor.js +0 -5
- package/dist/cjs/tracing/tracing.d.ts +1 -1
- package/dist/cjs/tracing/tracing.js +2 -0
- package/dist/cjs/tracing/wrappers/anthropicWrapper.d.ts +2 -2
- package/dist/cjs/tracing/wrappers/mistralWrapper.d.ts +3 -3
- package/dist/cjs/tracing/wrappers/openAiWrapper.d.ts +5 -5
- package/dist/cjs/tracing/wrappers/vercelAIWrapper.d.ts +2 -2
- package/dist/cjs/tracing/wrappers/vercelAIWrapper.js +8 -7
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +39 -0
- package/dist/esm/BaseClient.mjs +25 -0
- package/dist/esm/Client.d.mts +30 -93
- package/dist/esm/Client.mjs +20 -96
- package/dist/esm/api/errors/BadRequestError.d.mts +2 -5
- package/dist/esm/api/errors/BadRequestError.mjs +6 -4
- package/dist/esm/api/errors/ForbiddenError.d.mts +2 -5
- package/dist/esm/api/errors/ForbiddenError.mjs +6 -4
- package/dist/esm/api/errors/InternalServerError.d.mts +2 -5
- package/dist/esm/api/errors/InternalServerError.mjs +6 -4
- package/dist/esm/api/errors/NotFoundError.d.mts +2 -5
- package/dist/esm/api/errors/NotFoundError.mjs +6 -4
- package/dist/esm/api/errors/index.d.mts +2 -2
- package/dist/esm/api/errors/index.mjs +2 -2
- package/dist/esm/api/index.d.mts +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/resources/agents/client/Client.d.mts +25 -43
- package/dist/esm/api/resources/agents/client/Client.mjs +96 -186
- package/dist/esm/api/resources/agents/client/requests/AgentCreate.d.mts +0 -3
- package/dist/esm/api/resources/agents/client/requests/AgentCreate.mjs +1 -3
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/contacts/client/Client.d.mts +21 -39
- package/dist/esm/api/resources/contacts/client/Client.mjs +74 -144
- package/dist/esm/api/resources/contacts/client/requests/ContactCreate.d.mts +1 -4
- package/dist/esm/api/resources/contacts/client/requests/ContactCreate.mjs +1 -3
- package/dist/esm/api/resources/contacts/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/customers/client/Client.d.mts +111 -49
- package/dist/esm/api/resources/customers/client/Client.mjs +372 -271
- package/dist/esm/api/resources/customers/client/requests/CustomerCreate.d.mts +17 -5
- package/dist/esm/api/resources/customers/client/requests/CustomerCreate.mjs +1 -3
- package/dist/esm/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.d.mts +14 -0
- package/dist/esm/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.d.mts +18 -0
- package/dist/esm/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.mjs +2 -0
- package/dist/esm/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.mts +4 -15
- package/dist/esm/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.mjs +1 -3
- package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.mts +4 -15
- package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.mjs +1 -3
- package/dist/esm/api/resources/customers/client/requests/index.d.mts +5 -3
- package/dist/esm/api/resources/customers/index.d.mts +1 -0
- package/dist/esm/api/resources/customers/index.mjs +1 -0
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementRequestView.d.mts +5 -0
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementRequestView.mjs +5 -0
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementResponse.d.mts +4 -0
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementResponse.mjs +2 -0
- package/dist/esm/api/resources/customers/types/index.d.mts +2 -0
- package/dist/esm/api/resources/customers/types/index.mjs +2 -0
- package/dist/esm/api/resources/index.d.mts +12 -11
- package/dist/esm/api/resources/index.mjs +12 -11
- package/dist/esm/api/resources/orders/client/Client.d.mts +100 -39
- package/dist/esm/api/resources/orders/client/Client.mjs +299 -120
- package/dist/esm/api/resources/orders/client/requests/CancelRenewalRequest.d.mts +13 -0
- package/dist/esm/api/resources/orders/client/requests/CancelRenewalRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +1 -4
- package/dist/esm/api/resources/orders/client/requests/OrderCreate.mjs +1 -3
- package/dist/esm/api/resources/orders/client/requests/OrdersActivateAndPayRequest.d.mts +13 -0
- package/dist/esm/api/resources/orders/client/requests/OrdersActivateAndPayRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/ProrationUpgradeRequest.d.mts +24 -0
- package/dist/esm/api/resources/orders/client/requests/ProrationUpgradeRequest.mjs +2 -0
- package/dist/esm/api/resources/orders/client/requests/index.d.mts +4 -1
- package/dist/esm/api/resources/orders/resources/index.d.mts +1 -1
- package/dist/esm/api/resources/orders/resources/index.mjs +1 -1
- package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +11 -29
- package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +19 -39
- package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts +1 -4
- package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.mjs +1 -3
- package/dist/esm/api/resources/orders/resources/lines/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/plans/client/Client.d.mts +14 -32
- package/dist/esm/api/resources/plans/client/Client.mjs +49 -97
- package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.d.mts +5 -18
- package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.mjs +1 -3
- package/dist/esm/api/resources/plans/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/products/client/Client.d.mts +25 -43
- package/dist/esm/api/resources/products/client/Client.mjs +96 -186
- package/dist/esm/api/resources/products/client/requests/ProductCreate.d.mts +1 -4
- package/dist/esm/api/resources/products/client/requests/ProductCreate.mjs +1 -3
- package/dist/esm/api/resources/products/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/products/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/traces/client/Client.d.mts +10 -28
- package/dist/esm/api/resources/traces/client/Client.mjs +30 -66
- package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.d.mts +8 -27
- package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.mjs +1 -3
- package/dist/esm/api/resources/traces/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/usage/client/Client.d.mts +14 -32
- package/dist/esm/api/resources/usage/client/Client.mjs +42 -82
- package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.d.mts +0 -3
- package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.mjs +1 -3
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.d.mts +1 -4
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.mjs +1 -3
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.mts +1 -4
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.mjs +1 -3
- package/dist/esm/api/resources/usage/client/requests/index.d.mts +3 -3
- package/dist/esm/api/resources/usage/index.d.mts +1 -1
- package/dist/esm/api/resources/usage/index.mjs +1 -1
- package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.d.mts +0 -3
- package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.mjs +1 -3
- package/dist/esm/api/types/Address.d.mts +0 -3
- package/dist/esm/api/types/Address.mjs +1 -3
- package/dist/esm/api/types/Agent.d.mts +1 -4
- package/dist/esm/api/types/Agent.mjs +1 -3
- package/dist/esm/api/types/AgentAttribute.d.mts +1 -4
- package/dist/esm/api/types/AgentAttribute.mjs +1 -3
- package/dist/esm/api/types/AgentPricePoint.d.mts +1 -4
- package/dist/esm/api/types/AgentPricePoint.mjs +1 -3
- package/dist/esm/api/types/AgentPricePointTiers.d.mts +0 -3
- package/dist/esm/api/types/AgentPricePointTiers.mjs +1 -3
- package/dist/esm/api/types/AgentUpdate.d.mts +1 -4
- package/dist/esm/api/types/AgentUpdate.mjs +1 -3
- package/dist/esm/api/types/ApiError.d.mts +0 -3
- package/dist/esm/api/types/ApiError.mjs +1 -3
- package/dist/esm/api/types/BillingFrequency.d.mts +1 -4
- package/dist/esm/api/types/BillingFrequency.mjs +1 -3
- package/dist/esm/api/types/CancelRenewalResponse.d.mts +15 -0
- package/dist/esm/api/types/CancelRenewalResponse.mjs +2 -0
- package/dist/esm/api/types/ChargeType.d.mts +1 -4
- package/dist/esm/api/types/ChargeType.mjs +1 -3
- package/dist/esm/api/types/Contact.d.mts +1 -4
- package/dist/esm/api/types/Contact.mjs +1 -3
- package/dist/esm/api/types/ContactCreateForCustomer.d.mts +15 -0
- package/dist/esm/api/types/ContactCreateForCustomer.mjs +2 -0
- package/dist/esm/api/types/CostAmount.d.mts +0 -3
- package/dist/esm/api/types/CostAmount.mjs +1 -3
- package/dist/esm/api/types/CostTrace.d.mts +1 -4
- package/dist/esm/api/types/CostTrace.mjs +1 -3
- package/dist/esm/api/types/CostTracesResponse.d.mts +1 -4
- package/dist/esm/api/types/CostTracesResponse.mjs +1 -3
- package/dist/esm/api/types/CreationSource.d.mts +1 -4
- package/dist/esm/api/types/CreationSource.mjs +1 -3
- package/dist/esm/api/types/CreationState.d.mts +1 -4
- package/dist/esm/api/types/CreationState.mjs +1 -3
- package/dist/esm/api/types/Customer.d.mts +1 -4
- package/dist/esm/api/types/Customer.mjs +1 -3
- package/dist/esm/api/types/CustomerUpdate.d.mts +1 -4
- package/dist/esm/api/types/CustomerUpdate.mjs +1 -3
- package/dist/esm/api/types/EntitlementUsage.d.mts +0 -3
- package/dist/esm/api/types/EntitlementUsage.mjs +1 -3
- package/dist/esm/api/types/Error_.d.mts +1 -4
- package/dist/esm/api/types/Error_.mjs +1 -3
- package/dist/esm/api/types/Invoice.d.mts +40 -0
- package/dist/esm/api/types/Invoice.mjs +11 -0
- package/dist/esm/api/types/Order.d.mts +1 -4
- package/dist/esm/api/types/Order.mjs +1 -3
- package/dist/esm/api/types/OrderLine.d.mts +1 -4
- package/dist/esm/api/types/OrderLine.mjs +1 -3
- package/dist/esm/api/types/OrderLineAttribute.d.mts +1 -4
- package/dist/esm/api/types/OrderLineAttribute.mjs +1 -3
- package/dist/esm/api/types/OrderLineAttributeCreateOne.d.mts +0 -3
- package/dist/esm/api/types/OrderLineAttributeCreateOne.mjs +1 -3
- package/dist/esm/api/types/OrderLineAttributePricing.d.mts +1 -4
- package/dist/esm/api/types/OrderLineAttributePricing.mjs +1 -3
- package/dist/esm/api/types/OrderLineCreate.d.mts +1 -4
- package/dist/esm/api/types/OrderLineCreate.mjs +1 -3
- package/dist/esm/api/types/PaginationMeta.d.mts +0 -3
- package/dist/esm/api/types/PaginationMeta.mjs +1 -3
- package/dist/esm/api/types/PaymentMethod.d.mts +54 -0
- package/dist/esm/api/types/PaymentMethod.mjs +17 -0
- package/dist/esm/api/types/Plan.d.mts +3 -3
- package/dist/esm/api/types/Plan.mjs +1 -3
- package/dist/esm/api/types/PlanGroup.d.mts +1 -4
- package/dist/esm/api/types/PlanGroup.mjs +1 -3
- package/dist/esm/api/types/PricePoint.d.mts +1 -4
- package/dist/esm/api/types/PricePoint.mjs +1 -3
- package/dist/esm/api/types/Pricing.d.mts +1 -4
- package/dist/esm/api/types/Pricing.mjs +1 -3
- package/dist/esm/api/types/PricingModelType.d.mts +1 -4
- package/dist/esm/api/types/PricingModelType.mjs +1 -3
- package/dist/esm/api/types/Product.d.mts +3 -8
- package/dist/esm/api/types/Product.mjs +2 -3
- package/dist/esm/api/types/ProductUpdate.d.mts +2 -5
- package/dist/esm/api/types/ProductUpdate.mjs +1 -3
- package/dist/esm/api/types/ProrationAttributeUpdate.d.mts +11 -0
- package/dist/esm/api/types/ProrationAttributeUpdate.mjs +2 -0
- package/dist/esm/api/types/ProrationDetail.d.mts +16 -0
- package/dist/esm/api/types/ProrationDetail.mjs +2 -0
- package/dist/esm/api/types/ProrationUpgradeResponse.d.mts +22 -0
- package/dist/esm/api/types/ProrationUpgradeResponse.mjs +2 -0
- package/dist/esm/api/types/Salutation.d.mts +1 -4
- package/dist/esm/api/types/Salutation.mjs +1 -3
- package/dist/esm/api/types/Signal.d.mts +0 -3
- package/dist/esm/api/types/Signal.mjs +1 -3
- package/dist/esm/api/types/SignalV2.d.mts +0 -3
- package/dist/esm/api/types/SignalV2.mjs +1 -3
- package/dist/esm/api/types/TaxExemptStatus.d.mts +1 -4
- package/dist/esm/api/types/TaxExemptStatus.mjs +1 -3
- package/dist/esm/api/types/Tier.d.mts +0 -3
- package/dist/esm/api/types/Tier.mjs +1 -3
- package/dist/esm/api/types/Trace.d.mts +1 -4
- package/dist/esm/api/types/Trace.mjs +1 -3
- package/dist/esm/api/types/TracesResponse.d.mts +1 -4
- package/dist/esm/api/types/TracesResponse.mjs +1 -3
- package/dist/esm/api/types/UsagePaginationMeta.d.mts +0 -3
- package/dist/esm/api/types/UsagePaginationMeta.mjs +1 -3
- package/dist/esm/api/types/UsageSummariesResponse.d.mts +1 -4
- package/dist/esm/api/types/UsageSummariesResponse.mjs +1 -3
- package/dist/esm/api/types/UsageSummary.d.mts +0 -3
- package/dist/esm/api/types/UsageSummary.mjs +1 -3
- package/dist/esm/api/types/index.d.mts +33 -26
- package/dist/esm/api/types/index.mjs +33 -26
- package/dist/esm/auth/BearerAuthProvider.d.mts +20 -0
- package/dist/esm/auth/BearerAuthProvider.mjs +42 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +7 -0
- package/dist/esm/core/auth/AuthProvider.mjs +1 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/BasicAuth.mjs +5 -4
- package/dist/esm/core/auth/BearerToken.d.mts +3 -1
- package/dist/esm/core/auth/BearerToken.mjs +7 -6
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
- package/dist/esm/core/auth/index.d.mts +3 -0
- package/dist/esm/core/auth/index.mjs +1 -0
- package/dist/esm/core/base64.d.mts +2 -0
- package/dist/esm/core/base64.mjs +22 -0
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/fetcher/APIResponse.d.mts +1 -1
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +19 -0
- package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
- package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
- package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +15 -7
- package/dist/esm/core/fetcher/Fetcher.mjs +210 -14
- package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +1 -1
- package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -1
- package/dist/esm/core/fetcher/createRequestUrl.mjs +3 -4
- package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +42 -0
- package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -4
- package/dist/esm/core/fetcher/getFetchFn.mjs +1 -19
- package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
- package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
- package/dist/esm/core/fetcher/getResponseBody.mjs +42 -27
- package/dist/esm/core/fetcher/index.d.mts +7 -4
- package/dist/esm/core/fetcher/index.mjs +3 -2
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +2 -4
- package/dist/esm/core/fetcher/requestWithRetries.mjs +35 -8
- package/dist/esm/core/fetcher/signals.d.mts +1 -7
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/headers.d.mts +2 -3
- package/dist/esm/core/headers.mjs +6 -4
- package/dist/esm/core/index.d.mts +4 -1
- package/dist/esm/core/index.mjs +4 -1
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/runtime/runtime.mjs +11 -11
- package/dist/esm/core/url/encodePathParam.d.mts +1 -0
- package/dist/esm/core/url/encodePathParam.mjs +18 -0
- package/dist/esm/core/url/index.d.mts +3 -0
- package/dist/esm/core/url/index.mjs +3 -0
- package/dist/esm/core/url/join.d.mts +1 -0
- package/dist/esm/core/url/join.mjs +65 -0
- package/dist/esm/core/url/qs.d.mts +6 -0
- package/dist/esm/core/url/qs.mjs +61 -0
- package/dist/esm/environments.d.mts +0 -3
- package/dist/esm/environments.mjs +1 -3
- package/dist/esm/errors/PaidError.d.mts +1 -4
- package/dist/esm/errors/PaidError.mjs +7 -5
- package/dist/esm/errors/PaidTimeoutError.d.mts +0 -3
- package/dist/esm/errors/PaidTimeoutError.mjs +6 -4
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
- package/dist/esm/errors/handleNonStatusCodeError.mjs +29 -0
- package/dist/esm/exports.d.mts +1 -0
- package/dist/esm/exports.mjs +1 -0
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/integrations/adapters/expressjs/base-adapter.d.mts +8 -5
- package/dist/esm/integrations/adapters/expressjs/base-adapter.mjs +6 -11
- package/dist/esm/integrations/adapters/expressjs/routes.d.mts +14 -12
- package/dist/esm/integrations/adapters/expressjs/routes.mjs +18 -9
- package/dist/esm/integrations/adapters/nextjs/base-adapter.d.mts +3 -2
- package/dist/esm/integrations/adapters/nextjs/base-adapter.mjs +1 -1
- package/dist/esm/integrations/adapters/nextjs/routes.d.mts +13 -11
- package/dist/esm/integrations/adapters/nextjs/routes.mjs +18 -9
- package/dist/esm/integrations/controllers/billing.d.mts +3 -17
- package/dist/esm/integrations/controllers/contacts.d.mts +1 -1
- package/dist/esm/integrations/controllers/contacts.mjs +1 -0
- package/dist/esm/integrations/controllers/customers.d.mts +2 -2
- package/dist/esm/integrations/controllers/customers.mjs +1 -0
- package/dist/esm/integrations/controllers/invoices.d.mts +2 -6
- package/dist/esm/integrations/controllers/orders.d.mts +1 -5
- package/dist/esm/integrations/controllers/provision-users.d.mts +1 -1
- package/dist/esm/integrations/utils/create-adapter.d.mts +2 -1
- package/dist/esm/integrations/utils/create-adapter.mjs +2 -1
- package/dist/esm/tracing/autoInstrumentation.mjs +1 -1
- package/dist/esm/tracing/spanProcessor.d.mts +2 -2
- package/dist/esm/tracing/spanProcessor.mjs +0 -5
- package/dist/esm/tracing/tracing.d.mts +1 -1
- package/dist/esm/tracing/tracing.mjs +3 -0
- package/dist/esm/tracing/wrappers/anthropicWrapper.d.mts +2 -2
- package/dist/esm/tracing/wrappers/anthropicWrapper.mjs +1 -0
- package/dist/esm/tracing/wrappers/mistralWrapper.d.mts +3 -3
- package/dist/esm/tracing/wrappers/mistralWrapper.mjs +1 -0
- package/dist/esm/tracing/wrappers/openAiWrapper.d.mts +5 -5
- package/dist/esm/tracing/wrappers/openAiWrapper.mjs +1 -0
- package/dist/esm/tracing/wrappers/vercelAIWrapper.d.mts +2 -2
- package/dist/esm/tracing/wrappers/vercelAIWrapper.mjs +8 -7
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +43 -28
- package/reference.md +985 -396
- package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
- package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -247
- package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
- package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -126
- package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
- package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -229
- package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
- package/dist/cjs/wrapper/BatchUsage.d.ts +0 -8
- package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.mts +0 -30
- package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.mjs +0 -243
- package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.mts +0 -21
- package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.mjs +0 -122
- package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.mts +0 -31
- package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.mjs +0 -225
- package/dist/esm/core/fetcher/stream-wrappers/chooseStreamWrapper.d.mts +0 -18
- package/dist/esm/wrapper/BatchUsage.d.mts +0 -8
- package/dist/esm/wrapper/BatchUsage.mjs +0 -25
package/README.md
CHANGED
|
@@ -104,7 +104,7 @@ vercel (Vercel AI SDK)
|
|
|
104
104
|
Example usage with OpenAI:
|
|
105
105
|
|
|
106
106
|
```typescript
|
|
107
|
-
import { initializeTracing, trace } from "@paid-ai/paid-node";
|
|
107
|
+
import { initializeTracing, trace } from "@paid-ai/paid-node/tracing";
|
|
108
108
|
import { PaidOpenAI } from "@paid-ai/paid-node/openai";
|
|
109
109
|
import OpenAI from "openai";
|
|
110
110
|
|
|
@@ -141,7 +141,7 @@ For maximum convenience, you can use OpenTelemetry auto-instrumentation to autom
|
|
|
141
141
|
|
|
142
142
|
``` typescript
|
|
143
143
|
// Import and call auto-instrumentation before importing instrumented libraries
|
|
144
|
-
import { paidAutoInstrument } from "@paid-ai/paid-node";
|
|
144
|
+
import { paidAutoInstrument } from "@paid-ai/paid-node/tracing";
|
|
145
145
|
paidAutoInstrument()
|
|
146
146
|
|
|
147
147
|
import openai from "openai";
|
|
@@ -165,12 +165,12 @@ bedrock
|
|
|
165
165
|
If you're using Vercel's AI SDK, you can enable automatic telemetry without any wrappers by using the `experimental_telemetry` option. When enabled, it will automatically use Paid's registered tracer provider:
|
|
166
166
|
|
|
167
167
|
```typescript
|
|
168
|
-
import { initializeTracing, trace } from "@paid-ai/paid-node";
|
|
168
|
+
import { initializeTracing, trace } from "@paid-ai/paid-node/tracing";
|
|
169
169
|
import { generateText } from "ai";
|
|
170
170
|
|
|
171
171
|
async function main() {
|
|
172
172
|
initializeTracing("<your_paid_api_key>");
|
|
173
|
-
|
|
173
|
+
|
|
174
174
|
await trace({
|
|
175
175
|
externalCustomerId: "<your_external_customer_id>",
|
|
176
176
|
externalProductId: "<your_external_product_id>"
|
|
@@ -187,11 +187,11 @@ async function main() {
|
|
|
187
187
|
#### Manual instrumentation
|
|
188
188
|
|
|
189
189
|
``` typescript
|
|
190
|
-
import { paidAutoInstrument } from "@paid-ai/paid-node";
|
|
190
|
+
import { paidAutoInstrument } from "@paid-ai/paid-node/tracing";
|
|
191
191
|
import openai from "openai";
|
|
192
192
|
|
|
193
193
|
// If your module management is too complex and the previous approach didn't work
|
|
194
|
-
// you can provide libraries directly
|
|
194
|
+
// you can provide libraries directly
|
|
195
195
|
paidAutoInstrument({ openai })
|
|
196
196
|
```
|
|
197
197
|
|
|
@@ -208,7 +208,7 @@ In contrast to `Paid.usage.recordBulk()`, `signal()` is using OpenTelemetry to p
|
|
|
208
208
|
Here's an example of how to use it:
|
|
209
209
|
|
|
210
210
|
```typescript
|
|
211
|
-
import { initializeTracing, trace, signal } from "@paid-ai/paid-node";
|
|
211
|
+
import { initializeTracing, trace, signal } from "@paid-ai/paid-node/tracing";
|
|
212
212
|
|
|
213
213
|
async function main() {
|
|
214
214
|
// Initialize tracing
|
|
@@ -234,7 +234,7 @@ as the wrappers that recorded those costs.
|
|
|
234
234
|
This will look something like this:
|
|
235
235
|
|
|
236
236
|
```typescript
|
|
237
|
-
import { initializeTracing, trace, signal } from "@paid-ai/paid-node";
|
|
237
|
+
import { initializeTracing, trace, signal } from "@paid-ai/paid-node/tracing";
|
|
238
238
|
import { PaidOpenAI } from "@paid-ai/paid-node/openai";
|
|
239
239
|
import OpenAI from "openai";
|
|
240
240
|
|
|
@@ -303,7 +303,7 @@ await client.usage.flush(); // need to flush to send usage immediately
|
|
|
303
303
|
Alternatively the same `costData` payload can be passed to OTLP signaling mechanism:
|
|
304
304
|
|
|
305
305
|
```typescript
|
|
306
|
-
import { initializeTracing, trace, signal } from "@paid-ai/paid-node";
|
|
306
|
+
import { initializeTracing, trace, signal } from "@paid-ai/paid-node/tracing";
|
|
307
307
|
|
|
308
308
|
async function main() {
|
|
309
309
|
initializeTracing("<your_paid_api_key>");
|
|
@@ -360,7 +360,7 @@ await client.usage.flush();
|
|
|
360
360
|
Same but via OTEL signaling:
|
|
361
361
|
|
|
362
362
|
```typescript
|
|
363
|
-
import { initializeTracing, trace, signal } from "@paid-ai/paid-node";
|
|
363
|
+
import { initializeTracing, trace, signal } from "@paid-ai/paid-node/tracing";
|
|
364
364
|
|
|
365
365
|
async function main() {
|
|
366
366
|
initializeTracing("<your_paid_api_key>");
|
|
@@ -484,7 +484,7 @@ const client = new PaidClient({
|
|
|
484
484
|
If you would like to use the Paid OTEL tracer provider, you can access it via the `getPaidTracerProvider` function.
|
|
485
485
|
|
|
486
486
|
```typescript
|
|
487
|
-
import { initializeTracing, getPaidTracerProvider } from "@paid-ai/paid-node";
|
|
487
|
+
import { initializeTracing, getPaidTracerProvider } from "@paid-ai/paid-node/tracing";
|
|
488
488
|
initializeTracing("<your_paid_api_key>");
|
|
489
489
|
const tracerProvider = getPaidTracerProvider();
|
|
490
490
|
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BearerAuthProvider } from "./auth/BearerAuthProvider.js";
|
|
2
|
+
import * as core from "./core/index.js";
|
|
3
|
+
import type * as environments from "./environments.js";
|
|
4
|
+
export type BaseClientOptions = {
|
|
5
|
+
environment?: core.Supplier<environments.PaidEnvironment | string>;
|
|
6
|
+
/** Specify a custom URL to connect the client to. */
|
|
7
|
+
baseUrl?: core.Supplier<string>;
|
|
8
|
+
/** Additional headers to include in requests. */
|
|
9
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
10
|
+
/** The default maximum time to wait for a response in seconds. */
|
|
11
|
+
timeoutInSeconds?: number;
|
|
12
|
+
/** The default number of times to retry the request. Defaults to 2. */
|
|
13
|
+
maxRetries?: number;
|
|
14
|
+
/** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
|
|
15
|
+
fetch?: typeof fetch;
|
|
16
|
+
/** Configure logging for the client. */
|
|
17
|
+
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
18
|
+
} & BearerAuthProvider.AuthOptions;
|
|
19
|
+
export interface BaseRequestOptions {
|
|
20
|
+
/** The maximum time to wait for a response in seconds. */
|
|
21
|
+
timeoutInSeconds?: number;
|
|
22
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
23
|
+
maxRetries?: number;
|
|
24
|
+
/** A hook to abort the request. */
|
|
25
|
+
abortSignal?: AbortSignal;
|
|
26
|
+
/** Additional query string parameters to include in the request. */
|
|
27
|
+
queryParams?: Record<string, unknown>;
|
|
28
|
+
/** Additional headers to include in the request. */
|
|
29
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
30
|
+
}
|
|
31
|
+
export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
|
|
32
|
+
logging: core.logging.Logger;
|
|
33
|
+
authProvider?: core.AuthProvider;
|
|
34
|
+
};
|
|
35
|
+
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
|
|
36
|
+
authProvider: core.AuthProvider;
|
|
37
|
+
};
|
|
38
|
+
export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
|
|
39
|
+
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.normalizeClientOptions = normalizeClientOptions;
|
|
38
|
+
exports.normalizeClientOptionsWithAuth = normalizeClientOptionsWithAuth;
|
|
39
|
+
const BearerAuthProvider_js_1 = require("./auth/BearerAuthProvider.js");
|
|
40
|
+
const headers_js_1 = require("./core/headers.js");
|
|
41
|
+
const core = __importStar(require("./core/index.js"));
|
|
42
|
+
function normalizeClientOptions(options) {
|
|
43
|
+
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
|
+
"X-Fern-Language": "JavaScript",
|
|
45
|
+
"X-Fern-SDK-Name": "@paid-ai/paid-node",
|
|
46
|
+
"X-Fern-SDK-Version": "1.0.0",
|
|
47
|
+
"User-Agent": "@paid-ai/paid-node/1.0.0",
|
|
48
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
|
+
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
51
|
+
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
52
|
+
}
|
|
53
|
+
function normalizeClientOptionsWithAuth(options) {
|
|
54
|
+
var _a;
|
|
55
|
+
const normalized = normalizeClientOptions(options);
|
|
56
|
+
const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
|
|
57
|
+
(_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new BearerAuthProvider_js_1.BearerAuthProvider(normalizedWithNoOpAuthProvider));
|
|
58
|
+
return normalized;
|
|
59
|
+
}
|
|
60
|
+
function withNoOpAuthProvider(options) {
|
|
61
|
+
return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
|
|
62
|
+
}
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -1,98 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Plans } from "./api/resources/plans/client/Client.js";
|
|
12
|
-
import { Usage } from "./wrapper/BatchUsage.js";
|
|
13
|
-
import { Traces } from "./api/resources/traces/client/Client.js";
|
|
14
|
-
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
1
|
+
import { AgentsClient } from "./api/resources/agents/client/Client.js";
|
|
2
|
+
import { ContactsClient } from "./api/resources/contacts/client/Client.js";
|
|
3
|
+
import { CustomersClient } from "./api/resources/customers/client/Client.js";
|
|
4
|
+
import { OrdersClient } from "./api/resources/orders/client/Client.js";
|
|
5
|
+
import { PlansClient } from "./api/resources/plans/client/Client.js";
|
|
6
|
+
import { ProductsClient } from "./api/resources/products/client/Client.js";
|
|
7
|
+
import { TracesClient } from "./api/resources/traces/client/Client.js";
|
|
8
|
+
import { UsageClient } from "./api/resources/usage/client/Client.js";
|
|
9
|
+
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
10
|
+
import { type NormalizedClientOptions } from "./BaseClient.js";
|
|
15
11
|
export declare namespace PaidClient {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/** Specify a custom URL to connect the client to. */
|
|
19
|
-
baseUrl?: core.Supplier<string>;
|
|
20
|
-
token?: core.Supplier<core.BearerToken | undefined>;
|
|
21
|
-
/** Additional headers to include in requests. */
|
|
22
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
23
|
-
}
|
|
24
|
-
interface RequestOptions {
|
|
25
|
-
/** The maximum time to wait for a response in seconds. */
|
|
26
|
-
timeoutInSeconds?: number;
|
|
27
|
-
/** The number of times to retry the request. Defaults to 2. */
|
|
28
|
-
maxRetries?: number;
|
|
29
|
-
/** A hook to abort the request. */
|
|
30
|
-
abortSignal?: AbortSignal;
|
|
31
|
-
/** Additional headers to include in the request. */
|
|
32
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
12
|
+
type Options = BaseClientOptions;
|
|
13
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
33
14
|
}
|
|
34
15
|
}
|
|
35
16
|
export declare class PaidClient {
|
|
36
|
-
protected readonly _options: PaidClient.Options
|
|
37
|
-
protected _customers:
|
|
38
|
-
protected _agents:
|
|
39
|
-
protected _products:
|
|
40
|
-
protected _contacts:
|
|
41
|
-
protected _orders:
|
|
42
|
-
protected _plans:
|
|
43
|
-
protected _usage:
|
|
44
|
-
protected _traces:
|
|
45
|
-
constructor(
|
|
46
|
-
get customers():
|
|
47
|
-
get agents():
|
|
48
|
-
get products():
|
|
49
|
-
get contacts():
|
|
50
|
-
get orders():
|
|
51
|
-
get plans():
|
|
52
|
-
get usage():
|
|
53
|
-
get traces():
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated use the standalone 'initializeTracing' instead
|
|
56
|
-
*/
|
|
57
|
-
initializeTracing(collectorEndpoint?: string): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated use the standalone 'trace()' instead
|
|
60
|
-
* Use this method to track actions like LLM costs and sending signals.
|
|
61
|
-
* The callback to this function is the work that you want to trace.
|
|
62
|
-
*
|
|
63
|
-
* @param externalCustomerId - The external customer ID
|
|
64
|
-
* @param fn - The callback function containing the work to be traced
|
|
65
|
-
* @param externalAgentId - @deprecated Use externalProductId instead
|
|
66
|
-
* @param externalProductId - The external product ID
|
|
67
|
-
* @param storePrompt - Whether to store the prompt (defaults to false)
|
|
68
|
-
* @param args - Arguments to pass to the callback function
|
|
69
|
-
* @returns The return value of the callback function
|
|
70
|
-
*/
|
|
71
|
-
trace<T extends (...args: any[]) => any>(externalCustomerId: string, fn: T, externalAgentId?: string, externalProductId?: string, storePrompt?: boolean, ...args: Parameters<T>): Promise<ReturnType<T>>;
|
|
72
|
-
/**
|
|
73
|
-
* @deprecated use the standalone 'signal()' instead
|
|
74
|
-
* Sends Paid signal. Needs to be called as part of callback to Paid.trace().
|
|
75
|
-
* When enableCostTracing flag is on, signal is associated
|
|
76
|
-
* with cost traces from the same Paid.trace() context.
|
|
77
|
-
*
|
|
78
|
-
* @param eventName - The name of the signal.
|
|
79
|
-
* @param enableCostTracing - Whether to associate this signal with cost traces
|
|
80
|
-
* from the current Paid.trace() context (default: false)
|
|
81
|
-
* @param data - Optional additional data to include with the signal
|
|
82
|
-
*
|
|
83
|
-
* @remarks
|
|
84
|
-
* When enableCostTracing is on, the signal will be associated with cost
|
|
85
|
-
* traces within the same Paid.trace() context.
|
|
86
|
-
* It is advised to only make one call to this function
|
|
87
|
-
* with enableCostTracing per Paid.trace() context.
|
|
88
|
-
* Otherwise, there will be multiple signals that refer to the same costs.
|
|
89
|
-
*/
|
|
90
|
-
signal(eventName: string): void;
|
|
91
|
-
signal(eventName: string, data: Record<string, any>): void;
|
|
92
|
-
signal(eventName: string, enableCostTracing: boolean, data?: Record<string, any>): void;
|
|
93
|
-
/**
|
|
94
|
-
* @deprecated use the standalone 'getPaidTracerProvider()' instead
|
|
95
|
-
* Export the tracer provider which user can use for his own tracing.
|
|
96
|
-
*/
|
|
97
|
-
get tracerProvider(): NodeTracerProvider | undefined;
|
|
17
|
+
protected readonly _options: NormalizedClientOptions<PaidClient.Options>;
|
|
18
|
+
protected _customers: CustomersClient | undefined;
|
|
19
|
+
protected _agents: AgentsClient | undefined;
|
|
20
|
+
protected _products: ProductsClient | undefined;
|
|
21
|
+
protected _contacts: ContactsClient | undefined;
|
|
22
|
+
protected _orders: OrdersClient | undefined;
|
|
23
|
+
protected _plans: PlansClient | undefined;
|
|
24
|
+
protected _usage: UsageClient | undefined;
|
|
25
|
+
protected _traces: TracesClient | undefined;
|
|
26
|
+
constructor(options?: PaidClient.Options);
|
|
27
|
+
get customers(): CustomersClient;
|
|
28
|
+
get agents(): AgentsClient;
|
|
29
|
+
get products(): ProductsClient;
|
|
30
|
+
get contacts(): ContactsClient;
|
|
31
|
+
get orders(): OrdersClient;
|
|
32
|
+
get plans(): PlansClient;
|
|
33
|
+
get usage(): UsageClient;
|
|
34
|
+
get traces(): TracesClient;
|
|
98
35
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -1,160 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
40
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
42
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
43
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
44
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
-
});
|
|
46
|
-
};
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
47
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
4
|
exports.PaidClient = void 0;
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const Client_js_5 = require("./api/resources/orders/client/Client.js");
|
|
56
|
-
const Client_js_6 = require("./api/resources/plans/client/Client.js");
|
|
57
|
-
const BatchUsage_js_1 = require("./wrapper/BatchUsage.js");
|
|
5
|
+
const Client_js_1 = require("./api/resources/agents/client/Client.js");
|
|
6
|
+
const Client_js_2 = require("./api/resources/contacts/client/Client.js");
|
|
7
|
+
const Client_js_3 = require("./api/resources/customers/client/Client.js");
|
|
8
|
+
const Client_js_4 = require("./api/resources/orders/client/Client.js");
|
|
9
|
+
const Client_js_5 = require("./api/resources/plans/client/Client.js");
|
|
10
|
+
const Client_js_6 = require("./api/resources/products/client/Client.js");
|
|
58
11
|
const Client_js_7 = require("./api/resources/traces/client/Client.js");
|
|
59
|
-
const
|
|
60
|
-
const
|
|
12
|
+
const Client_js_8 = require("./api/resources/usage/client/Client.js");
|
|
13
|
+
const BaseClient_js_1 = require("./BaseClient.js");
|
|
61
14
|
class PaidClient {
|
|
62
|
-
constructor(
|
|
63
|
-
this._options =
|
|
64
|
-
"X-Fern-Language": "JavaScript",
|
|
65
|
-
"X-Fern-SDK-Name": "",
|
|
66
|
-
"X-Fern-SDK-Version": "0.8.0",
|
|
67
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
68
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
69
|
-
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
15
|
+
constructor(options = {}) {
|
|
16
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
|
|
70
17
|
}
|
|
71
18
|
get customers() {
|
|
72
19
|
var _a;
|
|
73
|
-
return ((_a = this._customers) !== null && _a !== void 0 ? _a : (this._customers = new
|
|
20
|
+
return ((_a = this._customers) !== null && _a !== void 0 ? _a : (this._customers = new Client_js_3.CustomersClient(this._options)));
|
|
74
21
|
}
|
|
75
22
|
get agents() {
|
|
76
23
|
var _a;
|
|
77
|
-
return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new
|
|
24
|
+
return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new Client_js_1.AgentsClient(this._options)));
|
|
78
25
|
}
|
|
79
26
|
get products() {
|
|
80
27
|
var _a;
|
|
81
|
-
return ((_a = this._products) !== null && _a !== void 0 ? _a : (this._products = new
|
|
28
|
+
return ((_a = this._products) !== null && _a !== void 0 ? _a : (this._products = new Client_js_6.ProductsClient(this._options)));
|
|
82
29
|
}
|
|
83
30
|
get contacts() {
|
|
84
31
|
var _a;
|
|
85
|
-
return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new
|
|
32
|
+
return ((_a = this._contacts) !== null && _a !== void 0 ? _a : (this._contacts = new Client_js_2.ContactsClient(this._options)));
|
|
86
33
|
}
|
|
87
34
|
get orders() {
|
|
88
35
|
var _a;
|
|
89
|
-
return ((_a = this._orders) !== null && _a !== void 0 ? _a : (this._orders = new
|
|
36
|
+
return ((_a = this._orders) !== null && _a !== void 0 ? _a : (this._orders = new Client_js_4.OrdersClient(this._options)));
|
|
90
37
|
}
|
|
91
38
|
get plans() {
|
|
92
39
|
var _a;
|
|
93
|
-
return ((_a = this._plans) !== null && _a !== void 0 ? _a : (this._plans = new
|
|
40
|
+
return ((_a = this._plans) !== null && _a !== void 0 ? _a : (this._plans = new Client_js_5.PlansClient(this._options)));
|
|
94
41
|
}
|
|
95
42
|
get usage() {
|
|
96
43
|
var _a;
|
|
97
|
-
return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new
|
|
44
|
+
return ((_a = this._usage) !== null && _a !== void 0 ? _a : (this._usage = new Client_js_8.UsageClient(this._options)));
|
|
98
45
|
}
|
|
99
46
|
get traces() {
|
|
100
47
|
var _a;
|
|
101
|
-
return ((_a = this._traces) !== null && _a !== void 0 ? _a : (this._traces = new Client_js_7.
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* @deprecated use the standalone 'initializeTracing' instead
|
|
105
|
-
*/
|
|
106
|
-
initializeTracing(collectorEndpoint) {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
const tokenSupplier = this._options.token;
|
|
109
|
-
const token = typeof tokenSupplier === "function" ? yield tokenSupplier() : tokenSupplier;
|
|
110
|
-
const resolvedToken = yield Promise.resolve(token);
|
|
111
|
-
(0, tracing_js_1.initializeTracing)(resolvedToken, collectorEndpoint);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* @deprecated use the standalone 'trace()' instead
|
|
116
|
-
* Use this method to track actions like LLM costs and sending signals.
|
|
117
|
-
* The callback to this function is the work that you want to trace.
|
|
118
|
-
*
|
|
119
|
-
* @param externalCustomerId - The external customer ID
|
|
120
|
-
* @param fn - The callback function containing the work to be traced
|
|
121
|
-
* @param externalAgentId - @deprecated Use externalProductId instead
|
|
122
|
-
* @param externalProductId - The external product ID
|
|
123
|
-
* @param storePrompt - Whether to store the prompt (defaults to false)
|
|
124
|
-
* @param args - Arguments to pass to the callback function
|
|
125
|
-
* @returns The return value of the callback function
|
|
126
|
-
*/
|
|
127
|
-
trace(externalCustomerId_1, fn_1, externalAgentId_1, externalProductId_1) {
|
|
128
|
-
return __awaiter(this, arguments, void 0, function* (externalCustomerId, fn, externalAgentId, externalProductId, storePrompt = false, ...args) {
|
|
129
|
-
// TODO: remove this after deprecation and replace externalAgentId with externalProductId everywhere
|
|
130
|
-
if (externalProductId) {
|
|
131
|
-
externalAgentId = externalProductId;
|
|
132
|
-
}
|
|
133
|
-
return yield (0, tracing_js_1.trace)({ externalCustomerId, externalProductId: externalAgentId, storePrompt }, fn, ...args);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
signal(eventName, enableCostTracingOrData, data) {
|
|
137
|
-
let enableCostTracing = false;
|
|
138
|
-
let finalData;
|
|
139
|
-
if (typeof enableCostTracingOrData === "boolean") {
|
|
140
|
-
// Case: signal(eventName, boolean, data?)
|
|
141
|
-
enableCostTracing = enableCostTracingOrData;
|
|
142
|
-
finalData = data;
|
|
143
|
-
}
|
|
144
|
-
else if (typeof enableCostTracingOrData === "object") {
|
|
145
|
-
// Case: signal(eventName, data)
|
|
146
|
-
enableCostTracing = false;
|
|
147
|
-
finalData = enableCostTracingOrData;
|
|
148
|
-
}
|
|
149
|
-
// Case: signal(eventName) - both remain default/undefined
|
|
150
|
-
return (0, signal_js_1.signal)(eventName, enableCostTracing, finalData);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* @deprecated use the standalone 'getPaidTracerProvider()' instead
|
|
154
|
-
* Export the tracer provider which user can use for his own tracing.
|
|
155
|
-
*/
|
|
156
|
-
get tracerProvider() {
|
|
157
|
-
return (0, tracing_js_1.getPaidTracerProvider)();
|
|
48
|
+
return ((_a = this._traces) !== null && _a !== void 0 ? _a : (this._traces = new Client_js_7.TracesClient(this._options)));
|
|
158
49
|
}
|
|
159
50
|
}
|
|
160
51
|
exports.PaidClient = PaidClient;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
1
|
+
import type * as core from "../../core/index.js";
|
|
4
2
|
import * as errors from "../../errors/index.js";
|
|
5
|
-
import * as Paid from "../index.js";
|
|
6
|
-
import * as core from "../../core/index.js";
|
|
3
|
+
import type * as Paid from "../index.js";
|
|
7
4
|
export declare class BadRequestError extends errors.PaidError {
|
|
8
5
|
constructor(body: Paid.Error_, rawResponse?: core.RawResponse);
|
|
9
6
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -46,7 +44,11 @@ class BadRequestError extends errors.PaidError {
|
|
|
46
44
|
body: body,
|
|
47
45
|
rawResponse: rawResponse,
|
|
48
46
|
});
|
|
49
|
-
Object.setPrototypeOf(this,
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
exports.BadRequestError = BadRequestError;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
1
|
+
import type * as core from "../../core/index.js";
|
|
4
2
|
import * as errors from "../../errors/index.js";
|
|
5
|
-
import * as Paid from "../index.js";
|
|
6
|
-
import * as core from "../../core/index.js";
|
|
3
|
+
import type * as Paid from "../index.js";
|
|
7
4
|
export declare class ForbiddenError extends errors.PaidError {
|
|
8
5
|
constructor(body: Paid.Error_, rawResponse?: core.RawResponse);
|
|
9
6
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -46,7 +44,11 @@ class ForbiddenError extends errors.PaidError {
|
|
|
46
44
|
body: body,
|
|
47
45
|
rawResponse: rawResponse,
|
|
48
46
|
});
|
|
49
|
-
Object.setPrototypeOf(this,
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
exports.ForbiddenError = ForbiddenError;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
1
|
+
import type * as core from "../../core/index.js";
|
|
4
2
|
import * as errors from "../../errors/index.js";
|
|
5
|
-
import * as Paid from "../index.js";
|
|
6
|
-
import * as core from "../../core/index.js";
|
|
3
|
+
import type * as Paid from "../index.js";
|
|
7
4
|
export declare class InternalServerError extends errors.PaidError {
|
|
8
5
|
constructor(body: Paid.Error_, rawResponse?: core.RawResponse);
|
|
9
6
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -46,7 +44,11 @@ class InternalServerError extends errors.PaidError {
|
|
|
46
44
|
body: body,
|
|
47
45
|
rawResponse: rawResponse,
|
|
48
46
|
});
|
|
49
|
-
Object.setPrototypeOf(this,
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
exports.InternalServerError = InternalServerError;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
1
|
+
import type * as core from "../../core/index.js";
|
|
4
2
|
import * as errors from "../../errors/index.js";
|
|
5
|
-
import * as Paid from "../index.js";
|
|
6
|
-
import * as core from "../../core/index.js";
|
|
3
|
+
import type * as Paid from "../index.js";
|
|
7
4
|
export declare class NotFoundError extends errors.PaidError {
|
|
8
5
|
constructor(body: Paid.Error_, rawResponse?: core.RawResponse);
|
|
9
6
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -46,7 +44,11 @@ class NotFoundError extends errors.PaidError {
|
|
|
46
44
|
body: body,
|
|
47
45
|
rawResponse: rawResponse,
|
|
48
46
|
});
|
|
49
|
-
Object.setPrototypeOf(this,
|
|
47
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
48
|
+
if (Error.captureStackTrace) {
|
|
49
|
+
Error.captureStackTrace(this, this.constructor);
|
|
50
|
+
}
|
|
51
|
+
this.name = this.constructor.name;
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
exports.NotFoundError = NotFoundError;
|