@clientcasa/sdk 0.1.0 → 0.1.3

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.
Files changed (125) hide show
  1. package/README.md +106 -92
  2. package/esm/lib/config.d.ts +3 -3
  3. package/esm/lib/config.js +3 -3
  4. package/esm/models/catalog-item-create.d.ts +10 -0
  5. package/esm/models/catalog-item-create.d.ts.map +1 -1
  6. package/esm/models/catalog-item-create.js +8 -0
  7. package/esm/models/catalog-item-create.js.map +1 -1
  8. package/esm/models/catalog-item-update.d.ts +10 -0
  9. package/esm/models/catalog-item-update.d.ts.map +1 -1
  10. package/esm/models/catalog-item-update.js +8 -0
  11. package/esm/models/catalog-item-update.js.map +1 -1
  12. package/esm/models/catalog-item.d.ts +9 -0
  13. package/esm/models/catalog-item.d.ts.map +1 -1
  14. package/esm/models/catalog-item.js +8 -0
  15. package/esm/models/catalog-item.js.map +1 -1
  16. package/esm/models/invoice-create.d.ts +0 -1
  17. package/esm/models/invoice-create.d.ts.map +1 -1
  18. package/esm/models/invoice-create.js +0 -1
  19. package/esm/models/invoice-create.js.map +1 -1
  20. package/esm/models/payout.d.ts +1 -1
  21. package/esm/models/payout.d.ts.map +1 -1
  22. package/esm/models/payout.js +1 -1
  23. package/esm/models/payout.js.map +1 -1
  24. package/esm/models/time-entry-create.d.ts +0 -2
  25. package/esm/models/time-entry-create.d.ts.map +1 -1
  26. package/esm/models/time-entry-create.js +0 -1
  27. package/esm/models/time-entry-create.js.map +1 -1
  28. package/esm/models/time-entry-update.d.ts +0 -2
  29. package/esm/models/time-entry-update.d.ts.map +1 -1
  30. package/esm/models/time-entry-update.js +0 -1
  31. package/esm/models/time-entry-update.js.map +1 -1
  32. package/esm/models/time-entry.d.ts +0 -1
  33. package/esm/models/time-entry.d.ts.map +1 -1
  34. package/esm/models/time-entry.js +0 -1
  35. package/esm/models/time-entry.js.map +1 -1
  36. package/esm/models/transaction.d.ts +1 -1
  37. package/esm/models/transaction.d.ts.map +1 -1
  38. package/esm/models/transaction.js +1 -1
  39. package/esm/models/transaction.js.map +1 -1
  40. package/esm/sdk/calendar-events.d.ts +4 -4
  41. package/esm/sdk/calendar-events.d.ts.map +1 -1
  42. package/esm/sdk/calendar-events.js +6 -6
  43. package/esm/sdk/calendar-events.js.map +1 -1
  44. package/esm/sdk/catalog-items.d.ts +4 -4
  45. package/esm/sdk/catalog-items.d.ts.map +1 -1
  46. package/esm/sdk/catalog-items.js +6 -6
  47. package/esm/sdk/catalog-items.js.map +1 -1
  48. package/esm/sdk/clients.d.ts +4 -4
  49. package/esm/sdk/clients.d.ts.map +1 -1
  50. package/esm/sdk/clients.js +6 -6
  51. package/esm/sdk/clients.js.map +1 -1
  52. package/esm/sdk/contacts.d.ts +4 -4
  53. package/esm/sdk/contacts.d.ts.map +1 -1
  54. package/esm/sdk/contacts.js +6 -6
  55. package/esm/sdk/contacts.js.map +1 -1
  56. package/esm/sdk/contracts.d.ts +4 -4
  57. package/esm/sdk/contracts.d.ts.map +1 -1
  58. package/esm/sdk/contracts.js +6 -6
  59. package/esm/sdk/contracts.js.map +1 -1
  60. package/esm/sdk/inquiries.d.ts +4 -4
  61. package/esm/sdk/inquiries.d.ts.map +1 -1
  62. package/esm/sdk/inquiries.js +6 -6
  63. package/esm/sdk/inquiries.js.map +1 -1
  64. package/esm/sdk/invoices.d.ts +4 -4
  65. package/esm/sdk/invoices.d.ts.map +1 -1
  66. package/esm/sdk/invoices.js +6 -6
  67. package/esm/sdk/invoices.js.map +1 -1
  68. package/esm/sdk/milestones.d.ts +4 -4
  69. package/esm/sdk/milestones.d.ts.map +1 -1
  70. package/esm/sdk/milestones.js +6 -6
  71. package/esm/sdk/milestones.js.map +1 -1
  72. package/esm/sdk/projects.d.ts +4 -4
  73. package/esm/sdk/projects.d.ts.map +1 -1
  74. package/esm/sdk/projects.js +6 -6
  75. package/esm/sdk/projects.js.map +1 -1
  76. package/esm/sdk/proposals.d.ts +4 -4
  77. package/esm/sdk/proposals.d.ts.map +1 -1
  78. package/esm/sdk/proposals.js +6 -6
  79. package/esm/sdk/proposals.js.map +1 -1
  80. package/esm/sdk/time-entries.d.ts +6 -6
  81. package/esm/sdk/time-entries.d.ts.map +1 -1
  82. package/esm/sdk/time-entries.js +8 -8
  83. package/esm/sdk/time-entries.js.map +1 -1
  84. package/esm/sdk/transactions.d.ts +6 -6
  85. package/esm/sdk/transactions.d.ts.map +1 -1
  86. package/esm/sdk/transactions.js +8 -8
  87. package/esm/sdk/transactions.js.map +1 -1
  88. package/esm/sdk/webhooks.d.ts +4 -4
  89. package/esm/sdk/webhooks.d.ts.map +1 -1
  90. package/esm/sdk/webhooks.js +6 -6
  91. package/esm/sdk/webhooks.js.map +1 -1
  92. package/esm/types/async.d.ts.map +1 -1
  93. package/esm/types/async.js +6 -6
  94. package/esm/types/async.js.map +1 -1
  95. package/esm/types/primitives.d.ts +0 -2
  96. package/esm/types/primitives.d.ts.map +1 -1
  97. package/esm/types/primitives.js +0 -22
  98. package/esm/types/primitives.js.map +1 -1
  99. package/jsr.json +1 -1
  100. package/package.json +6 -24
  101. package/src/lib/config.ts +3 -3
  102. package/src/models/catalog-item-create.ts +17 -0
  103. package/src/models/catalog-item-update.ts +17 -0
  104. package/src/models/catalog-item.ts +15 -0
  105. package/src/models/invoice-create.ts +0 -1
  106. package/src/models/payout.ts +2 -2
  107. package/src/models/time-entry-create.ts +0 -3
  108. package/src/models/time-entry-update.ts +0 -3
  109. package/src/models/time-entry.ts +0 -2
  110. package/src/models/transaction.ts +2 -2
  111. package/src/sdk/calendar-events.ts +15 -15
  112. package/src/sdk/catalog-items.ts +12 -12
  113. package/src/sdk/clients.ts +12 -12
  114. package/src/sdk/contacts.ts +12 -12
  115. package/src/sdk/contracts.ts +15 -15
  116. package/src/sdk/inquiries.ts +15 -15
  117. package/src/sdk/invoices.ts +12 -12
  118. package/src/sdk/milestones.ts +12 -12
  119. package/src/sdk/projects.ts +12 -12
  120. package/src/sdk/proposals.ts +15 -15
  121. package/src/sdk/time-entries.ts +14 -14
  122. package/src/sdk/transactions.ts +14 -14
  123. package/src/sdk/webhooks.ts +15 -15
  124. package/src/types/async.ts +8 -7
  125. package/src/types/primitives.ts +0 -26
@@ -65,17 +65,14 @@ export class Contracts extends ClientSDK {
65
65
  }
66
66
 
67
67
  /**
68
- * Update a contract (limited fields)
69
- *
70
- * @remarks
71
- * Only `title`, `effectiveDate`, `expirationDate`, and `archived` are editable via v1. `title`/`effectiveDate`/`expirationDate` are draft-only; `archived` is always editable.
68
+ * Delete a contract (only drafts)
72
69
  */
73
- async updateContract(
74
- security: operations.UpdateContractSecurity,
75
- request: operations.UpdateContractRequest,
70
+ async deleteContract(
71
+ security: operations.DeleteContractSecurity,
72
+ request: operations.DeleteContractRequest,
76
73
  options?: RequestOptions,
77
- ): Promise<models.Contract> {
78
- return unwrapAsync(contractsUpdateContract(
74
+ ): Promise<void> {
75
+ return unwrapAsync(contractsDeleteContract(
79
76
  this,
80
77
  security,
81
78
  request,
@@ -84,14 +81,17 @@ export class Contracts extends ClientSDK {
84
81
  }
85
82
 
86
83
  /**
87
- * Delete a contract (only drafts)
84
+ * Update a contract (limited fields)
85
+ *
86
+ * @remarks
87
+ * Only `title`, `effectiveDate`, `expirationDate`, and `archived` are editable via v1. `title`/`effectiveDate`/`expirationDate` are draft-only; `archived` is always editable.
88
88
  */
89
- async deleteContract(
90
- security: operations.DeleteContractSecurity,
91
- request: operations.DeleteContractRequest,
89
+ async updateContract(
90
+ security: operations.UpdateContractSecurity,
91
+ request: operations.UpdateContractRequest,
92
92
  options?: RequestOptions,
93
- ): Promise<void> {
94
- return unwrapAsync(contractsDeleteContract(
93
+ ): Promise<models.Contract> {
94
+ return unwrapAsync(contractsUpdateContract(
95
95
  this,
96
96
  security,
97
97
  request,
@@ -65,17 +65,14 @@ export class Inquiries extends ClientSDK {
65
65
  }
66
66
 
67
67
  /**
68
- * Update an inquiry
69
- *
70
- * @remarks
71
- * Status `converted` is terminal and set by the dashboard conversion flow. Transitions out of `converted` or `spam` are blocked.
68
+ * Delete an inquiry
72
69
  */
73
- async updateInquiry(
74
- security: operations.UpdateInquirySecurity,
75
- request: operations.UpdateInquiryRequest,
70
+ async deleteInquiry(
71
+ security: operations.DeleteInquirySecurity,
72
+ request: operations.DeleteInquiryRequest,
76
73
  options?: RequestOptions,
77
- ): Promise<models.Inquiry> {
78
- return unwrapAsync(inquiriesUpdateInquiry(
74
+ ): Promise<void> {
75
+ return unwrapAsync(inquiriesDeleteInquiry(
79
76
  this,
80
77
  security,
81
78
  request,
@@ -84,14 +81,17 @@ export class Inquiries extends ClientSDK {
84
81
  }
85
82
 
86
83
  /**
87
- * Delete an inquiry
84
+ * Update an inquiry
85
+ *
86
+ * @remarks
87
+ * Status `converted` is terminal and set by the dashboard conversion flow. Transitions out of `converted` or `spam` are blocked.
88
88
  */
89
- async deleteInquiry(
90
- security: operations.DeleteInquirySecurity,
91
- request: operations.DeleteInquiryRequest,
89
+ async updateInquiry(
90
+ security: operations.UpdateInquirySecurity,
91
+ request: operations.UpdateInquiryRequest,
92
92
  options?: RequestOptions,
93
- ): Promise<void> {
94
- return unwrapAsync(inquiriesDeleteInquiry(
93
+ ): Promise<models.Inquiry> {
94
+ return unwrapAsync(inquiriesUpdateInquiry(
95
95
  this,
96
96
  security,
97
97
  request,
@@ -65,14 +65,14 @@ export class Invoices extends ClientSDK {
65
65
  }
66
66
 
67
67
  /**
68
- * Update an invoice (line items not editable in v1)
68
+ * Delete an invoice (only drafts)
69
69
  */
70
- async updateInvoice(
71
- security: operations.UpdateInvoiceSecurity,
72
- request: operations.UpdateInvoiceRequest,
70
+ async deleteInvoice(
71
+ security: operations.DeleteInvoiceSecurity,
72
+ request: operations.DeleteInvoiceRequest,
73
73
  options?: RequestOptions,
74
- ): Promise<models.Invoice> {
75
- return unwrapAsync(invoicesUpdateInvoice(
74
+ ): Promise<void> {
75
+ return unwrapAsync(invoicesDeleteInvoice(
76
76
  this,
77
77
  security,
78
78
  request,
@@ -81,14 +81,14 @@ export class Invoices extends ClientSDK {
81
81
  }
82
82
 
83
83
  /**
84
- * Delete an invoice (only drafts)
84
+ * Update an invoice (line items not editable in v1)
85
85
  */
86
- async deleteInvoice(
87
- security: operations.DeleteInvoiceSecurity,
88
- request: operations.DeleteInvoiceRequest,
86
+ async updateInvoice(
87
+ security: operations.UpdateInvoiceSecurity,
88
+ request: operations.UpdateInvoiceRequest,
89
89
  options?: RequestOptions,
90
- ): Promise<void> {
91
- return unwrapAsync(invoicesDeleteInvoice(
90
+ ): Promise<models.Invoice> {
91
+ return unwrapAsync(invoicesUpdateInvoice(
92
92
  this,
93
93
  security,
94
94
  request,
@@ -65,14 +65,14 @@ export class Milestones extends ClientSDK {
65
65
  }
66
66
 
67
67
  /**
68
- * Update a milestone
68
+ * Delete a milestone
69
69
  */
70
- async updateMilestone(
71
- security: operations.UpdateMilestoneSecurity,
72
- request: operations.UpdateMilestoneRequest,
70
+ async deleteMilestone(
71
+ security: operations.DeleteMilestoneSecurity,
72
+ request: operations.DeleteMilestoneRequest,
73
73
  options?: RequestOptions,
74
- ): Promise<models.Milestone> {
75
- return unwrapAsync(milestonesUpdateMilestone(
74
+ ): Promise<void> {
75
+ return unwrapAsync(milestonesDeleteMilestone(
76
76
  this,
77
77
  security,
78
78
  request,
@@ -81,14 +81,14 @@ export class Milestones extends ClientSDK {
81
81
  }
82
82
 
83
83
  /**
84
- * Delete a milestone
84
+ * Update a milestone
85
85
  */
86
- async deleteMilestone(
87
- security: operations.DeleteMilestoneSecurity,
88
- request: operations.DeleteMilestoneRequest,
86
+ async updateMilestone(
87
+ security: operations.UpdateMilestoneSecurity,
88
+ request: operations.UpdateMilestoneRequest,
89
89
  options?: RequestOptions,
90
- ): Promise<void> {
91
- return unwrapAsync(milestonesDeleteMilestone(
90
+ ): Promise<models.Milestone> {
91
+ return unwrapAsync(milestonesUpdateMilestone(
92
92
  this,
93
93
  security,
94
94
  request,
@@ -62,14 +62,14 @@ export class Projects extends ClientSDK {
62
62
  }
63
63
 
64
64
  /**
65
- * Update a project
65
+ * Delete a project
66
66
  */
67
- async updateProject(
68
- security: operations.UpdateProjectSecurity,
69
- request: operations.UpdateProjectRequest,
67
+ async deleteProject(
68
+ security: operations.DeleteProjectSecurity,
69
+ request: operations.DeleteProjectRequest,
70
70
  options?: RequestOptions,
71
- ): Promise<models.Project> {
72
- return unwrapAsync(projectsUpdateProject(
71
+ ): Promise<void> {
72
+ return unwrapAsync(projectsDeleteProject(
73
73
  this,
74
74
  security,
75
75
  request,
@@ -78,14 +78,14 @@ export class Projects extends ClientSDK {
78
78
  }
79
79
 
80
80
  /**
81
- * Delete a project
81
+ * Update a project
82
82
  */
83
- async deleteProject(
84
- security: operations.DeleteProjectSecurity,
85
- request: operations.DeleteProjectRequest,
83
+ async updateProject(
84
+ security: operations.UpdateProjectSecurity,
85
+ request: operations.UpdateProjectRequest,
86
86
  options?: RequestOptions,
87
- ): Promise<void> {
88
- return unwrapAsync(projectsDeleteProject(
87
+ ): Promise<models.Project> {
88
+ return unwrapAsync(projectsUpdateProject(
89
89
  this,
90
90
  security,
91
91
  request,
@@ -65,17 +65,14 @@ export class Proposals extends ClientSDK {
65
65
  }
66
66
 
67
67
  /**
68
- * Update a proposal
69
- *
70
- * @remarks
71
- * Status transitions to `accepted`/`rejected`/`expired` are system-driven; do not set them directly.
68
+ * Delete a proposal (only drafts)
72
69
  */
73
- async updateProposal(
74
- security: operations.UpdateProposalSecurity,
75
- request: operations.UpdateProposalRequest,
70
+ async deleteProposal(
71
+ security: operations.DeleteProposalSecurity,
72
+ request: operations.DeleteProposalRequest,
76
73
  options?: RequestOptions,
77
- ): Promise<models.Proposal> {
78
- return unwrapAsync(proposalsUpdateProposal(
74
+ ): Promise<void> {
75
+ return unwrapAsync(proposalsDeleteProposal(
79
76
  this,
80
77
  security,
81
78
  request,
@@ -84,14 +81,17 @@ export class Proposals extends ClientSDK {
84
81
  }
85
82
 
86
83
  /**
87
- * Delete a proposal (only drafts)
84
+ * Update a proposal
85
+ *
86
+ * @remarks
87
+ * Status transitions to `accepted`/`rejected`/`expired` are system-driven; do not set them directly.
88
88
  */
89
- async deleteProposal(
90
- security: operations.DeleteProposalSecurity,
91
- request: operations.DeleteProposalRequest,
89
+ async updateProposal(
90
+ security: operations.UpdateProposalSecurity,
91
+ request: operations.UpdateProposalRequest,
92
92
  options?: RequestOptions,
93
- ): Promise<void> {
94
- return unwrapAsync(proposalsDeleteProposal(
93
+ ): Promise<models.Proposal> {
94
+ return unwrapAsync(proposalsUpdateProposal(
95
95
  this,
96
96
  security,
97
97
  request,
@@ -62,17 +62,17 @@ export class TimeEntries extends ClientSDK {
62
62
  }
63
63
 
64
64
  /**
65
- * Update a time entry
65
+ * Delete a time entry
66
66
  *
67
67
  * @remarks
68
- * Time entries billed to a paid invoice cannot be edited (the date field is immutable in that case).
68
+ * Time entries billed to a paid invoice cannot be deleted.
69
69
  */
70
- async updateTimeEntry(
71
- security: operations.UpdateTimeEntrySecurity,
72
- request: operations.UpdateTimeEntryRequest,
70
+ async deleteTimeEntry(
71
+ security: operations.DeleteTimeEntrySecurity,
72
+ request: operations.DeleteTimeEntryRequest,
73
73
  options?: RequestOptions,
74
- ): Promise<models.TimeEntry> {
75
- return unwrapAsync(timeEntriesUpdateTimeEntry(
74
+ ): Promise<void> {
75
+ return unwrapAsync(timeEntriesDeleteTimeEntry(
76
76
  this,
77
77
  security,
78
78
  request,
@@ -81,17 +81,17 @@ export class TimeEntries extends ClientSDK {
81
81
  }
82
82
 
83
83
  /**
84
- * Delete a time entry
84
+ * Update a time entry
85
85
  *
86
86
  * @remarks
87
- * Time entries billed to a paid invoice cannot be deleted.
87
+ * Time entries billed to a paid invoice cannot be edited (the date field is immutable in that case).
88
88
  */
89
- async deleteTimeEntry(
90
- security: operations.DeleteTimeEntrySecurity,
91
- request: operations.DeleteTimeEntryRequest,
89
+ async updateTimeEntry(
90
+ security: operations.UpdateTimeEntrySecurity,
91
+ request: operations.UpdateTimeEntryRequest,
92
92
  options?: RequestOptions,
93
- ): Promise<void> {
94
- return unwrapAsync(timeEntriesDeleteTimeEntry(
93
+ ): Promise<models.TimeEntry> {
94
+ return unwrapAsync(timeEntriesUpdateTimeEntry(
95
95
  this,
96
96
  security,
97
97
  request,
@@ -62,17 +62,17 @@ export class Transactions extends ClientSDK {
62
62
  }
63
63
 
64
64
  /**
65
- * Update a transaction
65
+ * Delete a transaction
66
66
  *
67
67
  * @remarks
68
- * Transactions billed to a sent/paid invoice may be frozen — the server will return 409 if so.
68
+ * Transactions billed to a sent/paid invoice cannot be deleted.
69
69
  */
70
- async updateTransaction(
71
- security: operations.UpdateTransactionSecurity,
72
- request: operations.UpdateTransactionRequest,
70
+ async deleteTransaction(
71
+ security: operations.DeleteTransactionSecurity,
72
+ request: operations.DeleteTransactionRequest,
73
73
  options?: RequestOptions,
74
- ): Promise<models.Transaction> {
75
- return unwrapAsync(transactionsUpdateTransaction(
74
+ ): Promise<void> {
75
+ return unwrapAsync(transactionsDeleteTransaction(
76
76
  this,
77
77
  security,
78
78
  request,
@@ -81,17 +81,17 @@ export class Transactions extends ClientSDK {
81
81
  }
82
82
 
83
83
  /**
84
- * Delete a transaction
84
+ * Update a transaction
85
85
  *
86
86
  * @remarks
87
- * Transactions billed to a sent/paid invoice cannot be deleted.
87
+ * Transactions billed to a sent/paid invoice may be frozen — the server will return 409 if so.
88
88
  */
89
- async deleteTransaction(
90
- security: operations.DeleteTransactionSecurity,
91
- request: operations.DeleteTransactionRequest,
89
+ async updateTransaction(
90
+ security: operations.UpdateTransactionSecurity,
91
+ request: operations.UpdateTransactionRequest,
92
92
  options?: RequestOptions,
93
- ): Promise<void> {
94
- return unwrapAsync(transactionsDeleteTransaction(
93
+ ): Promise<models.Transaction> {
94
+ return unwrapAsync(transactionsUpdateTransaction(
95
95
  this,
96
96
  security,
97
97
  request,
@@ -65,17 +65,14 @@ export class Webhooks extends ClientSDK {
65
65
  }
66
66
 
67
67
  /**
68
- * Update a webhook
69
- *
70
- * @remarks
71
- * Pass `secret: null` to remove the signing secret. Pass a new string to rotate.
68
+ * Delete a webhook
72
69
  */
73
- async updateWebhook(
74
- security: operations.UpdateWebhookSecurity,
75
- request: operations.UpdateWebhookRequest,
70
+ async deleteWebhook(
71
+ security: operations.DeleteWebhookSecurity,
72
+ request: operations.DeleteWebhookRequest,
76
73
  options?: RequestOptions,
77
- ): Promise<models.Webhook> {
78
- return unwrapAsync(webhooksUpdateWebhook(
74
+ ): Promise<void> {
75
+ return unwrapAsync(webhooksDeleteWebhook(
79
76
  this,
80
77
  security,
81
78
  request,
@@ -84,14 +81,17 @@ export class Webhooks extends ClientSDK {
84
81
  }
85
82
 
86
83
  /**
87
- * Delete a webhook
84
+ * Update a webhook
85
+ *
86
+ * @remarks
87
+ * Pass `secret: null` to remove the signing secret. Pass a new string to rotate.
88
88
  */
89
- async deleteWebhook(
90
- security: operations.DeleteWebhookSecurity,
91
- request: operations.DeleteWebhookRequest,
89
+ async updateWebhook(
90
+ security: operations.UpdateWebhookSecurity,
91
+ request: operations.UpdateWebhookRequest,
92
92
  options?: RequestOptions,
93
- ): Promise<void> {
94
- return unwrapAsync(webhooksDeleteWebhook(
93
+ ): Promise<models.Webhook> {
94
+ return unwrapAsync(webhooksUpdateWebhook(
95
95
  this,
96
96
  security,
97
97
  request,
@@ -21,16 +21,17 @@ export type APICall =
21
21
 
22
22
  export class APIPromise<T> implements Promise<T> {
23
23
  readonly #promise: Promise<[T, APICall]>;
24
- readonly #unwrapped: Promise<T>;
24
+ #unwrapped: Promise<T> | null;
25
25
 
26
26
  readonly [Symbol.toStringTag] = "APIPromise";
27
27
 
28
28
  constructor(p: [T, APICall] | Promise<[T, APICall]>) {
29
29
  this.#promise = p instanceof Promise ? p : Promise.resolve(p);
30
- this.#unwrapped =
31
- p instanceof Promise
32
- ? this.#promise.then(([value]) => value)
33
- : Promise.resolve(p[0]);
30
+ this.#unwrapped = p instanceof Promise ? null : Promise.resolve(p[0]);
31
+ }
32
+
33
+ #getUnwrapped(): Promise<T> {
34
+ return (this.#unwrapped ??= this.#promise.then(([value]) => value));
34
35
  }
35
36
 
36
37
  then<TResult1 = T, TResult2 = never>(
@@ -55,11 +56,11 @@ export class APIPromise<T> implements Promise<T> {
55
56
  | null
56
57
  | undefined,
57
58
  ): Promise<T | TResult> {
58
- return this.#unwrapped.catch(onrejected);
59
+ return this.#getUnwrapped().catch(onrejected);
59
60
  }
60
61
 
61
62
  finally(onfinally?: (() => void) | null | undefined): Promise<T> {
62
- return this.#unwrapped.finally(onfinally);
63
+ return this.#getUnwrapped().finally(onfinally);
63
64
  }
64
65
 
65
66
  $inspect(): Promise<[T, APICall]> {
@@ -70,28 +70,6 @@ export function number(): z.ZodMiniType<number> {
70
70
  ]);
71
71
  }
72
72
 
73
- export function bigint(): z.ZodMiniType<bigint> {
74
- return z.union([
75
- z.pipe(
76
- z.string(),
77
- z.transform((x, ctx) => {
78
- try {
79
- return BigInt(x);
80
- } catch (error) {
81
- ctx.issues.push({
82
- input: x,
83
- code: "invalid_type",
84
- expected: "bigint",
85
- received: "string",
86
- });
87
- return z.NEVER;
88
- }
89
- }),
90
- ),
91
- zodDefaultToZeroValue(0n),
92
- ]);
93
- }
94
-
95
73
  export function date(): z.ZodMiniType<Date> {
96
74
  return z.union([
97
75
  z.pipe(
@@ -126,10 +104,6 @@ export function literal<T extends string | number | boolean>(
126
104
  return z.union([z.literal(value), zodDefaultToZeroValue(value)]);
127
105
  }
128
106
 
129
- export function literalBigInt<T extends bigint>(value: T): z.ZodMiniType<T> {
130
- return z.pipe(z.literal(String(value)), z.transform((x) => BigInt(x))) as any;
131
- }
132
-
133
107
  export function optional<T extends z.ZodMiniType>(t: T) {
134
108
  return z.optional(z.union([
135
109
  // Null -> undefined