diff --git a/apps/docs/mintlify/api/openapi-local.yml b/apps/docs/mintlify/api/openapi-local.yml new file mode 100644 index 000000000..49262071a --- /dev/null +++ b/apps/docs/mintlify/api/openapi-local.yml @@ -0,0 +1,1471 @@ +info: + title: Autumn API + version: 2.1.0 +servers: + - url: http://localhost:8080 + description: Production server +openapi: 3.1.1 +components: + schemas: + CustomerId: + type: string + title: CustomerId + description: Your unique identifier for the customer + CustomerExpand: + enum: + - invoices + - trials_used + - rewards + - entities + - referrals + - payment_method + - subscriptions.plan + - purchases.plan + - balances.feature + title: CustomerExpand + Customer: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + name: + anyOf: + - type: string + - type: "null" + email: + anyOf: + - type: string + - type: "null" + created_at: + type: number + fingerprint: + anyOf: + - type: string + - type: "null" + stripe_id: + anyOf: + - type: string + - type: "null" + env: + enum: + - sandbox + - live + metadata: + type: object + propertyNames: {} + additionalProperties: {} + send_email_receipts: + type: boolean + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + auto_enable: + type: boolean + add_on: + type: boolean + status: + enum: + - active + - scheduled + - expired + past_due: + type: boolean + canceled_at: + anyOf: + - type: number + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + trial_ends_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + current_period_start: + anyOf: + - type: number + - type: "null" + current_period_end: + anyOf: + - type: number + - type: "null" + quantity: + type: number + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + expires_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + quantity: + type: number + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + granted: + type: number + remaining: + type: number + minimum: 0 + usage: + type: number + unlimited: + type: boolean + overage_allowed: + type: boolean + max_purchase: + anyOf: + - type: number + - type: "null" + next_reset_at: + anyOf: + - type: number + - type: "null" + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + plan_id: + anyOf: + - type: string + - type: "null" + included_grant: + type: number + prepaid_grant: + type: number + remaining: + type: number + usage: + type: number + unlimited: + type: boolean + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + interval_count: + type: number + resets_at: + anyOf: + - type: number + - type: "null" + required: + - interval + - resets_at + - type: "null" + price: + anyOf: + - type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + billing_units: + type: number + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + anyOf: + - type: number + - type: "null" + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + expires_at: + type: number + required: + - balance + - expires_at + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + invoices: + type: array + items: + type: object + properties: + plan_ids: + type: array + items: + type: string + description: Array of plan IDs included in this invoice + stripe_id: + type: string + description: The Stripe invoice ID + status: + type: string + description: The status of the invoice + total: + type: number + description: The total amount of the invoice + currency: + type: string + description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + description: URL to the Stripe-hosted invoice page + required: + - plan_ids + - stripe_id + - status + - total + - currency + - created_at + entities: + type: array + items: + type: object + properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity + name: + anyOf: + - type: string + - type: "null" + description: The name of the entity + customer_id: + anyOf: + - type: string + - type: "null" + description: The customer ID this entity belongs to + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created + env: + enum: + - sandbox + - live + description: The environment (sandbox/live) + required: + - id + - name + - created_at + - env + trials_used: + type: array + items: + type: object + properties: + plan_id: + type: string + customer_id: + type: string + fingerprint: + anyOf: + - type: string + - type: "null" + required: + - plan_id + - customer_id + rewards: + anyOf: + - type: object + properties: + discounts: + type: array + items: + type: object + properties: + id: + type: string + description: The unique identifier for this discount + name: + type: string + description: The name of the discount or coupon + type: + enum: + - percentage_discount + - fixed_discount + - free_product + - invoice_credits + description: The type of reward + discount_value: + type: number + description: The discount value (percentage or fixed amount) + duration_type: + enum: + - one_off + - months + - forever + description: How long the discount lasts + duration_value: + anyOf: + - type: number + - type: "null" + description: Number of billing periods the discount applies for repeating durations + currency: + anyOf: + - type: string + - type: "null" + description: The currency code for fixed amount discounts + start: + anyOf: + - type: number + - type: "null" + description: Timestamp when the discount becomes active + end: + anyOf: + - type: number + - type: "null" + description: Timestamp when the discount expires + subscription_id: + anyOf: + - type: string + - type: "null" + description: The Stripe subscription ID this discount is applied to + total_discount_amount: + anyOf: + - type: number + - type: "null" + description: Total amount saved from this discount + required: + - id + - name + - type + - discount_value + - duration_type + description: Array of active discounts applied to the customer + required: + - discounts + - type: "null" + referrals: + type: array + items: + type: object + properties: + program_id: + type: string + customer: + type: object + properties: + id: + type: string + name: + anyOf: + - type: string + - type: "null" + email: + anyOf: + - type: string + - type: "null" + required: + - id + reward_applied: + type: boolean + created_at: + type: number + required: + - program_id + - customer + - reward_applied + - created_at + payment_method: + anyOf: + - {} + - type: "null" + required: + - id + - name + - email + - created_at + - fingerprint + - stripe_id + - env + - metadata + - send_email_receipts + - subscriptions + - purchases + - balances + Plan: + type: object + properties: + id: + type: string + name: + type: string + description: + anyOf: + - type: string + - type: "null" + group: + anyOf: + - type: string + - type: "null" + version: + type: number + add_on: + type: boolean + auto_enable: + type: boolean + price: + anyOf: + - type: object + properties: + amount: + type: number + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + display: + type: object + properties: + primary_text: + type: string + secondary_text: + type: string + required: + - primary_text + required: + - amount + - interval + - type: "null" + items: + type: array + items: + type: object + properties: + feature_id: + type: string + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + included: + type: number + unlimited: + type: boolean + reset: + anyOf: + - type: object + properties: + interval: + enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + required: + - interval + - type: "null" + price: + anyOf: + - type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + interval: + enum: + - one_off + - week + - month + - quarter + - semi_annual + - year + interval_count: + type: number + billing_units: + type: number + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + anyOf: + - type: number + - type: "null" + required: + - interval + - billing_units + - billing_method + - max_purchase + - type: "null" + display: + type: object + properties: + primary_text: + type: string + secondary_text: + type: string + required: + - primary_text + rollover: + type: object + properties: + max: + anyOf: + - type: number + - type: "null" + expiry_duration_type: + enum: + - month + - forever + expiry_duration_length: + type: number + required: + - max + - expiry_duration_type + proration: + type: object + properties: + on_increase: + enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + on_decrease: + enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + required: + - feature_id + - included + - unlimited + - reset + - price + free_trial: + type: object + properties: + duration_length: + type: number + duration_type: + enum: + - day + - month + - year + card_required: + type: boolean + required: + - duration_length + - duration_type + - card_required + created_at: + type: number + env: + enum: + - sandbox + - live + archived: + type: boolean + base_variant_id: + anyOf: + - type: string + - type: "null" + customer_eligibility: + type: object + properties: + trial_available: + type: boolean + scenario: + enum: + - scheduled + - active + - new + - renew + - upgrade + - downgrade + - cancel + - expired + - past_due + required: + - scenario + required: + - id + - name + - description + - group + - version + - add_on + - auto_enable + - price + - items + - created_at + - env + - archived + - base_variant_id + securitySchemes: + secretKey: + type: http + scheme: bearer + bearerFormat: JWT +paths: + /v1/customers.getOrCreate: + post: + operationId: getOrCreate + description: >- + Creates a customer if they do not exist, or returns the existing customer by your external customer ID. + + + Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. + + + @example + + ```typescript + + // Create or fetch a customer by external ID + + const response = await client.getOrCreate({ + + + + "id": "cus_123", + "name": "John Doe", + "email": "john@example.com" + }); + ``` + tags: + - customers + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + anyOf: + - $ref: "#/components/schemas/CustomerId" + - type: "null" + name: + anyOf: + - type: string + - type: "null" + description: Customer's name + email: + anyOf: + - type: string + format: email + - type: "null" + description: Customer's email address + fingerprint: + anyOf: + - type: string + - type: "null" + description: Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + metadata: + anyOf: + - type: object + propertyNames: + type: string + additionalProperties: {} + - type: "null" + description: Additional metadata for the customer + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID if you already have one + create_in_stripe: + type: boolean + description: Whether to create the customer in Stripe + auto_enable_plan_id: + type: string + description: The ID of the free plan to auto-enable for the customer + processors: + anyOf: + - type: object + properties: + vercel: + type: object + properties: + installation_id: + type: string + access_token: + type: string + account_id: + type: string + custom_payment_method_id: + type: string + required: + - installation_id + - access_token + - account_id + - type: "null" + description: External processors for the customer + send_email_receipts: + type: boolean + description: Whether to send email receipts to this customer + internal_options: + type: object + properties: + default_group: + type: string + description: The group of products to attach to the customer + disable_defaults: + type: boolean + description: Whether to disable default products + expand: + type: array + items: + $ref: "#/components/schemas/CustomerExpand" + description: Customer expand options + entity_id: + type: string + entity_data: + type: object + properties: + feature_id: + type: string + description: The feature ID that this entity is associated with + name: + type: string + description: Name of the entity + required: + - feature_id + id: + anyOf: + - $ref: "#/components/schemas/CustomerId" + - type: "null" + with_autumn_id: + type: boolean + default: false + required: + - customer_id + title: GetOrCreateCustomerParams + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Customer" + parameters: + - &a1 + name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.customers.getOrCreate({ + customerId: null, + }); + + console.log(result); + } + + run(); + /v1/products: + get: + operationId: list + summary: List Plans + tags: + - plans + parameters: + - *a1 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + $ref: "#/components/schemas/Plan" + required: + - list + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.plans.list(); + + console.log(result); + } + + run(); + /v1/attach: + post: + operationId: attach + tags: + - billing + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + entity_id: + anyOf: + - type: string + - type: "null" + entity_data: + type: object + properties: + feature_id: + type: string + description: The feature ID that this entity is associated with + name: + type: string + description: Name of the entity + required: + - feature_id + options: + anyOf: + - type: array + items: + type: object + properties: + feature_id: + type: string + quantity: + type: number + reset_after_trial_end: + type: boolean + default: false + required: + - feature_id + - type: "null" + version: + type: number + free_trial: + anyOf: + - type: object + properties: + length: + type: number + duration: + enum: + - day + - month + - year + card_required: + type: boolean + default: true + required: + - length + - duration + - type: "null" + items: + type: array + items: + type: object + properties: + type: + anyOf: + - enum: + - feature + - priced_feature + - price + - type: "null" + description: The type of the product item. + feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID of the product item. Should be null for fixed price items. + feature_type: + anyOf: + - enum: + - single_use + - continuous_use + - boolean + - static + - type: "null" + feature: + anyOf: + - type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type + - type: "null" + included_usage: + anyOf: + - anyOf: + - type: number + - const: inf + - type: "null" + description: The amount of usage included for this feature (per interval). + interval: + anyOf: + - enum: + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - type: "null" + description: The reset or billing interval of the product item. If null, feature will have no reset date, and if there's a price, it will be billed one-off. + interval_count: + anyOf: + - type: number + - type: "null" + description: Interval count of the feature. + entity_feature_id: + anyOf: + - type: string + - type: "null" + description: The feature ID of the entity (like seats) to track sub-balances for. + usage_model: + anyOf: + - enum: + - prepaid + - pay_per_use + - type: "null" + description: Whether the feature should be prepaid upfront or billed for how much they use end of billing period. + price: + anyOf: + - type: number + - type: "null" + description: The price of the product item. Should be null if tiered pricing is set. + tiers: + anyOf: + - type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + description: The maximum amount of usage for this tier. + amount: + type: number + description: The price of the product item for this tier. + required: + - to + - amount + - type: "null" + description: Tiered pricing for the product item. Not applicable for fixed price items. + billing_units: + anyOf: + - type: number + - type: "null" + description: The billing units of the product item (eg $1 for 30 credits). + reset_usage_when_enabled: + anyOf: + - type: boolean + - type: "null" + description: Whether the usage should be reset when the product is enabled. + display: + anyOf: + - type: object + properties: + primary_text: + type: string + secondary_text: + anyOf: + - type: string + - type: "null" + required: + - primary_text + - type: "null" + usage_limit: + anyOf: + - type: number + - type: "null" + config: + anyOf: + - type: object + properties: + on_increase: + anyOf: + - enum: + - bill_immediately + - prorate_immediately + - prorate_next_cycle + - bill_next_cycle + - type: "null" + on_decrease: + anyOf: + - enum: + - prorate + - prorate_immediately + - prorate_next_cycle + - none + - no_prorations + - type: "null" + rollover: + anyOf: + - type: object + properties: + max: + anyOf: + - type: number + - type: "null" + duration: + enum: + - month + - forever + default: month + length: + type: number + required: + - max + - length + - type: "null" + - type: "null" + created_at: + anyOf: + - type: number + - type: "null" + entitlement_id: + anyOf: + - type: string + - type: "null" + price_id: + anyOf: + - type: string + - type: "null" + price_config: + anyOf: + - {} + - type: "null" + product_id: + type: string + invoice: + type: boolean + enable_product_immediately: + type: boolean + finalize_invoice: + type: boolean + redirect_mode: + enum: + - always + - if_required + - never + default: always + success_url: + type: string + new_billing_subscription: + type: boolean + plan_schedule: + enum: + - immediate + - end_of_cycle + billing_behavior: + enum: + - prorate_immediately + - next_cycle_only + adjustable_quantity: + type: boolean + required: + - product_id + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + entity_id: + type: string + invoice: + type: object + properties: + status: + anyOf: + - type: string + - type: "null" + stripe_id: + type: string + total: + type: number + currency: + type: string + hosted_invoice_url: + anyOf: + - type: string + - type: "null" + required: + - status + - stripe_id + - total + - currency + - hosted_invoice_url + payment_url: + anyOf: + - type: string + - type: "null" + required_action: + type: object + properties: + code: + enum: + - 3ds_required + - payment_method_required + - payment_failed + reason: + type: string + required: + - code + - reason + required: + - customer_id + - payment_url + parameters: + - *a1 + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.billing.attach({ + productId: "", + }); + + console.log(result); + } + + run(); +security: + - secretKey: [] +x-speakeasy-globals: + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true diff --git a/bun.lock b/bun.lock index 51a4594a8..0d60bf823 100644 --- a/bun.lock +++ b/bun.lock @@ -157,7 +157,7 @@ }, "packages/sdk": { "name": "@useautumn/sdk", - "version": "0.7.17", + "version": "0.7.20", "dependencies": { "zod": "^3.25.65 || ^4.0.0", }, diff --git a/packages/autumn-js/tsconfig.json b/packages/autumn-js/tsconfig.json index 6452f12e4..86be3870e 100644 --- a/packages/autumn-js/tsconfig.json +++ b/packages/autumn-js/tsconfig.json @@ -23,8 +23,8 @@ "@/hooks/*": ["src/libraries/react/hooks/*"], "@sdk": ["src/sdk/index"], "@sdk/*": ["src/sdk/*"], - "@useautumn/sdk": ["../sdk/src/index.ts"], - "@useautumn/sdk/*": ["../sdk/src/*"], + "@useautumn/sdk": ["../sdk/dist/esm/index.d.ts"], + "@useautumn/sdk/*": ["../sdk/dist/esm/*"], "@styles": ["src/styles/*"], "@compose": ["src/compose/*"], "@utils/*": ["src/utils/*"] diff --git a/packages/sdk/.speakeasy/gen.lock b/packages/sdk/.speakeasy/gen.lock index 907f1e71a..b598869a0 100644 --- a/packages/sdk/.speakeasy/gen.lock +++ b/packages/sdk/.speakeasy/gen.lock @@ -5,12 +5,12 @@ management: docVersion: 2.1.0 speakeasyVersion: 1.718.0 generationVersion: 2.824.1 - releaseVersion: 0.7.17 - configChecksum: dd6b38283636f80e5c431989f98863c2 + releaseVersion: 0.7.20 + configChecksum: 0b4fb6dcfb9d39ab7b3d33663bd406b2 persistentEdits: - generation_id: 271060cd-f397-4253-aa78-1e9cf827217e - pristine_commit_hash: 300d8ed45caecc561bc0e1703afd4e4cf84efd03 - pristine_tree_hash: 28c8440447a21d0b07ff327d0f36b54131dd7fe6 + generation_id: a47f16dc-6445-4109-b975-2d3d49434c47 + pristine_commit_hash: 11ad79633a20a21e4ef703ce48922a924c341aa5 + pristine_tree_hash: 1e6fc7ba17b211330e97103160441cbef1c2b0dc features: typescript: additionalDependencies: 0.1.0 @@ -495,12 +495,12 @@ trackedFiles: pristine_git_object: 900d545ed58929951e2208e1bec791cb264429a4 jsr.json: id: 7f6ab7767282 - last_write_checksum: sha1:eee963aca14b7c18652e2f9d207e3452ae3abbc2 - pristine_git_object: 95fa158d8d3da07562ba2a5d1c222033539033b1 + last_write_checksum: sha1:2e89abed613d4deac741401a416279b68cfa9e72 + pristine_git_object: 93b86e0cdade6cd1d8a890fc839d4b485097a5fb package.json: id: 7030d0b2f71b - last_write_checksum: sha1:bff21deea9c1d7faed735c21d6f96a577acca85b - pristine_git_object: 748baebbbd14e136b76e076c98bbd84a4132368a + last_write_checksum: sha1:0352148b93072588870244e5f8189426040f3582 + pristine_git_object: 9ef6629935a084177973f29c3964fcf927dc2efb src/core.ts: id: f431fdbcd144 last_write_checksum: sha1:f8f24a3ca09c1efb285d7a75ad3697d0128f47e2 @@ -539,8 +539,8 @@ trackedFiles: pristine_git_object: 44be0eae8246521b230e8e711a88eff738fc015d src/lib/config.ts: id: 320761608fb3 - last_write_checksum: sha1:f970042859f89ef41bb3ec0d2a572c04fe3549f8 - pristine_git_object: c1d9012aee57be0dc468d9111409c9a441383f66 + last_write_checksum: sha1:027a62f4a5a0c604e17486a65b11de580239e35d + pristine_git_object: 138841a530619f3d549f4bb45d7ea82bbd45eae4 src/lib/dlv.ts: id: b1988214835a last_write_checksum: sha1:1dd3e3fbb4550c4bf31f5ef997faff355d6f3250 diff --git a/packages/sdk/.speakeasy/gen.yaml b/packages/sdk/.speakeasy/gen.yaml index f8510d9bc..b34bcba3f 100644 --- a/packages/sdk/.speakeasy/gen.yaml +++ b/packages/sdk/.speakeasy/gen.yaml @@ -33,7 +33,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false typescript: - version: 0.7.17 + version: 0.7.20 acceptHeaderEnum: false additionalDependencies: dependencies: {} @@ -41,17 +41,30 @@ typescript: peerDependencies: {} additionalPackageJSON: exports: - .: ./src/index.ts - ./*: ./src/*.ts - ./*.js: ./src/*.ts - ./models: ./src/models/index.ts - ./models/errors: ./src/models/index.ts - ./models/operations: ./src/models/index.ts + .: + import: ./dist/esm/index.js + require: ./dist/commonjs/index.js + types: ./dist/esm/index.d.ts + ./models: + import: ./dist/esm/models/index.js + require: ./dist/commonjs/models/index.js + types: ./dist/esm/models/index.d.ts + ./models/errors: + import: ./dist/esm/models/index.js + require: ./dist/commonjs/models/index.js + types: ./dist/esm/models/index.d.ts + ./models/operations: + import: ./dist/esm/models/index.js + require: ./dist/commonjs/models/index.js + types: ./dist/esm/models/index.d.ts ./package.json: ./package.json - ./types: ./src/types/index.ts - main: ./src/index.ts - module: ./src/index.ts - types: ./src/index.ts + ./types: + import: ./dist/esm/types/index.js + require: ./dist/commonjs/types/index.js + types: ./dist/esm/types/index.d.ts + main: ./dist/commonjs/index.js + module: ./dist/esm/index.js + types: ./dist/esm/index.d.ts additionalScripts: {} alwaysIncludeInboundAndOutbound: false author: Speakeasy diff --git a/packages/sdk/jsr.json b/packages/sdk/jsr.json index 95fa158d8..93b86e0cd 100644 --- a/packages/sdk/jsr.json +++ b/packages/sdk/jsr.json @@ -2,7 +2,7 @@ { "name": "@useautumn/sdk", - "version": "0.7.17", + "version": "0.7.20", "exports": { ".": "./src/index.ts", "./models": "./src/models/index.ts", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 748baebbb..ac51ae52a 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,10 +1,10 @@ { "name": "@useautumn/sdk", - "version": "0.7.17", + "version": "0.7.20", "author": "Speakeasy", - "main": "./src/index.ts", - "module": "./src/index.ts", - "types": "./src/index.ts", + "main": "./dist/commonjs/index.js", + "module": "./dist/esm/index.js", + "types": "./dist/commonjs/index.d.ts", "type": "module", "tshy": { "sourceDialects": [ @@ -25,9 +25,7 @@ "build": "tshy", "prepublishOnly": "npm run build" }, - "peerDependencies": { - - }, + "peerDependencies": {}, "devDependencies": { "@eslint/js": "^9.26.0", "eslint": "^9.26.0", @@ -38,5 +36,63 @@ }, "dependencies": { "zod": "^3.25.65 || ^4.0.0" + }, + "exports": { + ".": { + "import": { + "@useautumn/sdk/source": "./src/index.ts", + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./package.json": "./package.json", + "./types": { + "import": { + "@useautumn/sdk/source": "./src/types/index.ts", + "types": "./dist/esm/types/index.d.ts", + "default": "./dist/esm/types/index.js" + }, + "require": { + "types": "./dist/commonjs/types/index.d.ts", + "default": "./dist/commonjs/types/index.js" + } + }, + "./models": { + "import": { + "@useautumn/sdk/source": "./src/models/index.ts", + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + }, + "./*.js": { + "import": { + "@useautumn/sdk/source": "./src/*.ts", + "types": "./dist/esm/*.d.ts", + "default": "./dist/esm/*.js" + }, + "require": { + "types": "./dist/commonjs/*.d.ts", + "default": "./dist/commonjs/*.js" + } + }, + "./*": { + "import": { + "@useautumn/sdk/source": "./src/*.ts", + "types": "./dist/esm/*.d.ts", + "default": "./dist/esm/*.js" + }, + "require": { + "types": "./dist/commonjs/*.d.ts", + "default": "./dist/commonjs/*.js" + } + } } } diff --git a/packages/sdk/src/hooks/registration.ts b/packages/sdk/src/hooks/registration.ts index 539b85cce..99236202e 100644 --- a/packages/sdk/src/hooks/registration.ts +++ b/packages/sdk/src/hooks/registration.ts @@ -1,4 +1,4 @@ -import { Hooks } from "./types"; +import type { Hooks } from "./types.js"; /* * This file is only ever generated once on the first generation and then is free to be modified. diff --git a/packages/sdk/src/lib/config.ts b/packages/sdk/src/lib/config.ts index c1d9012ae..138841a53 100644 --- a/packages/sdk/src/lib/config.ts +++ b/packages/sdk/src/lib/config.ts @@ -66,7 +66,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "2.1.0", - sdkVersion: "0.7.17", + sdkVersion: "0.7.20", genVersion: "2.824.1", - userAgent: "speakeasy-sdk/typescript 0.7.17 2.824.1 2.1.0 @useautumn/sdk", + userAgent: "speakeasy-sdk/typescript 0.7.20 2.824.1 2.1.0 @useautumn/sdk", } as const; diff --git a/shared/api/api.ts b/shared/api/api.ts index 155fdb3a0..93157703b 100644 --- a/shared/api/api.ts +++ b/shared/api/api.ts @@ -106,6 +106,13 @@ if (process.env.NODE_ENV !== "production") { }); console.log("Speakeasy SDK generation completed"); + console.log("Building @useautumn/sdk dist output..."); + execSync("bun run build", { + stdio: "inherit", + cwd: speakeasySdkDirPath, + }); + console.log("@useautumn/sdk build completed"); + console.log("Applying Speakeasy code samples to OpenAPI for docs..."); execSync( `bunx speakeasy overlay apply --schema .speakeasy/out.openapi.yaml --overlay .speakeasy/code-samples.overlay.yaml --out ${JSON.stringify(docsOpenApiLocalPath)}`,