@paid-ai/paid-node 1.0.1-alpha2 → 1.0.1-alpha8
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 +4 -5
- package/dist/cjs/BaseClient.d.ts +1 -1
- package/dist/cjs/Client.d.ts +9 -15
- package/dist/cjs/Client.js +17 -27
- package/dist/cjs/api/errors/BadRequestError.d.ts +1 -1
- package/dist/cjs/api/errors/ForbiddenError.d.ts +1 -1
- package/dist/cjs/api/errors/InternalServerError.d.ts +1 -1
- package/dist/cjs/api/errors/NotFoundError.d.ts +1 -1
- package/dist/cjs/api/resources/contacts/client/Client.d.ts +113 -31
- package/dist/cjs/api/resources/contacts/client/Client.js +341 -84
- package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.d.ts +19 -0
- package/dist/cjs/api/resources/contacts/client/requests/DeleteContactByExternalIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/contacts/client/requests/DeleteContactByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/contacts/client/requests/GetContactByExternalIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/contacts/client/requests/GetContactByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/contacts/client/requests/ListContactsRequest.d.ts +8 -0
- package/dist/cjs/api/resources/contacts/client/requests/UpdateContactByExternalIdRequest.d.ts +12 -0
- package/dist/cjs/api/resources/contacts/client/requests/UpdateContactByIdRequest.d.ts +12 -0
- package/dist/cjs/api/resources/contacts/client/requests/index.d.ts +8 -1
- package/dist/cjs/api/resources/customers/client/Client.d.ts +68 -140
- package/dist/cjs/api/resources/customers/client/Client.js +155 -521
- package/dist/cjs/api/resources/customers/client/requests/CreateCustomerRequest.d.ts +20 -0
- package/dist/cjs/api/resources/customers/client/requests/DeleteCustomerByExternalIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/customers/client/requests/DeleteCustomerByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerByExternalIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/customers/client/requests/GetCustomerByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/customers/client/requests/ListCustomersRequest.d.ts +8 -0
- package/dist/cjs/api/resources/customers/client/requests/UpdateCustomerByExternalIdRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customers/client/requests/UpdateCustomerByIdRequest.d.ts +12 -0
- package/dist/cjs/api/resources/customers/client/requests/index.d.ts +8 -5
- package/dist/cjs/api/resources/customers/index.d.ts +0 -1
- package/dist/cjs/api/resources/customers/index.js +0 -1
- package/dist/cjs/api/resources/index.d.ts +4 -10
- package/dist/cjs/api/resources/index.js +5 -11
- package/dist/cjs/api/resources/invoices/client/Client.d.ts +81 -0
- package/dist/cjs/api/resources/{usage → invoices}/client/Client.js +170 -77
- package/dist/cjs/api/resources/invoices/client/requests/GetInvoiceByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/invoices/client/requests/GetInvoiceLinesRequest.d.ts +11 -0
- package/dist/cjs/api/resources/invoices/client/requests/ListInvoicesRequest.d.ts +8 -0
- package/dist/cjs/api/resources/invoices/client/requests/UpdateInvoiceRequest.d.ts +10 -0
- package/dist/cjs/api/resources/invoices/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/orders/client/Client.d.ts +49 -91
- package/dist/cjs/api/resources/orders/client/Client.js +142 -267
- package/dist/cjs/api/resources/orders/client/requests/CreateOrderRequest.d.ts +22 -0
- package/dist/cjs/api/resources/orders/client/requests/DeleteOrderByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/orders/client/requests/GetOrderByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/orders/client/requests/GetOrderLinesRequest.d.ts +11 -0
- package/dist/cjs/api/resources/orders/client/requests/ListOrdersRequest.d.ts +8 -0
- package/dist/cjs/api/resources/orders/client/requests/UpdateOrderRequest.d.ts +22 -0
- package/dist/cjs/api/resources/orders/client/requests/index.d.ts +6 -4
- package/dist/cjs/api/resources/orders/index.d.ts +0 -1
- package/dist/cjs/api/resources/orders/index.js +0 -1
- package/dist/cjs/api/resources/products/client/Client.d.ts +74 -48
- package/dist/cjs/api/resources/products/client/Client.js +195 -184
- package/dist/cjs/api/resources/products/client/requests/CreateProductRequest.d.ts +14 -0
- package/dist/cjs/api/resources/products/client/requests/GetProductByExternalIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/products/client/requests/GetProductByIdRequest.d.ts +9 -0
- package/dist/cjs/api/resources/products/client/requests/ListProductsRequest.d.ts +8 -0
- package/dist/cjs/api/resources/products/client/requests/UpdateProductByExternalIdRequest.d.ts +12 -0
- package/dist/cjs/api/resources/products/client/requests/UpdateProductByIdRequest.d.ts +12 -0
- package/dist/cjs/api/resources/products/client/requests/index.d.ts +6 -1
- package/dist/cjs/api/resources/signals/client/Client.d.ts +36 -0
- package/dist/cjs/api/resources/{traces → signals}/client/Client.js +30 -54
- package/dist/cjs/api/resources/signals/client/requests/BulkSignalsRequest.d.ts +15 -0
- package/dist/cjs/api/resources/signals/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/Attribution.d.ts +2 -0
- package/dist/cjs/api/types/BulkSignalsResponse.d.ts +5 -0
- package/dist/cjs/api/types/Contact.d.ts +10 -15
- package/dist/cjs/api/types/ContactBillingAddress.d.ts +7 -0
- package/dist/cjs/api/types/ContactListResponse.d.ts +5 -0
- package/dist/cjs/api/types/Customer.d.ts +13 -12
- package/dist/cjs/api/types/CustomerAttribution.d.ts +2 -0
- package/dist/cjs/api/types/CustomerBillingAddress.d.ts +8 -0
- package/dist/cjs/api/types/CustomerByExternalId.d.ts +4 -0
- package/dist/cjs/api/types/CustomerById.d.ts +4 -0
- package/dist/cjs/api/types/CustomerCreationState.d.ts +5 -0
- package/dist/cjs/api/types/CustomerCreationState.js +8 -0
- package/dist/cjs/api/types/CustomerListResponse.d.ts +5 -0
- package/dist/cjs/api/types/EmptyResponse.d.ts +1 -0
- package/dist/cjs/api/types/ErrorResponse.d.ts +5 -0
- package/dist/cjs/api/types/Invoice.d.ts +57 -32
- package/dist/cjs/api/types/Invoice.js +23 -3
- package/dist/cjs/api/types/InvoiceLine.d.ts +30 -0
- package/dist/cjs/api/types/InvoiceLine.js +14 -0
- package/dist/cjs/api/types/InvoiceLinesResponse.d.ts +5 -0
- package/dist/cjs/api/types/InvoiceListResponse.d.ts +5 -0
- package/dist/cjs/api/types/Order.d.ts +24 -16
- package/dist/cjs/api/types/OrderCreationState.d.ts +5 -0
- package/dist/cjs/api/types/{CreationState.js → OrderCreationState.js} +3 -3
- package/dist/cjs/api/types/OrderLine.d.ts +6 -15
- package/dist/cjs/api/types/OrderLinesResponse.d.ts +5 -0
- package/dist/cjs/api/types/OrderListResponse.d.ts +5 -0
- package/dist/cjs/api/types/Pagination.d.ts +6 -0
- package/dist/cjs/api/types/Product.d.ts +7 -26
- package/dist/cjs/api/types/Product.js +0 -10
- package/dist/cjs/api/types/ProductByExternalId.d.ts +4 -0
- package/dist/cjs/api/types/ProductById.d.ts +4 -0
- package/dist/cjs/api/types/ProductListResponse.d.ts +5 -0
- package/dist/cjs/api/types/Signal.d.ts +5 -16
- package/dist/cjs/api/types/UpdateContactRequest.d.ts +10 -0
- package/dist/cjs/api/types/UpdateCustomerRequest.d.ts +14 -0
- package/dist/cjs/api/types/UpdateProductRequest.d.ts +8 -0
- package/dist/cjs/api/types/index.d.ts +25 -44
- package/dist/cjs/api/types/index.js +25 -44
- package/dist/cjs/environments.d.ts +2 -2
- package/dist/cjs/environments.js +1 -1
- package/dist/cjs/tracing/aiSdkSpanProcessor.d.ts +17 -0
- package/dist/cjs/tracing/aiSdkSpanProcessor.js +101 -0
- package/dist/cjs/tracing/autoInstrumentation.d.ts +1 -3
- package/dist/cjs/tracing/autoInstrumentation.js +99 -41
- package/dist/cjs/tracing/index.d.ts +2 -1
- package/dist/cjs/tracing/index.js +3 -1
- package/dist/cjs/tracing/signal.js +1 -4
- package/dist/cjs/tracing/spanProcessor.js +12 -0
- package/dist/cjs/tracing/tracing.js +10 -11
- package/dist/cjs/tracing/wrappers/anthropicWrapper.js +2 -2
- package/dist/cjs/tracing/wrappers/openAiWrapper.js +2 -2
- package/dist/cjs/tracing/wrappers/vercelAIWrapper.js +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +1 -1
- package/dist/esm/Client.d.mts +9 -15
- package/dist/esm/Client.mjs +13 -23
- package/dist/esm/api/errors/BadRequestError.d.mts +1 -1
- package/dist/esm/api/errors/ForbiddenError.d.mts +1 -1
- package/dist/esm/api/errors/InternalServerError.d.mts +1 -1
- package/dist/esm/api/errors/NotFoundError.d.mts +1 -1
- package/dist/esm/api/resources/contacts/client/Client.d.mts +113 -31
- package/dist/esm/api/resources/contacts/client/Client.mjs +341 -84
- package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.d.mts +19 -0
- package/dist/esm/api/resources/contacts/client/requests/DeleteContactByExternalIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/contacts/client/requests/DeleteContactByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/contacts/client/requests/GetContactByExternalIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/contacts/client/requests/GetContactByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/contacts/client/requests/ListContactsRequest.d.mts +8 -0
- package/dist/esm/api/resources/contacts/client/requests/UpdateContactByExternalIdRequest.d.mts +12 -0
- package/dist/esm/api/resources/contacts/client/requests/UpdateContactByIdRequest.d.mts +12 -0
- package/dist/esm/api/resources/contacts/client/requests/index.d.mts +8 -1
- package/dist/esm/api/resources/customers/client/Client.d.mts +68 -140
- package/dist/esm/api/resources/customers/client/Client.mjs +155 -521
- package/dist/esm/api/resources/customers/client/requests/CreateCustomerRequest.d.mts +20 -0
- package/dist/esm/api/resources/customers/client/requests/DeleteCustomerByExternalIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/customers/client/requests/DeleteCustomerByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerByExternalIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/customers/client/requests/GetCustomerByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/customers/client/requests/ListCustomersRequest.d.mts +8 -0
- package/dist/esm/api/resources/customers/client/requests/UpdateCustomerByExternalIdRequest.d.mts +12 -0
- package/dist/esm/api/resources/customers/client/requests/UpdateCustomerByIdRequest.d.mts +12 -0
- package/dist/esm/api/resources/customers/client/requests/index.d.mts +8 -5
- package/dist/esm/api/resources/customers/index.d.mts +0 -1
- package/dist/esm/api/resources/customers/index.mjs +0 -1
- package/dist/esm/api/resources/index.d.mts +4 -10
- package/dist/esm/api/resources/index.mjs +4 -10
- package/dist/esm/api/resources/invoices/client/Client.d.mts +81 -0
- package/dist/esm/api/resources/{usage → invoices}/client/Client.mjs +168 -75
- package/dist/esm/api/resources/invoices/client/requests/GetInvoiceByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/invoices/client/requests/GetInvoiceLinesRequest.d.mts +11 -0
- package/dist/esm/api/resources/invoices/client/requests/ListInvoicesRequest.d.mts +8 -0
- package/dist/esm/api/resources/invoices/client/requests/UpdateInvoiceRequest.d.mts +10 -0
- package/dist/esm/api/resources/invoices/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/orders/client/Client.d.mts +49 -91
- package/dist/esm/api/resources/orders/client/Client.mjs +142 -267
- package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.d.mts +22 -0
- package/dist/esm/api/resources/orders/client/requests/DeleteOrderByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/orders/client/requests/GetOrderByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/orders/client/requests/GetOrderLinesRequest.d.mts +11 -0
- package/dist/esm/api/resources/orders/client/requests/ListOrdersRequest.d.mts +8 -0
- package/dist/esm/api/resources/orders/client/requests/UpdateOrderRequest.d.mts +22 -0
- package/dist/esm/api/resources/orders/client/requests/index.d.mts +6 -4
- package/dist/esm/api/resources/orders/index.d.mts +0 -1
- package/dist/esm/api/resources/orders/index.mjs +0 -1
- package/dist/esm/api/resources/products/client/Client.d.mts +74 -48
- package/dist/esm/api/resources/products/client/Client.mjs +195 -184
- package/dist/esm/api/resources/products/client/requests/CreateProductRequest.d.mts +14 -0
- package/dist/esm/api/resources/products/client/requests/GetProductByExternalIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/products/client/requests/GetProductByIdRequest.d.mts +9 -0
- package/dist/esm/api/resources/products/client/requests/ListProductsRequest.d.mts +8 -0
- package/dist/esm/api/resources/products/client/requests/UpdateProductByExternalIdRequest.d.mts +12 -0
- package/dist/esm/api/resources/products/client/requests/UpdateProductByIdRequest.d.mts +12 -0
- package/dist/esm/api/resources/products/client/requests/index.d.mts +6 -1
- package/dist/esm/api/resources/signals/client/Client.d.mts +36 -0
- package/dist/esm/api/resources/{traces → signals}/client/Client.mjs +28 -52
- package/dist/esm/api/resources/signals/client/requests/BulkSignalsRequest.d.mts +15 -0
- package/dist/esm/api/resources/signals/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/Attribution.d.mts +2 -0
- package/dist/esm/api/types/BulkSignalsResponse.d.mts +5 -0
- package/dist/esm/api/types/Contact.d.mts +10 -15
- package/dist/esm/api/types/ContactBillingAddress.d.mts +7 -0
- package/dist/esm/api/types/ContactListResponse.d.mts +5 -0
- package/dist/esm/api/types/Customer.d.mts +13 -12
- package/dist/esm/api/types/CustomerAttribution.d.mts +2 -0
- package/dist/esm/api/types/CustomerBillingAddress.d.mts +8 -0
- package/dist/esm/api/types/CustomerByExternalId.d.mts +4 -0
- package/dist/esm/api/types/CustomerById.d.mts +4 -0
- package/dist/esm/api/types/CustomerCreationState.d.mts +5 -0
- package/dist/esm/api/types/CustomerCreationState.mjs +5 -0
- package/dist/esm/api/types/CustomerListResponse.d.mts +5 -0
- package/dist/esm/api/types/EmptyResponse.d.mts +1 -0
- package/dist/esm/api/types/ErrorResponse.d.mts +5 -0
- package/dist/esm/api/types/Invoice.d.mts +57 -32
- package/dist/esm/api/types/Invoice.mjs +23 -3
- package/dist/esm/api/types/InvoiceLine.d.mts +30 -0
- package/dist/esm/api/types/InvoiceLine.mjs +11 -0
- package/dist/esm/api/types/InvoiceLinesResponse.d.mts +5 -0
- package/dist/esm/api/types/InvoiceListResponse.d.mts +5 -0
- package/dist/esm/api/types/Order.d.mts +24 -16
- package/dist/esm/api/types/OrderCreationState.d.mts +5 -0
- package/dist/esm/api/types/{CreationState.mjs → OrderCreationState.mjs} +2 -2
- package/dist/esm/api/types/OrderLine.d.mts +6 -15
- package/dist/esm/api/types/OrderLinesResponse.d.mts +5 -0
- package/dist/esm/api/types/OrderListResponse.d.mts +5 -0
- package/dist/esm/api/types/Pagination.d.mts +6 -0
- package/dist/esm/api/types/Product.d.mts +7 -26
- package/dist/esm/api/types/Product.mjs +1 -9
- package/dist/esm/api/types/ProductByExternalId.d.mts +4 -0
- package/dist/esm/api/types/ProductById.d.mts +4 -0
- package/dist/esm/api/types/ProductListResponse.d.mts +5 -0
- package/dist/esm/api/types/Signal.d.mts +5 -16
- package/dist/esm/api/types/UpdateContactRequest.d.mts +10 -0
- package/dist/esm/api/types/UpdateCustomerRequest.d.mts +14 -0
- package/dist/esm/api/types/UpdateProductRequest.d.mts +8 -0
- package/dist/esm/api/types/index.d.mts +25 -44
- package/dist/esm/api/types/index.mjs +25 -44
- package/dist/esm/environments.d.mts +2 -2
- package/dist/esm/environments.mjs +1 -1
- package/dist/esm/tracing/aiSdkSpanProcessor.d.mts +17 -0
- package/dist/esm/tracing/aiSdkSpanProcessor.mjs +97 -0
- package/dist/esm/tracing/autoInstrumentation.d.mts +1 -3
- package/dist/esm/tracing/autoInstrumentation.mjs +66 -41
- package/dist/esm/tracing/index.d.mts +2 -1
- package/dist/esm/tracing/index.mjs +2 -1
- package/dist/esm/tracing/signal.mjs +1 -4
- package/dist/esm/tracing/spanProcessor.mjs +12 -0
- package/dist/esm/tracing/tracing.mjs +10 -11
- package/dist/esm/tracing/wrappers/anthropicWrapper.mjs +2 -2
- package/dist/esm/tracing/wrappers/openAiWrapper.mjs +2 -2
- package/dist/esm/tracing/wrappers/vercelAIWrapper.mjs +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +5 -74
- package/reference.md +410 -1671
- package/dist/cjs/api/resources/agents/client/Client.d.ts +0 -154
- package/dist/cjs/api/resources/agents/client/Client.js +0 -542
- package/dist/cjs/api/resources/agents/client/requests/AgentCreate.d.ts +0 -15
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/contacts/client/requests/ContactCreate.d.ts +0 -26
- package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.d.ts +0 -36
- package/dist/cjs/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.d.ts +0 -14
- package/dist/cjs/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.d.ts +0 -18
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.ts +0 -19
- package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.ts +0 -19
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementRequestView.d.ts +0 -5
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementRequestView.js +0 -8
- package/dist/cjs/api/resources/customers/types/CustomersCheckEntitlementResponse.d.ts +0 -4
- package/dist/cjs/api/resources/customers/types/index.d.ts +0 -2
- package/dist/cjs/api/resources/customers/types/index.js +0 -18
- package/dist/cjs/api/resources/orders/client/requests/CancelRenewalRequest.d.ts +0 -13
- package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +0 -35
- package/dist/cjs/api/resources/orders/client/requests/OrdersActivateAndPayRequest.d.ts +0 -13
- package/dist/cjs/api/resources/orders/client/requests/ProrationUpgradeRequest.d.ts +0 -24
- package/dist/cjs/api/resources/orders/resources/index.d.ts +0 -2
- package/dist/cjs/api/resources/orders/resources/index.js +0 -41
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +0 -32
- package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +0 -127
- package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts +0 -16
- package/dist/cjs/api/resources/orders/resources/lines/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/plans/client/Client.d.ts +0 -128
- package/dist/cjs/api/resources/plans/client/Client.js +0 -551
- package/dist/cjs/api/resources/plans/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/plans/client/index.js +0 -17
- package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.d.ts +0 -22
- package/dist/cjs/api/resources/plans/client/requests/PlansSubscribeRequest.d.ts +0 -13
- package/dist/cjs/api/resources/plans/client/requests/PlansUnsubscribeRequest.d.ts +0 -10
- package/dist/cjs/api/resources/plans/client/requests/PlansUpgradeRequest.d.ts +0 -16
- package/dist/cjs/api/resources/plans/client/requests/index.d.ts +0 -4
- package/dist/cjs/api/resources/plans/client/requests/index.js +0 -2
- package/dist/cjs/api/resources/plans/index.d.ts +0 -1
- package/dist/cjs/api/resources/plans/index.js +0 -17
- package/dist/cjs/api/resources/products/client/requests/ProductCreate.d.ts +0 -26
- package/dist/cjs/api/resources/products/client/requests/ProductCreate.js +0 -12
- package/dist/cjs/api/resources/traces/client/Client.d.ts +0 -35
- package/dist/cjs/api/resources/traces/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/traces/client/index.js +0 -17
- package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.d.ts +0 -31
- package/dist/cjs/api/resources/traces/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/traces/client/requests/index.js +0 -2
- package/dist/cjs/api/resources/traces/index.d.ts +0 -1
- package/dist/cjs/api/resources/traces/index.js +0 -17
- package/dist/cjs/api/resources/usage/client/Client.d.ts +0 -72
- package/dist/cjs/api/resources/usage/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/usage/client/index.js +0 -17
- package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.d.ts +0 -25
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkRequest.d.ts +0 -10
- package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.ts +0 -26
- package/dist/cjs/api/resources/usage/client/requests/index.d.ts +0 -3
- package/dist/cjs/api/resources/usage/client/requests/index.js +0 -2
- package/dist/cjs/api/resources/usage/index.d.ts +0 -2
- package/dist/cjs/api/resources/usage/index.js +0 -18
- package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.d.ts +0 -14
- package/dist/cjs/api/resources/usage/types/index.d.ts +0 -1
- package/dist/cjs/api/resources/usage/types/index.js +0 -17
- package/dist/cjs/api/types/Address.d.ts +0 -8
- package/dist/cjs/api/types/Agent.d.ts +0 -11
- package/dist/cjs/api/types/AgentAttribute.d.ts +0 -6
- package/dist/cjs/api/types/AgentPricePoint.d.ts +0 -7
- package/dist/cjs/api/types/AgentPricePointTiers.d.ts +0 -5
- package/dist/cjs/api/types/AgentUpdate.d.ts +0 -9
- package/dist/cjs/api/types/ApiError.d.ts +0 -9
- package/dist/cjs/api/types/BillingFrequency.d.ts +0 -6
- package/dist/cjs/api/types/BillingFrequency.js +0 -9
- package/dist/cjs/api/types/CancelRenewalResponse.d.ts +0 -15
- package/dist/cjs/api/types/ChargeType.d.ts +0 -7
- package/dist/cjs/api/types/ChargeType.js +0 -10
- package/dist/cjs/api/types/ContactCreateForCustomer.d.ts +0 -15
- package/dist/cjs/api/types/CostAmount.d.ts +0 -9
- package/dist/cjs/api/types/CostTrace.d.ts +0 -19
- package/dist/cjs/api/types/CostTracesResponse.d.ts +0 -8
- package/dist/cjs/api/types/CreationSource.d.ts +0 -7
- package/dist/cjs/api/types/CreationSource.js +0 -10
- package/dist/cjs/api/types/CreationState.d.ts +0 -5
- package/dist/cjs/api/types/CustomerUpdate.d.ts +0 -14
- package/dist/cjs/api/types/EntitlementUsage.d.ts +0 -20
- package/dist/cjs/api/types/Error_.d.ts +0 -7
- package/dist/cjs/api/types/OrderLineAttribute.d.ts +0 -7
- package/dist/cjs/api/types/OrderLineAttributeCreateOne.d.ts +0 -1
- package/dist/cjs/api/types/OrderLineAttributePricing.d.ts +0 -8
- package/dist/cjs/api/types/OrderLineCreate.d.ts +0 -19
- package/dist/cjs/api/types/PaginationMeta.d.ts +0 -25
- package/dist/cjs/api/types/PaymentMethod.d.ts +0 -54
- package/dist/cjs/api/types/PaymentMethod.js +0 -20
- package/dist/cjs/api/types/Plan.d.ts +0 -91
- package/dist/cjs/api/types/Plan.js +0 -22
- package/dist/cjs/api/types/PlanGroup.d.ts +0 -20
- package/dist/cjs/api/types/PlanWithFeatures.d.ts +0 -67
- package/dist/cjs/api/types/PlanWithFeatures.js +0 -22
- package/dist/cjs/api/types/PricePoint.d.ts +0 -7
- package/dist/cjs/api/types/Pricing.d.ts +0 -10
- package/dist/cjs/api/types/PricingModelType.d.ts +0 -7
- package/dist/cjs/api/types/PricingModelType.js +0 -10
- package/dist/cjs/api/types/ProductUpdate.d.ts +0 -20
- package/dist/cjs/api/types/ProductUpdate.js +0 -12
- package/dist/cjs/api/types/ProrationAttributeUpdate.d.ts +0 -11
- package/dist/cjs/api/types/ProrationDetail.d.ts +0 -16
- package/dist/cjs/api/types/ProrationUpgradeResponse.d.ts +0 -22
- package/dist/cjs/api/types/Salutation.d.ts +0 -9
- package/dist/cjs/api/types/Salutation.js +0 -12
- package/dist/cjs/api/types/SignalV2.d.ts +0 -19
- package/dist/cjs/api/types/TaxExemptStatus.d.ts +0 -6
- package/dist/cjs/api/types/TaxExemptStatus.js +0 -9
- package/dist/cjs/api/types/Tier.d.ts +0 -5
- package/dist/cjs/api/types/Trace.d.ts +0 -23
- package/dist/cjs/api/types/TracesResponse.d.ts +0 -8
- package/dist/cjs/api/types/UsagePaginationMeta.d.ts +0 -13
- package/dist/cjs/api/types/UsageSummariesResponse.d.ts +0 -8
- package/dist/cjs/api/types/UsageSummary.d.ts +0 -55
- package/dist/cjs/integrations/adapters/expressjs/base-adapter.d.ts +0 -20
- package/dist/cjs/integrations/adapters/expressjs/base-adapter.js +0 -66
- package/dist/cjs/integrations/adapters/expressjs/index.d.ts +0 -6
- package/dist/cjs/integrations/adapters/expressjs/index.js +0 -21
- package/dist/cjs/integrations/adapters/expressjs/routes.d.ts +0 -180
- package/dist/cjs/integrations/adapters/expressjs/routes.js +0 -306
- package/dist/cjs/integrations/adapters/nestjs/index.d.ts +0 -7
- package/dist/cjs/integrations/adapters/nestjs/index.js +0 -23
- package/dist/cjs/integrations/adapters/nextjs/base-adapter.d.ts +0 -11
- package/dist/cjs/integrations/adapters/nextjs/base-adapter.js +0 -58
- package/dist/cjs/integrations/adapters/nextjs/index.d.ts +0 -5
- package/dist/cjs/integrations/adapters/nextjs/index.js +0 -22
- package/dist/cjs/integrations/adapters/nextjs/routes.d.ts +0 -302
- package/dist/cjs/integrations/adapters/nextjs/routes.js +0 -356
- package/dist/cjs/integrations/client.d.ts +0 -49
- package/dist/cjs/integrations/client.js +0 -93
- package/dist/cjs/integrations/controllers/billing.d.ts +0 -182
- package/dist/cjs/integrations/controllers/billing.js +0 -267
- package/dist/cjs/integrations/controllers/contacts.d.ts +0 -66
- package/dist/cjs/integrations/controllers/contacts.js +0 -145
- package/dist/cjs/integrations/controllers/customers.d.ts +0 -96
- package/dist/cjs/integrations/controllers/customers.js +0 -206
- package/dist/cjs/integrations/controllers/index.d.ts +0 -7
- package/dist/cjs/integrations/controllers/index.js +0 -42
- package/dist/cjs/integrations/controllers/invoices.d.ts +0 -36
- package/dist/cjs/integrations/controllers/invoices.js +0 -72
- package/dist/cjs/integrations/controllers/orders.d.ts +0 -68
- package/dist/cjs/integrations/controllers/orders.js +0 -229
- package/dist/cjs/integrations/controllers/plans.d.ts +0 -208
- package/dist/cjs/integrations/controllers/plans.js +0 -365
- package/dist/cjs/integrations/controllers/provision-users.d.ts +0 -62
- package/dist/cjs/integrations/controllers/provision-users.js +0 -130
- package/dist/cjs/integrations/index.d.ts +0 -29
- package/dist/cjs/integrations/index.js +0 -44
- package/dist/cjs/integrations/types.d.ts +0 -122
- package/dist/cjs/integrations/types.js +0 -2
- package/dist/cjs/integrations/utils/api-fetch.d.ts +0 -18
- package/dist/cjs/integrations/utils/api-fetch.js +0 -53
- package/dist/cjs/integrations/utils/base-handler.d.ts +0 -79
- package/dist/cjs/integrations/utils/base-handler.js +0 -168
- package/dist/cjs/integrations/utils/create-adapter.d.ts +0 -30
- package/dist/cjs/integrations/utils/create-adapter.js +0 -57
- package/dist/esm/api/resources/agents/client/Client.d.mts +0 -154
- package/dist/esm/api/resources/agents/client/Client.mjs +0 -505
- package/dist/esm/api/resources/agents/client/requests/AgentCreate.d.mts +0 -15
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/contacts/client/requests/ContactCreate.d.mts +0 -26
- package/dist/esm/api/resources/customers/client/requests/CustomerCreate.d.mts +0 -36
- package/dist/esm/api/resources/customers/client/requests/CustomersCheckEntitlementRequest.d.mts +0 -14
- package/dist/esm/api/resources/customers/client/requests/CustomersCreatePaymentMethodRequest.d.mts +0 -18
- package/dist/esm/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.mts +0 -19
- package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.mts +0 -19
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementRequestView.d.mts +0 -5
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementRequestView.mjs +0 -5
- package/dist/esm/api/resources/customers/types/CustomersCheckEntitlementResponse.d.mts +0 -4
- package/dist/esm/api/resources/customers/types/index.d.mts +0 -2
- package/dist/esm/api/resources/customers/types/index.mjs +0 -2
- package/dist/esm/api/resources/orders/client/requests/CancelRenewalRequest.d.mts +0 -13
- package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +0 -35
- package/dist/esm/api/resources/orders/client/requests/OrdersActivateAndPayRequest.d.mts +0 -13
- package/dist/esm/api/resources/orders/client/requests/ProrationUpgradeRequest.d.mts +0 -24
- package/dist/esm/api/resources/orders/resources/index.d.mts +0 -2
- package/dist/esm/api/resources/orders/resources/index.mjs +0 -2
- package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +0 -32
- package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +0 -90
- package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts +0 -16
- package/dist/esm/api/resources/orders/resources/lines/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/plans/client/Client.d.mts +0 -128
- package/dist/esm/api/resources/plans/client/Client.mjs +0 -514
- package/dist/esm/api/resources/plans/client/index.d.mts +0 -1
- package/dist/esm/api/resources/plans/client/index.mjs +0 -1
- package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.d.mts +0 -22
- package/dist/esm/api/resources/plans/client/requests/PlansSubscribeRequest.d.mts +0 -13
- package/dist/esm/api/resources/plans/client/requests/PlansUnsubscribeRequest.d.mts +0 -10
- package/dist/esm/api/resources/plans/client/requests/PlansUpgradeRequest.d.mts +0 -16
- package/dist/esm/api/resources/plans/client/requests/index.d.mts +0 -4
- package/dist/esm/api/resources/plans/client/requests/index.mjs +0 -1
- package/dist/esm/api/resources/plans/index.d.mts +0 -1
- package/dist/esm/api/resources/plans/index.mjs +0 -1
- package/dist/esm/api/resources/products/client/requests/ProductCreate.d.mts +0 -26
- package/dist/esm/api/resources/products/client/requests/ProductCreate.mjs +0 -9
- package/dist/esm/api/resources/traces/client/Client.d.mts +0 -35
- package/dist/esm/api/resources/traces/client/index.d.mts +0 -1
- package/dist/esm/api/resources/traces/client/index.mjs +0 -1
- package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.d.mts +0 -31
- package/dist/esm/api/resources/traces/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/traces/client/requests/index.mjs +0 -1
- package/dist/esm/api/resources/traces/index.d.mts +0 -1
- package/dist/esm/api/resources/traces/index.mjs +0 -1
- package/dist/esm/api/resources/usage/client/Client.d.mts +0 -72
- package/dist/esm/api/resources/usage/client/index.d.mts +0 -1
- package/dist/esm/api/resources/usage/client/index.mjs +0 -1
- package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.d.mts +0 -25
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkRequest.d.mts +0 -10
- package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.mts +0 -26
- package/dist/esm/api/resources/usage/client/requests/index.d.mts +0 -3
- package/dist/esm/api/resources/usage/client/requests/index.mjs +0 -1
- package/dist/esm/api/resources/usage/index.d.mts +0 -2
- package/dist/esm/api/resources/usage/index.mjs +0 -2
- package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.d.mts +0 -14
- package/dist/esm/api/resources/usage/types/index.d.mts +0 -1
- package/dist/esm/api/resources/usage/types/index.mjs +0 -1
- package/dist/esm/api/types/Address.d.mts +0 -8
- package/dist/esm/api/types/Agent.d.mts +0 -11
- package/dist/esm/api/types/AgentAttribute.d.mts +0 -6
- package/dist/esm/api/types/AgentPricePoint.d.mts +0 -7
- package/dist/esm/api/types/AgentPricePointTiers.d.mts +0 -5
- package/dist/esm/api/types/AgentUpdate.d.mts +0 -9
- package/dist/esm/api/types/ApiError.d.mts +0 -9
- package/dist/esm/api/types/BillingFrequency.d.mts +0 -6
- package/dist/esm/api/types/BillingFrequency.mjs +0 -6
- package/dist/esm/api/types/CancelRenewalResponse.d.mts +0 -15
- package/dist/esm/api/types/ChargeType.d.mts +0 -7
- package/dist/esm/api/types/ChargeType.mjs +0 -7
- package/dist/esm/api/types/ContactCreateForCustomer.d.mts +0 -15
- package/dist/esm/api/types/CostAmount.d.mts +0 -9
- package/dist/esm/api/types/CostTrace.d.mts +0 -19
- package/dist/esm/api/types/CostTracesResponse.d.mts +0 -8
- package/dist/esm/api/types/CreationSource.d.mts +0 -7
- package/dist/esm/api/types/CreationSource.mjs +0 -7
- package/dist/esm/api/types/CreationState.d.mts +0 -5
- package/dist/esm/api/types/CustomerUpdate.d.mts +0 -14
- package/dist/esm/api/types/EntitlementUsage.d.mts +0 -20
- package/dist/esm/api/types/Error_.d.mts +0 -7
- package/dist/esm/api/types/OrderLineAttribute.d.mts +0 -7
- package/dist/esm/api/types/OrderLineAttributeCreateOne.d.mts +0 -1
- package/dist/esm/api/types/OrderLineAttributePricing.d.mts +0 -8
- package/dist/esm/api/types/OrderLineCreate.d.mts +0 -19
- package/dist/esm/api/types/PaginationMeta.d.mts +0 -25
- package/dist/esm/api/types/PaymentMethod.d.mts +0 -54
- package/dist/esm/api/types/PaymentMethod.mjs +0 -17
- package/dist/esm/api/types/Plan.d.mts +0 -91
- package/dist/esm/api/types/Plan.mjs +0 -19
- package/dist/esm/api/types/PlanGroup.d.mts +0 -20
- package/dist/esm/api/types/PlanWithFeatures.d.mts +0 -67
- package/dist/esm/api/types/PlanWithFeatures.mjs +0 -19
- package/dist/esm/api/types/PricePoint.d.mts +0 -7
- package/dist/esm/api/types/Pricing.d.mts +0 -10
- package/dist/esm/api/types/PricingModelType.d.mts +0 -7
- package/dist/esm/api/types/PricingModelType.mjs +0 -7
- package/dist/esm/api/types/ProductUpdate.d.mts +0 -20
- package/dist/esm/api/types/ProductUpdate.mjs +0 -9
- package/dist/esm/api/types/ProrationAttributeUpdate.d.mts +0 -11
- package/dist/esm/api/types/ProrationDetail.d.mts +0 -16
- package/dist/esm/api/types/ProrationUpgradeResponse.d.mts +0 -22
- package/dist/esm/api/types/Salutation.d.mts +0 -9
- package/dist/esm/api/types/Salutation.mjs +0 -9
- package/dist/esm/api/types/SignalV2.d.mts +0 -19
- package/dist/esm/api/types/TaxExemptStatus.d.mts +0 -6
- package/dist/esm/api/types/TaxExemptStatus.mjs +0 -6
- package/dist/esm/api/types/Tier.d.mts +0 -5
- package/dist/esm/api/types/Trace.d.mts +0 -23
- package/dist/esm/api/types/TracesResponse.d.mts +0 -8
- package/dist/esm/api/types/UsagePaginationMeta.d.mts +0 -13
- package/dist/esm/api/types/UsageSummariesResponse.d.mts +0 -8
- package/dist/esm/api/types/UsageSummary.d.mts +0 -55
- package/dist/esm/integrations/adapters/expressjs/base-adapter.d.mts +0 -20
- package/dist/esm/integrations/adapters/expressjs/base-adapter.mjs +0 -62
- package/dist/esm/integrations/adapters/expressjs/index.d.mts +0 -6
- package/dist/esm/integrations/adapters/expressjs/index.mjs +0 -6
- package/dist/esm/integrations/adapters/expressjs/routes.d.mts +0 -180
- package/dist/esm/integrations/adapters/expressjs/routes.mjs +0 -294
- package/dist/esm/integrations/adapters/nestjs/index.d.mts +0 -7
- package/dist/esm/integrations/adapters/nestjs/index.mjs +0 -7
- package/dist/esm/integrations/adapters/nextjs/base-adapter.d.mts +0 -11
- package/dist/esm/integrations/adapters/nextjs/base-adapter.mjs +0 -55
- package/dist/esm/integrations/adapters/nextjs/index.d.mts +0 -5
- package/dist/esm/integrations/adapters/nextjs/index.mjs +0 -5
- package/dist/esm/integrations/adapters/nextjs/routes.d.mts +0 -302
- package/dist/esm/integrations/adapters/nextjs/routes.mjs +0 -340
- package/dist/esm/integrations/client.d.mts +0 -49
- package/dist/esm/integrations/client.mjs +0 -89
- package/dist/esm/integrations/controllers/billing.d.mts +0 -182
- package/dist/esm/integrations/controllers/billing.mjs +0 -259
- package/dist/esm/integrations/controllers/contacts.d.mts +0 -66
- package/dist/esm/integrations/controllers/contacts.mjs +0 -141
- package/dist/esm/integrations/controllers/customers.d.mts +0 -96
- package/dist/esm/integrations/controllers/customers.mjs +0 -200
- package/dist/esm/integrations/controllers/index.d.mts +0 -7
- package/dist/esm/integrations/controllers/index.mjs +0 -7
- package/dist/esm/integrations/controllers/invoices.d.mts +0 -36
- package/dist/esm/integrations/controllers/invoices.mjs +0 -68
- package/dist/esm/integrations/controllers/orders.d.mts +0 -68
- package/dist/esm/integrations/controllers/orders.mjs +0 -224
- package/dist/esm/integrations/controllers/plans.d.mts +0 -208
- package/dist/esm/integrations/controllers/plans.mjs +0 -353
- package/dist/esm/integrations/controllers/provision-users.d.mts +0 -62
- package/dist/esm/integrations/controllers/provision-users.mjs +0 -126
- package/dist/esm/integrations/index.d.mts +0 -29
- package/dist/esm/integrations/index.mjs +0 -28
- package/dist/esm/integrations/types.d.mts +0 -122
- package/dist/esm/integrations/types.mjs +0 -1
- package/dist/esm/integrations/utils/api-fetch.d.mts +0 -18
- package/dist/esm/integrations/utils/api-fetch.mjs +0 -50
- package/dist/esm/integrations/utils/base-handler.d.mts +0 -79
- package/dist/esm/integrations/utils/base-handler.mjs +0 -164
- package/dist/esm/integrations/utils/create-adapter.d.mts +0 -30
- package/dist/esm/integrations/utils/create-adapter.mjs +0 -54
- /package/dist/cjs/api/resources/{agents/client/requests/AgentCreate.js → contacts/client/requests/CreateContactRequest.js} +0 -0
- /package/dist/cjs/api/resources/contacts/client/requests/{ContactCreate.js → DeleteContactByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customers/client/requests/CustomerCreate.js → contacts/client/requests/DeleteContactByIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customers/client/requests/CustomersCheckEntitlementRequest.js → contacts/client/requests/GetContactByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customers/client/requests/CustomersCreatePaymentMethodRequest.js → contacts/client/requests/GetContactByIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customers/client/requests/CustomersGetCostsByExternalIdRequest.js → contacts/client/requests/ListContactsRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customers/client/requests/CustomersGetUsageByExternalIdRequest.js → contacts/client/requests/UpdateContactByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{customers/types/CustomersCheckEntitlementResponse.js → contacts/client/requests/UpdateContactByIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{orders/client/requests/CancelRenewalRequest.js → customers/client/requests/CreateCustomerRequest.js} +0 -0
- /package/dist/cjs/api/resources/{orders/client/requests/OrderCreate.js → customers/client/requests/DeleteCustomerByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{orders/client/requests/OrdersActivateAndPayRequest.js → customers/client/requests/DeleteCustomerByIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{orders/client/requests/ProrationUpgradeRequest.js → customers/client/requests/GetCustomerByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{orders/resources/lines/client/requests/LinesUpdateRequest.js → customers/client/requests/GetCustomerByIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{plans/client/requests/PlansGetUsageRequest.js → customers/client/requests/ListCustomersRequest.js} +0 -0
- /package/dist/cjs/api/resources/{plans/client/requests/PlansSubscribeRequest.js → customers/client/requests/UpdateCustomerByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{plans/client/requests/PlansUnsubscribeRequest.js → customers/client/requests/UpdateCustomerByIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{agents → invoices}/client/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{agents → invoices}/client/index.js +0 -0
- /package/dist/cjs/api/resources/{plans/client/requests/PlansUpgradeRequest.js → invoices/client/requests/GetInvoiceByIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{traces/client/requests/GetTracesRequest.js → invoices/client/requests/GetInvoiceLinesRequest.js} +0 -0
- /package/dist/cjs/api/resources/{usage/client/requests/UsageCheckUsageRequest.js → invoices/client/requests/ListInvoicesRequest.js} +0 -0
- /package/dist/cjs/api/resources/{usage/client/requests/UsageRecordBulkRequest.js → invoices/client/requests/UpdateInvoiceRequest.js} +0 -0
- /package/dist/cjs/api/resources/{agents → invoices}/client/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{agents → invoices}/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{agents → invoices}/index.js +0 -0
- /package/dist/cjs/api/resources/{usage/client/requests/UsageRecordBulkV2Request.js → orders/client/requests/CreateOrderRequest.js} +0 -0
- /package/dist/cjs/api/resources/{usage/types/UsageCheckUsageResponse.js → orders/client/requests/DeleteOrderByIdRequest.js} +0 -0
- /package/dist/cjs/api/{types/Address.js → resources/orders/client/requests/GetOrderByIdRequest.js} +0 -0
- /package/dist/cjs/api/{types/Agent.js → resources/orders/client/requests/GetOrderLinesRequest.js} +0 -0
- /package/dist/cjs/api/{types/AgentAttribute.js → resources/orders/client/requests/ListOrdersRequest.js} +0 -0
- /package/dist/cjs/api/{types/AgentPricePoint.js → resources/orders/client/requests/UpdateOrderRequest.js} +0 -0
- /package/dist/cjs/api/{types/AgentPricePointTiers.js → resources/products/client/requests/CreateProductRequest.js} +0 -0
- /package/dist/cjs/api/{types/AgentUpdate.js → resources/products/client/requests/GetProductByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/{types/ApiError.js → resources/products/client/requests/GetProductByIdRequest.js} +0 -0
- /package/dist/cjs/api/{types/CancelRenewalResponse.js → resources/products/client/requests/ListProductsRequest.js} +0 -0
- /package/dist/cjs/api/{types/ContactCreateForCustomer.js → resources/products/client/requests/UpdateProductByExternalIdRequest.js} +0 -0
- /package/dist/cjs/api/{types/CostAmount.js → resources/products/client/requests/UpdateProductByIdRequest.js} +0 -0
- /package/dist/cjs/api/resources/{orders/resources/lines → signals}/client/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{orders/resources/lines → signals}/client/index.js +0 -0
- /package/dist/cjs/api/{types/CostTrace.js → resources/signals/client/requests/BulkSignalsRequest.js} +0 -0
- /package/dist/cjs/api/resources/{orders/resources/lines → signals}/client/requests/index.js +0 -0
- /package/dist/cjs/api/resources/{orders/resources/lines → signals}/index.d.ts +0 -0
- /package/dist/cjs/api/resources/{orders/resources/lines → signals}/index.js +0 -0
- /package/dist/cjs/api/types/{CostTracesResponse.js → Attribution.js} +0 -0
- /package/dist/cjs/api/types/{CustomerUpdate.js → BulkSignalsResponse.js} +0 -0
- /package/dist/cjs/api/types/{EntitlementUsage.js → ContactBillingAddress.js} +0 -0
- /package/dist/cjs/api/types/{Error_.js → ContactListResponse.js} +0 -0
- /package/dist/cjs/api/types/{OrderLineAttribute.js → CustomerAttribution.js} +0 -0
- /package/dist/cjs/api/types/{OrderLineAttributeCreateOne.js → CustomerBillingAddress.js} +0 -0
- /package/dist/cjs/api/types/{OrderLineAttributePricing.js → CustomerByExternalId.js} +0 -0
- /package/dist/cjs/api/types/{OrderLineCreate.js → CustomerById.js} +0 -0
- /package/dist/cjs/api/types/{PaginationMeta.js → CustomerListResponse.js} +0 -0
- /package/dist/cjs/api/types/{PlanGroup.js → EmptyResponse.js} +0 -0
- /package/dist/cjs/api/types/{PricePoint.js → ErrorResponse.js} +0 -0
- /package/dist/cjs/api/types/{Pricing.js → InvoiceLinesResponse.js} +0 -0
- /package/dist/cjs/api/types/{ProrationAttributeUpdate.js → InvoiceListResponse.js} +0 -0
- /package/dist/cjs/api/types/{ProrationDetail.js → OrderLinesResponse.js} +0 -0
- /package/dist/cjs/api/types/{ProrationUpgradeResponse.js → OrderListResponse.js} +0 -0
- /package/dist/cjs/api/types/{SignalV2.js → Pagination.js} +0 -0
- /package/dist/cjs/api/types/{Tier.js → ProductByExternalId.js} +0 -0
- /package/dist/cjs/api/types/{Trace.js → ProductById.js} +0 -0
- /package/dist/cjs/api/types/{TracesResponse.js → ProductListResponse.js} +0 -0
- /package/dist/cjs/api/types/{UsagePaginationMeta.js → UpdateContactRequest.js} +0 -0
- /package/dist/cjs/api/types/{UsageSummariesResponse.js → UpdateCustomerRequest.js} +0 -0
- /package/dist/cjs/api/types/{UsageSummary.js → UpdateProductRequest.js} +0 -0
- /package/dist/esm/api/resources/{agents/client/requests/AgentCreate.mjs → contacts/client/requests/CreateContactRequest.mjs} +0 -0
- /package/dist/esm/api/resources/contacts/client/requests/{ContactCreate.mjs → DeleteContactByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customers/client/requests/CustomerCreate.mjs → contacts/client/requests/DeleteContactByIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customers/client/requests/CustomersCheckEntitlementRequest.mjs → contacts/client/requests/GetContactByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customers/client/requests/CustomersCreatePaymentMethodRequest.mjs → contacts/client/requests/GetContactByIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customers/client/requests/CustomersGetCostsByExternalIdRequest.mjs → contacts/client/requests/ListContactsRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customers/client/requests/CustomersGetUsageByExternalIdRequest.mjs → contacts/client/requests/UpdateContactByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{customers/types/CustomersCheckEntitlementResponse.mjs → contacts/client/requests/UpdateContactByIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{orders/client/requests/CancelRenewalRequest.mjs → customers/client/requests/CreateCustomerRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{orders/client/requests/OrderCreate.mjs → customers/client/requests/DeleteCustomerByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{orders/client/requests/OrdersActivateAndPayRequest.mjs → customers/client/requests/DeleteCustomerByIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{orders/client/requests/ProrationUpgradeRequest.mjs → customers/client/requests/GetCustomerByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{orders/resources/lines/client/requests/LinesUpdateRequest.mjs → customers/client/requests/GetCustomerByIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{plans/client/requests/PlansGetUsageRequest.mjs → customers/client/requests/ListCustomersRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{plans/client/requests/PlansSubscribeRequest.mjs → customers/client/requests/UpdateCustomerByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{plans/client/requests/PlansUnsubscribeRequest.mjs → customers/client/requests/UpdateCustomerByIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{agents → invoices}/client/index.d.mts +0 -0
- /package/dist/esm/api/resources/{agents → invoices}/client/index.mjs +0 -0
- /package/dist/esm/api/resources/{plans/client/requests/PlansUpgradeRequest.mjs → invoices/client/requests/GetInvoiceByIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{traces/client/requests/GetTracesRequest.mjs → invoices/client/requests/GetInvoiceLinesRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{usage/client/requests/UsageCheckUsageRequest.mjs → invoices/client/requests/ListInvoicesRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{usage/client/requests/UsageRecordBulkRequest.mjs → invoices/client/requests/UpdateInvoiceRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{agents → invoices}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{agents → invoices}/index.d.mts +0 -0
- /package/dist/esm/api/resources/{agents → invoices}/index.mjs +0 -0
- /package/dist/esm/api/resources/{usage/client/requests/UsageRecordBulkV2Request.mjs → orders/client/requests/CreateOrderRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{usage/types/UsageCheckUsageResponse.mjs → orders/client/requests/DeleteOrderByIdRequest.mjs} +0 -0
- /package/dist/esm/api/{types/Address.mjs → resources/orders/client/requests/GetOrderByIdRequest.mjs} +0 -0
- /package/dist/esm/api/{types/Agent.mjs → resources/orders/client/requests/GetOrderLinesRequest.mjs} +0 -0
- /package/dist/esm/api/{types/AgentAttribute.mjs → resources/orders/client/requests/ListOrdersRequest.mjs} +0 -0
- /package/dist/esm/api/{types/AgentPricePoint.mjs → resources/orders/client/requests/UpdateOrderRequest.mjs} +0 -0
- /package/dist/esm/api/{types/AgentPricePointTiers.mjs → resources/products/client/requests/CreateProductRequest.mjs} +0 -0
- /package/dist/esm/api/{types/AgentUpdate.mjs → resources/products/client/requests/GetProductByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/{types/ApiError.mjs → resources/products/client/requests/GetProductByIdRequest.mjs} +0 -0
- /package/dist/esm/api/{types/CancelRenewalResponse.mjs → resources/products/client/requests/ListProductsRequest.mjs} +0 -0
- /package/dist/esm/api/{types/ContactCreateForCustomer.mjs → resources/products/client/requests/UpdateProductByExternalIdRequest.mjs} +0 -0
- /package/dist/esm/api/{types/CostAmount.mjs → resources/products/client/requests/UpdateProductByIdRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{orders/resources/lines → signals}/client/index.d.mts +0 -0
- /package/dist/esm/api/resources/{orders/resources/lines → signals}/client/index.mjs +0 -0
- /package/dist/esm/api/{types/CostTrace.mjs → resources/signals/client/requests/BulkSignalsRequest.mjs} +0 -0
- /package/dist/esm/api/resources/{orders/resources/lines → signals}/client/requests/index.mjs +0 -0
- /package/dist/esm/api/resources/{orders/resources/lines → signals}/index.d.mts +0 -0
- /package/dist/esm/api/resources/{orders/resources/lines → signals}/index.mjs +0 -0
- /package/dist/esm/api/types/{CostTracesResponse.mjs → Attribution.mjs} +0 -0
- /package/dist/esm/api/types/{CustomerUpdate.mjs → BulkSignalsResponse.mjs} +0 -0
- /package/dist/esm/api/types/{EntitlementUsage.mjs → ContactBillingAddress.mjs} +0 -0
- /package/dist/esm/api/types/{Error_.mjs → ContactListResponse.mjs} +0 -0
- /package/dist/esm/api/types/{OrderLineAttribute.mjs → CustomerAttribution.mjs} +0 -0
- /package/dist/esm/api/types/{OrderLineAttributeCreateOne.mjs → CustomerBillingAddress.mjs} +0 -0
- /package/dist/esm/api/types/{OrderLineAttributePricing.mjs → CustomerByExternalId.mjs} +0 -0
- /package/dist/esm/api/types/{OrderLineCreate.mjs → CustomerById.mjs} +0 -0
- /package/dist/esm/api/types/{PaginationMeta.mjs → CustomerListResponse.mjs} +0 -0
- /package/dist/esm/api/types/{PlanGroup.mjs → EmptyResponse.mjs} +0 -0
- /package/dist/esm/api/types/{PricePoint.mjs → ErrorResponse.mjs} +0 -0
- /package/dist/esm/api/types/{Pricing.mjs → InvoiceLinesResponse.mjs} +0 -0
- /package/dist/esm/api/types/{ProrationAttributeUpdate.mjs → InvoiceListResponse.mjs} +0 -0
- /package/dist/esm/api/types/{ProrationDetail.mjs → OrderLinesResponse.mjs} +0 -0
- /package/dist/esm/api/types/{ProrationUpgradeResponse.mjs → OrderListResponse.mjs} +0 -0
- /package/dist/esm/api/types/{SignalV2.mjs → Pagination.mjs} +0 -0
- /package/dist/esm/api/types/{Tier.mjs → ProductByExternalId.mjs} +0 -0
- /package/dist/esm/api/types/{Trace.mjs → ProductById.mjs} +0 -0
- /package/dist/esm/api/types/{TracesResponse.mjs → ProductListResponse.mjs} +0 -0
- /package/dist/esm/api/types/{UsagePaginationMeta.mjs → UpdateContactRequest.mjs} +0 -0
- /package/dist/esm/api/types/{UsageSummariesResponse.mjs → UpdateCustomerRequest.mjs} +0 -0
- /package/dist/esm/api/types/{UsageSummary.mjs → UpdateProductRequest.mjs} +0 -0
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { createHandler } from "../utils/base-handler.mjs";
|
|
11
|
-
import { getPlanById } from "./plans.mjs";
|
|
12
|
-
function hasProductWithExternalId(pp) {
|
|
13
|
-
if (!pp.product) {
|
|
14
|
-
throw new Error(`Plan product ${pp.id} is missing nested product data`);
|
|
15
|
-
}
|
|
16
|
-
return !!pp.product.externalId;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Generate default values for missing order fields
|
|
20
|
-
*/
|
|
21
|
-
function generateOrderDefaults(config, options = {}) {
|
|
22
|
-
const { defaultDurationDays = 365 } = options;
|
|
23
|
-
const startDate = config.startDate || new Date().toISOString().split("T")[0];
|
|
24
|
-
const endDate = config.endDate ||
|
|
25
|
-
new Date(Date.now() + defaultDurationDays * 24 * 60 * 60 * 1000)
|
|
26
|
-
.toISOString()
|
|
27
|
-
.split("T")[0];
|
|
28
|
-
const name = config.name || "Subscription Order";
|
|
29
|
-
const description = config.description || "Annual subscription";
|
|
30
|
-
const currency = config.currency || "USD";
|
|
31
|
-
// defensive guard
|
|
32
|
-
if (!config.orderLines && !config.planId && !config.agentExternalId) {
|
|
33
|
-
throw new Error("Either orderLines, planId, or agentExternalId must be provided");
|
|
34
|
-
}
|
|
35
|
-
const orderLines = config.orderLines
|
|
36
|
-
? config.orderLines.map(line => {
|
|
37
|
-
var _a;
|
|
38
|
-
return ({
|
|
39
|
-
agentExternalId: line.agentExternalId,
|
|
40
|
-
name: line.name || name,
|
|
41
|
-
description: line.description || description,
|
|
42
|
-
planProductId: (_a = line.planProductId) !== null && _a !== void 0 ? _a : undefined,
|
|
43
|
-
});
|
|
44
|
-
})
|
|
45
|
-
: [{
|
|
46
|
-
agentExternalId: config.agentExternalId,
|
|
47
|
-
name,
|
|
48
|
-
description,
|
|
49
|
-
}];
|
|
50
|
-
return {
|
|
51
|
-
customerId: config.customerId,
|
|
52
|
-
customerExternalId: config.customerExternalId,
|
|
53
|
-
billingContactId: config.billingContactId,
|
|
54
|
-
agentExternalId: config.agentExternalId,
|
|
55
|
-
planId: config.planId,
|
|
56
|
-
name,
|
|
57
|
-
description,
|
|
58
|
-
startDate,
|
|
59
|
-
endDate,
|
|
60
|
-
currency,
|
|
61
|
-
orderLines,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Internal helper to create and optionally activate an order
|
|
66
|
-
*/
|
|
67
|
-
function createAndActivateOrder(client, config, autoActivate) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const order = yield client.orders.create({
|
|
70
|
-
customerId: config.customerId,
|
|
71
|
-
customerExternalId: config.customerExternalId,
|
|
72
|
-
billingContactId: config.billingContactId,
|
|
73
|
-
name: config.name,
|
|
74
|
-
description: config.description,
|
|
75
|
-
startDate: config.startDate,
|
|
76
|
-
endDate: config.endDate,
|
|
77
|
-
currency: config.currency,
|
|
78
|
-
orderLines: config.orderLines.map(line => {
|
|
79
|
-
const orderLine = { agentExternalId: line.agentExternalId };
|
|
80
|
-
if (line.name)
|
|
81
|
-
orderLine.name = line.name;
|
|
82
|
-
if (line.description)
|
|
83
|
-
orderLine.description = line.description;
|
|
84
|
-
// planProductId is not in the create orders api spec - this is functioning but greptile will complain
|
|
85
|
-
if (line.planProductId)
|
|
86
|
-
orderLine.planProductId = line.planProductId;
|
|
87
|
-
return orderLine;
|
|
88
|
-
}),
|
|
89
|
-
planId: config.planId,
|
|
90
|
-
});
|
|
91
|
-
if (!order.id) {
|
|
92
|
-
throw new Error("Order created but missing ID");
|
|
93
|
-
}
|
|
94
|
-
if (autoActivate && order.creationState === "draft") {
|
|
95
|
-
try {
|
|
96
|
-
yield client.orders.activate(order.id);
|
|
97
|
-
return {
|
|
98
|
-
id: order.id,
|
|
99
|
-
creationState: "active",
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
catch (activationError) {
|
|
103
|
-
console.error(`Error activating order ${order.id}:`, activationError instanceof Error
|
|
104
|
-
? activationError.message
|
|
105
|
-
: "Unknown error");
|
|
106
|
-
return {
|
|
107
|
-
id: order.id,
|
|
108
|
-
creationState: order.creationState,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
id: order.id,
|
|
114
|
-
creationState: order.creationState,
|
|
115
|
-
};
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Create an order with defaults for missing fields
|
|
120
|
-
*
|
|
121
|
-
* This helper generates reasonable defaults for dates, names, and other fields,
|
|
122
|
-
* making it easy to create orders for prototyping and development.
|
|
123
|
-
*
|
|
124
|
-
* @param client - PaidClient instance
|
|
125
|
-
* @param config - Order configuration (customerId, customerExternalId, agentExternalId required)
|
|
126
|
-
* @param options - Additional options for order creation
|
|
127
|
-
* @returns Created order with ID
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* const order = await createOrderWithDefaults(client, {
|
|
132
|
-
* customerId: 'cus_123',
|
|
133
|
-
* customerExternalId: 'user-123',
|
|
134
|
-
* agentExternalId: 'agent-prod'
|
|
135
|
-
* });
|
|
136
|
-
* // Generates: startDate, endDate (1 year), name, description, currency (USD)
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
export function createOrderWithDefaults(client_1, config_1) {
|
|
140
|
-
return __awaiter(this, arguments, void 0, function* (client, config, options = {}) {
|
|
141
|
-
const { autoActivate = true } = options;
|
|
142
|
-
const completeConfig = generateOrderDefaults(config, options);
|
|
143
|
-
return createAndActivateOrder(client, completeConfig, autoActivate);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Create an order with explicit configuration (NO defaults applied)
|
|
148
|
-
*
|
|
149
|
-
* Required fields: customerId, customerExternalId, agentExternalId, name, description,
|
|
150
|
-
* startDate, endDate, currency, orderLines
|
|
151
|
-
*
|
|
152
|
-
* Use createOrderWithDefaults() if you want automatic default values for missing fields.
|
|
153
|
-
*
|
|
154
|
-
* @param client - PaidClient instance
|
|
155
|
-
* @param config - Complete order configuration with ALL required fields
|
|
156
|
-
* @param options - Additional options for order creation
|
|
157
|
-
* @returns Created order with ID
|
|
158
|
-
* @throws Error if any required fields are missing
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```typescript
|
|
162
|
-
* const order = await createOrder(client, {
|
|
163
|
-
* customerId: 'cus_123',
|
|
164
|
-
* customerExternalId: 'user-123',
|
|
165
|
-
* billingContactId: 'contact_123',
|
|
166
|
-
* agentExternalId: 'agent-prod',
|
|
167
|
-
* name: 'Pro Plan Subscription',
|
|
168
|
-
* description: 'Monthly subscription to Pro plan',
|
|
169
|
-
* startDate: '2024-01-01',
|
|
170
|
-
* endDate: '2025-01-01',
|
|
171
|
-
* currency: 'USD',
|
|
172
|
-
* orderLines: [{
|
|
173
|
-
* agentExternalId: 'agent-prod',
|
|
174
|
-
* name: 'Pro Plan',
|
|
175
|
-
* description: 'Pro plan features'
|
|
176
|
-
* }]
|
|
177
|
-
* }, { autoActivate: true });
|
|
178
|
-
* ```
|
|
179
|
-
*/
|
|
180
|
-
export function createOrder(client_1, config_1) {
|
|
181
|
-
return __awaiter(this, arguments, void 0, function* (client, config, options = {}) {
|
|
182
|
-
const { autoActivate = true } = options;
|
|
183
|
-
return createAndActivateOrder(client, config, autoActivate);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Create a framework-agnostic handler for order creation
|
|
188
|
-
*
|
|
189
|
-
* This handler can be used with any framework adapter.
|
|
190
|
-
*
|
|
191
|
-
* @param helperOptions - Default options for order creation
|
|
192
|
-
* @returns Handler function
|
|
193
|
-
*/
|
|
194
|
-
export function createOrdersHandler(helperOptions) {
|
|
195
|
-
return createHandler((client, body) => __awaiter(this, void 0, void 0, function* () {
|
|
196
|
-
var _a, _b, _c;
|
|
197
|
-
if (!body.customerExternalId) {
|
|
198
|
-
throw new Error("customerExternalId is required");
|
|
199
|
-
}
|
|
200
|
-
if (!body.agentExternalId && !body.planId) {
|
|
201
|
-
throw new Error("agentExternalId or planId are required");
|
|
202
|
-
}
|
|
203
|
-
const orderOptions = Object.assign(Object.assign({}, helperOptions), { autoActivate: (_b = (_a = body.autoActivate) !== null && _a !== void 0 ? _a : helperOptions === null || helperOptions === void 0 ? void 0 : helperOptions.autoActivate) !== null && _b !== void 0 ? _b : true });
|
|
204
|
-
if (body.planId) {
|
|
205
|
-
const plan = yield getPlanById(client, body.planId);
|
|
206
|
-
if (!((_c = plan.planProducts) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
207
|
-
throw new Error(`Plan ${body.planId} has no products`);
|
|
208
|
-
}
|
|
209
|
-
body.orderLines = plan.planProducts
|
|
210
|
-
.filter(hasProductWithExternalId)
|
|
211
|
-
.map((pp) => ({
|
|
212
|
-
agentExternalId: pp.product.externalId,
|
|
213
|
-
name: pp.product.name,
|
|
214
|
-
description: pp.product.description,
|
|
215
|
-
planProductId: pp.id,
|
|
216
|
-
}));
|
|
217
|
-
if (body.orderLines.length === 0) {
|
|
218
|
-
throw new Error(`Plan ${body.planId} has no products with externalId`);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
const order = yield createOrderWithDefaults(client, body, orderOptions);
|
|
222
|
-
return { success: true, data: order };
|
|
223
|
-
}), { requiredFields: ['customerExternalId'] });
|
|
224
|
-
}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { PaidClient } from "../../Client.mjs";
|
|
2
|
-
import type { PlanGroup } from "../../api/types/PlanGroup.mjs";
|
|
3
|
-
import type { Plan } from "../../api/types/Plan.mjs";
|
|
4
|
-
import type { PlanWithFeatures } from "../../api/types/PlanWithFeatures.mjs";
|
|
5
|
-
import type { Order } from "../../api/types/Order.mjs";
|
|
6
|
-
import type { CancelRenewalResponse } from "../../api/types/CancelRenewalResponse.mjs";
|
|
7
|
-
import type { ProrationUpgradeResponse } from "../../api/types/ProrationUpgradeResponse.mjs";
|
|
8
|
-
import type { PlansSubscribeRequest } from "../../api/resources/plans/client/requests/PlansSubscribeRequest.mjs";
|
|
9
|
-
import type { PlansUnsubscribeRequest } from "../../api/resources/plans/client/requests/PlansUnsubscribeRequest.mjs";
|
|
10
|
-
import type { PlansUpgradeRequest } from "../../api/resources/plans/client/requests/PlansUpgradeRequest.mjs";
|
|
11
|
-
/**
|
|
12
|
-
* Get a plan by ID
|
|
13
|
-
*
|
|
14
|
-
* @param client - PaidClient instance
|
|
15
|
-
* @param planId - Plan's ID
|
|
16
|
-
* @returns Plan data
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const plan = await getPlanById(client, 'plan-123');
|
|
21
|
-
* console.log(plan.name, plan.id);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function getPlanById(client: PaidClient, planId: string): Promise<Plan>;
|
|
25
|
-
/**
|
|
26
|
-
* Get a plan group by ID
|
|
27
|
-
*
|
|
28
|
-
* @param client - PaidClient instance
|
|
29
|
-
* @param planGroupId - Plan group's ID
|
|
30
|
-
* @returns Plan group data
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* const planGroup = await getPlanGroupById(client, 'plan-group-123');
|
|
35
|
-
* console.log(planGroup.name, planGroup.id);
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare function getPlanGroupById(client: PaidClient, planGroupId: string): Promise<PlanGroup>;
|
|
39
|
-
/**
|
|
40
|
-
* Create a framework-agnostic handler for fetching a plan group by ID
|
|
41
|
-
*
|
|
42
|
-
* This handler can be used with any framework adapter.
|
|
43
|
-
* The plan group ID should be provided either in params or query string.
|
|
44
|
-
*
|
|
45
|
-
* @returns Handler function
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* // In Next.js route: /api/plans/[planGroupId]/route.ts
|
|
50
|
-
* import { createGetPlanGroupByIdHandler } from '@paid-ai/paid-node/integrations';
|
|
51
|
-
* import { nextjsAdapter } from '@paid-ai/paid-node/integrations/nextjs';
|
|
52
|
-
*
|
|
53
|
-
* const handler = createGetPlanGroupByIdHandler();
|
|
54
|
-
* export const GET = nextjsAdapter(handler);
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
export declare function createGetPlanGroupByIdHandler(): (request: any, response: any, config?: any) => Promise<any>;
|
|
58
|
-
/**
|
|
59
|
-
* Get all plans in a plan group
|
|
60
|
-
*
|
|
61
|
-
* @param client - PaidClient instance
|
|
62
|
-
* @param planGroupId - Plan group's ID
|
|
63
|
-
* @returns Array of plans with features
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* const plans = await getGroupPlans(client, 'plan-group-123');
|
|
68
|
-
* console.log(plans.length);
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
export declare function getGroupPlans(client: PaidClient, planGroupId: string): Promise<PlanWithFeatures[]>;
|
|
72
|
-
/**
|
|
73
|
-
* Create a framework-agnostic handler for fetching plans in a plan group
|
|
74
|
-
*
|
|
75
|
-
* This handler can be used with any framework adapter.
|
|
76
|
-
* The plan group ID should be provided either in params or query string.
|
|
77
|
-
*
|
|
78
|
-
* @returns Handler function
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* // In Next.js route: /api/plans/[planGroupId]/plans/route.ts
|
|
83
|
-
* import { createGetGroupPlansHandler } from '@paid-ai/paid-node/integrations';
|
|
84
|
-
* import { nextjsAdapter } from '@paid-ai/paid-node/integrations/nextjs';
|
|
85
|
-
*
|
|
86
|
-
* const handler = createGetGroupPlansHandler();
|
|
87
|
-
* export const GET = nextjsAdapter(handler);
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
export declare function createGetGroupPlansHandler(): (request: any, response: any, config?: any) => Promise<any>;
|
|
91
|
-
/**
|
|
92
|
-
* Subscribe a customer to a plan
|
|
93
|
-
*
|
|
94
|
-
* Creates a new order for a customer based on the specified plan, automatically converting plan products to order lines.
|
|
95
|
-
*
|
|
96
|
-
* @param client - PaidClient instance
|
|
97
|
-
* @param planId - Plan's ID
|
|
98
|
-
* @param request - Subscribe request with customer external ID and currency
|
|
99
|
-
* @returns Created order
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* const order = await subscribe(client, 'plan-123', {
|
|
104
|
-
* customerExternalId: 'customer-123',
|
|
105
|
-
* currency: 'USD'
|
|
106
|
-
* });
|
|
107
|
-
* console.log(order.id);
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
export declare function subscribe(client: PaidClient, planId: string, request: PlansSubscribeRequest): Promise<Order>;
|
|
111
|
-
/**
|
|
112
|
-
* Create a framework-agnostic handler for subscribing a customer to a plan
|
|
113
|
-
*
|
|
114
|
-
* This handler can be used with any framework adapter.
|
|
115
|
-
* The plan ID should be provided either in params or query string.
|
|
116
|
-
* The request body should contain customerExternalId and currency.
|
|
117
|
-
*
|
|
118
|
-
* @returns Handler function
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```typescript
|
|
122
|
-
* // In Next.js route: /api/plans/[planId]/subscribe/route.ts
|
|
123
|
-
* import { createSubscribeHandler } from '@paid-ai/paid-node/integrations';
|
|
124
|
-
* import { nextjsAdapter } from '@paid-ai/paid-node/integrations/nextjs';
|
|
125
|
-
*
|
|
126
|
-
* const handler = createSubscribeHandler();
|
|
127
|
-
* export const POST = nextjsAdapter(handler);
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
export declare function createSubscribeHandler(): (request: any, response: any, config?: any) => Promise<any>;
|
|
131
|
-
/**
|
|
132
|
-
* Unsubscribe a customer from a plan
|
|
133
|
-
*
|
|
134
|
-
* Cancels the renewal of an order associated with the specified plan. The order will remain active until the cancellation date.
|
|
135
|
-
*
|
|
136
|
-
* @param client - PaidClient instance
|
|
137
|
-
* @param planId - Plan's ID
|
|
138
|
-
* @param request - Unsubscribe request with customer external ID
|
|
139
|
-
* @returns Cancel renewal response
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* ```typescript
|
|
143
|
-
* const response = await unsubscribe(client, 'plan-123', {
|
|
144
|
-
* customerExternalId: 'customer-123'
|
|
145
|
-
* });
|
|
146
|
-
* console.log(response.message);
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
export declare function unsubscribe(client: PaidClient, planId: string, request: PlansUnsubscribeRequest): Promise<CancelRenewalResponse>;
|
|
150
|
-
/**
|
|
151
|
-
* Create a framework-agnostic handler for unsubscribing a customer from a plan
|
|
152
|
-
*
|
|
153
|
-
* This handler can be used with any framework adapter.
|
|
154
|
-
* The plan ID should be provided either in params or query string.
|
|
155
|
-
* The request body should contain customerExternalId.
|
|
156
|
-
*
|
|
157
|
-
* @returns Handler function
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```typescript
|
|
161
|
-
* // In Next.js route: /api/plans/[planId]/unsubscribe/route.ts
|
|
162
|
-
* import { createUnsubscribeHandler } from '@paid-ai/paid-node/integrations';
|
|
163
|
-
* import { nextjsAdapter } from '@paid-ai/paid-node/integrations/nextjs';
|
|
164
|
-
*
|
|
165
|
-
* const handler = createUnsubscribeHandler();
|
|
166
|
-
* export const POST = nextjsAdapter(handler);
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
export declare function createUnsubscribeHandler(): (request: any, response: any, config?: any) => Promise<any>;
|
|
170
|
-
/**
|
|
171
|
-
* Upgrade a customer from their current plan to a new plan
|
|
172
|
-
*
|
|
173
|
-
* Upgrades a customer from their current plan to a new plan with automatic proration calculation. This schedules a plan change and applies credits for the unused portion of the current billing period.
|
|
174
|
-
*
|
|
175
|
-
* @param client - PaidClient instance
|
|
176
|
-
* @param request - Upgrade request with customer external ID, old plan ID, and new plan ID
|
|
177
|
-
* @returns Proration upgrade response
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* ```typescript
|
|
181
|
-
* const response = await upgrade(client, {
|
|
182
|
-
* customerExternalId: 'customer-123',
|
|
183
|
-
* oldPlanId: 'plan-123',
|
|
184
|
-
* newPlanId: 'plan-456'
|
|
185
|
-
* });
|
|
186
|
-
* console.log(response.order.id);
|
|
187
|
-
* ```
|
|
188
|
-
*/
|
|
189
|
-
export declare function upgrade(client: PaidClient, request: PlansUpgradeRequest): Promise<ProrationUpgradeResponse>;
|
|
190
|
-
/**
|
|
191
|
-
* Create a framework-agnostic handler for upgrading a customer's plan
|
|
192
|
-
*
|
|
193
|
-
* This handler can be used with any framework adapter.
|
|
194
|
-
* The request body should contain customerExternalId, oldPlanId, and newPlanId.
|
|
195
|
-
*
|
|
196
|
-
* @returns Handler function
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* ```typescript
|
|
200
|
-
* // In Next.js route: /api/plans/upgrade/route.ts
|
|
201
|
-
* import { createUpgradeHandler } from '@paid-ai/paid-node/integrations';
|
|
202
|
-
* import { nextjsAdapter } from '@paid-ai/paid-node/integrations/nextjs';
|
|
203
|
-
*
|
|
204
|
-
* const handler = createUpgradeHandler();
|
|
205
|
-
* export const POST = nextjsAdapter(handler);
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
export declare function createUpgradeHandler(): (request: any, response: any, config?: any) => Promise<any>;
|