@schematichq/schematic-typescript-node 1.2.4 → 1.2.6

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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Client.d.ts +11 -57
  3. package/dist/api/resources/companies/client/Client.d.ts +41 -2
  4. package/dist/api/resources/companies/client/requests/DeleteCompanyRequest.d.ts +14 -0
  5. package/dist/api/resources/companies/client/requests/ListPlanChangesRequest.d.ts +28 -0
  6. package/dist/api/resources/companies/client/requests/index.d.ts +2 -0
  7. package/dist/api/resources/companies/types/DeleteCompanyParams.d.ts +10 -0
  8. package/dist/api/resources/companies/types/DeleteCompanyResponse.d.ts +1 -1
  9. package/dist/api/resources/{features/types/CountAudienceCompaniesResponse.d.ts → companies/types/GetPlanChangeResponse.d.ts} +2 -2
  10. package/dist/api/resources/companies/types/ListPlanChangesParams.d.ts +17 -0
  11. package/dist/api/resources/{plans/types/DeleteAudienceResponse.d.ts → companies/types/ListPlanChangesResponse.d.ts} +3 -3
  12. package/dist/api/resources/companies/types/index.d.ts +4 -0
  13. package/dist/api/resources/credits/client/Client.d.ts +46 -24
  14. package/dist/api/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.d.ts +8 -0
  15. package/dist/api/resources/credits/client/requests/DeleteBillingPlanCreditGrantRequest.d.ts +12 -0
  16. package/dist/api/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.d.ts +21 -0
  17. package/dist/api/resources/credits/client/requests/index.d.ts +2 -0
  18. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryType.d.ts +11 -0
  19. package/dist/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryUnit.d.ts +8 -0
  20. package/dist/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.d.ts +9 -0
  21. package/dist/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.d.ts +1 -1
  22. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.d.ts +11 -0
  23. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.d.ts +8 -0
  24. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.d.ts +10 -0
  25. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.d.ts +8 -0
  26. package/dist/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.d.ts +8 -0
  27. package/dist/api/resources/{features/types/CountAudienceUsersResponse.d.ts → credits/types/UpdateBillingPlanCreditGrantResponse.d.ts} +2 -2
  28. package/dist/api/resources/credits/types/index.d.ts +9 -0
  29. package/dist/api/resources/features/client/Client.d.ts +0 -112
  30. package/dist/api/resources/features/types/index.d.ts +0 -4
  31. package/dist/api/resources/index.d.ts +3 -3
  32. package/dist/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +0 -1
  33. package/dist/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +0 -1
  34. package/dist/api/resources/plans/client/Client.d.ts +0 -58
  35. package/dist/api/resources/plans/client/requests/index.d.ts +0 -1
  36. package/dist/api/resources/plans/types/index.d.ts +0 -3
  37. package/dist/api/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.d.ts +2 -1
  38. package/dist/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.d.ts +2 -1
  39. package/dist/api/types/BillingPlanCreditGrantResponseData.d.ts +7 -0
  40. package/dist/api/types/Condition.d.ts +4 -4
  41. package/dist/api/types/ConditionConditionType.d.ts +15 -0
  42. package/dist/api/types/ConditionMetricPeriod.d.ts +10 -0
  43. package/dist/api/types/ConditionMetricPeriodMonthReset.d.ts +8 -0
  44. package/dist/api/types/ConditionOperator.d.ts +14 -0
  45. package/dist/api/types/CreateOrUpdateConditionGroupRequestBody.d.ts +0 -1
  46. package/dist/api/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +1 -2
  47. package/dist/api/types/CreditGrantExpiryRequestBody.d.ts +12 -0
  48. package/dist/api/types/CreditGrantExpiryRequestBodyExpiryType.d.ts +11 -0
  49. package/dist/api/types/CreditGrantExpiryRequestBodyExpiryUnit.d.ts +8 -0
  50. package/dist/api/types/CreditGrantExpiryRequestBodyResetCadence.d.ts +10 -0
  51. package/dist/api/types/CreditGrantExpiryRequestBodyResetStart.d.ts +8 -0
  52. package/dist/api/types/CreditGrantExpiryRequestBodyResetType.d.ts +8 -0
  53. package/dist/api/types/CreditLedgerEnrichedEntryResponseData.d.ts +1 -0
  54. package/dist/api/types/PlanChangeResponseData.d.ts +29 -0
  55. package/dist/api/types/PlanChangeResponseDataAction.d.ts +15 -0
  56. package/dist/api/types/PlanChangeResponseDataActorType.d.ts +10 -0
  57. package/dist/api/types/PlanChangeResponseDataBasePlanAction.d.ts +13 -0
  58. package/dist/api/types/PlanChangeResponseDataSubscriptionChangeAction.d.ts +15 -0
  59. package/dist/api/types/PlanCreditGrantView.d.ts +7 -0
  60. package/dist/api/types/PlanSnapshotView.d.ts +10 -0
  61. package/dist/api/types/Rule.d.ts +1 -1
  62. package/dist/api/types/RuleConditionDetailResponseData.d.ts +0 -1
  63. package/dist/api/types/RuleConditionGroupDetailResponseData.d.ts +0 -1
  64. package/dist/api/types/RuleConditionGroupResponseData.d.ts +0 -1
  65. package/dist/api/types/RuleConditionResponseData.d.ts +0 -1
  66. package/dist/api/types/RuleDetailResponseData.d.ts +0 -1
  67. package/dist/api/types/RuleResponseData.d.ts +0 -1
  68. package/dist/api/types/RuleRuleType.d.ts +13 -0
  69. package/dist/api/types/SubscriptionTraitUpdate.d.ts +12 -0
  70. package/dist/api/types/TraitDefinition.d.ts +3 -2
  71. package/dist/api/types/TraitDefinitionComparableType.d.ts +10 -0
  72. package/dist/api/types/TraitDefinitionEntityType.d.ts +8 -0
  73. package/dist/api/types/index.d.ts +20 -4
  74. package/dist/index.js +3 -3
  75. package/dist/serialization/resources/companies/types/DeleteCompanyParams.d.ts +13 -0
  76. package/dist/serialization/resources/companies/types/DeleteCompanyResponse.d.ts +2 -1
  77. package/dist/serialization/resources/companies/types/GetPlanChangeResponse.d.ts +14 -0
  78. package/dist/serialization/resources/companies/types/ListPlanChangesParams.d.ts +18 -0
  79. package/dist/serialization/resources/companies/types/ListPlanChangesResponse.d.ts +15 -0
  80. package/dist/serialization/resources/companies/types/index.d.ts +4 -0
  81. package/dist/serialization/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.d.ts +10 -0
  82. package/dist/serialization/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.d.ts +24 -0
  83. package/dist/serialization/resources/credits/client/requests/index.d.ts +1 -0
  84. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryType.d.ts +10 -0
  85. package/dist/serialization/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryUnit.d.ts +10 -0
  86. package/dist/serialization/resources/credits/types/DeleteBillingPlanCreditGrantParams.d.ts +12 -0
  87. package/dist/serialization/resources/credits/types/DeleteBillingPlanCreditGrantResponse.d.ts +2 -1
  88. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.d.ts +10 -0
  89. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.d.ts +10 -0
  90. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.d.ts +10 -0
  91. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.d.ts +10 -0
  92. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.d.ts +10 -0
  93. package/dist/serialization/resources/credits/types/UpdateBillingPlanCreditGrantResponse.d.ts +14 -0
  94. package/dist/serialization/resources/credits/types/index.d.ts +9 -0
  95. package/dist/serialization/resources/features/types/index.d.ts +0 -4
  96. package/dist/serialization/resources/index.d.ts +3 -3
  97. package/dist/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +0 -1
  98. package/dist/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +0 -1
  99. package/dist/serialization/resources/plans/client/requests/index.d.ts +0 -1
  100. package/dist/serialization/resources/plans/types/index.d.ts +0 -3
  101. package/dist/serialization/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.d.ts +1 -1
  102. package/dist/serialization/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.d.ts +1 -1
  103. package/dist/serialization/types/BillingPlanCreditGrantResponseData.d.ts +7 -0
  104. package/dist/serialization/types/Condition.d.ts +8 -4
  105. package/dist/serialization/types/ConditionConditionType.d.ts +10 -0
  106. package/dist/serialization/types/ConditionMetricPeriod.d.ts +10 -0
  107. package/dist/serialization/types/ConditionMetricPeriodMonthReset.d.ts +10 -0
  108. package/dist/serialization/types/ConditionOperator.d.ts +10 -0
  109. package/dist/serialization/types/CreateOrUpdateConditionGroupRequestBody.d.ts +0 -1
  110. package/dist/serialization/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +1 -1
  111. package/dist/serialization/types/CreditGrantExpiryRequestBody.d.ts +22 -0
  112. package/dist/serialization/types/CreditGrantExpiryRequestBodyExpiryType.d.ts +10 -0
  113. package/dist/serialization/types/CreditGrantExpiryRequestBodyExpiryUnit.d.ts +10 -0
  114. package/dist/serialization/types/CreditGrantExpiryRequestBodyResetCadence.d.ts +10 -0
  115. package/dist/serialization/types/CreditGrantExpiryRequestBodyResetStart.d.ts +10 -0
  116. package/dist/serialization/types/CreditGrantExpiryRequestBodyResetType.d.ts +10 -0
  117. package/dist/serialization/types/CreditLedgerEnrichedEntryResponseData.d.ts +1 -0
  118. package/dist/serialization/types/PlanChangeResponseData.d.ts +40 -0
  119. package/dist/serialization/types/PlanChangeResponseDataAction.d.ts +10 -0
  120. package/dist/serialization/types/PlanChangeResponseDataActorType.d.ts +10 -0
  121. package/dist/serialization/types/PlanChangeResponseDataBasePlanAction.d.ts +10 -0
  122. package/dist/serialization/types/PlanChangeResponseDataSubscriptionChangeAction.d.ts +10 -0
  123. package/dist/serialization/types/PlanCreditGrantView.d.ts +7 -0
  124. package/dist/serialization/types/PlanSnapshotView.d.ts +16 -0
  125. package/dist/serialization/types/Rule.d.ts +2 -1
  126. package/dist/serialization/types/RuleConditionDetailResponseData.d.ts +0 -1
  127. package/dist/serialization/types/RuleConditionGroupDetailResponseData.d.ts +0 -1
  128. package/dist/serialization/types/RuleConditionGroupResponseData.d.ts +0 -1
  129. package/dist/serialization/types/RuleConditionResponseData.d.ts +0 -1
  130. package/dist/serialization/types/RuleDetailResponseData.d.ts +0 -1
  131. package/dist/serialization/types/RuleResponseData.d.ts +0 -1
  132. package/dist/serialization/types/RuleRuleType.d.ts +10 -0
  133. package/dist/serialization/types/SubscriptionTraitUpdate.d.ts +18 -0
  134. package/dist/serialization/types/TraitDefinition.d.ts +4 -2
  135. package/dist/serialization/types/TraitDefinitionComparableType.d.ts +10 -0
  136. package/dist/serialization/types/TraitDefinitionEntityType.d.ts +10 -0
  137. package/dist/serialization/types/index.d.ts +20 -4
  138. package/package.json +2 -1
  139. package/dist/api/resources/features/types/ListAudienceCompaniesResponse.d.ts +0 -9
  140. package/dist/api/resources/features/types/ListAudienceUsersResponse.d.ts +0 -9
  141. package/dist/api/resources/plans/client/requests/UpdateAudienceRequestBody.d.ts +0 -25
  142. package/dist/api/resources/plans/types/GetAudienceResponse.d.ts +0 -9
  143. package/dist/api/resources/plans/types/UpdateAudienceResponse.d.ts +0 -9
  144. package/dist/api/types/AudienceRequestBody.d.ts +0 -13
  145. package/dist/api/types/PaginationFilter.d.ts +0 -9
  146. package/dist/api/types/PlanAudienceDetailResponseData.d.ts +0 -18
  147. package/dist/api/types/PlanAudienceResponseData.d.ts +0 -15
  148. package/dist/serialization/resources/features/types/CountAudienceCompaniesResponse.d.ts +0 -14
  149. package/dist/serialization/resources/features/types/CountAudienceUsersResponse.d.ts +0 -14
  150. package/dist/serialization/resources/features/types/ListAudienceCompaniesResponse.d.ts +0 -14
  151. package/dist/serialization/resources/features/types/ListAudienceUsersResponse.d.ts +0 -14
  152. package/dist/serialization/resources/plans/client/requests/UpdateAudienceRequestBody.d.ts +0 -15
  153. package/dist/serialization/resources/plans/types/DeleteAudienceResponse.d.ts +0 -14
  154. package/dist/serialization/resources/plans/types/GetAudienceResponse.d.ts +0 -14
  155. package/dist/serialization/resources/plans/types/UpdateAudienceResponse.d.ts +0 -14
  156. package/dist/serialization/types/AudienceRequestBody.d.ts +0 -18
  157. package/dist/serialization/types/PaginationFilter.d.ts +0 -13
  158. package/dist/serialization/types/PlanAudienceDetailResponseData.d.ts +0 -25
  159. package/dist/serialization/types/PlanAudienceResponseData.d.ts +0 -21
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var tw=Object.create;var xr=Object.defineProperty;var iw=Object.getOwnPropertyDescriptor;var aw=Object.getOwnPropertyNames;var sw=Object.getPrototypeOf,nw=Object.prototype.hasOwnProperty;var qo=(w,t)=>()=>(w&&(t=w(w=0)),t);var oe=(w,t)=>{for(var o in t)xr(w,o,{get:t[o],enumerable:!0})},gi=(w,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of aw(t))!nw.call(w,i)&&i!==o&&xr(w,i,{get:()=>t[i],enumerable:!(r=iw(t,i))||r.enumerable});return w};var H=(w,t,o)=>(o=w!=null?tw(sw(w)):{},gi(t||!w||!w.__esModule?xr(o,"default",{value:w,enumerable:!0}):o,w)),cw=w=>gi(xr({},"__esModule",{value:!0}),w);var ds={};oe(ds,{Node18UniversalStreamWrapper:()=>Jo});var Jo,hs=qo(()=>{"use strict";Jo=class w{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(t,o){this.events[t]?.push(o)}off(t,o){this.events[t]=this.events[t]?.filter(r=>r!==o)}pipe(t){return this.on("data",async o=>{if(t instanceof w)t._write(o);else if(t instanceof WritableStream){let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}else t.write(o)}),this.on("end",async()=>{t instanceof w?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.on("error",async o=>{t instanceof w?t._error(o):t instanceof WritableStream?t.getWriter().abort(o):t.destroy(o)}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",async o=>{if(t instanceof w)t._write(o);else if(t instanceof WritableStream){let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}else t.write(o)}),this.off("end",async()=>{t instanceof w?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.off("error",async o=>{t instanceof w?t._error(o):t instanceof WritableStream?t.getWriter().abort(o):t.destroy(o)})}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close")}).catch(o=>{this._emit("error",o)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(!t)return o}setEncoding(t){this.encoding=t}async text(){let t=[];for(;;){let{done:r,value:i}=await this.reader.read();if(r)break;i&&t.push(i)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t)}_end(){this._emit("end")}_error(t){this._emit("error",t)}_emit(t,o){if(this.events[t])for(let r of this.events[t]||[])r(o)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}o&&this._emit("data",o)}}catch(t){this._emit("error",t)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:o}},[Symbol.asyncIterator](){return this}}}}});var ws={};oe(ws,{UndiciStreamWrapper:()=>$o});var $o,gs=qo(()=>{"use strict";$o=class w{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(t,o){this.events[t]?.push(o)}off(t,o){this.events[t]=this.events[t]?.filter(r=>r!==o)}pipe(t){return this.on("data",o=>{if(t instanceof w)t._write(o);else{let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}}),this.on("end",()=>{t instanceof w?t._end():t.getWriter().close()}),this.on("error",o=>{t instanceof w?t._error(o):t.getWriter().abort(o)}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",o=>{if(t instanceof w)t._write(o);else{let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}}),this.off("end",()=>{t instanceof w?t._end():t.getWriter().close()}),this.off("error",o=>{t instanceof w?t._error(o):t.getWriter().abort(o)})}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close")}).catch(o=>{this._emit("error",o)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(!t)return o}setEncoding(t){this.encoding=t}async text(){let t=[];for(;;){let{done:r,value:i}=await this.reader.read();if(r)break;i&&t.push(i)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t)}_end(){this._emit("end")}_error(t){this._emit("error",t)}_emit(t,o){if(this.events[t])for(let r of this.events[t]||[])r(o)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}o&&this._emit("data",o)}}catch(t){this._emit("error",t)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:o}},[Symbol.asyncIterator](){return this}}}}});var ys={};oe(ys,{NodePre18StreamWrapper:()=>Zo});var Zo,Rs=qo(()=>{"use strict";Zo=class{constructor(t){this.readableStream=t}on(t,o){this.readableStream.on(t,o)}off(t,o){this.readableStream.off(t,o)}pipe(t){return this.readableStream.pipe(t),t}pipeTo(t){return this.pipe(t)}unpipe(t){t?this.readableStream.unpipe(t):this.readableStream.unpipe()}destroy(t){this.readableStream.destroy(t)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((t,o)=>{let r=this.readableStream.read();r?t(r):(this.readableStream.once("readable",()=>{let i=this.readableStream.read();t(i)}),this.readableStream.once("error",o))})}setEncoding(t){this.readableStream.setEncoding(t),this.encoding=t}async text(){let t=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let i of this.readableStream)t.push(o.encode(i));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(t))}async json(){let t=await this.text();return JSON.parse(t)}[Symbol.asyncIterator](){let o=this.readableStream[Symbol.asyncIterator]();return{async next(){let{value:r,done:i}=await o.next();return{value:r,done:i}},[Symbol.asyncIterator](){return this}}}}});var ag={};oe(ag,{LocalCache:()=>$e,Schematic:()=>Y,SchematicClient:()=>ko,SchematicEnvironment:()=>f,SchematicError:()=>c,SchematicTimeoutError:()=>z,WEBHOOK_SIGNATURE_HEADER:()=>di,WEBHOOK_TIMESTAMP_HEADER:()=>hi,WebhookSignatureError:()=>xe,computeHexSignature:()=>rw,computeSignature:()=>Mo,verifySignature:()=>wi,verifyWebhookSignature:()=>ow});module.exports=cw(ag);var Y={};oe(Y,{BadRequestError:()=>P,BillingProductPricingUsageType:()=>pw,CountBillingProductsRequestPriceUsageType:()=>Vi,CountBillingProductsResponseParamsPriceUsageType:()=>ki,CountCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ha,CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>wa,CountCreditBundlesRequestStatus:()=>Ji,CountCreditBundlesResponseParamsStatus:()=>$i,CountCreditLedgerRequestPeriod:()=>sa,CountCreditLedgerResponseParamsPeriod:()=>na,CountEntityKeyDefinitionsRequestEntityType:()=>ba,CountEntityKeyDefinitionsResponseParamsEntityType:()=>fa,CountEntityTraitDefinitionsRequestEntityType:()=>Ta,CountEntityTraitDefinitionsRequestTraitType:()=>va,CountEntityTraitDefinitionsResponseParamsEntityType:()=>Oa,CountEntityTraitDefinitionsResponseParamsTraitType:()=>ja,CountPlansRequestPlanType:()=>Za,CountPlansResponseParamsPlanType:()=>Ya,CreateBillingCreditRequestBodyBurnStrategy:()=>Mi,CreateBillingCreditRequestBodyDefaultRolloverPolicy:()=>qi,CreateBillingPlanCreditGrantRequestBodyExpiryType:()=>ca,CreateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>pa,CreateBillingPlanCreditGrantRequestBodyResetCadence:()=>la,CreateBillingPlanCreditGrantRequestBodyResetStart:()=>ma,CreateBillingPlanCreditGrantRequestBodyResetType:()=>ua,CreateBillingPriceRequestBodyBillingScheme:()=>Pi,CreateBillingPriceRequestBodyTiersMode:()=>Ci,CreateBillingPriceRequestBodyUsageType:()=>Ti,CreateBillingSubscriptionRequestBodyTrialEndSetting:()=>Di,CreateCompanyCreditGrantExpiryType:()=>Yi,CreateCompanyCreditGrantExpiryUnit:()=>Qi,CreateCompanyOverrideRequestBodyMetricPeriod:()=>Ba,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Va,CreateCompanyOverrideRequestBodyValueType:()=>ka,CreateComponentRequestBodyEntityType:()=>Qa,CreateCreditBundleRequestBodyExpiryType:()=>Li,CreateCreditBundleRequestBodyExpiryUnit:()=>Gi,CreateCreditBundleRequestBodyStatus:()=>Ni,CreateEntitlementReqCommonMetricPeriod:()=>lw,CreateEntitlementReqCommonMetricPeriodMonthReset:()=>mw,CreateEntitlementReqCommonValueType:()=>uw,CreateEntityTraitDefinitionRequestBodyEntityType:()=>Ua,CreateEntityTraitDefinitionRequestBodyTraitType:()=>Pa,CreateEnvironmentRequestBodyEnvironmentType:()=>yi,CreateEventRequestBodyEventType:()=>dw,CreateFeatureRequestBodyFeatureType:()=>zi,CreateFeatureRequestBodyLifecyclePhase:()=>bi,CreateOrUpdateConditionRequestBodyConditionType:()=>hw,CreateOrUpdateConditionRequestBodyMetricPeriod:()=>ww,CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset:()=>gw,CreateOrUpdateConditionRequestBodyOperator:()=>yw,CreateOrUpdateRuleRequestBodyRuleType:()=>Rw,CreatePlanEntitlementRequestBodyMetricPeriod:()=>Aa,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Fa,CreatePlanEntitlementRequestBodyPriceBehavior:()=>Ia,CreatePlanEntitlementRequestBodyValueType:()=>Ka,CreatePlanRequestBodyPlanType:()=>Ja,CreateWebhookRequestBodyRequestTypesItem:()=>cs,CreditGrantDetailGrantReason:()=>zw,FeatureCompanyResponseDataAllocationType:()=>bw,FeatureCompanyResponseDataCreditGrantReason:()=>fw,FeatureCompanyUserResponseDataAllocationType:()=>_w,FeatureUsageResponseDataAllocationType:()=>Sw,FeatureUsageResponseDataCreditGrantReason:()=>Ew,ForbiddenError:()=>E,GetEnrichedCreditLedgerRequestPeriod:()=>ia,GetEnrichedCreditLedgerResponseParamsPeriod:()=>aa,InternalServerError:()=>U,ListBillingProductsRequestPriceUsageType:()=>ji,ListBillingProductsResponseParamsPriceUsageType:()=>Bi,ListCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ga,ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>ya,ListCompanyGrantsRequestDir:()=>ra,ListCompanyGrantsRequestOrder:()=>ea,ListCompanyGrantsResponseParamsDir:()=>oa,ListCompanyGrantsResponseParamsOrder:()=>ta,ListCreditBundlesRequestStatus:()=>Ii,ListCreditBundlesResponseParamsStatus:()=>Ki,ListEntityKeyDefinitionsRequestEntityType:()=>Ra,ListEntityKeyDefinitionsResponseParamsEntityType:()=>za,ListEntityTraitDefinitionsRequestEntityType:()=>_a,ListEntityTraitDefinitionsRequestTraitType:()=>Sa,ListEntityTraitDefinitionsResponseParamsEntityType:()=>Ea,ListEntityTraitDefinitionsResponseParamsTraitType:()=>xa,ListEventsRequestEventTypesItem:()=>is,ListEventsResponseParamsEventTypesItem:()=>as,ListPlansRequestPlanType:()=>Ha,ListPlansResponseParamsPlanType:()=>Wa,ListProductPricesRequestPriceUsageType:()=>vi,ListProductPricesResponseParamsPriceUsageType:()=>Oi,NotFoundError:()=>x,SearchBillingPricesRequestTiersMode:()=>Si,SearchBillingPricesRequestUsageType:()=>Ei,SearchBillingPricesResponseParamsTiersMode:()=>xi,SearchBillingPricesResponseParamsUsageType:()=>Ui,UnauthorizedError:()=>S,UpdateBillingCreditRequestBodyBurnStrategy:()=>Ai,UpdateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Fi,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>Da,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Ma,UpdateCompanyOverrideRequestBodyValueType:()=>qa,UpdateComponentRequestBodyEntityType:()=>es,UpdateComponentRequestBodyState:()=>rs,UpdateCreditBundleDetailsRequestBodyExpiryType:()=>Xi,UpdateCreditBundleDetailsRequestBodyExpiryUnit:()=>Hi,UpdateCreditBundleDetailsRequestBodyStatus:()=>Wi,UpdateEntitlementReqCommonMetricPeriod:()=>xw,UpdateEntitlementReqCommonMetricPeriodMonthReset:()=>Uw,UpdateEntitlementReqCommonValueType:()=>Pw,UpdateEntityTraitDefinitionRequestBodyTraitType:()=>Ca,UpdateEnvironmentRequestBodyEnvironmentType:()=>Ri,UpdateFeatureRequestBodyFeatureType:()=>fi,UpdateFeatureRequestBodyLifecyclePhase:()=>_i,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>La,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Ga,UpdatePlanEntitlementRequestBodyPriceBehavior:()=>Na,UpdatePlanEntitlementRequestBodyValueType:()=>Xa,UpdateWebhookRequestBodyRequestTypesItem:()=>ps,UpdateWebhookRequestBodyStatus:()=>ls,UpsertBillingProductRequestBodyChargeType:()=>$a,UsageBasedEntitlementRequestBodyPriceBehavior:()=>Cw,ZeroOutGrantRequestBodyReason:()=>Zi,accesstokens:()=>ns,accounts:()=>Ao,billing:()=>Io,checkout:()=>da,companies:()=>Lo,components:()=>Xo,credits:()=>Ko,crm:()=>os,dataexports:()=>ts,entitlements:()=>Go,events:()=>Ho,features:()=>Fo,plangroups:()=>ss,plans:()=>No,webhooks:()=>Wo});var Ao={};oe(Ao,{CreateEnvironmentRequestBodyEnvironmentType:()=>yi,UpdateEnvironmentRequestBodyEnvironmentType:()=>Ri});var yi={Development:"development",Staging:"staging",Production:"production"};var Ri={Development:"development",Staging:"staging",Production:"production"};var Fo={};oe(Fo,{CreateFeatureRequestBodyFeatureType:()=>zi,CreateFeatureRequestBodyLifecyclePhase:()=>bi,UpdateFeatureRequestBodyFeatureType:()=>fi,UpdateFeatureRequestBodyLifecyclePhase:()=>_i});var zi={Boolean:"boolean",Event:"event",Trait:"trait"};var bi={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",InPlan:"in_plan",Inactive:"inactive",InternalTesting:"internal_testing",Legacy:"legacy"};var fi={Boolean:"boolean",Event:"event",Trait:"trait"};var _i={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",InPlan:"in_plan",Inactive:"inactive",InternalTesting:"internal_testing",Legacy:"legacy"};var Io={};oe(Io,{CountBillingProductsRequestPriceUsageType:()=>Vi,CountBillingProductsResponseParamsPriceUsageType:()=>ki,CreateBillingPriceRequestBodyBillingScheme:()=>Pi,CreateBillingPriceRequestBodyTiersMode:()=>Ci,CreateBillingPriceRequestBodyUsageType:()=>Ti,CreateBillingSubscriptionRequestBodyTrialEndSetting:()=>Di,ListBillingProductsRequestPriceUsageType:()=>ji,ListBillingProductsResponseParamsPriceUsageType:()=>Bi,ListProductPricesRequestPriceUsageType:()=>vi,ListProductPricesResponseParamsPriceUsageType:()=>Oi,SearchBillingPricesRequestTiersMode:()=>Si,SearchBillingPricesRequestUsageType:()=>Ei,SearchBillingPricesResponseParamsTiersMode:()=>xi,SearchBillingPricesResponseParamsUsageType:()=>Ui});var Si={Volume:"volume",Graduated:"graduated"};var Ei={Licensed:"licensed",Metered:"metered"};var xi={Volume:"volume",Graduated:"graduated"};var Ui={Licensed:"licensed",Metered:"metered"};var Pi={PerUnit:"per_unit",Tiered:"tiered"};var Ci={Volume:"volume",Graduated:"graduated"};var Ti={Licensed:"licensed",Metered:"metered"};var vi={Licensed:"licensed",Metered:"metered"};var Oi={Licensed:"licensed",Metered:"metered"};var ji={Licensed:"licensed",Metered:"metered"};var Bi={Licensed:"licensed",Metered:"metered"};var Vi={Licensed:"licensed",Metered:"metered"};var ki={Licensed:"licensed",Metered:"metered"};var Di={Subscribe:"subscribe",Cancel:"cancel"};var Ko={};oe(Ko,{CountCreditBundlesRequestStatus:()=>Ji,CountCreditBundlesResponseParamsStatus:()=>$i,CountCreditLedgerRequestPeriod:()=>sa,CountCreditLedgerResponseParamsPeriod:()=>na,CreateBillingCreditRequestBodyBurnStrategy:()=>Mi,CreateBillingCreditRequestBodyDefaultRolloverPolicy:()=>qi,CreateBillingPlanCreditGrantRequestBodyExpiryType:()=>ca,CreateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>pa,CreateBillingPlanCreditGrantRequestBodyResetCadence:()=>la,CreateBillingPlanCreditGrantRequestBodyResetStart:()=>ma,CreateBillingPlanCreditGrantRequestBodyResetType:()=>ua,CreateCompanyCreditGrantExpiryType:()=>Yi,CreateCompanyCreditGrantExpiryUnit:()=>Qi,CreateCreditBundleRequestBodyExpiryType:()=>Li,CreateCreditBundleRequestBodyExpiryUnit:()=>Gi,CreateCreditBundleRequestBodyStatus:()=>Ni,GetEnrichedCreditLedgerRequestPeriod:()=>ia,GetEnrichedCreditLedgerResponseParamsPeriod:()=>aa,ListCompanyGrantsRequestDir:()=>ra,ListCompanyGrantsRequestOrder:()=>ea,ListCompanyGrantsResponseParamsDir:()=>oa,ListCompanyGrantsResponseParamsOrder:()=>ta,ListCreditBundlesRequestStatus:()=>Ii,ListCreditBundlesResponseParamsStatus:()=>Ki,UpdateBillingCreditRequestBodyBurnStrategy:()=>Ai,UpdateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Fi,UpdateCreditBundleDetailsRequestBodyExpiryType:()=>Xi,UpdateCreditBundleDetailsRequestBodyExpiryUnit:()=>Hi,UpdateCreditBundleDetailsRequestBodyStatus:()=>Wi,ZeroOutGrantRequestBodyReason:()=>Zi});var Mi={PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",ExpirationPriority:"expiration_priority"};var qi={None:"none",Rollover:"rollover",Expire:"expire"};var Ai={PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",ExpirationPriority:"expiration_priority"};var Fi={None:"none",Rollover:"rollover",Expire:"expire"};var Ii={Active:"active",Inactive:"inactive"};var Ki={Active:"active",Inactive:"inactive"};var Li={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Gi={Days:"days",BillingPeriods:"billing_periods"};var Ni={Active:"active",Inactive:"inactive"};var Xi={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Hi={Days:"days",BillingPeriods:"billing_periods"};var Wi={Active:"active",Inactive:"inactive"};var Ji={Active:"active",Inactive:"inactive"};var $i={Active:"active",Inactive:"inactive"};var Zi={PlanChange:"plan_change",Manual:"manual",PlanPeriodReset:"plan_period_reset",Expired:"expired"};var Yi={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Qi={Days:"days",BillingPeriods:"billing_periods"};var ea={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var ra={Asc:"asc",Desc:"desc"};var oa={Asc:"asc",Desc:"desc"};var ta={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var ia={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var aa={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var sa={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var na={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var ca={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var pa={Days:"days",BillingPeriods:"billing_periods"};var la={Monthly:"monthly",Yearly:"yearly",Daily:"daily",Weekly:"weekly"};var ma={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var ua={PlanPeriod:"plan_period",NoReset:"no_reset"};var da={};var Lo={};oe(Lo,{CountCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ha,CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>wa,CountEntityKeyDefinitionsRequestEntityType:()=>ba,CountEntityKeyDefinitionsResponseParamsEntityType:()=>fa,CountEntityTraitDefinitionsRequestEntityType:()=>Ta,CountEntityTraitDefinitionsRequestTraitType:()=>va,CountEntityTraitDefinitionsResponseParamsEntityType:()=>Oa,CountEntityTraitDefinitionsResponseParamsTraitType:()=>ja,CreateEntityTraitDefinitionRequestBodyEntityType:()=>Ua,CreateEntityTraitDefinitionRequestBodyTraitType:()=>Pa,ListCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ga,ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>ya,ListEntityKeyDefinitionsRequestEntityType:()=>Ra,ListEntityKeyDefinitionsResponseParamsEntityType:()=>za,ListEntityTraitDefinitionsRequestEntityType:()=>_a,ListEntityTraitDefinitionsRequestTraitType:()=>Sa,ListEntityTraitDefinitionsResponseParamsEntityType:()=>Ea,ListEntityTraitDefinitionsResponseParamsTraitType:()=>xa,UpdateEntityTraitDefinitionRequestBodyTraitType:()=>Ca});var ha={Asc:"asc",Desc:"desc"};var wa={Asc:"asc",Desc:"desc"};var ga={Asc:"asc",Desc:"desc"};var ya={Asc:"asc",Desc:"desc"};var Ra={Company:"company",User:"user"};var za={Company:"company",User:"user"};var ba={Company:"company",User:"user"};var fa={Company:"company",User:"user"};var _a={Company:"company",User:"user"};var Sa={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ea={Company:"company",User:"user"};var xa={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ua={Company:"company",User:"user"};var Pa={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ca={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ta={Company:"company",User:"user"};var va={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Oa={Company:"company",User:"user"};var ja={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Go={};oe(Go,{CreateCompanyOverrideRequestBodyMetricPeriod:()=>Ba,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Va,CreateCompanyOverrideRequestBodyValueType:()=>ka,CreatePlanEntitlementRequestBodyMetricPeriod:()=>Aa,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Fa,CreatePlanEntitlementRequestBodyPriceBehavior:()=>Ia,CreatePlanEntitlementRequestBodyValueType:()=>Ka,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>Da,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Ma,UpdateCompanyOverrideRequestBodyValueType:()=>qa,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>La,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Ga,UpdatePlanEntitlementRequestBodyPriceBehavior:()=>Na,UpdatePlanEntitlementRequestBodyValueType:()=>Xa});var Ba={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Va={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ka={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Da={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Ma={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var qa={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Aa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Fa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ia={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var Ka={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var La={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Ga={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Na={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var Xa={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var No={};oe(No,{CountPlansRequestPlanType:()=>Za,CountPlansResponseParamsPlanType:()=>Ya,CreatePlanRequestBodyPlanType:()=>Ja,ListPlansRequestPlanType:()=>Ha,ListPlansResponseParamsPlanType:()=>Wa,UpsertBillingProductRequestBodyChargeType:()=>$a});var Ha={Plan:"plan",AddOn:"add_on"};var Wa={Plan:"plan",AddOn:"add_on"};var Ja={Plan:"plan",AddOn:"add_on"};var $a={OneTime:"one_time",Recurring:"recurring",Free:"free"};var Za={Plan:"plan",AddOn:"add_on"};var Ya={Plan:"plan",AddOn:"add_on"};var Xo={};oe(Xo,{CreateComponentRequestBodyEntityType:()=>Qa,UpdateComponentRequestBodyEntityType:()=>es,UpdateComponentRequestBodyState:()=>rs});var Qa={Entitlement:"entitlement",Billing:"billing"};var es={Entitlement:"entitlement",Billing:"billing"};var rs={Draft:"draft",Live:"live"};var os={};var ts={};var Ho={};oe(Ho,{ListEventsRequestEventTypesItem:()=>is,ListEventsResponseParamsEventTypesItem:()=>as});var is={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var as={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var ss={};var ns={};var Wo={};oe(Wo,{CreateWebhookRequestBodyRequestTypesItem:()=>cs,UpdateWebhookRequestBodyRequestTypesItem:()=>ps,UpdateWebhookRequestBodyStatus:()=>ls});var cs={CompanyUpdated:"company.updated",UserUpdated:"user.updated",PlanUpdated:"plan.updated",PlanEntitlementUpdated:"plan.entitlement.updated",CompanyOverrideUpdated:"company.override.updated",FeatureUpdated:"feature.updated",FlagUpdated:"flag.updated",FlagRulesUpdated:"flag_rules.updated",CompanyCreated:"company.created",UserCreated:"user.created",PlanCreated:"plan.created",PlanEntitlementCreated:"plan.entitlement.created",CompanyOverrideCreated:"company.override.created",FeatureCreated:"feature.created",FlagCreated:"flag.created",CompanyDeleted:"company.deleted",UserDeleted:"user.deleted",PlanDeleted:"plan.deleted",PlanEntitlementDeleted:"plan.entitlement.deleted",CompanyOverrideDeleted:"company.override.deleted",FeatureDeleted:"feature.deleted",FlagDeleted:"flag.deleted",TestSend:"test.send",SubscriptionTrialEnded:"subscription.trial.ended",EntitlementLimitWarning:"entitlement.limit.warning",EntitlementLimitReached:"entitlement.limit.reached",EntitlementSoftLimitWarning:"entitlement.soft_limit.warning",EntitlementSoftLimitReached:"entitlement.soft_limit.reached",EntitlementTierLimitWarning:"entitlement.tier_limit.warning",EntitlementTierLimitReached:"entitlement.tier_limit.reached",CreditLimitWarning:"credit.limit.warning",CreditLimitReached:"credit.limit.reached"};var ps={CompanyUpdated:"company.updated",UserUpdated:"user.updated",PlanUpdated:"plan.updated",PlanEntitlementUpdated:"plan.entitlement.updated",CompanyOverrideUpdated:"company.override.updated",FeatureUpdated:"feature.updated",FlagUpdated:"flag.updated",FlagRulesUpdated:"flag_rules.updated",CompanyCreated:"company.created",UserCreated:"user.created",PlanCreated:"plan.created",PlanEntitlementCreated:"plan.entitlement.created",CompanyOverrideCreated:"company.override.created",FeatureCreated:"feature.created",FlagCreated:"flag.created",CompanyDeleted:"company.deleted",UserDeleted:"user.deleted",PlanDeleted:"plan.deleted",PlanEntitlementDeleted:"plan.entitlement.deleted",CompanyOverrideDeleted:"company.override.deleted",FeatureDeleted:"feature.deleted",FlagDeleted:"flag.deleted",TestSend:"test.send",SubscriptionTrialEnded:"subscription.trial.ended",EntitlementLimitWarning:"entitlement.limit.warning",EntitlementLimitReached:"entitlement.limit.reached",EntitlementSoftLimitWarning:"entitlement.soft_limit.warning",EntitlementSoftLimitReached:"entitlement.soft_limit.reached",EntitlementTierLimitWarning:"entitlement.tier_limit.warning",EntitlementTierLimitReached:"entitlement.tier_limit.reached",CreditLimitWarning:"credit.limit.warning",CreditLimitReached:"credit.limit.reached"};var ls={Active:"active",Inactive:"inactive"};var pw={Licensed:"licensed",Metered:"metered"};var lw={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var mw={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var uw={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var dw={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var hw={Company:"company",Metric:"metric",Trait:"trait",User:"user",Plan:"plan",BillingProduct:"billing_product",CrmProduct:"crm_product",BasePlan:"base_plan"};var ww={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var gw={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var yw={Eq:"eq",Ne:"ne",Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Rw={GlobalOverride:"global_override",CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Standard:"standard",Default:"default",PlanAudience:"plan_audience"};var zw={Free:"free",Plan:"plan",Purchased:"purchased"};var bw={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var fw={Free:"free",Plan:"plan",Purchased:"purchased"};var _w={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited",Unknown:"unknown"};var Sw={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Ew={Free:"free",Plan:"plan",Purchased:"purchased"};var xw={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Uw={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Pw={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Cw={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var le=(w,t,o)=>JSON.stringify(w,t,o);var c=class w extends Error{constructor({message:t,statusCode:o,body:r,rawResponse:i}){super(Tw({message:t,statusCode:o,body:r})),Object.setPrototypeOf(this,w.prototype),this.statusCode=o,this.body=r,this.rawResponse=i}};function Tw({message:w,statusCode:t,body:o}){let r=[];return w!=null&&r.push(w),t!=null&&r.push(`Status code: ${t.toString()}`),o!=null&&r.push(`Body: ${le(o,void 0,2)}`),r.join(`
2
- `)}var z=class w extends Error{constructor(t){super(t),Object.setPrototypeOf(this,w.prototype)}};var P=class w extends c{constructor(t,o){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var S=class w extends c{constructor(t,o){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var E=class w extends c{constructor(t,o){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var x=class w extends c{constructor(t,o){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var U=class w extends c{constructor(t,o){super({message:"InternalServerError",statusCode:500,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var zr=require("timers"),$e=class{constructor({maxItems:t=1e3,ttl:o=5e3}={}){this.accessCounter=0;this.cache=new Map,this.maxItems=t,this.defaultTTL=o}async get(t){let o=this.cache.get(t);if(o){if(o.expiration<=Date.now()){this.evictItem(t,o);return}return this.accessCounter++,o.accessCounter=this.accessCounter,this.cache.set(t,o),o.value}}async set(t,o,r){if(this.maxItems===0)return;let i=r??this.defaultTTL,m=this.cache.get(t);m&&this.evictItem(t,m),this.evictExpiredItems(),this.evictLRUItems(),this.accessCounter++;let g={value:o,accessCounter:this.accessCounter,expiration:Date.now()+i,timeoutId:(0,zr.setTimeout)(()=>this.evictItem(t,g),i)};this.cache.set(t,g)}resetCache(){this.cache.forEach(t=>{t.timeoutId&&(0,zr.clearTimeout)(t.timeoutId)}),this.cache.clear(),this.accessCounter=0}evictItem(t,o){o.timeoutId&&(0,zr.clearTimeout)(o.timeoutId),this.cache.delete(t)}evictExpiredItems(){this.cache.forEach((t,o)=>{t.expiration<=Date.now()&&this.evictItem(o,t)})}evictLRUItems(){for(;this.cache.size>=this.maxItems;){let t,o=Number.MAX_SAFE_INTEGER;this.cache.forEach((r,i)=>{r.accessCounter<o&&(t=i,o=r.accessCounter)}),t&&this.evictItem(t,this.cache.get(t))}}};var f={Default:"https://api.schematichq.com"};var Ke;typeof globalThis.Headers<"u"?Ke=globalThis.Headers:Ke=class ms{constructor(t){if(this.headers=new Map,t)if(t instanceof ms)t.forEach((o,r)=>this.append(r,o));else if(Array.isArray(t))for(let[o,r]of t)if(typeof o=="string"&&typeof r=="string")this.append(o,r);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[o,r]of Object.entries(t))if(typeof r=="string")this.append(o,r);else throw new TypeError("Header values must be strings")}append(t,o){let r=t.toLowerCase(),i=this.headers.get(r)||[];this.headers.set(r,[...i,o])}delete(t){let o=t.toLowerCase();this.headers.delete(o)}get(t){let o=t.toLowerCase(),r=this.headers.get(o);return r?r.join(", "):null}has(t){let o=t.toLowerCase();return this.headers.has(o)}set(t,o){let r=t.toLowerCase();this.headers.set(r,[o])}forEach(t,o){let r=o?t.bind(o):t;this.headers.forEach((i,m)=>r(i.join(", "),m,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,o]of this.headers.entries())yield[t,o.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let t of this.headers.values())yield t.join(", ")}[Symbol.iterator](){return this.entries()}};var Le={headers:new Ke,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},Ge={headers:new Ke,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function Ze(w){return{headers:w.headers,redirected:w.redirected,status:w.status,statusText:w.statusText,type:w.type,url:w.url}}var us=H(require("qs"));function Ur(w,t){return Object.keys(t??{}).length>0?`${w}?${us.default.stringify(t,{arrayFormat:"repeat"})}`:w}var h=vw();function vw(){return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.name==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!process.versions?.node?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:{type:"unknown"}}async function Pr(){return h.type==="node"&&h.parsedVersion!=null&&h.parsedVersion>=18?fetch:h.type==="node"?(await import("node-fetch")).default:typeof fetch=="function"?fetch:(await import("node-fetch")).default}async function Cr({body:w,type:t}){return t.includes("json")?le(w):w}async function zs(w){return h.type==="node"&&h.parsedVersion!=null&&h.parsedVersion>=18?new(await Promise.resolve().then(()=>(hs(),ds))).Node18UniversalStreamWrapper(w):h.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(gs(),ws))).UndiciStreamWrapper(w):new(await Promise.resolve().then(()=>(Rs(),ys))).NodePre18StreamWrapper(w)}async function Tr(w,t){if(w.body!=null&&t==="blob")return await w.blob();if(w.body!=null&&t==="arrayBuffer")return await w.arrayBuffer();if(w.body!=null&&t==="sse")return w.body;if(w.body!=null&&t==="streaming")return zs(w.body);if(w.body!=null&&t==="text")return await w.text();{let o=await w.text();if(o.length>0)try{return JSON.parse(o)}catch{return{ok:!1,error:{reason:"non-json",statusCode:w.status,rawBody:o}}}else return}}var Ow="timeout";function bs(w){let t=new AbortController,o=setTimeout(()=>t.abort(Ow),w);return{signal:t.signal,abortId:o}}function fs(...w){let t=w.length===1&&Array.isArray(w[0])?w[0]:w,o=new AbortController;for(let r of t){if(r.aborted){o.abort(r?.reason);break}r.addEventListener("abort",()=>o.abort(r?.reason),{signal:o.signal})}return o.signal}var vr=async(w,t,o,r,i,m,g,p,s)=>{let l=[],u;if(m!=null){let{signal:C,abortId:O}=bs(m);u=O,l.push(C)}g!=null&&l.push(g);let R=fs(l),y=await w(t,{method:o,headers:r,body:i,signal:R,credentials:p?"include":void 0,duplex:s});return u!=null&&clearTimeout(u),y};function jw(w){let t=1+(Math.random()*2-1)*.2;return w*t}async function Or(w,t=2){let o=await w();for(let r=0;r<t&&([408,429].includes(o.status)||o.status>=500);++r){let i=Math.min(1e3*Math.pow(2,r),6e4),m=jw(i);await new Promise(g=>setTimeout(g,m)),o=await w()}return o}async function Bw(w){let t={};if(w.body!==void 0&&w.contentType!=null&&(t["Content-Type"]=w.contentType),w.headers!=null)for(let[m,g]of Object.entries(w.headers))g!=null&&(t[m]=g);let o=Ur(w.url,w.queryParameters),r=await Cr({body:w.body,type:w.requestType==="json"?"json":"other"}),i=await Pr();try{let m=await Or(async()=>vr(i,o,w.method,t,r,w.timeoutMs,w.abortSignal,w.withCredentials,w.duplex),w.maxRetries),g=await Tr(m,w.responseType);return m.status>=200&&m.status<400?{ok:!0,body:g,headers:m.headers,rawResponse:Ze(m)}:{ok:!1,error:{reason:"status-code",statusCode:m.status,body:g},rawResponse:Ze(m)}}catch(m){return w.abortSignal!=null&&w.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Le}:m instanceof Error&&m.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:Le}:m instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:m.message},rawResponse:Ge}:{ok:!1,error:{reason:"unknown",errorMessage:le(m)},rawResponse:Ge}}}var _=Bw;var d={get:async w=>typeof w=="function"?w():w};var b=class w extends Promise{constructor(t){super(o=>{o(void 0)}),this.innerPromise=t}static fromFunction(t,...o){return new w(t(...o))}static interceptFunction(t){return(...o)=>w.fromPromise(t(...o))}static fromPromise(t){return new w(t)}static fromExecutor(t){let o=new Promise(t);return new w(o)}static fromResult(t){let o=Promise.resolve(t);return new w(o)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,o){return this.unwrap().then(t,o)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}async withRawResponse(){return await this.innerPromise}};var e={};oe(e,{JsonError:()=>Ye,ParseError:()=>Qe,any:()=>Ds,bigint:()=>Ss,boolean:()=>Ms,booleanLiteral:()=>ks,date:()=>Es,discriminant:()=>Xs,enum_:()=>Br,getObjectLikeUtils:()=>ye,getObjectUtils:()=>Ne,getSchemaUtils:()=>F,isProperty:()=>Te,lazy:()=>xs,lazyObject:()=>js,list:()=>kr,number:()=>qs,object:()=>Vr,objectWithoutOptionalProperties:()=>Os,optional:()=>Yo,property:()=>Ps,record:()=>Ks,set:()=>Ls,string:()=>As,stringLiteral:()=>Vs,transform:()=>Qo,undiscriminatedUnion:()=>Ns,union:()=>Ws,unknown:()=>Fs,withParsedProperties:()=>rt});var V={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function A(w,t){return`Expected ${t}. Received ${Vw(w)}.`}function Vw(w){if(Array.isArray(w))return"list";if(w===null)return"null";if(w instanceof BigInt)return"BigInt";switch(typeof w){case"string":return`"${w}"`;case"bigint":case"number":case"boolean":case"undefined":return`${w}`}return typeof w}function Q(w){return{...w,json:_s(w.json),parse:_s(w.parse)}}function _s(w){return(t,o)=>{let r=w(t,o),{skipValidation:i=!1}=o??{};return!r.ok&&i?(console.warn(["Failed to validate.",...r.errors.map(m=>" - "+(m.path.length>0?`${m.path.join(".")}: ${m.message}`:m.message))].join(`
3
- `)),{ok:!0,value:t}):r}}function jr(w){return w.path.length===0?w.message:`${w.path.join(" -> ")}: ${w.message}`}var Ye=class w extends Error{constructor(o){super(o.map(jr).join("; "));this.errors=o;Object.setPrototypeOf(this,w.prototype)}};var Qe=class w extends Error{constructor(o){super(o.map(jr).join("; "));this.errors=o;Object.setPrototypeOf(this,w.prototype)}};function F(w){return{nullable:()=>kw(w),optional:()=>Yo(w),optionalNullable:()=>Dw(w),transform:t=>Qo(w,t),parseOrThrow:(t,o)=>{let r=w.parse(t,o);if(r.ok)return r.value;throw new Qe(r.errors)},jsonOrThrow:(t,o)=>{let r=w.json(t,o);if(r.ok)return r.value;throw new Ye(r.errors)}}}function kw(w){let t={parse:(o,r)=>o==null?{ok:!0,value:null}:w.parse(o,r),json:(o,r)=>o==null?{ok:!0,value:null}:w.json(o,r),getType:()=>V.NULLABLE};return{...t,...F(t)}}function Yo(w){let t={parse:(o,r)=>o==null?{ok:!0,value:void 0}:w.parse(o,r),json:(o,r)=>r?.omitUndefined&&o===void 0?{ok:!0,value:void 0}:o==null?{ok:!0,value:null}:w.json(o,r),getType:()=>V.OPTIONAL};return{...t,...F(t)}}function Dw(w){let t={parse:(o,r)=>o===void 0?{ok:!0,value:void 0}:o===null?{ok:!0,value:null}:w.parse(o,r),json:(o,r)=>o===void 0?{ok:!0,value:void 0}:o===null?{ok:!0,value:null}:w.json(o,r),getType:()=>V.OPTIONAL_NULLABLE};return{...t,...F(t)}}function Qo(w,t){let o={parse:(r,i)=>{let m=w.parse(r,i);return m.ok?{ok:!0,value:t.transform(m.value)}:m},json:(r,i)=>{let m=t.untransform(r);return w.json(m,i)},getType:()=>w.getType()};return{...o,...F(o)}}function Ss(){let w={parse:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:o,message:A(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:o,message:A(t,"bigint")}]}:{ok:!0,value:t},getType:()=>V.BIGINT};return{...Q(w),...F(w)}}var Mw=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Es(){let w={parse:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:o,message:A(t,"string")}]}:Mw.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:o,message:A(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:o=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:o,message:A(t,"Date object")}]},getType:()=>V.DATE};return{...Q(w),...F(w)}}function ie(w,t){return()=>{let o={parse:t,json:t,getType:()=>w};return{...Q(o),...F(o)}}}function Br(w){let t=new Set(w);return ie(V.ENUM,(r,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:m=[]}={})=>typeof r!="string"?{ok:!1,errors:[{path:m,message:A(r,"string")}]}:!t.has(r)&&!i?{ok:!1,errors:[{path:m,message:A(r,"enum")}]}:{ok:!0,value:r})()}function xs(w){let t=et(w);return{...t,...F(t)}}function et(w){return{parse:(t,o)=>er(w).parse(t,o),json:(t,o)=>er(w).json(t,o),getType:()=>er(w).getType()}}function er(w){let t=w;return t.__zurg_memoized==null&&(t.__zurg_memoized=w()),t.__zurg_memoized}function br(w){return Object.entries(w)}function fr(w,t){let o=new Set(t);return Object.entries(w).reduce((r,[i,m])=>(o.has(i)&&(r[i]=m),r),{})}function Ce(w){if(typeof w!="object"||w===null)return!1;if(Object.getPrototypeOf(w)===null)return!0;let t=w;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(w)===t}function _r(w){return Object.keys(w)}function Us(w,t){let o=[],r=[];for(let i of w)t(i)?o.push(i):r.push(i);return[o,r]}function ye(w){return{withParsedProperties:t=>rt(w,t)}}function rt(w,t){let o={parse:(r,i)=>{let m=w.parse(r,i);if(!m.ok)return m;let g=Object.entries(t).reduce((p,[s,l])=>({...p,[s]:typeof l=="function"?l(m.value):l}),{});return{ok:!0,value:{...m.value,...g}}},json:(r,i)=>{if(!Ce(r))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:A(r,"object")}]};let m=new Set(Object.keys(t)),g=fr(r,Object.keys(r).filter(p=>!m.has(p)));return w.json(g,i)},getType:()=>w.getType()};return{...o,...F(o),...ye(o)}}function Ps(w,t){return{rawKey:w,valueSchema:t,isProperty:!0}}function Te(w){return w.isProperty}function Vr(w){let t={_getRawProperties:()=>Object.entries(w).map(([o,r])=>Te(r)?r.rawKey:o),_getParsedProperties:()=>_r(w),parse:(o,r)=>{let i={},m=[];for(let[g,p]of br(w)){let s=Te(p)?p.rawKey:g,l=Te(p)?p.valueSchema:p,u={rawKey:s,parsedKey:g,valueSchema:l};i[s]=u,vs(l)&&m.push(s)}return Cs({value:o,requiredKeys:m,getProperty:g=>{let p=i[g];if(p!=null)return{transformedKey:p.parsedKey,transform:s=>p.valueSchema.parse(s,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],g]})}},unrecognizedObjectKeys:r?.unrecognizedObjectKeys,skipValidation:r?.skipValidation,breadcrumbsPrefix:r?.breadcrumbsPrefix,omitUndefined:r?.omitUndefined})},json:(o,r)=>{let i=[];for(let[m,g]of br(w)){let p=Te(g)?g.valueSchema:g;vs(p)&&i.push(m)}return Cs({value:o,requiredKeys:i,getProperty:m=>{let g=w[m];if(g!=null)return Te(g)?{transformedKey:g.rawKey,transform:p=>g.valueSchema.json(p,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],m]})}:{transformedKey:m,transform:p=>g.json(p,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],m]})}},unrecognizedObjectKeys:r?.unrecognizedObjectKeys,skipValidation:r?.skipValidation,breadcrumbsPrefix:r?.breadcrumbsPrefix,omitUndefined:r?.omitUndefined})},getType:()=>V.OBJECT};return{...Q(t),...F(t),...ye(t),...Ne(t)}}function Cs({value:w,requiredKeys:t,getProperty:o,unrecognizedObjectKeys:r="fail",skipValidation:i=!1,breadcrumbsPrefix:m=[]}){if(!Ce(w))return{ok:!1,errors:[{path:m,message:A(w,"object")}]};let g=new Set(t),p=[],s={};for(let[l,u]of Object.entries(w)){let R=o(l);if(R!=null){g.delete(l);let y=R.transform(u);y.ok?s[R.transformedKey]=y.value:(s[l]=u,p.push(...y.errors))}else switch(r){case"fail":p.push({path:[...m,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":s[l]=u;break}}return p.push(...t.filter(l=>g.has(l)).map(l=>({path:m,message:`Missing required key "${l}"`}))),p.length===0||i?{ok:!0,value:s}:{ok:!1,errors:p}}function Ne(w){return{extend:t=>{let o={_getParsedProperties:()=>[...w._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...w._getRawProperties(),...t._getRawProperties()],parse:(r,i)=>Ts({extensionKeys:t._getRawProperties(),value:r,transformBase:m=>w.parse(m,i),transformExtension:m=>t.parse(m,i)}),json:(r,i)=>Ts({extensionKeys:t._getParsedProperties(),value:r,transformBase:m=>w.json(m,i),transformExtension:m=>t.json(m,i)}),getType:()=>V.OBJECT};return{...o,...F(o),...ye(o),...Ne(o)}},passthrough:()=>{let t={_getParsedProperties:()=>w._getParsedProperties(),_getRawProperties:()=>w._getRawProperties(),parse:(o,r)=>{let i=w.parse(o,{...r,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...o,...i.value}}:i},json:(o,r)=>{let i=w.json(o,{...r,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...o,...i.value}}:i},getType:()=>V.OBJECT};return{...t,...F(t),...ye(t),...Ne(t)}}}}function Ts({extensionKeys:w,value:t,transformBase:o,transformExtension:r}){let i=new Set(w),[m,g]=Us(_r(t),l=>i.has(l)),p=o(fr(t,g)),s=r(fr(t,m));return p.ok&&s.ok?{ok:!0,value:{...p.value,...s.value}}:{ok:!1,errors:[...p.ok?[]:p.errors,...s.ok?[]:s.errors]}}function vs(w){return!qw(w)}function qw(w){switch(w.getType()){case V.ANY:case V.UNKNOWN:case V.OPTIONAL:case V.OPTIONAL_NULLABLE:return!0;default:return!1}}function Os(w){return Vr(w)}function js(w){let t={...et(w),_getRawProperties:()=>er(w)._getRawProperties(),_getParsedProperties:()=>er(w)._getParsedProperties()};return{...t,...F(t),...ye(t),...Ne(t)}}function kr(w){let t={parse:(o,r)=>Bs(o,(i,m)=>w.parse(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),json:(o,r)=>Bs(o,(i,m)=>w.json(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),getType:()=>V.LIST};return{...Q(t),...F(t)}}function Bs(w,t){return Array.isArray(w)?w.map((r,i)=>t(r,i)).reduce((r,i)=>{if(r.ok&&i.ok)return{ok:!0,value:[...r.value,i.value]};let m=[];return r.ok||m.push(...r.errors),i.ok||m.push(...i.errors),{ok:!1,errors:m}},{ok:!0,value:[]}):{ok:!1,errors:[{message:A(w,"list"),path:[]}]}}function Vs(w){return ie(V.STRING_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===w?{ok:!0,value:w}:{ok:!1,errors:[{path:r,message:A(o,`"${w}"`)}]})()}function ks(w){return ie(V.BOOLEAN_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===w?{ok:!0,value:w}:{ok:!1,errors:[{path:r,message:A(o,`${w.toString()}`)}]})()}var Ds=ie(V.ANY,w=>({ok:!0,value:w}));var Ms=ie(V.BOOLEAN,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="boolean"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:A(w,"boolean")}]});var qs=ie(V.NUMBER,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="number"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:A(w,"number")}]});var As=ie(V.STRING,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="string"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:A(w,"string")}]});var Fs=ie(V.UNKNOWN,w=>({ok:!0,value:w}));function Ks(w,t){let o={parse:(r,i)=>Is({value:r,isKeyNumeric:w.getType()===V.NUMBER,transformKey:m=>w.parse(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${m} (key)`]}),transformValue:(m,g)=>t.parse(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${g}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(r,i)=>Is({value:r,isKeyNumeric:w.getType()===V.NUMBER,transformKey:m=>w.json(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${m} (key)`]}),transformValue:(m,g)=>t.json(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${g}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>V.RECORD};return{...Q(o),...F(o)}}function Is({value:w,isKeyNumeric:t,transformKey:o,transformValue:r,breadcrumbsPrefix:i=[]}){return Ce(w)?br(w).reduce((m,[g,p])=>{if(p===void 0)return m;let s=m,l=g;if(t){let C=g.length>0?Number(g):NaN;isNaN(C)||(l=C)}let u=o(l),R=r(p,l);if(s.ok&&u.ok&&R.ok)return{ok:!0,value:{...s.value,[u.value]:R.value}};let y=[];return s.ok||y.push(...s.errors),u.ok||y.push(...u.errors),R.ok||y.push(...R.errors),{ok:!1,errors:y}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:A(w,"object")}]}}function Ls(w){let t=kr(w),o={parse:(r,i)=>{let m=t.parse(r,i);return m.ok?{ok:!0,value:new Set(m.value)}:m},json:(r,i)=>r instanceof Set?t.json([...r],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:A(r,"Set")}]},getType:()=>V.SET};return{...Q(o),...F(o)}}function Ns(w){let t={parse:(o,r)=>Gs((i,m)=>i.parse(o,m),w,r),json:(o,r)=>Gs((i,m)=>i.json(o,m),w,r),getType:()=>V.UNDISCRIMINATED_UNION};return{...Q(t),...F(t)}}function Gs(w,t,o){let r=[];for(let[i,m]of t.entries()){let g=w(m,{...o,skipValidation:!1});if(g.ok)return g;for(let p of g.errors)r.push({path:p.path,message:`[Variant ${i}] ${p.message}`})}return{ok:!1,errors:r}}function Xs(w,t){return{parsedDiscriminant:w,rawDiscriminant:t}}function Ws(w,t){let o=typeof w=="string"?w:w.rawDiscriminant,r=typeof w=="string"?w:w.parsedDiscriminant,i=Br(_r(t)),m={parse:(g,p)=>Hs({value:g,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:s=>i.parse(s,{allowUnrecognizedEnumValues:p?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...p?.breadcrumbsPrefix??[],o]}),getAdditionalPropertiesSchema:s=>t[s],allowUnrecognizedUnionMembers:p?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(s,l)=>l.parse(s,p),breadcrumbsPrefix:p?.breadcrumbsPrefix}),json:(g,p)=>Hs({value:g,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:s=>i.json(s,{allowUnrecognizedEnumValues:p?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...p?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:s=>t[s],allowUnrecognizedUnionMembers:p?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(s,l)=>l.json(s,p),breadcrumbsPrefix:p?.breadcrumbsPrefix}),getType:()=>V.UNION};return{...Q(m),...F(m),...ye(m)}}function Hs({value:w,discriminant:t,transformedDiscriminant:o,transformDiscriminantValue:r,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:m=!1,transformAdditionalProperties:g,breadcrumbsPrefix:p=[]}){if(!Ce(w))return{ok:!1,errors:[{path:p,message:A(w,"object")}]};let{[t]:s,...l}=w;if(s==null)return{ok:!1,errors:[{path:p,message:`Missing discriminant ("${t}")`}]};let u=r(s);if(!u.ok)return{ok:!1,errors:u.errors};let R=i(u.value);if(R==null)return m?{ok:!0,value:{[o]:u.value,...l}}:{ok:!1,errors:[{path:[...p,t],message:"Unexpected discriminant value"}]};let y=g(l,R);return y.ok?{ok:!0,value:{[o]:s,...y.value}}:y}var Pe=H(require("url-join"));var se=H(require("url-join"));var Js=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var Re=e.object({createdAt:e.property("created_at",e.date()),description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),lastUsedAt:e.property("last_used_at",e.date().optional()),name:e.string(),scopes:e.list(e.string()),updatedAt:e.property("updated_at",e.date())});var $s=e.object({data:e.list(Re),params:Js});var Zs=e.object({createdAt:e.property("created_at",e.date()),description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),lastUsedAt:e.property("last_used_at",e.date().optional()),name:e.string(),scopes:e.list(e.string()),secret:e.string(),updatedAt:e.property("updated_at",e.date())});var Ys=e.object({data:Zs,params:e.record(e.string(),e.unknown())});var Qs=e.object({data:Re,params:e.record(e.string(),e.unknown())});var en=e.object({data:Re,params:e.record(e.string(),e.unknown())});var q=e.object({deleted:e.boolean().optional()});var rn=e.object({data:q,params:e.record(e.string(),e.unknown())});var on=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var j=e.object({count:e.number().optional()});var tn=e.object({data:j,params:on});var an=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),requestType:e.property("request_type",e.string().optional())});var sn=e.object({apiKeyId:e.property("api_key_id",e.string()),endedAt:e.property("ended_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),method:e.string(),reqBody:e.property("req_body",e.string().optional()),requestType:e.property("request_type",e.string().optional()),resourceId:e.property("resource_id",e.number().optional()),resourceIdString:e.property("resource_id_string",e.string().optional()),resourceName:e.property("resource_name",e.string().optional()),resourceType:e.property("resource_type",e.string().optional()),respCode:e.property("resp_code",e.number().optional()),secondaryResource:e.property("secondary_resource",e.string().optional()),startedAt:e.property("started_at",e.date()),url:e.string(),userName:e.property("user_name",e.string().optional())});var nn=e.object({data:e.list(sn),params:an});var cn=e.object({apiKey:e.property("api_key",Re.optional()),apiKeyId:e.property("api_key_id",e.string()),endedAt:e.property("ended_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),method:e.string(),reqBody:e.property("req_body",e.string().optional()),requestType:e.property("request_type",e.string().optional()),resourceId:e.property("resource_id",e.number().optional()),resourceIdString:e.property("resource_id_string",e.string().optional()),resourceName:e.property("resource_name",e.string().optional()),resourceType:e.property("resource_type",e.string().optional()),respBody:e.property("resp_body",e.string().optional()),respCode:e.property("resp_code",e.number().optional()),secondaryResource:e.property("secondary_resource",e.string().optional()),startedAt:e.property("started_at",e.date()),url:e.string(),userAgent:e.property("user_agent",e.string().optional()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var pn=e.object({data:cn,params:e.record(e.string(),e.unknown())});var ln=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),requestType:e.property("request_type",e.string().optional())});var mn=e.object({data:j,params:ln});var un=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var rr=e.object({createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",e.string()),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var dn=e.object({data:e.list(rr),params:un});var hn=e.enum_(["development","staging","production"]);var wn=e.object({apiKeys:e.property("api_keys",e.list(Re)),createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",e.string()),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var gn=e.object({data:wn,params:e.record(e.string(),e.unknown())});var yn=e.object({data:rr,params:e.record(e.string(),e.unknown())});var Rn=e.enum_(["development","staging","production"]);var zn=e.object({data:rr,params:e.record(e.string(),e.unknown())});var bn=e.object({data:q,params:e.record(e.string(),e.unknown())});var fn=e.object({ok:e.boolean()});var _n=e.object({data:fn,params:e.record(e.string(),e.unknown())});var ot=e.object({description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),name:e.string()});var tt=e.object({description:e.string().optional(),name:e.string().optional()});var it=e.object({environmentType:e.property("environment_type",hn),name:e.string()});var at=e.object({environmentType:e.property("environment_type",Rn.optional()),name:e.string().optional()});var Sn=e.object({data:j,params:e.record(e.string(),e.unknown())});var En=e.object({data:j,params:e.record(e.string(),e.unknown())});var or=e.object({addedOn:e.property("added_on",e.date().optional()),billingProductExternalId:e.property("billing_product_external_id",e.string().optional()),billingProductId:e.property("billing_product_id",e.string().optional()),description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string(),planPeriod:e.property("plan_period",e.string().optional()),planPrice:e.property("plan_price",e.number().optional())});var Dr=e.object({amountOff:e.property("amount_off",e.number().optional()),couponId:e.property("coupon_id",e.string()),couponName:e.property("coupon_name",e.string()),currency:e.string().optional(),customerFacingCode:e.property("customer_facing_code",e.string().optional()),discountExternalId:e.property("discount_external_id",e.string()),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number().optional()),endedAt:e.property("ended_at",e.date().optional()),isActive:e.property("is_active",e.boolean()),percentOff:e.property("percent_off",e.number().optional()),promoCodeExternalId:e.property("promo_code_external_id",e.string().optional()),startedAt:e.property("started_at",e.date()),subscriptionExternalId:e.property("subscription_external_id",e.string())});var me=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string().optional()),id:e.string(),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),updatedAt:e.property("updated_at",e.date()),url:e.string().optional()});var ce=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),customerExternalId:e.property("customer_external_id",e.string()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),paymentMethodType:e.property("payment_method_type",e.string()),updatedAt:e.property("updated_at",e.date())});var Mr=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),upTo:e.property("up_to",e.number().optional())});var qr=e.object({billingScheme:e.property("billing_scheme",e.string()),billingThreshold:e.property("billing_threshold",e.number().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),interval:e.string(),meterId:e.property("meter_id",e.string().optional()),name:e.string(),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceId:e.property("price_id",e.string()),priceTier:e.property("price_tier",e.list(Mr)),quantity:e.number(),subscriptionId:e.property("subscription_id",e.string()),subscriptionItemExternalId:e.property("subscription_item_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",e.string())});var ve=e.object({cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),discounts:e.list(Dr),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),latestInvoice:e.property("latest_invoice",me.optional()),metadata:e.record(e.string(),e.unknown()).optional(),paymentMethod:e.property("payment_method",ce.optional()),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),products:e.list(qr),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",e.string().optional())});var Z=e.object({createdAt:e.property("created_at",e.date()),displayName:e.property("display_name",e.string()),entityType:e.property("entity_type",e.string()),hierarchy:e.list(e.string()),id:e.string(),traitType:e.property("trait_type",e.string()),updatedAt:e.property("updated_at",e.date())});var tr=e.object({createdAt:e.property("created_at",e.date()),definition:Z.optional(),definitionId:e.property("definition_id",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var Ar=e.object({createdAt:e.property("created_at",e.date()),entityType:e.property("entity_type",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date())});var ir=e.object({createdAt:e.property("created_at",e.date()),definition:Ar.optional(),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var Fr=e.object({accountId:e.property("account_id",e.string()),capturedAtMax:e.property("captured_at_max",e.date()),capturedAtMin:e.property("captured_at_min",e.date()),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string()),monthReset:e.property("month_reset",e.string()),period:e.string(),validUntil:e.property("valid_until",e.date().optional()),value:e.number()});var Ir=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var st=e.object({comparableType:e.property("comparable_type",e.string()),entityType:e.property("entity_type",e.string()),id:e.string()});var Kr=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",st.optional()),conditionType:e.property("condition_type",e.string()),consumptionRate:e.property("consumption_rate",e.number().optional()),creditId:e.property("credit_id",e.string().optional()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),metricValue:e.property("metric_value",e.number().optional()),operator:e.string(),resourceIds:e.property("resource_ids",e.list(e.string())),traitDefinition:e.property("trait_definition",st.optional()),traitValue:e.property("trait_value",e.string())});var xn=e.object({conditions:e.list(Kr)});var Lr=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(xn)),conditions:e.list(Kr),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",e.string()),value:e.boolean()});var I=e.object({addOns:e.property("add_ons",e.list(or)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",ve.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(ve)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ce.optional()),entityTraits:e.property("entity_traits",e.list(tr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(ir),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Fr),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ce)),plan:or.optional(),plans:e.list(Ir),rules:e.list(Lr),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Un=e.object({data:e.list(I),params:e.record(e.string(),e.unknown())});var Gr=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var ar=e.object({company:Gr.optional(),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),id:e.string(),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string())});var pe=e.object({companyMemberships:e.property("company_memberships",e.list(ar)),createdAt:e.property("created_at",e.date()),entityTraits:e.property("entity_traits",e.list(tr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(ir),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string(),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date())});var Pn=e.object({data:e.list(pe),params:e.record(e.string(),e.unknown())});var Cn=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutCompanyOverrideFor:e.property("without_company_override_for",e.string().optional()),withoutPlanEntitlementFor:e.property("without_plan_entitlement_for",e.string().optional())});var Nr=e.object({companyCount:e.property("company_count",e.number()),environmentId:e.property("environment_id",e.string()),eventCount:e.property("event_count",e.number()),eventSubtype:e.property("event_subtype",e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),userCount:e.property("user_count",e.number())});var sr=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",e.string()),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",e.string().optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Tn=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var nr=e.object({comparisonTrait:e.property("comparison_trait",Z.optional()),comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionGroupId:e.property("condition_group_id",e.string().optional()),conditionType:e.property("condition_type",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),metricValue:e.property("metric_value",e.number().optional()),operator:e.string(),planId:e.property("plan_id",e.string().optional()),resourceIds:e.property("resource_ids",e.list(e.string())),resources:e.list(Tn),ruleId:e.property("rule_id",e.string()),trait:Z.optional(),traitEntityType:e.property("trait_entity_type",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Xr=e.object({conditions:e.list(nr),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),planId:e.property("plan_id",e.string().optional()),ruleId:e.property("rule_id",e.string()),updatedAt:e.property("updated_at",e.date())});var Hr=e.object({conditionGroups:e.property("condition_groups",e.list(Xr)),conditions:e.list(nr),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),planId:e.property("plan_id",e.string().optional()),priority:e.number(),ruleType:e.property("rule_type",e.string()),updatedAt:e.property("updated_at",e.date()),value:e.boolean()});var ze=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),feature:sr.optional(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",e.string()),id:e.string(),key:e.string(),lastCheckedAt:e.property("last_checked_at",e.date().optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),rules:e.list(Hr),updatedAt:e.property("updated_at",e.date())});var cr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var W=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),eventSummary:e.property("event_summary",Nr.optional()),featureType:e.property("feature_type",e.string()),flags:e.list(ze),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",e.string().optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),plans:e.list(cr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:Z.optional(),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var vn=e.object({data:e.list(W),params:Cn});var On=e.enum_(["boolean","event","trait"]);var jn=e.enum_(["add_on","alpha","beta","deprecated","ga","in_plan","inactive","internal_testing","legacy"]);var Bn=e.object({data:W,params:e.record(e.string(),e.unknown())});var Vn=e.object({data:W,params:e.record(e.string(),e.unknown())});var kn=e.enum_(["boolean","event","trait"]);var Dn=e.enum_(["add_on","alpha","beta","deprecated","ga","in_plan","inactive","internal_testing","legacy"]);var Mn=e.object({data:W,params:e.record(e.string(),e.unknown())});var qn=e.object({data:q,params:e.record(e.string(),e.unknown())});var An=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutCompanyOverrideFor:e.property("without_company_override_for",e.string().optional()),withoutPlanEntitlementFor:e.property("without_plan_entitlement_for",e.string().optional())});var Fn=e.object({data:j,params:An});var In=e.object({featureId:e.property("feature_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Kn=e.object({data:e.list(ze),params:In});var Ln=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Gn=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Nn=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Xn=e.object({data:q,params:e.record(e.string(),e.unknown())});var Hn=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",e.string()),id:e.string(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Wn=e.object({flag:Hn.optional(),rules:e.list(Hr)});var Jn=e.object({data:Wn,params:e.record(e.string(),e.unknown())});var Wr=e.object({companyId:e.property("company_id",e.string().optional()),error:e.string().optional(),featureAllocation:e.property("feature_allocation",e.number().optional()),featureUsage:e.property("feature_usage",e.number().optional()),featureUsageEvent:e.property("feature_usage_event",e.string().optional()),featureUsagePeriod:e.property("feature_usage_period",e.string().optional()),featureUsageResetAt:e.property("feature_usage_reset_at",e.date().optional()),flag:e.string(),flagId:e.property("flag_id",e.string().optional()),reason:e.string(),ruleId:e.property("rule_id",e.string().optional()),ruleType:e.property("rule_type",e.string().optional()),userId:e.property("user_id",e.string().optional()),value:e.boolean()});var $n=e.object({data:Wr,params:e.record(e.string(),e.unknown())});var Zn=e.object({flags:e.list(Wr)});var Yn=e.object({data:Zn,params:e.record(e.string(),e.unknown())});var Qn=e.object({featureId:e.property("feature_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ec=e.object({data:j,params:Qn});var Jr=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",e.stringLiteral("boolean")),id:e.string().optional(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var nt=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",On),flag:Jr.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",jn.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional())});var ct=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",kn.optional()),flag:Jr.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",Dn.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string().optional(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional())});var rc=e.enum_(["company","metric","trait","user","plan","billing_product","crm_product","base_plan"]);var oc=e.enum_(["all_time","current_month","current_week","current_day"]);var tc=e.enum_(["first_of_month","billing_cycle"]);var ic=e.enum_(["eq","ne","gt","gte","lt","lte","is_empty","not_empty"]);var be=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionType:e.property("condition_type",rc),creditCost:e.property("credit_cost",e.number().optional()),creditId:e.property("credit_id",e.string().optional()),eventSubtype:e.property("event_subtype",e.string().optional()),id:e.string().optional(),metricPeriod:e.property("metric_period",oc.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",tc.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:ic,resourceIds:e.property("resource_ids",e.list(e.string())),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string().optional())});var Oe=e.object({conditions:e.list(be),flagId:e.property("flag_id",e.string().optional()),id:e.string().optional(),planId:e.property("plan_id",e.string().optional())});var ac=e.enum_(["global_override","company_override","plan_entitlement","standard","default","plan_audience"]);var sc=e.object({conditionGroups:e.property("condition_groups",e.list(Oe)),conditions:e.list(be),id:e.string().optional(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",ac.optional()),value:e.boolean()});var pt=e.object({rules:e.list(sc)});var nc=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var $r=e.object({accountId:e.property("account_id",e.string()),amountOff:e.property("amount_off",e.number().optional()),currency:e.string().optional(),duration:e.string().optional(),durationInMonths:e.property("duration_in_months",e.number().optional()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),isActive:e.property("is_active",e.boolean()),maxRedemptions:e.property("max_redemptions",e.number().optional()),metadata:e.record(e.string(),e.unknown()),name:e.string(),percentOff:e.property("percent_off",e.number().optional()),timesRedeemed:e.property("times_redeemed",e.number()),validFrom:e.property("valid_from",e.date().optional()),validUntil:e.property("valid_until",e.date().optional())});var cc=e.object({data:e.list($r),params:nc});var pc=e.object({data:$r,params:e.record(e.string(),e.unknown())});var lc=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),failedToImport:e.property("failed_to_import",e.boolean()),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var mc=e.object({data:lc,params:e.record(e.string(),e.unknown())});var uc=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),failedToImport:e.property("failed_to_import",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),q:e.string().optional()});var dc=e.object({currency:e.string(),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),meteredUsage:e.property("metered_usage",e.boolean()),perUnitPrice:e.property("per_unit_price",e.number()),totalPrice:e.property("total_price",e.number())});var hc=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),failedToImport:e.property("failed_to_import",e.boolean()),id:e.string(),name:e.string(),subscriptions:e.list(dc),updatedAt:e.property("updated_at",e.date())});var wc=e.object({data:e.list(hc),params:uc});var gc=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),failedToImport:e.property("failed_to_import",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),q:e.string().optional()});var yc=e.object({data:j,params:gc});var Rc=e.object({companyId:e.property("company_id",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),subscriptionExternalId:e.property("subscription_external_id",e.string().optional())});var zc=e.object({data:e.list(me),params:Rc});var bc=e.object({data:me,params:e.record(e.string(),e.unknown())});var fc=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Zr=e.object({dispalyName:e.property("dispaly_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string()),externalPriceId:e.property("external_price_id",e.string()),id:e.string()});var _c=e.object({data:e.list(Zr),params:fc});var Sc=e.object({data:Zr,params:e.record(e.string(),e.unknown())});var Ec=e.object({companyId:e.property("company_id",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var xc=e.object({data:e.list(ce),params:Ec});var Uc=e.object({data:ce,params:e.record(e.string(),e.unknown())});var Pc=e.enum_(["volume","graduated"]);var Cc=e.enum_(["licensed","metered"]);var Tc=e.enum_(["volume","graduated"]);var vc=e.enum_(["licensed","metered"]);var Oc=e.object({forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),ids:e.list(e.string()).optional(),interval:e.string().optional(),limit:e.number().optional(),offset:e.number().optional(),price:e.number().optional(),productId:e.property("product_id",e.string().optional()),q:e.string().optional(),requiresPaymentMethod:e.property("requires_payment_method",e.boolean().optional()),tiersMode:e.property("tiers_mode",Tc.optional()),usageType:e.property("usage_type",vc.optional())});var ee=e.object({billingScheme:e.property("billing_scheme",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:e.string(),isActive:e.property("is_active",e.boolean()),meterEventName:e.property("meter_event_name",e.string().optional()),meterEventPayloadKey:e.property("meter_event_payload_key",e.string().optional()),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceId:e.property("price_id",e.string()),priceTier:e.property("price_tier",e.list(Mr)),productExternalId:e.property("product_external_id",e.string()),productId:e.property("product_id",e.string()),productName:e.property("product_name",e.string()),tiersMode:e.property("tiers_mode",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",e.string())});var jc=e.object({data:e.list(ee),params:Oc});var Bc=e.enum_(["per_unit","tiered"]);var Vc=e.enum_(["volume","graduated"]);var kc=e.enum_(["licensed","metered"]);var K=e.object({currency:e.string(),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),interval:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),scheme:e.string()});var Dc=e.object({data:K,params:e.record(e.string(),e.unknown())});var Mc=e.object({data:q,params:e.record(e.string(),e.unknown())});var qc=e.enum_(["licensed","metered"]);var Ac=e.enum_(["licensed","metered"]);var Fc=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",Ac.optional()),q:e.string().optional(),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var Ic=e.object({data:e.list(K),params:Fc});var Kc=e.object({data:q,params:e.record(e.string(),e.unknown())});var pr=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string().optional(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),name:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),productId:e.property("product_id",e.string()),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var Lc=e.object({data:pr,params:e.record(e.string(),e.unknown())});var Gc=e.enum_(["licensed","metered"]);var Nc=e.enum_(["licensed","metered"]);var Xc=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",Nc.optional()),q:e.string().optional(),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var je=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string().optional(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),name:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),prices:e.list(K),productId:e.property("product_id",e.string()),quantity:e.number(),subscriptionCount:e.property("subscription_count",e.number()),updatedAt:e.property("updated_at",e.date())});var Hc=e.object({data:e.list(je),params:Xc});var Wc=e.enum_(["licensed","metered"]);var Jc=e.enum_(["licensed","metered"]);var $c=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",Jc.optional()),q:e.string().optional(),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var Zc=e.object({data:j,params:$c});var Yc=e.enum_(["subscribe","cancel"]);var Qc=e.object({cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",e.string().optional())});var ep=e.object({data:Qc,params:e.record(e.string(),e.unknown())});var lt=e.object({amountOff:e.property("amount_off",e.number()),currency:e.string().optional(),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number()),externalId:e.property("external_id",e.string()),maxRedemptions:e.property("max_redemptions",e.number()),name:e.string(),percentOff:e.property("percent_off",e.number()),timesRedeemed:e.property("times_redeemed",e.number())});var mt=e.object({companyId:e.property("company_id",e.string().optional()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),email:e.string(),externalId:e.property("external_id",e.string()),failedToImport:e.property("failed_to_import",e.boolean()),meta:e.record(e.string(),e.string()),name:e.string()});var ut=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),externalId:e.property("external_id",e.string().optional()),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),url:e.string().optional()});var dt=e.object({displayName:e.property("display_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string()),externalId:e.property("external_id",e.string())});var ht=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string()),externalId:e.property("external_id",e.string()),paymentMethodType:e.property("payment_method_type",e.string())});var rp=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitDecimal:e.property("per_unit_decimal",e.string().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),priceExternalId:e.property("price_external_id",e.string()),upTo:e.property("up_to",e.number().optional())});var wt=e.object({billingScheme:e.property("billing_scheme",Bc),currency:e.string(),externalAccountId:e.property("external_account_id",e.string()),interval:e.string(),isActive:e.property("is_active",e.boolean()),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number().optional()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceTiers:e.property("price_tiers",e.list(rp)),productExternalId:e.property("product_external_id",e.string()),tiersMode:e.property("tiers_mode",Vc.optional()),usageType:e.property("usage_type",kc)});var gt=e.object({externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean().optional()),name:e.string(),price:e.number()});var op=e.object({couponExternalId:e.property("coupon_external_id",e.string()),customerFacingCode:e.property("customer_facing_code",e.string().optional()),endedAt:e.property("ended_at",e.date().optional()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),promoCodeExternalId:e.property("promo_code_external_id",e.string().optional()),startedAt:e.property("started_at",e.date())});var tp=e.enum_(["licensed","metered"]);var ip=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),currency:e.string(),interval:e.string(),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number().optional()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),quantity:e.number(),subscriptionItemExternalId:e.property("subscription_item_external_id",e.string().optional()),usageType:e.property("usage_type",tp)});var yt=e.object({cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodExternalId:e.property("default_payment_method_external_id",e.string().optional()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),discounts:e.list(op),expiredAt:e.property("expired_at",e.date()),interval:e.string().optional(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number().optional()),periodStart:e.property("period_start",e.number().optional()),productExternalIds:e.property("product_external_ids",e.list(ip)),status:e.string().optional(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",Yc.optional())});var ap=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var fe=e.object({burnStrategy:e.property("burn_strategy",e.string()),createdAt:e.property("created_at",e.date()),defaultExpiryUnit:e.property("default_expiry_unit",e.string()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",e.string()),description:e.string(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:K.optional(),product:pr.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var sp=e.object({data:e.list(fe),params:ap});var np=e.enum_(["plan_first_then_credit_bundles_first_in_first_out","first_in_first_out","last_in_first_out","expiration_priority"]);var cp=e.enum_(["none","rollover","expire"]);var pp=e.object({data:fe,params:e.record(e.string(),e.unknown())});var lp=e.object({data:fe,params:e.record(e.string(),e.unknown())});var mp=e.enum_(["plan_first_then_credit_bundles_first_in_first_out","first_in_first_out","last_in_first_out","expiration_priority"]);var up=e.enum_(["none","rollover","expire"]);var dp=e.object({data:fe,params:e.record(e.string(),e.unknown())});var hp=e.object({data:q,params:e.record(e.string(),e.unknown())});var wp=e.enum_(["active","inactive"]);var gp=e.enum_(["active","inactive"]);var yp=e.object({bundleType:e.property("bundle_type",e.stringLiteral("fixed").optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:gp.optional()});var de=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",e.string()),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",e.string()),expiryUnit:e.property("expiry_unit",e.string()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:K.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:e.string(),unitPrice:e.property("unit_price",K.optional()),updatedAt:e.property("updated_at",e.date())});var Rp=e.object({data:e.list(de),params:yp});var zp=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var bp=e.enum_(["days","billing_periods"]);var fp=e.enum_(["active","inactive"]);var _p=e.object({data:de,params:e.record(e.string(),e.unknown())});var Sp=e.object({data:de,params:e.record(e.string(),e.unknown())});var Ep=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var xp=e.enum_(["days","billing_periods"]);var Up=e.enum_(["active","inactive"]);var Pp=e.object({data:de,params:e.record(e.string(),e.unknown())});var Cp=e.object({data:q,params:e.record(e.string(),e.unknown())});var Tp=e.enum_(["active","inactive"]);var vp=e.enum_(["active","inactive"]);var Op=e.object({bundleType:e.property("bundle_type",e.stringLiteral("fixed").optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:vp.optional()});var jp=e.object({data:j,params:Op});var Bp=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var Vp=e.object({data:j,params:Bp});var kp=e.enum_(["plan_change","manual","plan_period_reset","expired"]);var Be=e.object({companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),createdAt:e.property("created_at",e.date()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",e.string()),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),price:K.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),sourceLabel:e.property("source_label",e.string()),updatedAt:e.property("updated_at",e.date()),validFrom:e.property("valid_from",e.date().optional()),zeroedOutDate:e.property("zeroed_out_date",e.date().optional()),zeroedOutReason:e.property("zeroed_out_reason",e.string().optional())});var Dp=e.object({data:Be,params:e.record(e.string(),e.unknown())});var Mp=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var qp=e.enum_(["days","billing_periods"]);var Ap=e.object({data:Be,params:e.record(e.string(),e.unknown())});var Fp=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var Ip=e.enum_(["asc","desc"]);var Kp=e.enum_(["asc","desc"]);var Lp=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var Gp=e.object({companyId:e.property("company_id",e.string().optional()),dir:Kp.optional(),limit:e.number().optional(),offset:e.number().optional(),order:Lp.optional()});var Np=e.object({data:e.list(Be),params:Gp});var Xp=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var Hp=e.object({data:j,params:Xp});var Wp=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var Jp=e.object({data:e.list(Be),params:Wp});var $p=e.enum_(["daily","weekly","monthly","raw"]);var Zp=e.enum_(["daily","weekly","monthly","raw"]);var Yp=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),period:Zp.optional(),startTime:e.property("start_time",e.string().optional())});var Qp=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var el=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var rl=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string()});var ol=e.object({billingCreditId:e.property("billing_credit_id",e.string()),company:Qp.optional(),companyId:e.property("company_id",e.string()),credit:el.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:rl.optional(),featureId:e.property("feature_id",e.string().optional()),firstTransactionAt:e.property("first_transaction_at",e.date()),freeGrantCount:e.property("free_grant_count",e.number()),grantCount:e.property("grant_count",e.number()),lastTransactionAt:e.property("last_transaction_at",e.date()),manuallyZeroedCount:e.property("manually_zeroed_count",e.number()),netChange:e.property("net_change",e.number()),planGrantCount:e.property("plan_grant_count",e.number()),purchasedGrantCount:e.property("purchased_grant_count",e.number()),timeBucket:e.property("time_bucket",e.date()),totalConsumed:e.property("total_consumed",e.number()),totalGranted:e.property("total_granted",e.number()),transactionCount:e.property("transaction_count",e.number()),usageCount:e.property("usage_count",e.number()),zeroedOutCount:e.property("zeroed_out_count",e.number())});var tl=e.object({data:e.list(ol),params:Yp});var il=e.enum_(["daily","weekly","monthly","raw"]);var al=e.enum_(["daily","weekly","monthly","raw"]);var sl=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),period:al.optional(),startTime:e.property("start_time",e.string().optional())});var nl=e.object({data:j,params:sl});var cl=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional())});var Ve=e.object({createdAt:e.property("created_at",e.date()),creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),creditPluralName:e.property("credit_plural_name",e.string().optional()),creditSingularName:e.property("credit_singular_name",e.string().optional()),expiryType:e.property("expiry_type",e.string().optional()),expiryUnit:e.property("expiry_unit",e.string().optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),resetCadence:e.property("reset_cadence",e.string()),resetStart:e.property("reset_start",e.string()),resetType:e.property("reset_type",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var pl=e.object({data:e.list(Ve),params:cl});var ll=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var ml=e.enum_(["days","billing_periods"]);var ul=e.enum_(["monthly","yearly","daily","weekly"]);var dl=e.enum_(["billing_period","first_of_month"]);var hl=e.enum_(["plan_period","no_reset"]);var wl=e.object({data:Ve,params:e.record(e.string(),e.unknown())});var gl=e.object({data:q,params:e.record(e.string(),e.unknown())});var yl=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional())});var Rl=e.object({data:j,params:yl});var Rt=e.object({burnStrategy:e.property("burn_strategy",np.optional()),currency:e.string(),defaultExpiryUnit:e.property("default_expiry_unit",e.string().optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",cp.optional()),description:e.string(),icon:e.string().optional(),name:e.string(),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var zt=e.object({burnStrategy:e.property("burn_strategy",mp.optional()),defaultExpiryUnit:e.property("default_expiry_unit",e.stringLiteral("days").optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",up.optional()),description:e.string(),icon:e.string().optional(),name:e.string(),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var bt=e.object({bundleName:e.property("bundle_name",e.string()),bundleType:e.property("bundle_type",e.stringLiteral("fixed").optional()),creditId:e.property("credit_id",e.string()),currency:e.string(),expiryType:e.property("expiry_type",zp.optional()),expiryUnit:e.property("expiry_unit",bp.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:fp.optional()});var ft=e.object({bundleName:e.property("bundle_name",e.string()),expiryType:e.property("expiry_type",Ep.optional()),expiryUnit:e.property("expiry_unit",xp.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:Up.optional()});var _t=e.object({reason:kp.optional()});var St=e.object({billingPeriodsCount:e.property("billing_periods_count",e.number().optional()),companyId:e.property("company_id",e.string()),creditId:e.property("credit_id",e.string()),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",Mp.optional()),expiryUnit:e.property("expiry_unit",qp.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),quantity:e.number(),reason:e.string()});var Et=e.object({creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),expiryType:e.property("expiry_type",ll.optional()),expiryUnit:e.property("expiry_unit",ml.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),planId:e.property("plan_id",e.string()),resetCadence:e.property("reset_cadence",ul),resetStart:e.property("reset_start",dl),resetType:e.property("reset_type",hl.optional())});var zl=e.object({cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),confirmPaymentIntentClientSecret:e.property("confirm_payment_intent_client_secret",e.string().optional()),confirmPaymentIntentId:e.property("confirm_payment_intent_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",e.string().optional())});var bl=e.object({data:zl,params:e.record(e.string(),e.unknown())});var re=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",je.optional()),chargeType:e.property("charge_type",e.string()),companyCount:e.property("company_count",e.number()),controlledBy:e.property("controlled_by",e.string()),createdAt:e.property("created_at",e.date()),description:e.string(),features:e.list(W),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Ve).optional()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",K.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",K.optional()),planType:e.property("plan_type",e.string()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",K.optional())});var Xe=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),consumptionRate:e.property("consumption_rate",e.number().optional()),featureId:e.property("feature_id",e.string()),meteredPrice:e.property("metered_price",ee.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",ee.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueType:e.property("value_type",e.string()),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",ee.optional())});var fl=e.enum_(["boolean","numeric","trait","unlimited"]);var _l=e.object({createdAt:e.property("created_at",e.date()),externalUserId:e.property("external_user_id",e.string()),externalUserName:e.property("external_user_name",e.string()),id:e.string(),note:e.string(),updatedAt:e.property("updated_at",e.date())});var he=e.object({company:I.optional(),companyId:e.property("company_id",e.string()),consumptionRate:e.property("consumption_rate",e.number().optional()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expirationDate:e.property("expiration_date",e.date().optional()),feature:sr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),notes:e.list(_l),ruleId:e.property("rule_id",e.string().optional()),ruleIdUsageExceeded:e.property("rule_id_usage_exceeded",e.string().optional()),updatedAt:e.property("updated_at",e.date()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",Z.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",e.string())});var Sl=e.enum_(["free","plan","purchased"]);var ke=e.object({creditTypeIcon:e.property("credit_type_icon",e.string().optional()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",Sl),quantity:e.number()});var El=e.enum_(["free","plan","purchased"]);var De=e.object({audienceType:e.property("audience_type",e.string().optional()),createdAt:e.property("created_at",e.date()),description:e.string(),icon:e.string(),id:e.string(),name:e.string(),planType:e.property("plan_type",e.string()),updatedAt:e.property("updated_at",e.date())});var ae=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),consumptionRate:e.property("consumption_rate",e.number().optional()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),feature:sr.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),meteredMonthlyPrice:e.property("metered_monthly_price",ee.optional()),meteredYearlyPrice:e.property("metered_yearly_price",ee.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),plan:De.optional(),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",e.string().optional()),ruleId:e.property("rule_id",e.string()),ruleIdUsageExceeded:e.property("rule_id_usage_exceeded",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageBasedProduct:e.property("usage_based_product",pr.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCredit:e.property("value_credit",fe.optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",Z.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",e.string())});var Me=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",fl),companyOverride:e.property("company_override",he.optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(ke).optional()),creditGrantReason:e.property("credit_grant_reason",El.optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditUsed:e.property("credit_used",e.number().optional()),effectiveLimit:e.property("effective_limit",e.number().optional()),effectivePrice:e.property("effective_price",e.number().optional()),entitlementExpirationDate:e.property("entitlement_expiration_date",e.date().optional()),entitlementId:e.property("entitlement_id",e.string()),entitlementSource:e.property("entitlement_source",e.string().optional()),entitlementType:e.property("entitlement_type",e.string()),feature:W.optional(),hasValidAllocation:e.property("has_valid_allocation",e.boolean().optional()),isUnlimited:e.property("is_unlimited",e.boolean().optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",ee.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:De.optional(),planEntitlement:e.property("plan_entitlement",ae.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",ee.optional())});var qe=e.object({features:e.list(Me)});var xl=e.object({bundle:de.optional(),quantity:e.number(),total:e.number()});var Ae=e.object({cancelAt:e.property("cancel_at",e.date().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),discounts:e.list(Dr),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),latestInvoice:e.property("latest_invoice",me.optional()),paymentMethod:e.property("payment_method",ce.optional()),products:e.list(qr),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.date().optional())});var Ul=e.object({activeAddOns:e.property("active_add_ons",e.list(re)),activePlan:e.property("active_plan",re.optional()),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Xe)),availableCreditBundles:e.property("available_credit_bundles",e.list(de)),company:I.optional(),featureUsage:e.property("feature_usage",qe.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(xl)),selectedPlan:e.property("selected_plan",re.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(Xe)),subscription:Ae.optional()});var Pl=e.object({data:Ul,params:e.record(e.string(),e.unknown())});var Cl=e.object({amount:e.number(),description:e.string(),priceId:e.property("price_id",e.string()),proration:e.boolean(),quantity:e.number()});var Tl=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),newCharges:e.property("new_charges",e.number()),percentOff:e.property("percent_off",e.number()),periodStart:e.property("period_start",e.date()),promoCodeApplied:e.property("promo_code_applied",e.boolean()),proration:e.number(),taxAmount:e.property("tax_amount",e.number().optional()),taxDisplayName:e.property("tax_display_name",e.string().optional()),taxRequireBillingDetails:e.property("tax_require_billing_details",e.boolean()),trialEnd:e.property("trial_end",e.date().optional()),upcomingInvoiceLineItems:e.property("upcoming_invoice_line_items",e.list(Cl))});var Yr=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),finance:Tl.optional(),newCharges:e.property("new_charges",e.number()),paymentMethodRequired:e.property("payment_method_required",e.boolean()),percentOff:e.property("percent_off",e.number()),periodStart:e.property("period_start",e.date()),promoCodeApplied:e.property("promo_code_applied",e.boolean()),proration:e.number(),trialEnd:e.property("trial_end",e.date().optional()),usageViolations:e.property("usage_violations",e.list(Me))});var vl=e.object({data:Yr,params:e.record(e.string(),e.unknown())});var Ol=e.object({company:I.optional(),success:e.boolean()});var jl=e.object({data:Ol,params:e.record(e.string(),e.unknown())});var Bl=e.object({subscriptionChangePreview:e.property("subscription_change_preview",Yr.optional())});var Vl=e.object({data:Bl,params:e.record(e.string(),e.unknown())});var kl=e.object({data:ve,params:e.record(e.string(),e.unknown())});var xt=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var Ut=e.object({trialEnd:e.property("trial_end",e.date().optional())});var Dl=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional(),withSubscription:e.property("with_subscription",e.boolean().optional()),withoutFeatureOverrideFor:e.property("without_feature_override_for",e.string().optional()),withoutPlan:e.property("without_plan",e.boolean().optional())});var Ml=e.object({data:e.list(I),params:Dl});var ql=e.object({data:I,params:e.record(e.string(),e.unknown())});var Al=e.object({data:I,params:e.record(e.string(),e.unknown())});var Fl=e.object({data:q,params:e.record(e.string(),e.unknown())});var Il=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional(),withSubscription:e.property("with_subscription",e.boolean().optional()),withoutFeatureOverrideFor:e.property("without_feature_override_for",e.string().optional()),withoutPlan:e.property("without_plan",e.boolean().optional())});var Kl=e.object({data:j,params:Il});var Ll=e.enum_(["asc","desc"]);var Gl=e.enum_(["asc","desc"]);var Nl=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),displayProperties:e.property("display_properties",e.list(e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),monetizedSubscriptions:e.property("monetized_subscriptions",e.boolean().optional()),offset:e.number().optional(),planIds:e.property("plan_ids",e.list(e.string()).optional()),q:e.string().optional(),sortOrderColumn:e.property("sort_order_column",e.string().optional()),sortOrderDirection:e.property("sort_order_direction",Gl.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(e.string()).optional()),subscriptionTypes:e.property("subscription_types",e.list(e.string()).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Xl=e.object({data:j,params:Nl});var Hl=e.object({data:I,params:e.record(e.string(),e.unknown())});var Wl=e.object({data:Gr,params:e.record(e.string(),e.unknown())});var Jl=e.enum_(["asc","desc"]);var $l=e.enum_(["asc","desc"]);var Zl=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),displayProperties:e.property("display_properties",e.list(e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),monetizedSubscriptions:e.property("monetized_subscriptions",e.boolean().optional()),offset:e.number().optional(),planIds:e.property("plan_ids",e.list(e.string()).optional()),q:e.string().optional(),sortOrderColumn:e.property("sort_order_column",e.string().optional()),sortOrderDirection:e.property("sort_order_direction",$l.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(e.string()).optional()),subscriptionTypes:e.property("subscription_types",e.list(e.string()).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Yl=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(ke)),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditTypeName:e.property("credit_type_name",e.string().optional()),creditUsed:e.property("credit_used",e.number().optional())});var Ql=e.object({creditTypeId:e.property("credit_type_id",e.string().optional()),creditUsage:e.property("credit_usage",Yl.optional()),entitlementSource:e.property("entitlement_source",e.string()),entitlementValueType:e.property("entitlement_value_type",e.string()),featureId:e.property("feature_id",e.string()),featureName:e.property("feature_name",e.string()),featureType:e.property("feature_type",e.string()),hardLimit:e.property("hard_limit",e.string()),hasAccess:e.property("has_access",e.boolean()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",ee.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),softLimit:e.property("soft_limit",e.string()),usage:e.string(),valueNumeric:e.property("value_numeric",e.number().optional()),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",ee.optional())});var em=e.object({addOns:e.property("add_ons",e.list(or)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",ve.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(ve)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ce.optional()),entityTraits:e.property("entity_traits",e.list(tr)),environmentId:e.property("environment_id",e.string()),featureUsage:e.property("feature_usage",e.list(Ql)),id:e.string(),keys:e.list(ir),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Fr),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ce)),plan:or.optional(),plans:e.list(Ir),rules:e.list(Lr),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var rm=e.object({data:e.list(em),params:Zl});var om=e.object({keys:e.record(e.string(),e.string()).optional()});var tm=e.object({data:I,params:om});var im=e.object({companyId:e.property("company_id",e.string().optional()),dealStage:e.property("deal_stage",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Pt=e.record(e.string(),e.unknown());var am=e.object({billingFrequency:e.property("billing_frequency",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),description:e.string(),discountPercentage:e.property("discount_percentage",Pt.optional()),id:e.string(),name:e.string(),price:e.number(),quantity:e.number(),termMonth:e.property("term_month",e.number().optional()),totalDiscount:e.property("total_discount",Pt.optional()),updatedAt:e.property("updated_at",e.date())});var sm=e.object({dealArr:e.property("deal_arr",e.string()),dealExternalId:e.property("deal_external_id",e.string()),dealMrr:e.property("deal_mrr",e.string()),dealName:e.property("deal_name",e.string().optional()),lineItems:e.property("line_items",e.list(am))});var nm=e.object({data:e.list(sm),params:im});var cm=e.object({companyId:e.property("company_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),userId:e.property("user_id",e.string().optional())});var pm=e.object({data:e.list(ar),params:cm});var lm=e.object({data:ar,params:e.record(e.string(),e.unknown())});var mm=e.object({data:q,params:e.record(e.string(),e.unknown())});var um=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional()});var dm=e.object({data:e.list(Ae),params:um});var hm=e.object({data:I,params:e.record(e.string(),e.unknown())});var wm=e.enum_(["company","user"]);var gm=e.enum_(["company","user"]);var ym=e.object({entityType:e.property("entity_type",gm.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Rm=e.object({data:e.list(Ar),params:ym});var zm=e.enum_(["company","user"]);var bm=e.enum_(["company","user"]);var fm=e.object({entityType:e.property("entity_type",bm.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var _m=e.object({data:j,params:fm});var Sm=e.enum_(["company","user"]);var Em=e.enum_(["boolean","currency","date","number","string","url"]);var xm=e.enum_(["company","user"]);var Um=e.enum_(["boolean","currency","date","number","string","url"]);var Pm=e.object({entityType:e.property("entity_type",xm.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",Um.optional())});var Cm=e.object({data:e.list(Z),params:Pm});var Tm=e.enum_(["company","user"]);var vm=e.enum_(["boolean","currency","date","number","string","url"]);var Om=e.object({data:Z,params:e.record(e.string(),e.unknown())});var jm=e.object({data:Z,params:e.record(e.string(),e.unknown())});var Bm=e.enum_(["boolean","currency","date","number","string","url"]);var Vm=e.object({data:Z,params:e.record(e.string(),e.unknown())});var km=e.enum_(["company","user"]);var Dm=e.enum_(["boolean","currency","date","number","string","url"]);var Mm=e.enum_(["company","user"]);var qm=e.enum_(["boolean","currency","date","number","string","url"]);var Am=e.object({entityType:e.property("entity_type",Mm.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",qm.optional())});var Fm=e.object({data:j,params:Am});var Im=e.object({definitionId:e.property("definition_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Km=e.object({definitionId:e.property("definition_id",e.string()),value:e.string()});var Lm=e.object({data:e.list(Km),params:Im});var Gm=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitIds:e.property("trait_ids",e.list(e.string()).optional())});var _e=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),planId:e.property("plan_id",e.string()),planType:e.property("plan_type",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Nm=e.object({data:e.list(_e),params:Gm});var Xm=e.object({data:_e,params:e.record(e.string(),e.unknown())});var Hm=e.object({data:_e,params:e.record(e.string(),e.unknown())});var Wm=e.object({data:_e,params:e.record(e.string(),e.unknown())});var Jm=e.object({data:q,params:e.record(e.string(),e.unknown())});var $m=e.object({data:e.list(_e),params:e.record(e.string(),e.unknown())});var Zm=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitIds:e.property("trait_ids",e.list(e.string()).optional())});var Ym=e.object({data:j,params:Zm});var Qm=e.object({data:pe,params:e.record(e.string(),e.unknown())});var eu=e.object({companyId:e.property("company_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var ru=e.object({data:e.list(pe),params:eu});var ou=e.object({data:pe,params:e.record(e.string(),e.unknown())});var tu=e.object({data:pe,params:e.record(e.string(),e.unknown())});var iu=e.object({data:q,params:e.record(e.string(),e.unknown())});var au=e.object({companyId:e.property("company_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var su=e.object({data:j,params:au});var nu=e.object({data:pe,params:e.record(e.string(),e.unknown())});var Qr=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var cu=e.object({data:Qr,params:e.record(e.string(),e.unknown())});var pu=e.object({keys:e.record(e.string(),e.string()).optional()});var lu=e.object({data:pe,params:pu});var Ct=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var Tt=e.object({displayName:e.property("display_name",e.string().optional()),entityType:e.property("entity_type",Tm),hierarchy:e.list(e.string()),traitType:e.property("trait_type",vm)});var vt=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",Bm)});var Ot=e.object({planId:e.property("plan_id",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var jt=e.object({planId:e.property("plan_id",e.string()),traitValue:e.property("trait_value",e.string())});var mu=e.object({traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var Bt=e.object({planId:e.property("plan_id",e.string()),traits:e.list(mu)});var uu=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutExpired:e.property("without_expired",e.boolean().optional())});var du=e.object({data:e.list(he),params:uu});var hu=e.enum_(["all_time","current_month","current_week","current_day"]);var wu=e.enum_(["first_of_month","billing_cycle"]);var gu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var yu=e.object({data:he,params:e.record(e.string(),e.unknown())});var Ru=e.object({data:he,params:e.record(e.string(),e.unknown())});var zu=e.enum_(["all_time","current_month","current_week","current_day"]);var bu=e.enum_(["first_of_month","billing_cycle"]);var fu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var _u=e.object({data:he,params:e.record(e.string(),e.unknown())});var Su=e.object({data:q,params:e.record(e.string(),e.unknown())});var Eu=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutExpired:e.property("without_expired",e.boolean().optional())});var xu=e.object({data:j,params:Eu});var Uu=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Pu=e.enum_(["boolean","numeric","trait","unlimited"]);var Cu=e.enum_(["free","plan","purchased"]);var Tu=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(ke).optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditTypeName:e.property("credit_type_name",e.string().optional()),creditUsed:e.property("credit_used",e.number().optional())});var vu=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Pu),company:I.optional(),companyOverride:e.property("company_override",he.optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(ke).optional()),creditGrantReason:e.property("credit_grant_reason",Cu.optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditUsage:e.property("credit_usage",Tu.optional()),creditUsed:e.property("credit_used",e.number().optional()),effectiveLimit:e.property("effective_limit",e.number().optional()),effectivePrice:e.property("effective_price",e.number().optional()),entitlementExpirationDate:e.property("entitlement_expiration_date",e.date().optional()),entitlementId:e.property("entitlement_id",e.string()),entitlementSource:e.property("entitlement_source",e.string().optional()),entitlementType:e.property("entitlement_type",e.string()),feature:W.optional(),hasValidAllocation:e.property("has_valid_allocation",e.boolean().optional()),isUnlimited:e.property("is_unlimited",e.boolean().optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",ee.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:De.optional(),planEntitlement:e.property("plan_entitlement",ae.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",ee.optional())});var Ou=e.object({data:e.list(vu),params:Uu});var ju=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Bu=e.object({data:j,params:ju});var Vu=e.object({companyId:e.property("company_id",e.string().optional()),companyKeys:e.property("company_keys",e.record(e.string(),e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutNegativeEntitlements:e.property("without_negative_entitlements",e.boolean().optional())});var ku=e.object({data:e.list(Me),params:Vu});var Du=e.object({companyId:e.property("company_id",e.string().optional()),companyKeys:e.property("company_keys",e.record(e.string(),e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutNegativeEntitlements:e.property("without_negative_entitlements",e.boolean().optional())});var Mu=e.object({data:j,params:Du});var qu=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Au=e.enum_(["boolean","numeric","trait","unlimited","unknown"]);var Fu=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Au),company:I.optional(),entitlementId:e.property("entitlement_id",e.string()),entitlementType:e.property("entitlement_type",e.string()),feature:W.optional(),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),period:e.string().optional(),plan:De.optional(),usage:e.number().optional(),user:Qr.optional()});var Iu=e.object({data:e.list(Fu),params:qu});var Ku=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Lu=e.object({data:j,params:Ku});var Gu=e.object({featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var Nu=e.object({data:e.list(ae),params:Gu});var Xu=e.enum_(["all_time","current_month","current_week","current_day"]);var Hu=e.enum_(["first_of_month","billing_cycle"]);var Wu=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var Ju=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var $u=e.object({data:ae,params:e.record(e.string(),e.unknown())});var Zu=e.object({data:ae,params:e.record(e.string(),e.unknown())});var Yu=e.enum_(["all_time","current_month","current_week","current_day"]);var Qu=e.enum_(["first_of_month","billing_cycle"]);var ed=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var rd=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var od=e.object({data:ae,params:e.record(e.string(),e.unknown())});var td=e.object({data:q,params:e.record(e.string(),e.unknown())});var id=e.object({featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var ad=e.object({data:j,params:id});var sd=e.object({keys:e.record(e.string(),e.string()).optional()});var nd=e.object({data:qe,params:sd});var Vt=e.object({companyId:e.property("company_id",e.string()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",hu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",wu.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",gu)});var kt=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),metricPeriod:e.property("metric_period",zu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",bu.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",fu)});var we=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),upTo:e.property("up_to",e.number().optional())});var Dt=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",Xu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Hu.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(we).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",Wu.optional()),priceTiers:e.property("price_tiers",e.list(we).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",e.string().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Ju),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(we).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Mt=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),metricPeriod:e.property("metric_period",Yu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Qu.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(we).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),priceBehavior:e.property("price_behavior",ed.optional()),priceTiers:e.property("price_tiers",e.list(we).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",e.string().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",rd),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(we).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var cd=e.object({data:I,params:e.record(e.string(),e.unknown())});var eo=e.object({conditionGroups:e.property("condition_groups",e.list(Xr)),conditions:e.list(nr),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),planId:e.property("plan_id",e.string().optional()),priority:e.number(),ruleType:e.property("rule_type",e.string()),updatedAt:e.property("updated_at",e.date()),value:e.boolean()});var pd=e.object({data:eo,params:e.record(e.string(),e.unknown())});var ld=e.object({data:eo,params:e.record(e.string(),e.unknown())});var md=e.object({data:q,params:e.record(e.string(),e.unknown())});var ud=e.enum_(["plan","add_on"]);var dd=e.enum_(["plan","add_on"]);var hd=e.object({companyId:e.property("company_id",e.string().optional()),forFallbackPlan:e.property("for_fallback_plan",e.boolean().optional()),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),hasProductId:e.property("has_product_id",e.boolean().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",dd.optional()),q:e.string().optional(),requiresPaymentMethod:e.property("requires_payment_method",e.boolean().optional()),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional()),withoutProductId:e.property("without_product_id",e.boolean().optional())});var wd=e.object({data:e.list(re),params:hd});var gd=e.enum_(["plan","add_on"]);var yd=e.object({data:re,params:e.record(e.string(),e.unknown())});var Rd=e.object({data:re,params:e.record(e.string(),e.unknown())});var zd=e.object({data:re,params:e.record(e.string(),e.unknown())});var bd=e.object({data:q,params:e.record(e.string(),e.unknown())});var fd=e.enum_(["one_time","recurring","free"]);var _d=e.object({accountId:e.property("account_id",e.string()),billingProductId:e.property("billing_product_id",e.string()),chargeType:e.property("charge_type",e.string()),controlledBy:e.property("controlled_by",e.string()),environmentId:e.property("environment_id",e.string()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPriceId:e.property("monthly_price_id",e.string().optional()),oneTimePriceId:e.property("one_time_price_id",e.string().optional()),planId:e.property("plan_id",e.string()),trialDays:e.property("trial_days",e.number().optional()),yearlyPriceId:e.property("yearly_price_id",e.string().optional())});var Sd=e.object({data:_d,params:e.record(e.string(),e.unknown())});var Ed=e.enum_(["plan","add_on"]);var xd=e.enum_(["plan","add_on"]);var Ud=e.object({companyId:e.property("company_id",e.string().optional()),forFallbackPlan:e.property("for_fallback_plan",e.boolean().optional()),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),hasProductId:e.property("has_product_id",e.boolean().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",xd.optional()),q:e.string().optional(),requiresPaymentMethod:e.property("requires_payment_method",e.boolean().optional()),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional()),withoutProductId:e.property("without_product_id",e.boolean().optional())});var Pd=e.object({data:j,params:Ud});var Cd=e.object({planId:e.property("plan_id",e.string().optional())});var Td=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var vd=e.object({data:e.list(Td),params:Cd});var qt=e.object({addOnIds:e.property("add_on_ids",e.list(e.string())),basePlanId:e.property("base_plan_id",e.string().optional())});var At=e.object({conditionGroups:e.property("condition_groups",e.list(Oe)),conditions:e.list(be)});var Ft=e.object({description:e.string(),icon:e.string().optional(),name:e.string(),planType:e.property("plan_type",gd)});var It=e.object({description:e.string().optional(),icon:e.string().optional(),name:e.string()});var Kt=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),chargeType:e.property("charge_type",fd),currency:e.string().optional(),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",e.number().optional()),monthlyPriceId:e.property("monthly_price_id",e.string().optional()),oneTimePrice:e.property("one_time_price",e.number().optional()),oneTimePriceId:e.property("one_time_price_id",e.string().optional()),trialDays:e.property("trial_days",e.number().optional()),yearlyPrice:e.property("yearly_price",e.number().optional()),yearlyPriceId:e.property("yearly_price_id",e.string().optional())});var Od=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ge=e.object({ast:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date()),id:e.string(),name:e.string(),state:e.string(),type:e.string(),updatedAt:e.property("updated_at",e.date())});var jd=e.object({data:e.list(ge),params:Od});var Bd=e.enum_(["entitlement","billing"]);var Vd=e.object({data:ge,params:e.record(e.string(),e.unknown())});var kd=e.object({data:ge,params:e.record(e.string(),e.unknown())});var Dd=e.enum_(["entitlement","billing"]);var Md=e.enum_(["draft","live"]);var qd=e.object({data:ge,params:e.record(e.string(),e.unknown())});var Ad=e.object({data:q,params:e.record(e.string(),e.unknown())});var Fd=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Id=e.object({data:j,params:Fd});var Kd=e.object({companyId:e.property("company_id",e.string().optional()),componentId:e.property("component_id",e.string().optional())});var lr=e.object({ctaText:e.property("cta_text",e.string()),ctaWebSite:e.property("cta_web_site",e.string()),priceText:e.property("price_text",e.string())});var Ld=e.object({createdAt:e.property("created_at",e.date()),creditAmount:e.property("credit_amount",e.number()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",e.string().optional()),expiryUnit:e.property("expiry_unit",e.string().optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),pluralName:e.property("plural_name",e.string().optional()),resetCadence:e.property("reset_cadence",e.string()),resetStart:e.property("reset_start",e.string()),resetType:e.property("reset_type",e.string()),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var mr=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",je.optional()),chargeType:e.property("charge_type",e.string()),companyCanTrial:e.property("company_can_trial",e.boolean()),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",e.string()),createdAt:e.property("created_at",e.date()),current:e.boolean(),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",lr.optional()),description:e.string(),entitlements:e.list(ae),features:e.list(W),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Ld)),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",K.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",K.optional()),planType:e.property("plan_type",e.string()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageViolations:e.property("usage_violations",e.list(Me)),valid:e.boolean(),yearlyPrice:e.property("yearly_price",K.optional())});var Fe=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var ro=e.object({badgeVisibility:e.property("badge_visibility",e.boolean()),checkout:e.boolean()});var oo=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean())});var Sr=e.object({billingScheme:e.property("billing_scheme",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:e.string(),isActive:e.property("is_active",e.boolean()),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),tiersMode:e.property("tiers_mode",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",e.string())});var to=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",e.string()),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",e.string()),expiryUnit:e.property("expiry_unit",e.string()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:Sr.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:e.string(),unitPrice:e.property("unit_price",Sr.optional()),updatedAt:e.property("updated_at",e.date())});var io=e.object({billingCreditBundleId:e.property("billing_credit_bundle_id",e.string().optional()),billingCreditId:e.property("billing_credit_id",e.string()),companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditName:e.property("credit_name",e.string()),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",e.string().optional()),expiryUnit:e.property("expiry_unit",e.string().optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),grantReason:e.property("grant_reason",e.string()),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),price:Sr.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),singularName:e.property("singular_name",e.string().optional()),sourceLabel:e.property("source_label",e.string()),updatedAt:e.property("updated_at",e.date()),validFrom:e.property("valid_from",e.date().optional()),zeroedOutDate:e.property("zeroed_out_date",e.date().optional()),zeroedOutReason:e.property("zeroed_out_reason",e.string().optional())});var ao=e.object({accountId:e.property("account_id",e.string().optional()),publishableKey:e.property("publishable_key",e.string().optional()),schematicPublishableKey:e.property("schematic_publishable_key",e.string()),setupIntentClientSecret:e.property("setup_intent_client_secret",e.string().optional())});var Gd=e.object({activeAddOns:e.property("active_add_ons",e.list(mr)),activePlans:e.property("active_plans",e.list(mr)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Xe)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(Fe)),capabilities:ro.optional(),checkoutSettings:e.property("checkout_settings",oo),company:I.optional(),component:ge.optional(),creditBundles:e.property("credit_bundles",e.list(to)),creditGrants:e.property("credit_grants",e.list(io)),defaultPlan:e.property("default_plan",re.optional()),featureUsage:e.property("feature_usage",qe.optional()),invoices:e.list(me),postTrialPlan:e.property("post_trial_plan",re.optional()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),stripeEmbed:e.property("stripe_embed",ao.optional()),subscription:Ae.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",me.optional())});var Nd=e.object({data:Gd,params:Kd});var Lt=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Bd),name:e.string()});var Gt=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Dd.optional()),name:e.string().optional(),state:Md.optional()});var so=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),dealId:e.property("deal_id",e.string().optional()),environmentId:e.property("environment_id",e.string()),productExternalId:e.property("product_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Xd=e.object({data:so,params:e.record(e.string(),e.unknown())});var Hd=e.object({data:so,params:e.record(e.string(),e.unknown())});var Wd=e.object({accountId:e.property("account_id",e.string()),arr:e.string(),companyExternalId:e.property("company_external_id",e.string().optional()),createdAt:e.property("created_at",e.date()),dealExternalId:e.property("deal_external_id",e.string()),dealId:e.property("deal_id",e.string()),environmentId:e.property("environment_id",e.string()),mrr:e.string(),name:e.string().optional(),productExternalId:e.property("product_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Jd=e.object({data:Wd,params:e.record(e.string(),e.unknown())});var $d=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var no=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),name:e.string(),price:e.string(),productId:e.property("product_id",e.string()),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var Zd=e.object({data:e.list(no),params:$d});var Yd=e.object({data:no,params:e.record(e.string(),e.unknown())});var Nt=e.object({dealExternalId:e.property("deal_external_id",e.string()),lineItemExternalId:e.property("line_item_external_id",e.string())});var Xt=e.object({amount:e.string(),discountPercentage:e.property("discount_percentage",e.string().optional()),interval:e.string(),lineItemExternalId:e.property("line_item_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),quantity:e.number(),termMonth:e.property("term_month",e.number().optional()),totalDiscount:e.property("total_discount",e.string().optional())});var Ht=e.object({arr:e.string().optional(),crmCompanyId:e.property("crm_company_id",e.string().optional()),crmCompanyKey:e.property("crm_company_key",e.string()),crmProductId:e.property("crm_product_id",e.string().optional()),crmType:e.property("crm_type",e.string()),dealExternalId:e.property("deal_external_id",e.string()),dealName:e.property("deal_name",e.string().optional()),dealStage:e.property("deal_stage",e.string().optional()),mrr:e.string().optional()});var Wt=e.object({currency:e.string(),description:e.string(),externalId:e.property("external_id",e.string()),interval:e.string(),name:e.string(),price:e.string(),quantity:e.number(),sku:e.string()});var Qd=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),exportType:e.property("export_type",e.string()),id:e.string(),metadata:e.string(),outputFileType:e.property("output_file_type",e.string()),status:e.string(),updatedAt:e.property("updated_at",e.date())});var eh=e.object({data:Qd,params:e.record(e.string(),e.unknown())});var Jt=e.object({metadata:e.string()});var co=e.object({capturedAt:e.property("captured_at",e.date()),eventId:e.property("event_id",e.string().optional()),remoteAddr:e.property("remote_addr",e.string()),remoteIp:e.property("remote_ip",e.string()),userAgent:e.property("user_agent",e.string())});var rh=e.object({events:e.list(co)});var oh=e.object({data:rh,params:e.record(e.string(),e.unknown())});var th=e.object({eventSubtypes:e.property("event_subtypes",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ih=e.object({data:e.list(Nr),params:th});var $t=e.enum_(["identify","track","flag_check"]);var ah=e.enum_(["identify","track","flag_check"]);var sh=e.object({companyId:e.property("company_id",e.string().optional()),eventSubtype:e.property("event_subtype",e.string().optional()),eventTypes:e.property("event_types",e.list(ah).optional()),flagId:e.property("flag_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),userId:e.property("user_id",e.string().optional())});var po=e.object({apiKey:e.property("api_key",e.string().optional()),body:e.record(e.string(),e.unknown()),bodyPreview:e.property("body_preview",e.string()),capturedAt:e.property("captured_at",e.date()),company:cr.optional(),companyId:e.property("company_id",e.string().optional()),enrichedAt:e.property("enriched_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),errorMessage:e.property("error_message",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string())),features:e.list(cr),id:e.string(),loadedAt:e.property("loaded_at",e.date().optional()),processedAt:e.property("processed_at",e.date().optional()),quantity:e.number(),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),subtype:e.string().optional(),type:e.string(),updatedAt:e.property("updated_at",e.date()),user:cr.optional(),userId:e.property("user_id",e.string().optional())});var nh=e.object({data:e.list(po),params:sh});var ch=e.object({data:co,params:e.record(e.string(),e.unknown())});var ph=e.object({data:po,params:e.record(e.string(),e.unknown())});var lh=e.object({connected:e.boolean(),environmentId:e.property("environment_id",e.string()),lastEventAt:e.property("last_event_at",e.date().optional())});var mh=e.object({data:lh,params:e.record(e.string(),e.unknown())});var uh=e.object({company:e.record(e.string(),e.string()).optional(),event:e.string(),quantity:e.number().optional(),traits:e.record(e.string(),e.unknown()).optional(),user:e.record(e.string(),e.string()).optional()});var dh=e.object({companyId:e.property("company_id",e.string().optional()),error:e.string().optional(),flagId:e.property("flag_id",e.string().optional()),flagKey:e.property("flag_key",e.string()),reason:e.string(),reqCompany:e.property("req_company",e.record(e.string(),e.string()).optional()),reqUser:e.property("req_user",e.record(e.string(),e.string()).optional()),ruleId:e.property("rule_id",e.string().optional()),userId:e.property("user_id",e.string().optional()),value:e.boolean()});var hh=e.object({keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var wh=e.object({company:hh.optional(),keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var gh=e.undiscriminatedUnion([uh,dh,wh]);var yh=e.enum_(["identify","track","flag_check"]);var lo=e.object({body:gh.optional(),eventType:e.property("event_type",yh),sentAt:e.property("sent_at",e.date().optional())});var Zt=e.object({events:e.list(lo)});var mo=e.object({ctaText:e.property("cta_text",e.string()),ctaWebSite:e.property("cta_web_site",e.string()),priceText:e.property("price_text",e.string())});var He=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",je.optional()),chargeType:e.property("charge_type",e.string()),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",e.string()),createdAt:e.property("created_at",e.date()),customPlanConfig:e.property("custom_plan_config",mo.optional()),description:e.string(),entitlements:e.list(ae),features:e.list(W),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Ve).optional()),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",K.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",K.optional()),planType:e.property("plan_type",e.string()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",K.optional())});var uo=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean())});var Rh=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var Yt=e.object({entitlements:e.list(Rh).optional(),planId:e.property("plan_id",e.string())});var ur=e.object({bundleId:e.string()});var zh=e.object({addOns:e.property("add_ons",e.list(He)),checkoutSettings:e.property("checkout_settings",uo),customPlanConfig:e.property("custom_plan_config",mo.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlan:e.property("default_plan",He.optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlan:e.property("fallback_plan",He.optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlan:e.property("initial_plan",He.optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPrice:e.property("initial_plan_price",K.optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnList:e.property("ordered_add_on_list",e.list(Yt)),orderedBundleList:e.property("ordered_bundle_list",e.list(ur)),orderedPlanList:e.property("ordered_plan_list",e.list(Yt)),plans:e.list(He),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlan:e.property("trial_expiry_plan",He.optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPrice:e.property("trial_expiry_plan_price",K.optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var bh=e.object({data:zh,params:e.record(e.string(),e.unknown())});var fh=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var _h=e.object({entitlementId:e.property("entitlement_id",e.string()),visible:e.boolean().optional()});var Ue=e.object({entitlements:e.list(_h).optional(),planId:e.property("plan_id",e.string())});var ho=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(fh)),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutSettings:e.property("checkout_settings",uo),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnIds:e.property("ordered_add_on_ids",e.list(Ue)),planIds:e.property("plan_ids",e.list(Ue)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var Sh=e.object({data:ho,params:e.record(e.string(),e.unknown())});var Eh=e.object({data:ho,params:e.record(e.string(),e.unknown())});var Qt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Fe).optional()),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutCollectAddress:e.property("checkout_collect_address",e.boolean()),checkoutCollectEmail:e.property("checkout_collect_email",e.boolean()),checkoutCollectPhone:e.property("checkout_collect_phone",e.boolean()),customPlanConfig:e.property("custom_plan_config",lr.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),enableTaxCollection:e.property("enable_tax_collection",e.boolean()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOns:e.property("ordered_add_ons",e.list(Ue)),orderedBundleList:e.property("ordered_bundle_list",e.list(ur)),orderedPlans:e.property("ordered_plans",e.list(Ue)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var ei=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Fe).optional()),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutCollectAddress:e.property("checkout_collect_address",e.boolean()),checkoutCollectEmail:e.property("checkout_collect_email",e.boolean()),checkoutCollectPhone:e.property("checkout_collect_phone",e.boolean()),customPlanConfig:e.property("custom_plan_config",lr.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),enableTaxCollection:e.property("enable_tax_collection",e.boolean()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOns:e.property("ordered_add_ons",e.list(Ue)),orderedBundleList:e.property("ordered_bundle_list",e.list(ur)),orderedPlans:e.property("ordered_plans",e.list(Ue)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var xh=e.object({apiKeyId:e.property("api_key_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expiredAt:e.property("expired_at",e.date()),id:e.string(),resourceType:e.property("resource_type",e.string()),token:e.string(),updatedAt:e.property("updated_at",e.date())});var Uh=e.object({data:xh,params:e.record(e.string(),e.unknown())});var ri=e.object({lookup:e.record(e.string(),e.string()),resource_type:e.string()});var Ph=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),webhookId:e.property("webhook_id",e.string().optional())});var dr=e.object({creditId:e.property("credit_id",e.string())});var hr=e.object({featureId:e.property("feature_id",e.string())});var Se=e.object({createdAt:e.property("created_at",e.date()),creditTriggerConfigs:e.property("credit_trigger_configs",e.list(dr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(hr).optional()),id:e.string(),name:e.string(),requestTypes:e.property("request_types",e.list(e.string())),secret:e.string(),status:e.string(),updatedAt:e.property("updated_at",e.date()),url:e.string()});var wo=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",e.string()),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),updatedAt:e.property("updated_at",e.date()),webhook:Se.optional(),webhookId:e.property("webhook_id",e.string())});var Ch=e.object({data:e.list(wo),params:Ph});var Th=e.object({data:wo,params:e.record(e.string(),e.unknown())});var vh=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),webhookId:e.property("webhook_id",e.string().optional())});var Oh=e.object({data:j,params:vh});var jh=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Bh=e.object({data:e.list(Se),params:jh});var Vh=e.enum_(["company.updated","user.updated","plan.updated","plan.entitlement.updated","company.override.updated","feature.updated","flag.updated","flag_rules.updated","company.created","user.created","plan.created","plan.entitlement.created","company.override.created","feature.created","flag.created","company.deleted","user.deleted","plan.deleted","plan.entitlement.deleted","company.override.deleted","feature.deleted","flag.deleted","test.send","subscription.trial.ended","entitlement.limit.warning","entitlement.limit.reached","entitlement.soft_limit.warning","entitlement.soft_limit.reached","entitlement.tier_limit.warning","entitlement.tier_limit.reached","credit.limit.warning","credit.limit.reached"]);var kh=e.object({data:Se,params:e.record(e.string(),e.unknown())});var Dh=e.object({data:Se,params:e.record(e.string(),e.unknown())});var Mh=e.enum_(["company.updated","user.updated","plan.updated","plan.entitlement.updated","company.override.updated","feature.updated","flag.updated","flag_rules.updated","company.created","user.created","plan.created","plan.entitlement.created","company.override.created","feature.created","flag.created","company.deleted","user.deleted","plan.deleted","plan.entitlement.deleted","company.override.deleted","feature.deleted","flag.deleted","test.send","subscription.trial.ended","entitlement.limit.warning","entitlement.limit.reached","entitlement.soft_limit.warning","entitlement.soft_limit.reached","entitlement.tier_limit.warning","entitlement.tier_limit.reached","credit.limit.warning","credit.limit.reached"]);var qh=e.enum_(["active","inactive"]);var Ah=e.object({data:Se,params:e.record(e.string(),e.unknown())});var Fh=e.object({data:q,params:e.record(e.string(),e.unknown())});var Ih=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Kh=e.object({data:j,params:Ih});var oi=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(dr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(hr).optional()),name:e.string(),requestTypes:e.property("request_types",e.list(Vh)),url:e.string()});var ti=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(dr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(hr).optional()),name:e.string().optional(),requestTypes:e.property("request_types",e.list(Mh).optional()),status:qh.optional(),url:e.string().optional()});var a=e.object({error:e.string()});var Er=e.object({conditionGroups:e.property("condition_groups",e.list(Oe)),conditions:e.list(be),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var go=e.object({addOnId:e.property("add_on_id",e.string()),priceId:e.property("price_id",e.string())});var wr=e.object({bundleId:e.property("bundle_id",e.string()),quantity:e.number()});var gr=e.object({priceId:e.property("price_id",e.string()),quantity:e.number()});var ii=e.object({addOnIds:e.property("add_on_ids",e.list(go)),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(wr)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(gr)),paymentMethodId:e.property("payment_method_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional()),skipTrial:e.property("skip_trial",e.boolean())});var kre=e.object({addOnIds:e.property("add_on_ids",e.list(go)),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(wr)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(gr)),paymentMethodId:e.property("payment_method_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional()),skipTrial:e.property("skip_trial",e.boolean())});var ai=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var qre=e.object({companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),id:e.string(),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string())});var eoe=e.object({activeAddOns:e.property("active_add_ons",e.list(mr)),activePlans:e.property("active_plans",e.list(mr)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Xe)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(Fe)),capabilities:ro.optional(),checkoutSettings:e.property("checkout_settings",oo),company:I.optional(),component:ge.optional(),creditBundles:e.property("credit_bundles",e.list(to)),creditGrants:e.property("credit_grants",e.list(io)),defaultPlan:e.property("default_plan",re.optional()),featureUsage:e.property("feature_usage",qe.optional()),postTrialPlan:e.property("post_trial_plan",re.optional()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),stripeEmbed:e.property("stripe_embed",ao.optional()),subscription:Ae.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",me.optional())});var ooe=e.object({amountOff:e.property("amount_off",e.number()),currency:e.string().optional(),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number()),maxRedemptions:e.property("max_redemptions",e.number()),name:e.string(),percentOff:e.property("percent_off",e.number()),timesRedeemed:e.property("times_redeemed",e.number())});var Lh=e.enum_(["all_time","current_month","current_week","current_day"]);var Gh=e.enum_(["first_of_month","billing_cycle"]);var Nh=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var loe=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",Lh.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Gh.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Nh)});var si=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",e.stringLiteral("boolean")),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var doe=e.object({createdAt:e.property("created_at",e.date()),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var woe=e.object({createdAt:e.property("created_at",e.date()),definitionId:e.property("definition_id",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var yoe=e.object({apiKey:e.property("api_key",e.string().optional()),body:e.record(e.string(),e.unknown()),bodyPreview:e.property("body_preview",e.string()),capturedAt:e.property("captured_at",e.date()),companyId:e.property("company_id",e.string().optional()),enrichedAt:e.property("enriched_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),errorMessage:e.property("error_message",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string())),id:e.string(),loadedAt:e.property("loaded_at",e.date().optional()),processedAt:e.property("processed_at",e.date().optional()),quantity:e.number(),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),subtype:e.string().optional(),type:e.string(),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional())});var zoe=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),url:e.string().optional()});var ni=e.object({keys:e.record(e.string(),e.string())});var Xh=e.object({planId:e.property("plan_id",e.string()),priceId:e.property("price_id",e.string().optional())});var ci=e.object({addOnSelections:e.property("add_on_selections",e.list(Xh)),basePlanId:e.property("base_plan_id",e.string().optional()),basePlanPriceId:e.property("base_plan_price_id",e.string().optional()),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(wr)),payInAdvanceEntitlements:e.property("pay_in_advance_entitlements",e.list(gr)),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional())});var Poe=e.object({displayName:e.property("display_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string())});var Toe=e.object({limit:e.number().optional(),offset:e.number().optional()});var Ooe=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string()),paymentMethodType:e.property("payment_method_type",e.string())});var Boe=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),planId:e.property("plan_id",e.string().optional()),priority:e.number(),ruleType:e.property("rule_type",e.string()),updatedAt:e.property("updated_at",e.date()),value:e.boolean()});var koe=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),planId:e.property("plan_id",e.string().optional()),ruleId:e.property("rule_id",e.string()),updatedAt:e.property("updated_at",e.date())});var Moe=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionGroupId:e.property("condition_group_id",e.string().optional()),conditionType:e.property("condition_type",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),metricValue:e.property("metric_value",e.number().optional()),operator:e.string(),planId:e.property("plan_id",e.string().optional()),resourceIds:e.property("resource_ids",e.list(e.string())),ruleId:e.property("rule_id",e.string()),traitEntityType:e.property("trait_entity_type",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Aoe=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),planId:e.property("plan_id",e.string().optional()),priority:e.number(),ruleType:e.property("rule_type",e.string()),updatedAt:e.property("updated_at",e.date()),value:e.boolean()});var Ioe=e.object({apiKeyId:e.property("api_key_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expiredAt:e.property("expired_at",e.date()),id:e.string(),resourceType:e.property("resource_type",e.string()),updatedAt:e.property("updated_at",e.date())});var Hh=e.enum_(["all_time","current_month","current_week","current_day"]);var Wh=e.enum_(["first_of_month","billing_cycle"]);var Jh=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Joe=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),metricPeriod:e.property("metric_period",Hh.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Wh.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Jh)});var Qoe=e.object({conditionGroups:e.property("condition_groups",e.list(Oe)),conditions:e.list(be),name:e.string(),priority:e.number(),value:e.boolean()});var pi=e.object({id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var li=e.object({incr:e.number().optional(),keys:e.record(e.string(),e.string()),set:e.string().optional(),trait:e.string(),updateOnly:e.property("update_only",e.boolean().optional())});var mi=e.object({companies:e.list(e.record(e.string(),e.string())).optional(),company:e.record(e.string(),e.string()).optional(),companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var ite=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var $h=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var pte=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),currency:e.string().optional(),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(we).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),priceBehavior:e.property("price_behavior",$h.optional()),priceTiers:e.property("price_tiers",e.list(we).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",e.string().optional()),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(we).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var mte=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",e.string()),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),updatedAt:e.property("updated_at",e.date()),webhookId:e.property("webhook_id",e.string())});var yo=class{constructor(t={}){this._options=t}listApiKeys(t,o){return b.fromPromise(this.__listApiKeys(t,o))}async __listApiKeys(t,o){let{environmentId:r,requireEnvironment:i,limit:m,offset:g}=t,p={};r!=null&&(p.environment_id=r),p.require_environment=i.toString(),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-keys"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:$s.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /api-keys.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}createApiKey(t,o){return b.fromPromise(this.__createApiKey(t,o))}async __createApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-keys"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ot.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ys.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /api-keys.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getApiKey(t,o){return b.fromPromise(this.__getApiKey(t,o))}async __getApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-keys/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Qs.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /api-keys/{api_key_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateApiKey(t,o={},r){return b.fromPromise(this.__updateApiKey(t,o,r))}async __updateApiKey(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-keys/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:tt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:en.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /api-keys/{api_key_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteApiKey(t,o){return b.fromPromise(this.__deleteApiKey(t,o))}async __deleteApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-keys/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:rn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /api-keys/{api_key_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countApiKeys(t,o){return b.fromPromise(this.__countApiKeys(t,o))}async __countApiKeys(t,o){let{environmentId:r,requireEnvironment:i,limit:m,offset:g}=t,p={};r!=null&&(p.environment_id=r),p.require_environment=i.toString(),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-keys/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:tn.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /api-keys/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listApiRequests(t={},o){return b.fromPromise(this.__listApiRequests(t,o))}async __listApiRequests(t={},o){let{q:r,requestType:i,environmentId:m,limit:g,offset:p}=t,s={};r!=null&&(s.q=r),i!=null&&(s.request_type=i),m!=null&&(s.environment_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-requests"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:nn.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /api-requests.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getApiRequest(t,o){return b.fromPromise(this.__getApiRequest(t,o))}async __getApiRequest(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-requests/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:pn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /api-requests/{api_request_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countApiRequests(t={},o){return b.fromPromise(this.__countApiRequests(t,o))}async __countApiRequests(t={},o){let{q:r,requestType:i,environmentId:m,limit:g,offset:p}=t,s={};r!=null&&(s.q=r),i!=null&&(s.request_type=i),m!=null&&(s.environment_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-requests/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:mn.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /api-requests/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}listEnvironments(t={},o){return b.fromPromise(this.__listEnvironments(t,o))}async __listEnvironments(t={},o){let{ids:r,limit:i,offset:m}=t,g={};r!=null&&(Array.isArray(r)?g.ids=r.map(s=>s):g.ids=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"environments"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:dn.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /environments.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createEnvironment(t,o){return b.fromPromise(this.__createEnvironment(t,o))}async __createEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"environments"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:it.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:gn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /environments.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEnvironment(t,o){return b.fromPromise(this.__getEnvironment(t,o))}async __getEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`environments/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:yn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /environments/{environment_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateEnvironment(t,o={},r){return b.fromPromise(this.__updateEnvironment(t,o,r))}async __updateEnvironment(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`environments/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:at.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:zn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /environments/{environment_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteEnvironment(t,o){return b.fromPromise(this.__deleteEnvironment(t,o))}async __deleteEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`environments/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:bn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /environments/{environment_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}quickstart(t){return b.fromPromise(this.__quickstart(t))}async __quickstart(t){let o=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"quickstart"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:_n.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new P(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 401:throw new S(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 403:throw new E(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 404:throw new x(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 500:throw new U(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /quickstart.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var J=H(require("url-join"));var Ro=class{constructor(t={}){this._options=t}countAudienceCompanies(t,o){return b.fromPromise(this.__countAudienceCompanies(t,o))}async __countAudienceCompanies(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"audience/count-companies"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Er.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Sn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /audience/count-companies.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countAudienceUsers(t,o){return b.fromPromise(this.__countAudienceUsers(t,o))}async __countAudienceUsers(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"audience/count-users"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Er.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:En.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /audience/count-users.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listAudienceCompanies(t,o){return b.fromPromise(this.__listAudienceCompanies(t,o))}async __listAudienceCompanies(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"audience/get-companies"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Er.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Un.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /audience/get-companies.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listAudienceUsers(t,o){return b.fromPromise(this.__listAudienceUsers(t,o))}async __listAudienceUsers(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"audience/get-users"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Er.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Pn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /audience/get-users.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listFeatures(t={},o){return b.fromPromise(this.__listFeatures(t,o))}async __listFeatures(t={},o){let{ids:r,q:i,withoutCompanyOverrideFor:m,withoutPlanEntitlementFor:g,featureType:p,booleanRequireEvent:s,limit:l,offset:u}=t,R={};r!=null&&(Array.isArray(r)?R.ids=r.map(C=>C):R.ids=r),i!=null&&(R.q=i),m!=null&&(R.without_company_override_for=m),g!=null&&(R.without_plan_entitlement_for=g),p!=null&&(Array.isArray(p)?R.feature_type=p.map(C=>C):R.feature_type=p),s!=null&&(R.boolean_require_event=s.toString()),l!=null&&(R.limit=l.toString()),u!=null&&(R.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"features"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:R,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:vn.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /features.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}createFeature(t,o){return b.fromPromise(this.__createFeature(t,o))}async __createFeature(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"features"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:nt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Bn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /features.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getFeature(t,o){return b.fromPromise(this.__getFeature(t,o))}async __getFeature(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`features/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Vn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /features/{feature_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateFeature(t,o={},r){return b.fromPromise(this.__updateFeature(t,o,r))}async __updateFeature(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`features/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ct.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Mn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /features/{feature_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFeature(t,o){return b.fromPromise(this.__deleteFeature(t,o))}async __deleteFeature(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`features/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:qn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /features/{feature_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countFeatures(t={},o){return b.fromPromise(this.__countFeatures(t,o))}async __countFeatures(t={},o){let{ids:r,q:i,withoutCompanyOverrideFor:m,withoutPlanEntitlementFor:g,featureType:p,booleanRequireEvent:s,limit:l,offset:u}=t,R={};r!=null&&(Array.isArray(r)?R.ids=r.map(C=>C):R.ids=r),i!=null&&(R.q=i),m!=null&&(R.without_company_override_for=m),g!=null&&(R.without_plan_entitlement_for=g),p!=null&&(Array.isArray(p)?R.feature_type=p.map(C=>C):R.feature_type=p),s!=null&&(R.boolean_require_event=s.toString()),l!=null&&(R.limit=l.toString()),u!=null&&(R.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"features/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:R,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:Fn.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /features/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}listFlags(t={},o){return b.fromPromise(this.__listFlags(t,o))}async __listFlags(t={},o){let{featureId:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.feature_id=r),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:Kn.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /flags.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}createFlag(t,o){return b.fromPromise(this.__createFlag(t,o))}async __createFlag(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:si.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ln.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /flags.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getFlag(t,o){return b.fromPromise(this.__getFlag(t,o))}async __getFlag(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Gn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /flags/{flag_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateFlag(t,o,r){return b.fromPromise(this.__updateFlag(t,o,r))}async __updateFlag(t,o,r){let i=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:si.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Nn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /flags/{flag_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFlag(t,o){return b.fromPromise(this.__deleteFlag(t,o))}async __deleteFlag(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Xn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /flags/{flag_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateFlagRules(t,o,r){return b.fromPromise(this.__updateFlagRules(t,o,r))}async __updateFlagRules(t,o,r){let i=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}/rules`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:pt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Jn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /flags/{flag_id}/rules.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}checkFlag(t,o,r){return b.fromPromise(this.__checkFlag(t,o,r))}async __checkFlag(t,o,r){let i=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}/check`),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ai.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:$n.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /flags/{key}/check.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}checkFlags(t,o){return b.fromPromise(this.__checkFlags(t,o))}async __checkFlags(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags/check"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ai.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Yn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /flags/check.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countFlags(t={},o){return b.fromPromise(this.__countFlags(t,o))}async __countFlags(t={},o){let{featureId:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.feature_id=r),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:ec.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /flags/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var X=H(require("url-join"));var zo=class{constructor(t={}){this._options=t}listCoupons(t={},o){return b.fromPromise(this.__listCoupons(t,o))}async __listCoupons(t={},o){let{isActive:r,q:i,limit:m,offset:g}=t,p={};r!=null&&(p.is_active=r.toString()),i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/coupons"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:cc.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/coupons.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertBillingCoupon(t,o){return b.fromPromise(this.__upsertBillingCoupon(t,o))}async __upsertBillingCoupon(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/coupons"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:lt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:pc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/coupons.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingCustomer(t,o){return b.fromPromise(this.__upsertBillingCustomer(t,o))}async __upsertBillingCustomer(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/customer/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:mt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:mc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/customer/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCustomersWithSubscriptions(t={},o){return b.fromPromise(this.__listCustomersWithSubscriptions(t,o))}async __listCustomersWithSubscriptions(t={},o){let{companyIds:r,name:i,failedToImport:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.company_ids=r.map(R=>R):l.company_ids=r),i!=null&&(l.name=i),m!=null&&(l.failed_to_import=m.toString()),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/customers"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:wc.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/customers.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}countCustomers(t={},o){return b.fromPromise(this.__countCustomers(t,o))}async __countCustomers(t={},o){let{companyIds:r,name:i,failedToImport:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.company_ids=r.map(R=>R):l.company_ids=r),i!=null&&(l.name=i),m!=null&&(l.failed_to_import=m.toString()),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/customers/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:yc.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/customers/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}listInvoices(t,o){return b.fromPromise(this.__listInvoices(t,o))}async __listInvoices(t,o){let{companyId:r,customerExternalId:i,subscriptionExternalId:m,limit:g,offset:p}=t,s={};r!=null&&(s.company_id=r),s.customer_external_id=i,s.subscription_external_id=m,g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/invoices"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:zc.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/invoices.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}upsertInvoice(t,o){return b.fromPromise(this.__upsertInvoice(t,o))}async __upsertInvoice(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/invoices"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ut.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:bc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/invoices.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listMeters(t={},o){return b.fromPromise(this.__listMeters(t,o))}async __listMeters(t={},o){let{displayName:r,limit:i,offset:m}=t,g={};r!=null&&(g.display_name=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/meter"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:_c.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/meter.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}upsertBillingMeter(t,o){return b.fromPromise(this.__upsertBillingMeter(t,o))}async __upsertBillingMeter(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/meter/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:dt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Sc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/meter/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listPaymentMethods(t,o){return b.fromPromise(this.__listPaymentMethods(t,o))}async __listPaymentMethods(t,o){let{companyId:r,customerExternalId:i,limit:m,offset:g}=t,p={};r!=null&&(p.company_id=r),p.customer_external_id=i,m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/payment-methods"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:xc.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/payment-methods.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertPaymentMethod(t,o){return b.fromPromise(this.__upsertPaymentMethod(t,o))}async __upsertPaymentMethod(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/payment-methods"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ht.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Uc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/payment-methods.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}searchBillingPrices(t={},o){return b.fromPromise(this.__searchBillingPrices(t,o))}async __searchBillingPrices(t={},o){let{forInitialPlan:r,forTrialExpiryPlan:i,ids:m,productId:g,interval:p,price:s,q:l,requiresPaymentMethod:u,tiersMode:R,usageType:y,limit:C,offset:O}=t,T={};r!=null&&(T.for_initial_plan=r.toString()),i!=null&&(T.for_trial_expiry_plan=i.toString()),m!=null&&(Array.isArray(m)?T.ids=m.map(D=>D):T.ids=m),g!=null&&(T.product_id=g),p!=null&&(T.interval=p),s!=null&&(T.price=s.toString()),l!=null&&(T.q=l),u!=null&&(T.requires_payment_method=u.toString()),R!=null&&(T.tiers_mode=Pc.jsonOrThrow(R,{unrecognizedObjectKeys:"strip"})),y!=null&&(T.usage_type=Cc.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})),C!=null&&(T.limit=C.toString()),O!=null&&(T.offset=O.toString());let k=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/price"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:T,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(k.ok)return{data:jc.parseOrThrow(k.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:k.rawResponse};if(k.error.reason==="status-code")switch(k.error.statusCode){case 400:throw new P(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 401:throw new S(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 403:throw new E(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 404:throw new x(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);case 500:throw new U(a.parseOrThrow(k.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),k.rawResponse);default:throw new c({statusCode:k.error.statusCode,body:k.error.body,rawResponse:k.rawResponse})}switch(k.error.reason){case"non-json":throw new c({statusCode:k.error.statusCode,body:k.error.rawBody,rawResponse:k.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/price.");case"unknown":throw new c({message:k.error.errorMessage,rawResponse:k.rawResponse})}}upsertBillingPrice(t,o){return b.fromPromise(this.__upsertBillingPrice(t,o))}async __upsertBillingPrice(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/price/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:wt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Dc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/price/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteBillingProduct(t,o){return b.fromPromise(this.__deleteBillingProduct(t,o))}async __deleteBillingProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/product/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Mc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /billing/product/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listProductPrices(t={},o){return b.fromPromise(this.__listProductPrices(t,o))}async __listProductPrices(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:p,withOneTimeCharges:s,withZeroPrice:l,withPricesOnly:u,isActive:R,limit:y,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(k=>k):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=qc.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.without_linked_to_plan=p.toString()),s!=null&&(O.with_one_time_charges=s.toString()),l!=null&&(O.with_zero_price=l.toString()),u!=null&&(O.with_prices_only=u.toString()),R!=null&&(O.is_active=R.toString()),y!=null&&(O.limit=y.toString()),C!=null&&(O.offset=C.toString());let T=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/product/prices"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:Ic.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new P(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new S(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new E(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new x(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new U(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new c({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case"non-json":throw new c({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/product/prices.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}deleteProductPrice(t,o){return b.fromPromise(this.__deleteProductPrice(t,o))}async __deleteProductPrice(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/product/prices/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Kc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /billing/product/prices/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingProduct(t,o){return b.fromPromise(this.__upsertBillingProduct(t,o))}async __upsertBillingProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/product/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:gt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Lc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/product/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBillingProducts(t={},o){return b.fromPromise(this.__listBillingProducts(t,o))}async __listBillingProducts(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:p,withOneTimeCharges:s,withZeroPrice:l,withPricesOnly:u,isActive:R,limit:y,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(k=>k):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=Gc.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.without_linked_to_plan=p.toString()),s!=null&&(O.with_one_time_charges=s.toString()),l!=null&&(O.with_zero_price=l.toString()),u!=null&&(O.with_prices_only=u.toString()),R!=null&&(O.is_active=R.toString()),y!=null&&(O.limit=y.toString()),C!=null&&(O.offset=C.toString());let T=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/products"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:Hc.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new P(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new S(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new E(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new x(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new U(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new c({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case"non-json":throw new c({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/products.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}countBillingProducts(t={},o){return b.fromPromise(this.__countBillingProducts(t,o))}async __countBillingProducts(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:p,withOneTimeCharges:s,withZeroPrice:l,withPricesOnly:u,isActive:R,limit:y,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(k=>k):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=Wc.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.without_linked_to_plan=p.toString()),s!=null&&(O.with_one_time_charges=s.toString()),l!=null&&(O.with_zero_price=l.toString()),u!=null&&(O.with_prices_only=u.toString()),R!=null&&(O.is_active=R.toString()),y!=null&&(O.limit=y.toString()),C!=null&&(O.offset=C.toString());let T=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/products/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:Zc.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new P(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new S(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new E(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new x(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new U(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new c({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case"non-json":throw new c({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/products/count.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}upsertBillingSubscription(t,o){return b.fromPromise(this.__upsertBillingSubscription(t,o))}async __upsertBillingSubscription(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/subscription/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:yt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ep.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/subscription/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var G=H(require("url-join"));var bo=class{constructor(t={}){this._options=t}listBillingCredits(t={},o){return b.fromPromise(this.__listBillingCredits(t,o))}async __listBillingCredits(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(l=>l):p.ids=r),i!=null&&(p.name=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:sp.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}createBillingCredit(t,o){return b.fromPromise(this.__createBillingCredit(t,o))}async __createBillingCredit(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Rt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:pp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/credits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSingleBillingCredit(t,o){return b.fromPromise(this.__getSingleBillingCredit(t,o))}async __getSingleBillingCredit(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:lp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateBillingCredit(t,o,r){return b.fromPromise(this.__updateBillingCredit(t,o,r))}async __updateBillingCredit(t,o,r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:zt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:dp.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /billing/credits/{billing_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}softDeleteBillingCredit(t,o){return b.fromPromise(this.__softDeleteBillingCredit(t,o))}async __softDeleteBillingCredit(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:hp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /billing/credits/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCreditBundles(t={},o){return b.fromPromise(this.__listCreditBundles(t,o))}async __listCreditBundles(t={},o){let{ids:r,creditId:i,status:m,bundleType:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(R=>R):l.ids=r),i!=null&&(l.credit_id=i),m!=null&&(l.status=wp.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.bundle_type=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Rp.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/bundles.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createCreditBundle(t,o){return b.fromPromise(this.__createCreditBundle(t,o))}async __createCreditBundle(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:bt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:_p.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/credits/bundles.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCreditBundle(t,o){return b.fromPromise(this.__getCreditBundle(t,o))}async __getCreditBundle(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/bundles/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Sp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/bundles/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCreditBundleDetails(t,o,r){return b.fromPromise(this.__updateCreditBundleDetails(t,o,r))}async __updateCreditBundleDetails(t,o,r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/bundles/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ft.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Pp.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /billing/credits/bundles/{billing_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteCreditBundle(t,o){return b.fromPromise(this.__deleteCreditBundle(t,o))}async __deleteCreditBundle(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/bundles/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Cp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /billing/credits/bundles/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countCreditBundles(t={},o){return b.fromPromise(this.__countCreditBundles(t,o))}async __countCreditBundles(t={},o){let{ids:r,creditId:i,status:m,bundleType:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(R=>R):l.ids=r),i!=null&&(l.credit_id=i),m!=null&&(l.status=Tp.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.bundle_type=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:jp.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/bundles/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}countBillingCredits(t={},o){return b.fromPromise(this.__countBillingCredits(t,o))}async __countBillingCredits(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(l=>l):p.ids=r),i!=null&&(p.name=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Vp.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}zeroOutGrant(t,o={},r){return b.fromPromise(this.__zeroOutGrant(t,o,r))}async __zeroOutGrant(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/grants/${encodeURIComponent(t)}/zero-out`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:_t.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Dp.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /billing/credits/grants/{billing_id}/zero-out.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}grantBillingCreditsToCompany(t,o){return b.fromPromise(this.__grantBillingCreditsToCompany(t,o))}async __grantBillingCreditsToCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/company"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:St.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ap.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/credits/grants/company.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCompanyGrants(t={},o){return b.fromPromise(this.__listCompanyGrants(t,o))}async __listCompanyGrants(t={},o){let{companyId:r,order:i,dir:m,limit:g,offset:p}=t,s={};r!=null&&(s.company_id=r),i!=null&&(s.order=Fp.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"})),m!=null&&(s.dir=Ip.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/company/list"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:Np.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/grants/company/list.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}countBillingCreditsGrants(t={},o){return b.fromPromise(this.__countBillingCreditsGrants(t,o))}async __countBillingCreditsGrants(t={},o){let{creditId:r,ids:i,limit:m,offset:g}=t,p={};r!=null&&(p.credit_id=r),i!=null&&(Array.isArray(i)?p.ids=i.map(l=>l):p.ids=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Hp.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/grants/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listGrantsForCredit(t={},o){return b.fromPromise(this.__listGrantsForCredit(t,o))}async __listGrantsForCredit(t={},o){let{creditId:r,ids:i,limit:m,offset:g}=t,p={};r!=null&&(p.credit_id=r),i!=null&&(Array.isArray(i)?p.ids=i.map(l=>l):p.ids=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/list"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Jp.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/grants/list.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getEnrichedCreditLedger(t,o){return b.fromPromise(this.__getEnrichedCreditLedger(t,o))}async __getEnrichedCreditLedger(t,o){let{companyId:r,billingCreditId:i,featureId:m,period:g,startTime:p,endTime:s,limit:l,offset:u}=t,R={};R.company_id=r,i!=null&&(R.billing_credit_id=i),m!=null&&(R.feature_id=m),R.period=$p.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}),p!=null&&(R.start_time=p),s!=null&&(R.end_time=s),l!=null&&(R.limit=l.toString()),u!=null&&(R.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/ledger"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:R,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:tl.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/ledger.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}countCreditLedger(t,o){return b.fromPromise(this.__countCreditLedger(t,o))}async __countCreditLedger(t,o){let{companyId:r,billingCreditId:i,featureId:m,period:g,startTime:p,endTime:s,limit:l,offset:u}=t,R={};R.company_id=r,i!=null&&(R.billing_credit_id=i),m!=null&&(R.feature_id=m),R.period=il.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}),p!=null&&(R.start_time=p),s!=null&&(R.end_time=s),l!=null&&(R.limit=l.toString()),u!=null&&(R.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/ledger/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:R,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:nl.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/ledger/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}listBillingPlanCreditGrants(t={},o){return b.fromPromise(this.__listBillingPlanCreditGrants(t,o))}async __listBillingPlanCreditGrants(t={},o){let{creditId:r,planId:i,planIds:m,ids:g,limit:p,offset:s}=t,l={};r!=null&&(l.credit_id=r),i!=null&&(l.plan_id=i),m!=null&&(Array.isArray(m)?l.plan_ids=m.map(R=>R):l.plan_ids=m),g!=null&&(Array.isArray(g)?l.ids=g.map(R=>R):l.ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:pl.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/plan-grants.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createBillingPlanCreditGrant(t,o){return b.fromPromise(this.__createBillingPlanCreditGrant(t,o))}async __createBillingPlanCreditGrant(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Et.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:wl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/credits/plan-grants.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteBillingPlanCreditGrant(t,o){return b.fromPromise(this.__deleteBillingPlanCreditGrant(t,o))}async __deleteBillingPlanCreditGrant(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/plan-grants/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:gl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /billing/credits/plan-grants/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countBillingPlanCreditGrants(t={},o){return b.fromPromise(this.__countBillingPlanCreditGrants(t,o))}async __countBillingPlanCreditGrants(t={},o){let{creditId:r,planId:i,planIds:m,ids:g,limit:p,offset:s}=t,l={};r!=null&&(l.credit_id=r),i!=null&&(l.plan_id=i),m!=null&&(Array.isArray(m)?l.plan_ids=m.map(R=>R):l.plan_ids=m),g!=null&&(Array.isArray(g)?l.ids=g.map(R=>R):l.ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Rl.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/plan-grants/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var We=H(require("url-join"));var fo=class{constructor(t={}){this._options=t}internal(t,o){return b.fromPromise(this.__internal(t,o))}async __internal(t,o){let r=await(this._options.fetcher??_)({url:(0,We.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"checkout-internal"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ii.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:bl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /checkout-internal.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCheckoutData(t,o){return b.fromPromise(this.__getCheckoutData(t,o))}async __getCheckoutData(t,o){let r=await(this._options.fetcher??_)({url:(0,We.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"checkout-internal/data"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:xt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Pl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /checkout-internal/data.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}previewCheckoutInternal(t,o){return b.fromPromise(this.__previewCheckoutInternal(t,o))}async __previewCheckoutInternal(t,o){let r=await(this._options.fetcher??_)({url:(0,We.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"checkout-internal/preview"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ii.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:vl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /checkout-internal/preview.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}managePlan(t,o){return b.fromPromise(this.__managePlan(t,o))}async __managePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,We.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"manage-plan"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ci.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:jl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /manage-plan.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}previewManagePlan(t,o){return b.fromPromise(this.__previewManagePlan(t,o))}async __previewManagePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,We.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"manage-plan/preview"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ci.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Vl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /manage-plan/preview.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCustomerSubscriptionTrialEnd(t,o={},r){return b.fromPromise(this.__updateCustomerSubscriptionTrialEnd(t,o,r))}async __updateCustomerSubscriptionTrialEnd(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,We.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`subscription/${encodeURIComponent(t)}/edit-trial-end`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Ut.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:kl.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /subscription/{subscription_id}/edit-trial-end.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var M=H(require("url-join"));var _o=class{constructor(t={}){this._options=t}listCompanies(t={},o){return b.fromPromise(this.__listCompanies(t,o))}async __listCompanies(t={},o){let{ids:r,planId:i,q:m,withoutFeatureOverrideFor:g,withoutPlan:p,withSubscription:s,limit:l,offset:u}=t,R={};r!=null&&(Array.isArray(r)?R.ids=r.map(C=>C):R.ids=r),i!=null&&(R.plan_id=i),m!=null&&(R.q=m),g!=null&&(R.without_feature_override_for=g),p!=null&&(R.without_plan=p.toString()),s!=null&&(R.with_subscription=s.toString()),l!=null&&(R.limit=l.toString()),u!=null&&(R.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:R,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:Ml.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /companies.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}upsertCompany(t,o){return b.fromPromise(this.__upsertCompany(t,o))}async __upsertCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:pi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ql.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /companies.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCompany(t,o){return b.fromPromise(this.__getCompany(t,o))}async __getCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`companies/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Al.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /companies/{company_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompany(t,o){return b.fromPromise(this.__deleteCompany(t,o))}async __deleteCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`companies/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Fl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /companies/{company_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countCompanies(t={},o){return b.fromPromise(this.__countCompanies(t,o))}async __countCompanies(t={},o){let{ids:r,planId:i,q:m,withoutFeatureOverrideFor:g,withoutPlan:p,withSubscription:s,limit:l,offset:u}=t,R={};r!=null&&(Array.isArray(r)?R.ids=r.map(C=>C):R.ids=r),i!=null&&(R.plan_id=i),m!=null&&(R.q=m),g!=null&&(R.without_feature_override_for=g),p!=null&&(R.without_plan=p.toString()),s!=null&&(R.with_subscription=s.toString()),l!=null&&(R.limit=l.toString()),u!=null&&(R.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:R,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:Kl.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /companies/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}countCompaniesForAdvancedFilter(t={},o){return b.fromPromise(this.__countCompaniesForAdvancedFilter(t,o))}async __countCompaniesForAdvancedFilter(t={},o){let{ids:r,planIds:i,featureIds:m,creditTypeIds:g,subscriptionStatuses:p,subscriptionTypes:s,monetizedSubscriptions:l,q:u,withoutPlan:R,withoutSubscription:y,sortOrderColumn:C,sortOrderDirection:O,displayProperties:T,limit:k,offset:D}=t,v={};r!=null&&(Array.isArray(r)?v.ids=r.map(L=>L):v.ids=r),i!=null&&(Array.isArray(i)?v.plan_ids=i.map(L=>L):v.plan_ids=i),m!=null&&(Array.isArray(m)?v.feature_ids=m.map(L=>L):v.feature_ids=m),g!=null&&(Array.isArray(g)?v.credit_type_ids=g.map(L=>L):v.credit_type_ids=g),p!=null&&(Array.isArray(p)?v.subscription_statuses=p.map(L=>L):v.subscription_statuses=p),s!=null&&(Array.isArray(s)?v.subscription_types=s.map(L=>L):v.subscription_types=s),l!=null&&(v.monetized_subscriptions=l.toString()),u!=null&&(v.q=u),R!=null&&(v.without_plan=R.toString()),y!=null&&(v.without_subscription=y.toString()),C!=null&&(v.sort_order_column=C),O!=null&&(v.sort_order_direction=Ll.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?v.display_properties=T.map(L=>L):v.display_properties=T),k!=null&&(v.limit=k.toString()),D!=null&&(v.offset=D.toString());let B=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/count2"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:v,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(B.ok)return{data:Xl.parseOrThrow(B.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:B.rawResponse};if(B.error.reason==="status-code")switch(B.error.statusCode){case 400:throw new P(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new S(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new E(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new x(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new U(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);default:throw new c({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse})}switch(B.error.reason){case"non-json":throw new c({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /companies/count2.");case"unknown":throw new c({message:B.error.errorMessage,rawResponse:B.rawResponse})}}createCompany(t,o){return b.fromPromise(this.__createCompany(t,o))}async __createCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/create"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:pi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Hl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /companies/create.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompanyByKeys(t,o){return b.fromPromise(this.__deleteCompanyByKeys(t,o))}async __deleteCompanyByKeys(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/delete"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ni.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Wl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /companies/delete.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCompaniesForAdvancedFilter(t={},o){return b.fromPromise(this.__listCompaniesForAdvancedFilter(t,o))}async __listCompaniesForAdvancedFilter(t={},o){let{ids:r,planIds:i,featureIds:m,creditTypeIds:g,subscriptionStatuses:p,subscriptionTypes:s,monetizedSubscriptions:l,q:u,withoutPlan:R,withoutSubscription:y,sortOrderColumn:C,sortOrderDirection:O,displayProperties:T,limit:k,offset:D}=t,v={};r!=null&&(Array.isArray(r)?v.ids=r.map(L=>L):v.ids=r),i!=null&&(Array.isArray(i)?v.plan_ids=i.map(L=>L):v.plan_ids=i),m!=null&&(Array.isArray(m)?v.feature_ids=m.map(L=>L):v.feature_ids=m),g!=null&&(Array.isArray(g)?v.credit_type_ids=g.map(L=>L):v.credit_type_ids=g),p!=null&&(Array.isArray(p)?v.subscription_statuses=p.map(L=>L):v.subscription_statuses=p),s!=null&&(Array.isArray(s)?v.subscription_types=s.map(L=>L):v.subscription_types=s),l!=null&&(v.monetized_subscriptions=l.toString()),u!=null&&(v.q=u),R!=null&&(v.without_plan=R.toString()),y!=null&&(v.without_subscription=y.toString()),C!=null&&(v.sort_order_column=C),O!=null&&(v.sort_order_direction=Jl.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?v.display_properties=T.map(L=>L):v.display_properties=T),k!=null&&(v.limit=k.toString()),D!=null&&(v.offset=D.toString());let B=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/list2"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:v,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(B.ok)return{data:rm.parseOrThrow(B.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:B.rawResponse};if(B.error.reason==="status-code")switch(B.error.statusCode){case 400:throw new P(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new S(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new E(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new x(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new U(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);default:throw new c({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse})}switch(B.error.reason){case"non-json":throw new c({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /companies/list2.");case"unknown":throw new c({message:B.error.errorMessage,rawResponse:B.rawResponse})}}lookupCompany(t,o){return b.fromPromise(this.__lookupCompany(t,o))}async __lookupCompany(t,o){let{keys:r}=t,i={};i.keys=le(r);let m=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/lookup"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:tm.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /companies/lookup.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}getActiveDeals(t,o){return b.fromPromise(this.__getActiveDeals(t,o))}async __getActiveDeals(t,o){let{companyId:r,dealStage:i,limit:m,offset:g}=t,p={};p.company_id=r,p.deal_stage=i,m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-crm-deals"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:nm.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /company-crm-deals.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listCompanyMemberships(t={},o){return b.fromPromise(this.__listCompanyMemberships(t,o))}async __listCompanyMemberships(t={},o){let{companyId:r,userId:i,limit:m,offset:g}=t,p={};r!=null&&(p.company_id=r),i!=null&&(p.user_id=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-memberships"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:pm.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /company-memberships.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getOrCreateCompanyMembership(t,o){return b.fromPromise(this.__getOrCreateCompanyMembership(t,o))}async __getOrCreateCompanyMembership(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-memberships"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ct.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:lm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /company-memberships.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompanyMembership(t,o){return b.fromPromise(this.__deleteCompanyMembership(t,o))}async __deleteCompanyMembership(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-memberships/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:mm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /company-memberships/{company_membership_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getActiveCompanySubscription(t={},o){return b.fromPromise(this.__getActiveCompanySubscription(t,o))}async __getActiveCompanySubscription(t={},o){let{companyId:r,companyIds:i,limit:m,offset:g}=t,p={};r!=null&&(p.company_id=r),i!=null&&(Array.isArray(i)?p.company_ids=i.map(l=>l):p.company_ids=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-subscriptions"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:dm.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /company-subscriptions.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertCompanyTrait(t,o){return b.fromPromise(this.__upsertCompanyTrait(t,o))}async __upsertCompanyTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-traits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:li.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:hm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /company-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listEntityKeyDefinitions(t={},o){return b.fromPromise(this.__listEntityKeyDefinitions(t,o))}async __listEntityKeyDefinitions(t={},o){let{entityType:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.entity_type=wm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-key-definitions"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:Rm.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /entity-key-definitions.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}countEntityKeyDefinitions(t={},o){return b.fromPromise(this.__countEntityKeyDefinitions(t,o))}async __countEntityKeyDefinitions(t={},o){let{entityType:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.entity_type=zm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-key-definitions/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:_m.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /entity-key-definitions/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}listEntityTraitDefinitions(t={},o){return b.fromPromise(this.__listEntityTraitDefinitions(t,o))}async __listEntityTraitDefinitions(t={},o){let{entityType:r,ids:i,q:m,traitType:g,limit:p,offset:s}=t,l={};r!=null&&(l.entity_type=Sm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?l.ids=i.map(R=>R):l.ids=i),m!=null&&(l.q=m),g!=null&&(l.trait_type=Em.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-definitions"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Cm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /entity-trait-definitions.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}getOrCreateEntityTraitDefinition(t,o){return b.fromPromise(this.__getOrCreateEntityTraitDefinition(t,o))}async __getOrCreateEntityTraitDefinition(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-definitions"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Tt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Om.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /entity-trait-definitions.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEntityTraitDefinition(t,o){return b.fromPromise(this.__getEntityTraitDefinition(t,o))}async __getEntityTraitDefinition(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`entity-trait-definitions/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:jm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /entity-trait-definitions/{entity_trait_definition_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateEntityTraitDefinition(t,o,r){return b.fromPromise(this.__updateEntityTraitDefinition(t,o,r))}async __updateEntityTraitDefinition(t,o,r){let i=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`entity-trait-definitions/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:vt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Vm.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /entity-trait-definitions/{entity_trait_definition_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}countEntityTraitDefinitions(t={},o){return b.fromPromise(this.__countEntityTraitDefinitions(t,o))}async __countEntityTraitDefinitions(t={},o){let{entityType:r,ids:i,q:m,traitType:g,limit:p,offset:s}=t,l={};r!=null&&(l.entity_type=km.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?l.ids=i.map(R=>R):l.ids=i),m!=null&&(l.q=m),g!=null&&(l.trait_type=Dm.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-definitions/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Fm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /entity-trait-definitions/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}getEntityTraitValues(t,o){return b.fromPromise(this.__getEntityTraitValues(t,o))}async __getEntityTraitValues(t,o){let{definitionId:r,q:i,limit:m,offset:g}=t,p={};p.definition_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-values"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Lm.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /entity-trait-values.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPlanTraits(t={},o){return b.fromPromise(this.__listPlanTraits(t,o))}async __listPlanTraits(t={},o){let{ids:r,planId:i,traitId:m,traitIds:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(R=>R):l.ids=r),i!=null&&(l.plan_id=i),m!=null&&(l.trait_id=m),g!=null&&(Array.isArray(g)?l.trait_ids=g.map(R=>R):l.trait_ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Nm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plan-traits.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createPlanTrait(t,o){return b.fromPromise(this.__createPlanTrait(t,o))}async __createPlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ot.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Xm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /plan-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlanTrait(t,o){return b.fromPromise(this.__getPlanTrait(t,o))}async __getPlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-traits/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Hm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plan-traits/{plan_trait_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanTrait(t,o,r){return b.fromPromise(this.__updatePlanTrait(t,o,r))}async __updatePlanTrait(t,o,r){let i=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-traits/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:jt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Wm.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /plan-traits/{plan_trait_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlanTrait(t,o){return b.fromPromise(this.__deletePlanTrait(t,o))}async __deletePlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-traits/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Jm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /plan-traits/{plan_trait_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanTraitsBulk(t,o){return b.fromPromise(this.__updatePlanTraitsBulk(t,o))}async __updatePlanTraitsBulk(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits/bulk"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Bt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:$m.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /plan-traits/bulk.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countPlanTraits(t={},o){return b.fromPromise(this.__countPlanTraits(t,o))}async __countPlanTraits(t={},o){let{ids:r,planId:i,traitId:m,traitIds:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(R=>R):l.ids=r),i!=null&&(l.plan_id=i),m!=null&&(l.trait_id=m),g!=null&&(Array.isArray(g)?l.trait_ids=g.map(R=>R):l.trait_ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Ym.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plan-traits/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}upsertUserTrait(t,o){return b.fromPromise(this.__upsertUserTrait(t,o))}async __upsertUserTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"user-traits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:li.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Qm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /user-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listUsers(t={},o){return b.fromPromise(this.__listUsers(t,o))}async __listUsers(t={},o){let{companyId:r,ids:i,planId:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(l.company_id=r),i!=null&&(Array.isArray(i)?l.ids=i.map(R=>R):l.ids=i),m!=null&&(l.plan_id=m),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:ru.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /users.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}upsertUser(t,o){return b.fromPromise(this.__upsertUser(t,o))}async __upsertUser(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:mi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ou.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /users.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getUser(t,o){return b.fromPromise(this.__getUser(t,o))}async __getUser(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`users/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:tu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /users/{user_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteUser(t,o){return b.fromPromise(this.__deleteUser(t,o))}async __deleteUser(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`users/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:iu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /users/{user_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countUsers(t={},o){return b.fromPromise(this.__countUsers(t,o))}async __countUsers(t={},o){let{companyId:r,ids:i,planId:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(l.company_id=r),i!=null&&(Array.isArray(i)?l.ids=i.map(R=>R):l.ids=i),m!=null&&(l.plan_id=m),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:su.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /users/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createUser(t,o){return b.fromPromise(this.__createUser(t,o))}async __createUser(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/create"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:mi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:nu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /users/create.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteUserByKeys(t,o){return b.fromPromise(this.__deleteUserByKeys(t,o))}async __deleteUserByKeys(t,o){let r=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/delete"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ni.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:cu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /users/delete.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}lookupUser(t,o){return b.fromPromise(this.__lookupUser(t,o))}async __lookupUser(t,o){let{keys:r}=t,i={};i.keys=le(r);let m=await(this._options.fetcher??_)({url:(0,M.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/lookup"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:lu.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /users/lookup.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var $=H(require("url-join"));var So=class{constructor(t={}){this._options=t}listCompanyOverrides(t={},o){return b.fromPromise(this.__listCompanyOverrides(t,o))}async __listCompanyOverrides(t={},o){let{companyId:r,companyIds:i,featureId:m,featureIds:g,ids:p,withoutExpired:s,q:l,limit:u,offset:R}=t,y={};r!=null&&(y.company_id=r),i!=null&&(Array.isArray(i)?y.company_ids=i.map(O=>O):y.company_ids=i),m!=null&&(y.feature_id=m),g!=null&&(Array.isArray(g)?y.feature_ids=g.map(O=>O):y.feature_ids=g),p!=null&&(Array.isArray(p)?y.ids=p.map(O=>O):y.ids=p),s!=null&&(y.without_expired=s.toString()),l!=null&&(y.q=l),u!=null&&(y.limit=u.toString()),R!=null&&(y.offset=R.toString());let C=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-overrides"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:du.parseOrThrow(C.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /company-overrides.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}createCompanyOverride(t,o){return b.fromPromise(this.__createCompanyOverride(t,o))}async __createCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-overrides"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Vt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:yu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /company-overrides.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCompanyOverride(t,o){return b.fromPromise(this.__getCompanyOverride(t,o))}async __getCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-overrides/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ru.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /company-overrides/{company_override_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCompanyOverride(t,o,r){return b.fromPromise(this.__updateCompanyOverride(t,o,r))}async __updateCompanyOverride(t,o,r){let i=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-overrides/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:kt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:_u.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /company-overrides/{company_override_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteCompanyOverride(t,o){return b.fromPromise(this.__deleteCompanyOverride(t,o))}async __deleteCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-overrides/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Su.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /company-overrides/{company_override_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countCompanyOverrides(t={},o){return b.fromPromise(this.__countCompanyOverrides(t,o))}async __countCompanyOverrides(t={},o){let{companyId:r,companyIds:i,featureId:m,featureIds:g,ids:p,withoutExpired:s,q:l,limit:u,offset:R}=t,y={};r!=null&&(y.company_id=r),i!=null&&(Array.isArray(i)?y.company_ids=i.map(O=>O):y.company_ids=i),m!=null&&(y.feature_id=m),g!=null&&(Array.isArray(g)?y.feature_ids=g.map(O=>O):y.feature_ids=g),p!=null&&(Array.isArray(p)?y.ids=p.map(O=>O):y.ids=p),s!=null&&(y.without_expired=s.toString()),l!=null&&(y.q=l),u!=null&&(y.limit=u.toString()),R!=null&&(y.offset=R.toString());let C=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-overrides/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:xu.parseOrThrow(C.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /company-overrides/count.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}listFeatureCompanies(t,o){return b.fromPromise(this.__listFeatureCompanies(t,o))}async __listFeatureCompanies(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-companies"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Ou.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /feature-companies.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}countFeatureCompanies(t,o){return b.fromPromise(this.__countFeatureCompanies(t,o))}async __countFeatureCompanies(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-companies/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Bu.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /feature-companies/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listFeatureUsage(t={},o){return b.fromPromise(this.__listFeatureUsage(t,o))}async __listFeatureUsage(t={},o){let{companyId:r,companyKeys:i,featureIds:m,q:g,withoutNegativeEntitlements:p,limit:s,offset:l}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.company_keys=le(i)),m!=null&&(Array.isArray(m)?u.feature_ids=m.map(y=>y):u.feature_ids=m),g!=null&&(u.q=g),p!=null&&(u.without_negative_entitlements=p.toString()),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let R=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-usage"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(R.ok)return{data:ku.parseOrThrow(R.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:R.rawResponse};if(R.error.reason==="status-code")switch(R.error.statusCode){case 400:throw new P(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new S(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new E(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new x(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new U(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);default:throw new c({statusCode:R.error.statusCode,body:R.error.body,rawResponse:R.rawResponse})}switch(R.error.reason){case"non-json":throw new c({statusCode:R.error.statusCode,body:R.error.rawBody,rawResponse:R.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /feature-usage.");case"unknown":throw new c({message:R.error.errorMessage,rawResponse:R.rawResponse})}}countFeatureUsage(t={},o){return b.fromPromise(this.__countFeatureUsage(t,o))}async __countFeatureUsage(t={},o){let{companyId:r,companyKeys:i,featureIds:m,q:g,withoutNegativeEntitlements:p,limit:s,offset:l}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.company_keys=le(i)),m!=null&&(Array.isArray(m)?u.feature_ids=m.map(y=>y):u.feature_ids=m),g!=null&&(u.q=g),p!=null&&(u.without_negative_entitlements=p.toString()),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let R=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-usage/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(R.ok)return{data:Mu.parseOrThrow(R.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:R.rawResponse};if(R.error.reason==="status-code")switch(R.error.statusCode){case 400:throw new P(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new S(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new E(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new x(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new U(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);default:throw new c({statusCode:R.error.statusCode,body:R.error.body,rawResponse:R.rawResponse})}switch(R.error.reason){case"non-json":throw new c({statusCode:R.error.statusCode,body:R.error.rawBody,rawResponse:R.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /feature-usage/count.");case"unknown":throw new c({message:R.error.errorMessage,rawResponse:R.rawResponse})}}listFeatureUsers(t,o){return b.fromPromise(this.__listFeatureUsers(t,o))}async __listFeatureUsers(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-users"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Iu.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /feature-users.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}countFeatureUsers(t,o){return b.fromPromise(this.__countFeatureUsers(t,o))}async __countFeatureUsers(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-users/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Lu.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /feature-users/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPlanEntitlements(t={},o){return b.fromPromise(this.__listPlanEntitlements(t,o))}async __listPlanEntitlements(t={},o){let{featureId:r,featureIds:i,ids:m,planId:g,planIds:p,q:s,withMeteredProducts:l,limit:u,offset:R}=t,y={};r!=null&&(y.feature_id=r),i!=null&&(Array.isArray(i)?y.feature_ids=i.map(O=>O):y.feature_ids=i),m!=null&&(Array.isArray(m)?y.ids=m.map(O=>O):y.ids=m),g!=null&&(y.plan_id=g),p!=null&&(Array.isArray(p)?y.plan_ids=p.map(O=>O):y.plan_ids=p),s!=null&&(y.q=s),l!=null&&(y.with_metered_products=l.toString()),u!=null&&(y.limit=u.toString()),R!=null&&(y.offset=R.toString());let C=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:Nu.parseOrThrow(C.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plan-entitlements.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}createPlanEntitlement(t,o){return b.fromPromise(this.__createPlanEntitlement(t,o))}async __createPlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Dt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:$u.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /plan-entitlements.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlanEntitlement(t,o){return b.fromPromise(this.__getPlanEntitlement(t,o))}async __getPlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-entitlements/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Zu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plan-entitlements/{plan_entitlement_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanEntitlement(t,o,r){return b.fromPromise(this.__updatePlanEntitlement(t,o,r))}async __updatePlanEntitlement(t,o,r){let i=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-entitlements/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Mt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:od.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /plan-entitlements/{plan_entitlement_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlanEntitlement(t,o){return b.fromPromise(this.__deletePlanEntitlement(t,o))}async __deletePlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-entitlements/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:td.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /plan-entitlements/{plan_entitlement_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countPlanEntitlements(t={},o){return b.fromPromise(this.__countPlanEntitlements(t,o))}async __countPlanEntitlements(t={},o){let{featureId:r,featureIds:i,ids:m,planId:g,planIds:p,q:s,withMeteredProducts:l,limit:u,offset:R}=t,y={};r!=null&&(y.feature_id=r),i!=null&&(Array.isArray(i)?y.feature_ids=i.map(O=>O):y.feature_ids=i),m!=null&&(Array.isArray(m)?y.ids=m.map(O=>O):y.ids=m),g!=null&&(y.plan_id=g),p!=null&&(Array.isArray(p)?y.plan_ids=p.map(O=>O):y.plan_ids=p),s!=null&&(y.q=s),l!=null&&(y.with_metered_products=l.toString()),u!=null&&(y.limit=u.toString()),R!=null&&(y.offset=R.toString());let C=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:ad.parseOrThrow(C.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plan-entitlements/count.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}getFeatureUsageByCompany(t,o){return b.fromPromise(this.__getFeatureUsageByCompany(t,o))}async __getFeatureUsageByCompany(t,o){let{keys:r}=t,i={};i.keys=le(r);let m=await(this._options.fetcher??_)({url:(0,$.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"usage-by-company"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:nd.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /usage-by-company.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var ue=H(require("url-join"));var Eo=class{constructor(t={}){this._options=t}updateCompanyPlans(t,o,r){return b.fromPromise(this.__updateCompanyPlans(t,o,r))}async __updateCompanyPlans(t,o,r){let i=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-plans/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:qt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:cd.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /company-plans/{company_plan_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}getAudience(t,o){return b.fromPromise(this.__getAudience(t,o))}async __getAudience(t,o){let r=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-audiences/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:pd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plan-audiences/{plan_audience_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateAudience(t,o,r){return b.fromPromise(this.__updateAudience(t,o,r))}async __updateAudience(t,o,r){let i=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-audiences/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:At.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:ld.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /plan-audiences/{plan_audience_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteAudience(t,o){return b.fromPromise(this.__deleteAudience(t,o))}async __deleteAudience(t,o){let r=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-audiences/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:md.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /plan-audiences/{plan_audience_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listPlans(t={},o){return b.fromPromise(this.__listPlans(t,o))}async __listPlans(t={},o){let{companyId:r,forFallbackPlan:i,forInitialPlan:m,forTrialExpiryPlan:g,hasProductId:p,ids:s,planType:l,q:u,requiresPaymentMethod:R,withoutEntitlementFor:y,withoutProductId:C,withoutPaidProductId:O,limit:T,offset:k}=t,D={};r!=null&&(D.company_id=r),i!=null&&(D.for_fallback_plan=i.toString()),m!=null&&(D.for_initial_plan=m.toString()),g!=null&&(D.for_trial_expiry_plan=g.toString()),p!=null&&(D.has_product_id=p.toString()),s!=null&&(Array.isArray(s)?D.ids=s.map(B=>B):D.ids=s),l!=null&&(D.plan_type=ud.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),u!=null&&(D.q=u),R!=null&&(D.requires_payment_method=R.toString()),y!=null&&(D.without_entitlement_for=y),C!=null&&(D.without_product_id=C.toString()),O!=null&&(D.without_paid_product_id=O.toString()),T!=null&&(D.limit=T.toString()),k!=null&&(D.offset=k.toString());let v=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:D,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(v.ok)return{data:wd.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new S(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new U(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new c({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}switch(v.error.reason){case"non-json":throw new c({statusCode:v.error.statusCode,body:v.error.rawBody,rawResponse:v.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plans.");case"unknown":throw new c({message:v.error.errorMessage,rawResponse:v.rawResponse})}}createPlan(t,o){return b.fromPromise(this.__createPlan(t,o))}async __createPlan(t,o){let r=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ft.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:yd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /plans.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlan(t,o){return b.fromPromise(this.__getPlan(t,o))}async __getPlan(t,o){let r=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Rd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plans/{plan_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlan(t,o,r){return b.fromPromise(this.__updatePlan(t,o,r))}async __updatePlan(t,o,r){let i=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:It.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:zd.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /plans/{plan_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlan(t,o){return b.fromPromise(this.__deletePlan(t,o))}async __deletePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:bd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /plans/{plan_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingProductPlan(t,o,r){return b.fromPromise(this.__upsertBillingProductPlan(t,o,r))}async __upsertBillingProductPlan(t,o,r){let i=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}/billing_products`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Kt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Sd.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /plans/{plan_id}/billing_products.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}countPlans(t={},o){return b.fromPromise(this.__countPlans(t,o))}async __countPlans(t={},o){let{companyId:r,forFallbackPlan:i,forInitialPlan:m,forTrialExpiryPlan:g,hasProductId:p,ids:s,planType:l,q:u,requiresPaymentMethod:R,withoutEntitlementFor:y,withoutProductId:C,withoutPaidProductId:O,limit:T,offset:k}=t,D={};r!=null&&(D.company_id=r),i!=null&&(D.for_fallback_plan=i.toString()),m!=null&&(D.for_initial_plan=m.toString()),g!=null&&(D.for_trial_expiry_plan=g.toString()),p!=null&&(D.has_product_id=p.toString()),s!=null&&(Array.isArray(s)?D.ids=s.map(B=>B):D.ids=s),l!=null&&(D.plan_type=Ed.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),u!=null&&(D.q=u),R!=null&&(D.requires_payment_method=R.toString()),y!=null&&(D.without_entitlement_for=y),C!=null&&(D.without_product_id=C.toString()),O!=null&&(D.without_paid_product_id=O.toString()),T!=null&&(D.limit=T.toString()),k!=null&&(D.offset=k.toString());let v=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:D,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(v.ok)return{data:Pd.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new S(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new U(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new c({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}switch(v.error.reason){case"non-json":throw new c({statusCode:v.error.statusCode,body:v.error.rawBody,rawResponse:v.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plans/count.");case"unknown":throw new c({message:v.error.errorMessage,rawResponse:v.rawResponse})}}listPlanIssues(t,o){return b.fromPromise(this.__listPlanIssues(t,o))}async __listPlanIssues(t,o){let{planId:r}=t,i={};i.plan_id=r;let m=await(this._options.fetcher??_)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans/issues"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:vd.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 400:throw new P(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plans/issues.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Ie=H(require("url-join"));var xo=class{constructor(t={}){this._options=t}listComponents(t={},o){return b.fromPromise(this.__listComponents(t,o))}async __listComponents(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,Ie.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:jd.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /components.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createComponent(t,o){return b.fromPromise(this.__createComponent(t,o))}async __createComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,Ie.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Lt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Vd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /components.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getComponent(t,o){return b.fromPromise(this.__getComponent(t,o))}async __getComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,Ie.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`components/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:kd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /components/{component_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateComponent(t,o={},r){return b.fromPromise(this.__updateComponent(t,o,r))}async __updateComponent(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,Ie.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`components/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Gt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:qd.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /components/{component_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteComponent(t,o){return b.fromPromise(this.__deleteComponent(t,o))}async __deleteComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,Ie.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`components/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ad.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /components/{component_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countComponents(t={},o){return b.fromPromise(this.__countComponents(t,o))}async __countComponents(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,Ie.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:Id.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /components/count.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}previewComponentData(t={},o){return b.fromPromise(this.__previewComponentData(t,o))}async __previewComponentData(t={},o){let{companyId:r,componentId:i}=t,m={};r!=null&&(m.company_id=r),i!=null&&(m.component_id=i);let g=await(this._options.fetcher??_)({url:(0,Ie.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components/preview-data"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:m,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(g.ok)return{data:Nd.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 401:throw new S(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new U(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new c({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new c({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /components/preview-data.");case"unknown":throw new c({message:g.error.errorMessage,rawResponse:g.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var yr=H(require("url-join"));var Uo=class{constructor(t={}){this._options=t}upsertDealLineItemAssociation(t,o){return b.fromPromise(this.__upsertDealLineItemAssociation(t,o))}async __upsertDealLineItemAssociation(t,o){let r=await(this._options.fetcher??_)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/associations/deal-line-item"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Nt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Xd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /crm/associations/deal-line-item.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertLineItem(t,o){return b.fromPromise(this.__upsertLineItem(t,o))}async __upsertLineItem(t,o){let r=await(this._options.fetcher??_)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/deal-line-item/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Xt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Hd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /crm/deal-line-item/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertCrmDeal(t,o){return b.fromPromise(this.__upsertCrmDeal(t,o))}async __upsertCrmDeal(t,o){let r=await(this._options.fetcher??_)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/deals/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ht.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Jd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /crm/deals/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCrmProducts(t={},o){return b.fromPromise(this.__listCrmProducts(t,o))}async __listCrmProducts(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(l=>l):p.ids=r),i!=null&&(p.name=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/products"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Zd.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /crm/products.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertCrmProduct(t,o){return b.fromPromise(this.__upsertCrmProduct(t,o))}async __upsertCrmProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/products/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Wt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Yd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /crm/products/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var ui=H(require("url-join"));var Po=class{constructor(t={}){this._options=t}createDataExport(t,o){return b.fromPromise(this.__createDataExport(t,o))}async __createDataExport(t,o){let r=await(this._options.fetcher??_)({url:(0,ui.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"data-exports"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:{...Jt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),export_type:"company-feature-usage",output_file_type:"csv"},timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:eh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /data-exports.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getDataExportArtifact(t,o){return b.fromPromise(this.__getDataExportArtifact(t,o))}async __getDataExportArtifact(t,o){let r=await(this._options.fetcher??_)({url:(0,ui.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`data-exports/${encodeURIComponent(t)}/artifact`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",responseType:"streaming",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /data-exports/{data_export_id}/artifact.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Je=H(require("url-join"));var Co=class{constructor(t={}){this._options=t}createEventBatch(t,o){return b.fromPromise(this.__createEventBatch(t,o))}async __createEventBatch(t,o){let r=await(this._options.fetcher??_)({url:(0,Je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"event-batch"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Zt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:oh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /event-batch.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEventSummaries(t={},o){return b.fromPromise(this.__getEventSummaries(t,o))}async __getEventSummaries(t={},o){let{q:r,eventSubtypes:i,limit:m,offset:g}=t,p={};r!=null&&(p.q=r),i!=null&&(Array.isArray(i)?p.event_subtypes=i.map(l=>l):p.event_subtypes=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,Je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"event-types"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:ih.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /event-types.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listEvents(t={},o){return b.fromPromise(this.__listEvents(t,o))}async __listEvents(t={},o){let{companyId:r,eventSubtype:i,eventTypes:m,flagId:g,userId:p,limit:s,offset:l}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.event_subtype=i),m!=null&&(Array.isArray(m)?u.event_types=m.map(y=>$t.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})):u.event_types=$t.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(u.flag_id=g),p!=null&&(u.user_id=p),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let R=await(this._options.fetcher??_)({url:(0,Je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"events"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(R.ok)return{data:nh.parseOrThrow(R.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:R.rawResponse};if(R.error.reason==="status-code")switch(R.error.statusCode){case 400:throw new P(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 401:throw new S(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 403:throw new E(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 404:throw new x(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);case 500:throw new U(a.parseOrThrow(R.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),R.rawResponse);default:throw new c({statusCode:R.error.statusCode,body:R.error.body,rawResponse:R.rawResponse})}switch(R.error.reason){case"non-json":throw new c({statusCode:R.error.statusCode,body:R.error.rawBody,rawResponse:R.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /events.");case"unknown":throw new c({message:R.error.errorMessage,rawResponse:R.rawResponse})}}createEvent(t,o){return b.fromPromise(this.__createEvent(t,o))}async __createEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,Je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"events"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:lo.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ch.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /events.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEvent(t,o){return b.fromPromise(this.__getEvent(t,o))}async __getEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,Je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`events/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ph.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /events/{event_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSegmentIntegrationStatus(t){return b.fromPromise(this.__getSegmentIntegrationStatus(t))}async __getSegmentIntegrationStatus(t){let o=await(this._options.fetcher??_)({url:(0,Je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"segment-integration"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:mh.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new S(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 403:throw new E(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 404:throw new x(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 500:throw new U(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /segment-integration.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var To=H(require("url-join"));var vo=class{constructor(t={}){this._options=t}getPlanGroup(t){return b.fromPromise(this.__getPlanGroup(t))}async __getPlanGroup(t){let o=await(this._options.fetcher??_)({url:(0,To.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-groups"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:bh.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new S(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 403:throw new E(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 404:throw new x(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 500:throw new U(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /plan-groups.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPlanGroup(t,o){return b.fromPromise(this.__createPlanGroup(t,o))}async __createPlanGroup(t,o){let r=await(this._options.fetcher??_)({url:(0,To.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-groups"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Qt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Sh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /plan-groups.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanGroup(t,o,r){return b.fromPromise(this.__updatePlanGroup(t,o,r))}async __updatePlanGroup(t,o,r){let i=await(this._options.fetcher??_)({url:(0,To.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-groups/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ei.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Eh.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /plan-groups/{plan_group_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Zh=H(require("url-join"));var Oo=class{constructor(t={}){this._options=t}issueTemporaryAccessToken(t,o){return b.fromPromise(this.__issueTemporaryAccessToken(t,o))}async __issueTemporaryAccessToken(t,o){let r=await(this._options.fetcher??_)({url:(0,Zh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"temporary-access-tokens"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:{...ri.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),resource_type:"company"},timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Uh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /temporary-access-tokens.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Ee=H(require("url-join"));var jo=class{constructor(t={}){this._options=t}listWebhookEvents(t={},o){return b.fromPromise(this.__listWebhookEvents(t,o))}async __listWebhookEvents(t={},o){let{ids:r,q:i,webhookId:m,limit:g,offset:p}=t,s={};r!=null&&(Array.isArray(r)?s.ids=r.map(u=>u):s.ids=r),i!=null&&(s.q=i),m!=null&&(s.webhook_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhook-events"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:Ch.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /webhook-events.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getWebhookEvent(t,o){return b.fromPromise(this.__getWebhookEvent(t,o))}async __getWebhookEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhook-events/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Th.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /webhook-events/{webhook_event_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countWebhookEvents(t={},o){return b.fromPromise(this.__countWebhookEvents(t,o))}async __countWebhookEvents(t={},o){let{ids:r,q:i,webhookId:m,limit:g,offset:p}=t,s={};r!=null&&(Array.isArray(r)?s.ids=r.map(u=>u):s.ids=r),i!=null&&(s.q=i),m!=null&&(s.webhook_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhook-events/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:Oh.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /webhook-events/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}listWebhooks(t={},o){return b.fromPromise(this.__listWebhooks(t,o))}async __listWebhooks(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhooks"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:Bh.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /webhooks.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createWebhook(t,o){return b.fromPromise(this.__createWebhook(t,o))}async __createWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhooks"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:oi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:kh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /webhooks.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWebhook(t,o){return b.fromPromise(this.__getWebhook(t,o))}async __getWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhooks/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Dh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /webhooks/{webhook_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateWebhook(t,o={},r){return b.fromPromise(this.__updateWebhook(t,o,r))}async __updateWebhook(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhooks/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ti.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Ah.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /webhooks/{webhook_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteWebhook(t,o){return b.fromPromise(this.__deleteWebhook(t,o))}async __deleteWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhooks/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Fh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /webhooks/{webhook_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countWebhooks(t={},o){return b.fromPromise(this.__countWebhooks(t,o))}async __countWebhooks(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhooks/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:Kh.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /webhooks/count.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Bo=class{constructor(t={}){this._options=t}get accounts(){return this._accounts??=new yo(this._options)}get features(){return this._features??=new Ro(this._options)}get billing(){return this._billing??=new zo(this._options)}get credits(){return this._credits??=new bo(this._options)}get checkout(){return this._checkout??=new fo(this._options)}get companies(){return this._companies??=new _o(this._options)}get entitlements(){return this._entitlements??=new So(this._options)}get plans(){return this._plans??=new Eo(this._options)}get components(){return this._components??=new xo(this._options)}get crm(){return this._crm??=new Uo(this._options)}get dataexports(){return this._dataexports??=new Po(this._options)}get events(){return this._events??=new Co(this._options)}get plangroups(){return this._plangroups??=new vo(this._options)}get accesstokens(){return this._accesstokens??=new Oo(this._options)}get webhooks(){return this._webhooks??=new jo(this._options)}getCredit(t){return b.fromPromise(this.__getCredit(t))}async __getCredit(t){let o=await(this._options.fetcher??_)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/:credit_id"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/:credit_id.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateCredit(t){return b.fromPromise(this.__updateCredit(t))}async __updateCredit(t){let o=await(this._options.fetcher??_)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/:credit_id"),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /billing/credits/:credit_id.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deleteCredit(t){return b.fromPromise(this.__deleteCredit(t))}async __deleteCredit(t){let o=await(this._options.fetcher??_)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/:credit_id"),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /billing/credits/:credit_id.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getCreditBundle(t){return b.fromPromise(this.__getCreditBundle(t))}async __getCreditBundle(t){let o=await(this._options.fetcher??_)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles/:bundle_id"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling GET /billing/credits/bundles/:bundle_id.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}purchaseCreditBundle(t){return b.fromPromise(this.__purchaseCreditBundle(t))}async __purchaseCreditBundle(t){let o=await(this._options.fetcher??_)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles/:bundle_id"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling POST /billing/credits/bundles/:bundle_id.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateCreditBundle(t){return b.fromPromise(this.__updateCreditBundle(t))}async __updateCreditBundle(t){let o=await(this._options.fetcher??_)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles/:bundle_id"),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /billing/credits/bundles/:bundle_id.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}zeroOutCreditGrant(t){return b.fromPromise(this.__zeroOutCreditGrant(t))}async __zeroOutCreditGrant(t){let o=await(this._options.fetcher??_)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/:grant_id/zero-out"),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling PUT /billing/credits/grants/:grant_id/zero-out.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deletePlanCreditGrant(t){return b.fromPromise(this.__deletePlanCreditGrant(t))}async __deletePlanCreditGrant(t){let o=await(this._options.fetcher??_)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants/:plan_grant_id"),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.4","User-Agent":"@schematichq/schematic-typescript-node/1.2.4","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:void 0,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new z("Timeout exceeded when calling DELETE /billing/credits/plan-grants/:plan_grant_id.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Rr=class{error(t,...o){console.error(t,...o)}warn(t,...o){console.warn(t,...o)}info(t,...o){console.info(t,...o)}debug(t,...o){console.debug(t,...o)}};var eg=1e3,rg=1e3,og=3,tg=1e3,Vo=class{constructor(t,o){this.events=[];this.intervalId=null;this.shutdown=!1;this.stopped=!1;this.flushing=!1;let{logger:r=new Rr,maxSize:i=rg,interval:m=eg,offline:g=!1,maxRetries:p=og,initialRetryDelay:s=tg}=o||{};this.eventsApi=t,this.interval=m,this.logger=r,this.maxSize=i,this.offline=g,this.maxRetries=p,this.initialRetryDelay=s,this.startPeriodicFlush()}async flush(){if(!(this.events.length===0||this.flushing)){this.flushing=!0;try{let t=[...this.events];this.events=[];let o=0,r=!1,i=null;for(;o<=this.maxRetries&&!r;)try{o>0&&this.logger.info(`Retrying event batch submission (attempt ${o} of ${this.maxRetries})`),await this.eventsApi.createEventBatch({events:t}),r=!0}catch(m){if(i=m,o++,o<=this.maxRetries){let g=this.initialRetryDelay*Math.pow(2,o-1),p=Math.random()*.1*g,s=g+p;this.logger.warn(`Event batch submission failed: ${m}. Retrying in ${(s/1e3).toFixed(2)} seconds...`),process.env.NODE_ENV!=="test"&&await new Promise(l=>setTimeout(l,s))}}r?o>0&&this.logger.info(`Event batch submission succeeded after ${o} retries`):this.logger.error(`Event batch submission failed after ${this.maxRetries} retries:`,i)}finally{this.flushing=!1}}}async push(t){if(!this.offline){if(this.stopped){this.logger.error("Event buffer is stopped, not accepting new events");return}this.events.length>=this.maxSize&&!this.flushing&&await this.flush(),this.events.push(t)}}async stop(){this.shutdown=!0,this.stopped=!0,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),await this.flush()}startPeriodicFlush(){this.offline||this.intervalId||(this.intervalId=setInterval(async()=>{this.shutdown||await this.flush()},this.interval))}};function Yh(w){return async function(o){let r={};if(w&&Object.assign(r,w),o.body!==void 0&&o.contentType!=null&&(r["Content-Type"]=o.contentType),o.headers!=null)for(let[p,s]of Object.entries(o.headers))s!=null&&(r[p]=s);let i=Ur(o.url,o.queryParameters),m=await Cr({body:o.body,type:o.requestType==="json"?"json":"other"}),g=await Pr();try{let p=await Or(async()=>vr(g,i,o.method,r,m,o.timeoutMs,o.abortSignal,o.withCredentials,o.duplex),o.maxRetries),s=await Tr(p,o.responseType),l=Ze(p);return p.status>=200&&p.status<400?{ok:!0,body:s,headers:p.headers,rawResponse:l}:{ok:!1,error:{reason:"status-code",statusCode:p.status,body:s},rawResponse:l}}catch(p){return o.abortSignal!=null&&o.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Le}:p instanceof Error&&p.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:Le}:p instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:p.message},rawResponse:Ge}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(p)},rawResponse:Ge}}}}async function ig(w){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new Ke,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var Qh=ig;var ko=class extends Bo{constructor(t){let{apiKey:o="",basePath:r,eventBufferInterval:i,flagDefaults:m={},logger:g=new Rr}=t??{},{offline:p=!1}=t??{},s={};t?.environmentId&&(s["X-Schematic-Environment-Id"]=t.environmentId),t?.headers&&Object.assign(s,t.headers),p?o!==""&&g.debug("Offline mode enabled, ignoring API key"):o===""&&!p&&(g.warn("No API key was provided, running in offline mode"),p=!0),super({apiKey:o,environment:r,fetcher:p?Qh:Yh(s)}),this.logger=g,this.eventBuffer=new Vo(this.events,{interval:i,logger:g,offline:p}),this.flagCheckCacheProviders=t?.cacheProviders?.flagChecks??[new $e],this.flagDefaults=m,this.offline=p}async checkFlag(t,o){if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag value for flag ${o}`),this.getFlagDefault(o);try{let r=JSON.stringify({evalCtx:t,key:o});for(let m of this.flagCheckCacheProviders){let g=await m.get(r);if(g!==void 0)return this.logger.debug(`${m.constructor.name} cache hit for flag ${o}`),g}let i=await this.features.checkFlag(o,t);if(i.data.value===void 0)return this.logger.debug(`No value returned from feature flag API for flag ${o}, falling back to default`),this.getFlagDefault(o);for(let m of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${o} in ${m.constructor.name}`),await m.set(r,i.data.value);return this.logger.debug(`Feature flag API response for ${o}: ${JSON.stringify(i.data)}`),i.data.value}catch(r){return this.logger.error(`Error checking flag ${o}: ${r}`),this.getFlagDefault(o)}}async checkFlags(t,o){if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag values for flags ${o?o.join(", "):"all"}`),o&&o.length>0?o.map(r=>({flag:r,value:this.getFlagDefault(r),reason:"Offline mode - using default value"})):[];try{if(!o||o.length===0)return this.logger.debug("No specific flag keys provided, calling standard checkFlags API"),(await this.features.checkFlags(t)).data.flags;let r=new Map,i=[];for(let s of o){let l=JSON.stringify({evalCtx:t,key:s}),u=!1;for(let R of this.flagCheckCacheProviders){let y=await R.get(l);if(y!==void 0){this.logger.debug(`${R.constructor.name} cache hit for flag ${s}`),r.set(s,{flag:s,value:y,reason:"Retrieved from cache"}),u=!0;break}}u||i.push(s)}if(i.length===0)return this.logger.debug(`All ${o.length} flags found in cache`),o.map(s=>r.get(s));this.logger.debug(`Cache miss for ${i.length} flags: ${i.join(", ")}, calling API`);let g=(await this.features.checkFlags(t)).data.flags,p=[];for(let s of o){let l=g.find(u=>u.flag===s);if(l){let u=JSON.stringify({evalCtx:t,key:s});for(let R of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${u} in ${R.constructor.name}`),await R.set(u,l.value);p.push(l)}else{let u=r.get(s);if(u)p.push(u);else{this.logger.debug(`Flag ${s} not found in API response or cache, using default value`);let R={flag:s,value:this.getFlagDefault(s),reason:"Flag not found - using default value"};p.push(R)}}}return this.logger.debug(`Checked ${o.length} flags: used fresh API values for consistency (${i.length} were cache misses)`),p}catch(r){return this.logger.error(`Error checking flags ${o?o.join(", "):"all"}: ${r}`),o&&o.length>0?o.map(i=>({flag:i,value:this.getFlagDefault(i),reason:`Error occurred - using default value: ${r}`})):[]}}async close(){return this.eventBuffer.stop()}async identify(t){if(!this.offline)try{await this.enqueueEvent("identify",t)}catch(o){this.logger.error(`Error sending identify event: ${o}`)}}async track(t){if(!this.offline)try{await this.enqueueEvent("track",t)}catch(o){this.logger.error(`Error sending track event: ${o}`)}}setFlagDefault(t,o){this.flagDefaults[t]=o}setFlagDefaults(t){Object.assign(this.flagDefaults,t)}getFlagDefault(t){return this.flagDefaults[t]??!1}async enqueueEvent(t,o){try{this.eventBuffer.push({eventType:t,body:o,sentAt:new Date})}catch(r){this.logger.error(`Error enqueueing ${t} event: ${r}`)}}};var Do=H(require("crypto")),di="X-Schematic-Webhook-Signature",hi="X-Schematic-Webhook-Timestamp",xe=class w extends Error{constructor(t){super(t),Object.setPrototypeOf(this,w.prototype),this.name="WebhookSignatureError"}static missingSignature(){return new w("Missing webhook signature header")}static missingTimestamp(){return new w("Missing webhook timestamp header")}static invalidSignature(){return new w("Invalid webhook signature")}};function Mo(w,t,o){let r=Buffer.isBuffer(w)?w:Buffer.from(w),i=Buffer.concat([r,Buffer.from(`+${t}`)]),m=Do.createHmac("sha256",o);return m.update(i),m.digest()}function rw(w,t,o){return Mo(w,t,o).toString("hex")}function wi(w,t,o,r){if(!t)throw xe.missingSignature();if(!o)throw xe.missingTimestamp();let i;try{i=Buffer.from(t,"hex")}catch(g){throw new xe(`Invalid signature format: ${g?.message||"Unknown error"}`)}let m=Mo(w,o,r);if(i.length!==m.length||!Do.timingSafeEqual(i,m))throw xe.invalidSignature()}function ow(w,t,o,r={}){let i=w.headers,m=r.signatureHeader||di,g=r.timestampHeader||hi,p=ew(i,m),s=ew(i,g),l;if(o!==void 0)l=o;else if("rawBody"in w&&w.rawBody)l=w.rawBody;else throw new xe("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");wi(l,p,s,t)}function ew(w,t){let o=w[t]||w[t.toLowerCase()];return Array.isArray(o)?o[0]||"":o||""}0&&(module.exports={LocalCache,Schematic,SchematicClient,SchematicEnvironment,SchematicError,SchematicTimeoutError,WEBHOOK_SIGNATURE_HEADER,WEBHOOK_TIMESTAMP_HEADER,WebhookSignatureError,computeHexSignature,computeSignature,verifySignature,verifyWebhookSignature});
1
+ "use strict";var jg=Object.create;var Sr=Object.defineProperty;var kg=Object.getOwnPropertyDescriptor;var Dg=Object.getOwnPropertyNames;var Vg=Object.getPrototypeOf,qg=Object.prototype.hasOwnProperty;var qo=(w,t)=>()=>(w&&(t=w(w=0)),t);var re=(w,t)=>{for(var o in t)Sr(w,o,{get:t[o],enumerable:!0})},wi=(w,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Dg(t))!qg.call(w,i)&&i!==o&&Sr(w,i,{get:()=>t[i],enumerable:!(r=kg(t,i))||r.enumerable});return w};var H=(w,t,o)=>(o=w!=null?jg(Vg(w)):{},wi(t||!w||!w.__esModule?Sr(o,"default",{value:w,enumerable:!0}):o,w)),Mg=w=>wi(Sr({},"__esModule",{value:!0}),w);var bs={};re(bs,{Node18UniversalStreamWrapper:()=>Wo});var Wo,fs=qo(()=>{"use strict";Wo=class w{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(t,o){this.events[t]?.push(o)}off(t,o){this.events[t]=this.events[t]?.filter(r=>r!==o)}pipe(t){return this.on("data",async o=>{if(t instanceof w)t._write(o);else if(t instanceof WritableStream){let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}else t.write(o)}),this.on("end",async()=>{t instanceof w?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.on("error",async o=>{t instanceof w?t._error(o):t instanceof WritableStream?t.getWriter().abort(o):t.destroy(o)}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",async o=>{if(t instanceof w)t._write(o);else if(t instanceof WritableStream){let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}else t.write(o)}),this.off("end",async()=>{t instanceof w?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.off("error",async o=>{t instanceof w?t._error(o):t instanceof WritableStream?t.getWriter().abort(o):t.destroy(o)})}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close")}).catch(o=>{this._emit("error",o)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(!t)return o}setEncoding(t){this.encoding=t}async text(){let t=[];for(;;){let{done:r,value:i}=await this.reader.read();if(r)break;i&&t.push(i)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t)}_end(){this._emit("end")}_error(t){this._emit("error",t)}_emit(t,o){if(this.events[t])for(let r of this.events[t]||[])r(o)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}o&&this._emit("data",o)}}catch(t){this._emit("error",t)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:o}},[Symbol.asyncIterator](){return this}}}}});var _s={};re(_s,{UndiciStreamWrapper:()=>Jo});var Jo,Ss=qo(()=>{"use strict";Jo=class w{constructor(t){this.readableStream=t,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(t,o){this.events[t]?.push(o)}off(t,o){this.events[t]=this.events[t]?.filter(r=>r!==o)}pipe(t){return this.on("data",o=>{if(t instanceof w)t._write(o);else{let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}}),this.on("end",()=>{t instanceof w?t._end():t.getWriter().close()}),this.on("error",o=>{t instanceof w?t._error(o):t.getWriter().abort(o)}),this._startReading(),t}pipeTo(t){return this.pipe(t)}unpipe(t){this.off("data",o=>{if(t instanceof w)t._write(o);else{let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}}),this.off("end",()=>{t instanceof w?t._end():t.getWriter().close()}),this.off("error",o=>{t instanceof w?t._error(o):t.getWriter().abort(o)})}destroy(t){this.reader.cancel(t).then(()=>{this._emit("close")}).catch(o=>{this._emit("error",o)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(!t)return o}setEncoding(t){this.encoding=t}async text(){let t=[];for(;;){let{done:r,value:i}=await this.reader.read();if(r)break;i&&t.push(i)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(t).arrayBuffer())}async json(){let t=await this.text();return JSON.parse(t)}_write(t){this._emit("data",t)}_end(){this._emit("end")}_error(t){this._emit("error",t)}_emit(t,o){if(this.events[t])for(let r of this.events[t]||[])r(o)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();if(t){this._emit("end"),this._emit("close");break}o&&this._emit("data",o)}}catch(t){this._emit("error",t)}}[Symbol.asyncIterator](){return{next:async()=>{this.paused&&await new Promise(r=>{this.resumeCallback=r});let{done:t,value:o}=await this.reader.read();return t?{done:!0,value:void 0}:{done:!1,value:o}},[Symbol.asyncIterator](){return this}}}}});var xs={};re(xs,{NodePre18StreamWrapper:()=>$o});var $o,Es=qo(()=>{"use strict";$o=class{constructor(t){this.readableStream=t}on(t,o){this.readableStream.on(t,o)}off(t,o){this.readableStream.off(t,o)}pipe(t){return this.readableStream.pipe(t),t}pipeTo(t){return this.pipe(t)}unpipe(t){t?this.readableStream.unpipe(t):this.readableStream.unpipe()}destroy(t){this.readableStream.destroy(t)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((t,o)=>{let r=this.readableStream.read();r?t(r):(this.readableStream.once("readable",()=>{let i=this.readableStream.read();t(i)}),this.readableStream.once("error",o))})}setEncoding(t){this.readableStream.setEncoding(t),this.encoding=t}async text(){let t=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let i of this.readableStream)t.push(o.encode(i));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(t))}async json(){let t=await this.text();return JSON.parse(t)}[Symbol.asyncIterator](){let o=this.readableStream[Symbol.asyncIterator]();return{async next(){let{value:r,done:i}=await o.next();return{value:r,done:i}},[Symbol.asyncIterator](){return this}}}}});var Zw={};re(Zw,{LocalCache:()=>He,Schematic:()=>Z,SchematicClient:()=>ko,SchematicEnvironment:()=>f,SchematicError:()=>c,SchematicTimeoutError:()=>R,WEBHOOK_SIGNATURE_HEADER:()=>di,WEBHOOK_TIMESTAMP_HEADER:()=>hi,WebhookSignatureError:()=>Ee,computeHexSignature:()=>Og,computeSignature:()=>Vo,verifySignature:()=>gi,verifyWebhookSignature:()=>Bg});module.exports=Mg(Zw);var Z={};re(Z,{BadRequestError:()=>P,BillingProductPricingUsageType:()=>Ag,ConditionConditionType:()=>Fg,ConditionMetricPeriod:()=>Ig,ConditionMetricPeriodMonthReset:()=>Kg,ConditionOperator:()=>Lg,CountBillingProductsRequestPriceUsageType:()=>vi,CountBillingProductsResponseParamsPriceUsageType:()=>Oi,CountCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ya,CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>za,CountCreditBundlesRequestStatus:()=>Ni,CountCreditBundlesResponseParamsStatus:()=>Xi,CountCreditLedgerRequestPeriod:()=>oa,CountCreditLedgerResponseParamsPeriod:()=>ta,CountEntityKeyDefinitionsRequestEntityType:()=>Sa,CountEntityKeyDefinitionsResponseParamsEntityType:()=>xa,CountEntityTraitDefinitionsRequestEntityType:()=>Ba,CountEntityTraitDefinitionsRequestTraitType:()=>ja,CountEntityTraitDefinitionsResponseParamsEntityType:()=>ka,CountEntityTraitDefinitionsResponseParamsTraitType:()=>Da,CountPlansRequestPlanType:()=>es,CountPlansResponseParamsPlanType:()=>rs,CreateBillingCreditRequestBodyBurnStrategy:()=>ji,CreateBillingCreditRequestBodyDefaultRolloverPolicy:()=>ki,CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryType:()=>ia,CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryUnit:()=>aa,CreateBillingPlanCreditGrantRequestBodyExpiryType:()=>sa,CreateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>na,CreateBillingPlanCreditGrantRequestBodyResetCadence:()=>ca,CreateBillingPlanCreditGrantRequestBodyResetStart:()=>pa,CreateBillingPlanCreditGrantRequestBodyResetType:()=>la,CreateBillingPriceRequestBodyBillingScheme:()=>Si,CreateBillingPriceRequestBodyTiersMode:()=>xi,CreateBillingPriceRequestBodyUsageType:()=>Ei,CreateBillingSubscriptionRequestBodyTrialEndSetting:()=>Bi,CreateCompanyCreditGrantExpiryType:()=>Wi,CreateCompanyCreditGrantExpiryUnit:()=>Ji,CreateCompanyOverrideRequestBodyMetricPeriod:()=>Va,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>qa,CreateCompanyOverrideRequestBodyValueType:()=>Ma,CreateComponentRequestBodyEntityType:()=>os,CreateCreditBundleRequestBodyExpiryType:()=>Ai,CreateCreditBundleRequestBodyExpiryUnit:()=>Fi,CreateCreditBundleRequestBodyStatus:()=>Ii,CreateEntitlementReqCommonMetricPeriod:()=>Gg,CreateEntitlementReqCommonMetricPeriodMonthReset:()=>Ng,CreateEntitlementReqCommonValueType:()=>Xg,CreateEntityTraitDefinitionRequestBodyEntityType:()=>Ta,CreateEntityTraitDefinitionRequestBodyTraitType:()=>va,CreateEnvironmentRequestBodyEnvironmentType:()=>yi,CreateEventRequestBodyEventType:()=>Hg,CreateFeatureRequestBodyFeatureType:()=>ps,CreateFeatureRequestBodyLifecyclePhase:()=>ls,CreateOrUpdateConditionRequestBodyConditionType:()=>Wg,CreateOrUpdateConditionRequestBodyMetricPeriod:()=>Jg,CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset:()=>$g,CreateOrUpdateConditionRequestBodyOperator:()=>Zg,CreateOrUpdateRuleRequestBodyRuleType:()=>Yg,CreatePlanEntitlementRequestBodyMetricPeriod:()=>Ka,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>La,CreatePlanEntitlementRequestBodyPriceBehavior:()=>Ga,CreatePlanEntitlementRequestBodyValueType:()=>Na,CreatePlanRequestBodyPlanType:()=>Ya,CreateWebhookRequestBodyRequestTypesItem:()=>gs,CreditGrantDetailGrantReason:()=>Qg,CreditGrantExpiryRequestBodyExpiryType:()=>ew,CreditGrantExpiryRequestBodyExpiryUnit:()=>rw,CreditGrantExpiryRequestBodyResetCadence:()=>ow,CreditGrantExpiryRequestBodyResetStart:()=>tw,CreditGrantExpiryRequestBodyResetType:()=>iw,FeatureCompanyResponseDataAllocationType:()=>aw,FeatureCompanyResponseDataCreditGrantReason:()=>sw,FeatureCompanyUserResponseDataAllocationType:()=>nw,FeatureUsageResponseDataAllocationType:()=>cw,FeatureUsageResponseDataCreditGrantReason:()=>pw,ForbiddenError:()=>x,GetEnrichedCreditLedgerRequestPeriod:()=>ea,GetEnrichedCreditLedgerResponseParamsPeriod:()=>ra,InternalServerError:()=>U,ListBillingProductsRequestPriceUsageType:()=>Ci,ListBillingProductsResponseParamsPriceUsageType:()=>Ti,ListCompaniesForAdvancedFilterRequestSortOrderDirection:()=>Ra,ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>ba,ListCompanyGrantsRequestDir:()=>Zi,ListCompanyGrantsRequestOrder:()=>$i,ListCompanyGrantsResponseParamsDir:()=>Yi,ListCompanyGrantsResponseParamsOrder:()=>Qi,ListCreditBundlesRequestStatus:()=>qi,ListCreditBundlesResponseParamsStatus:()=>Mi,ListEntityKeyDefinitionsRequestEntityType:()=>fa,ListEntityKeyDefinitionsResponseParamsEntityType:()=>_a,ListEntityTraitDefinitionsRequestEntityType:()=>Ea,ListEntityTraitDefinitionsRequestTraitType:()=>Ua,ListEntityTraitDefinitionsResponseParamsEntityType:()=>Pa,ListEntityTraitDefinitionsResponseParamsTraitType:()=>Ca,ListEventsRequestEventTypesItem:()=>ns,ListEventsResponseParamsEventTypesItem:()=>cs,ListPlansRequestPlanType:()=>$a,ListPlansResponseParamsPlanType:()=>Za,ListProductPricesRequestPriceUsageType:()=>Ui,ListProductPricesResponseParamsPriceUsageType:()=>Pi,NotFoundError:()=>E,PlanChangeResponseDataAction:()=>lw,PlanChangeResponseDataActorType:()=>mw,PlanChangeResponseDataBasePlanAction:()=>uw,PlanChangeResponseDataSubscriptionChangeAction:()=>dw,RuleRuleType:()=>hw,SearchBillingPricesRequestTiersMode:()=>Ri,SearchBillingPricesRequestUsageType:()=>bi,SearchBillingPricesResponseParamsTiersMode:()=>fi,SearchBillingPricesResponseParamsUsageType:()=>_i,TraitDefinitionComparableType:()=>gw,TraitDefinitionEntityType:()=>ww,UnauthorizedError:()=>S,UpdateBillingCreditRequestBodyBurnStrategy:()=>Di,UpdateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Vi,UpdateBillingPlanCreditGrantRequestBodyExpiryType:()=>ma,UpdateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>ua,UpdateBillingPlanCreditGrantRequestBodyResetCadence:()=>da,UpdateBillingPlanCreditGrantRequestBodyResetStart:()=>ha,UpdateBillingPlanCreditGrantRequestBodyResetType:()=>ga,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>Aa,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Fa,UpdateCompanyOverrideRequestBodyValueType:()=>Ia,UpdateComponentRequestBodyEntityType:()=>ts,UpdateComponentRequestBodyState:()=>is,UpdateCreditBundleDetailsRequestBodyExpiryType:()=>Ki,UpdateCreditBundleDetailsRequestBodyExpiryUnit:()=>Li,UpdateCreditBundleDetailsRequestBodyStatus:()=>Gi,UpdateEntitlementReqCommonMetricPeriod:()=>yw,UpdateEntitlementReqCommonMetricPeriodMonthReset:()=>zw,UpdateEntitlementReqCommonValueType:()=>Rw,UpdateEntityTraitDefinitionRequestBodyTraitType:()=>Oa,UpdateEnvironmentRequestBodyEnvironmentType:()=>zi,UpdateFeatureRequestBodyFeatureType:()=>ms,UpdateFeatureRequestBodyLifecyclePhase:()=>us,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>Xa,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Ha,UpdatePlanEntitlementRequestBodyPriceBehavior:()=>Wa,UpdatePlanEntitlementRequestBodyValueType:()=>Ja,UpdateWebhookRequestBodyRequestTypesItem:()=>ws,UpdateWebhookRequestBodyStatus:()=>ys,UpsertBillingProductRequestBodyChargeType:()=>Qa,UsageBasedEntitlementRequestBodyPriceBehavior:()=>bw,ZeroOutGrantRequestBodyReason:()=>Hi,accesstokens:()=>hs,accounts:()=>Mo,billing:()=>Ao,checkout:()=>wa,companies:()=>Io,components:()=>Go,credits:()=>Fo,crm:()=>as,dataexports:()=>ss,entitlements:()=>Ko,events:()=>No,features:()=>Xo,plangroups:()=>ds,plans:()=>Lo,webhooks:()=>Ho});var Mo={};re(Mo,{CreateEnvironmentRequestBodyEnvironmentType:()=>yi,UpdateEnvironmentRequestBodyEnvironmentType:()=>zi});var yi={Development:"development",Staging:"staging",Production:"production"};var zi={Development:"development",Staging:"staging",Production:"production"};var Ao={};re(Ao,{CountBillingProductsRequestPriceUsageType:()=>vi,CountBillingProductsResponseParamsPriceUsageType:()=>Oi,CreateBillingPriceRequestBodyBillingScheme:()=>Si,CreateBillingPriceRequestBodyTiersMode:()=>xi,CreateBillingPriceRequestBodyUsageType:()=>Ei,CreateBillingSubscriptionRequestBodyTrialEndSetting:()=>Bi,ListBillingProductsRequestPriceUsageType:()=>Ci,ListBillingProductsResponseParamsPriceUsageType:()=>Ti,ListProductPricesRequestPriceUsageType:()=>Ui,ListProductPricesResponseParamsPriceUsageType:()=>Pi,SearchBillingPricesRequestTiersMode:()=>Ri,SearchBillingPricesRequestUsageType:()=>bi,SearchBillingPricesResponseParamsTiersMode:()=>fi,SearchBillingPricesResponseParamsUsageType:()=>_i});var Ri={Volume:"volume",Graduated:"graduated"};var bi={Licensed:"licensed",Metered:"metered"};var fi={Volume:"volume",Graduated:"graduated"};var _i={Licensed:"licensed",Metered:"metered"};var Si={PerUnit:"per_unit",Tiered:"tiered"};var xi={Volume:"volume",Graduated:"graduated"};var Ei={Licensed:"licensed",Metered:"metered"};var Ui={Licensed:"licensed",Metered:"metered"};var Pi={Licensed:"licensed",Metered:"metered"};var Ci={Licensed:"licensed",Metered:"metered"};var Ti={Licensed:"licensed",Metered:"metered"};var vi={Licensed:"licensed",Metered:"metered"};var Oi={Licensed:"licensed",Metered:"metered"};var Bi={Subscribe:"subscribe",Cancel:"cancel"};var Fo={};re(Fo,{CountCreditBundlesRequestStatus:()=>Ni,CountCreditBundlesResponseParamsStatus:()=>Xi,CountCreditLedgerRequestPeriod:()=>oa,CountCreditLedgerResponseParamsPeriod:()=>ta,CreateBillingCreditRequestBodyBurnStrategy:()=>ji,CreateBillingCreditRequestBodyDefaultRolloverPolicy:()=>ki,CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryType:()=>ia,CreateBillingPlanCreditGrantRequestBodyAutoTopupExpiryUnit:()=>aa,CreateBillingPlanCreditGrantRequestBodyExpiryType:()=>sa,CreateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>na,CreateBillingPlanCreditGrantRequestBodyResetCadence:()=>ca,CreateBillingPlanCreditGrantRequestBodyResetStart:()=>pa,CreateBillingPlanCreditGrantRequestBodyResetType:()=>la,CreateCompanyCreditGrantExpiryType:()=>Wi,CreateCompanyCreditGrantExpiryUnit:()=>Ji,CreateCreditBundleRequestBodyExpiryType:()=>Ai,CreateCreditBundleRequestBodyExpiryUnit:()=>Fi,CreateCreditBundleRequestBodyStatus:()=>Ii,GetEnrichedCreditLedgerRequestPeriod:()=>ea,GetEnrichedCreditLedgerResponseParamsPeriod:()=>ra,ListCompanyGrantsRequestDir:()=>Zi,ListCompanyGrantsRequestOrder:()=>$i,ListCompanyGrantsResponseParamsDir:()=>Yi,ListCompanyGrantsResponseParamsOrder:()=>Qi,ListCreditBundlesRequestStatus:()=>qi,ListCreditBundlesResponseParamsStatus:()=>Mi,UpdateBillingCreditRequestBodyBurnStrategy:()=>Di,UpdateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Vi,UpdateBillingPlanCreditGrantRequestBodyExpiryType:()=>ma,UpdateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>ua,UpdateBillingPlanCreditGrantRequestBodyResetCadence:()=>da,UpdateBillingPlanCreditGrantRequestBodyResetStart:()=>ha,UpdateBillingPlanCreditGrantRequestBodyResetType:()=>ga,UpdateCreditBundleDetailsRequestBodyExpiryType:()=>Ki,UpdateCreditBundleDetailsRequestBodyExpiryUnit:()=>Li,UpdateCreditBundleDetailsRequestBodyStatus:()=>Gi,ZeroOutGrantRequestBodyReason:()=>Hi});var ji={PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",ExpirationPriority:"expiration_priority"};var ki={None:"none",Rollover:"rollover",Expire:"expire"};var Di={PlanFirstThenCreditBundlesFirstInFirstOut:"plan_first_then_credit_bundles_first_in_first_out",FirstInFirstOut:"first_in_first_out",LastInFirstOut:"last_in_first_out",ExpirationPriority:"expiration_priority"};var Vi={None:"none",Rollover:"rollover",Expire:"expire"};var qi={Active:"active",Inactive:"inactive"};var Mi={Active:"active",Inactive:"inactive"};var Ai={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Fi={Days:"days",BillingPeriods:"billing_periods"};var Ii={Active:"active",Inactive:"inactive"};var Ki={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Li={Days:"days",BillingPeriods:"billing_periods"};var Gi={Active:"active",Inactive:"inactive"};var Ni={Active:"active",Inactive:"inactive"};var Xi={Active:"active",Inactive:"inactive"};var Hi={PlanChange:"plan_change",Manual:"manual",PlanPeriodReset:"plan_period_reset",Expired:"expired"};var Wi={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Ji={Days:"days",BillingPeriods:"billing_periods"};var $i={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var Zi={Asc:"asc",Desc:"desc"};var Yi={Asc:"asc",Desc:"desc"};var Qi={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var ea={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var ra={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var oa={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var ta={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};var ia={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var aa={Days:"days",BillingPeriods:"billing_periods"};var sa={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var na={Days:"days",BillingPeriods:"billing_periods"};var ca={Monthly:"monthly",Yearly:"yearly",Daily:"daily",Weekly:"weekly"};var pa={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var la={PlanPeriod:"plan_period",NoReset:"no_reset"};var ma={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var ua={Days:"days",BillingPeriods:"billing_periods"};var da={Monthly:"monthly",Yearly:"yearly",Daily:"daily",Weekly:"weekly"};var ha={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var ga={PlanPeriod:"plan_period",NoReset:"no_reset"};var wa={};var Io={};re(Io,{CountCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ya,CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>za,CountEntityKeyDefinitionsRequestEntityType:()=>Sa,CountEntityKeyDefinitionsResponseParamsEntityType:()=>xa,CountEntityTraitDefinitionsRequestEntityType:()=>Ba,CountEntityTraitDefinitionsRequestTraitType:()=>ja,CountEntityTraitDefinitionsResponseParamsEntityType:()=>ka,CountEntityTraitDefinitionsResponseParamsTraitType:()=>Da,CreateEntityTraitDefinitionRequestBodyEntityType:()=>Ta,CreateEntityTraitDefinitionRequestBodyTraitType:()=>va,ListCompaniesForAdvancedFilterRequestSortOrderDirection:()=>Ra,ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>ba,ListEntityKeyDefinitionsRequestEntityType:()=>fa,ListEntityKeyDefinitionsResponseParamsEntityType:()=>_a,ListEntityTraitDefinitionsRequestEntityType:()=>Ea,ListEntityTraitDefinitionsRequestTraitType:()=>Ua,ListEntityTraitDefinitionsResponseParamsEntityType:()=>Pa,ListEntityTraitDefinitionsResponseParamsTraitType:()=>Ca,UpdateEntityTraitDefinitionRequestBodyTraitType:()=>Oa});var ya={Asc:"asc",Desc:"desc"};var za={Asc:"asc",Desc:"desc"};var Ra={Asc:"asc",Desc:"desc"};var ba={Asc:"asc",Desc:"desc"};var fa={Company:"company",User:"user"};var _a={Company:"company",User:"user"};var Sa={Company:"company",User:"user"};var xa={Company:"company",User:"user"};var Ea={Company:"company",User:"user"};var Ua={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Pa={Company:"company",User:"user"};var Ca={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ta={Company:"company",User:"user"};var va={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Oa={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ba={Company:"company",User:"user"};var ja={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var ka={Company:"company",User:"user"};var Da={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ko={};re(Ko,{CreateCompanyOverrideRequestBodyMetricPeriod:()=>Va,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>qa,CreateCompanyOverrideRequestBodyValueType:()=>Ma,CreatePlanEntitlementRequestBodyMetricPeriod:()=>Ka,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>La,CreatePlanEntitlementRequestBodyPriceBehavior:()=>Ga,CreatePlanEntitlementRequestBodyValueType:()=>Na,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>Aa,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Fa,UpdateCompanyOverrideRequestBodyValueType:()=>Ia,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>Xa,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Ha,UpdatePlanEntitlementRequestBodyPriceBehavior:()=>Wa,UpdatePlanEntitlementRequestBodyValueType:()=>Ja});var Va={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var qa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ma={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Aa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Fa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ia={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Ka={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var La={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ga={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var Na={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Xa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Ha={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Wa={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var Ja={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Lo={};re(Lo,{CountPlansRequestPlanType:()=>es,CountPlansResponseParamsPlanType:()=>rs,CreatePlanRequestBodyPlanType:()=>Ya,ListPlansRequestPlanType:()=>$a,ListPlansResponseParamsPlanType:()=>Za,UpsertBillingProductRequestBodyChargeType:()=>Qa});var $a={Plan:"plan",AddOn:"add_on"};var Za={Plan:"plan",AddOn:"add_on"};var Ya={Plan:"plan",AddOn:"add_on"};var Qa={OneTime:"one_time",Recurring:"recurring",Free:"free"};var es={Plan:"plan",AddOn:"add_on"};var rs={Plan:"plan",AddOn:"add_on"};var Go={};re(Go,{CreateComponentRequestBodyEntityType:()=>os,UpdateComponentRequestBodyEntityType:()=>ts,UpdateComponentRequestBodyState:()=>is});var os={Entitlement:"entitlement",Billing:"billing"};var ts={Entitlement:"entitlement",Billing:"billing"};var is={Draft:"draft",Live:"live"};var as={};var ss={};var No={};re(No,{ListEventsRequestEventTypesItem:()=>ns,ListEventsResponseParamsEventTypesItem:()=>cs});var ns={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var cs={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var Xo={};re(Xo,{CreateFeatureRequestBodyFeatureType:()=>ps,CreateFeatureRequestBodyLifecyclePhase:()=>ls,UpdateFeatureRequestBodyFeatureType:()=>ms,UpdateFeatureRequestBodyLifecyclePhase:()=>us});var ps={Boolean:"boolean",Event:"event",Trait:"trait"};var ls={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",InPlan:"in_plan",Inactive:"inactive",InternalTesting:"internal_testing",Legacy:"legacy"};var ms={Boolean:"boolean",Event:"event",Trait:"trait"};var us={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",InPlan:"in_plan",Inactive:"inactive",InternalTesting:"internal_testing",Legacy:"legacy"};var ds={};var hs={};var Ho={};re(Ho,{CreateWebhookRequestBodyRequestTypesItem:()=>gs,UpdateWebhookRequestBodyRequestTypesItem:()=>ws,UpdateWebhookRequestBodyStatus:()=>ys});var gs={CompanyUpdated:"company.updated",UserUpdated:"user.updated",PlanUpdated:"plan.updated",PlanEntitlementUpdated:"plan.entitlement.updated",CompanyOverrideUpdated:"company.override.updated",FeatureUpdated:"feature.updated",FlagUpdated:"flag.updated",FlagRulesUpdated:"flag_rules.updated",CompanyCreated:"company.created",UserCreated:"user.created",PlanCreated:"plan.created",PlanEntitlementCreated:"plan.entitlement.created",CompanyOverrideCreated:"company.override.created",FeatureCreated:"feature.created",FlagCreated:"flag.created",CompanyDeleted:"company.deleted",UserDeleted:"user.deleted",PlanDeleted:"plan.deleted",PlanEntitlementDeleted:"plan.entitlement.deleted",CompanyOverrideDeleted:"company.override.deleted",FeatureDeleted:"feature.deleted",FlagDeleted:"flag.deleted",TestSend:"test.send",SubscriptionTrialEnded:"subscription.trial.ended",EntitlementLimitWarning:"entitlement.limit.warning",EntitlementLimitReached:"entitlement.limit.reached",EntitlementSoftLimitWarning:"entitlement.soft_limit.warning",EntitlementSoftLimitReached:"entitlement.soft_limit.reached",EntitlementTierLimitWarning:"entitlement.tier_limit.warning",EntitlementTierLimitReached:"entitlement.tier_limit.reached",CreditLimitWarning:"credit.limit.warning",CreditLimitReached:"credit.limit.reached",CompanyPlanChange:"company.plan_change"};var ws={CompanyUpdated:"company.updated",UserUpdated:"user.updated",PlanUpdated:"plan.updated",PlanEntitlementUpdated:"plan.entitlement.updated",CompanyOverrideUpdated:"company.override.updated",FeatureUpdated:"feature.updated",FlagUpdated:"flag.updated",FlagRulesUpdated:"flag_rules.updated",CompanyCreated:"company.created",UserCreated:"user.created",PlanCreated:"plan.created",PlanEntitlementCreated:"plan.entitlement.created",CompanyOverrideCreated:"company.override.created",FeatureCreated:"feature.created",FlagCreated:"flag.created",CompanyDeleted:"company.deleted",UserDeleted:"user.deleted",PlanDeleted:"plan.deleted",PlanEntitlementDeleted:"plan.entitlement.deleted",CompanyOverrideDeleted:"company.override.deleted",FeatureDeleted:"feature.deleted",FlagDeleted:"flag.deleted",TestSend:"test.send",SubscriptionTrialEnded:"subscription.trial.ended",EntitlementLimitWarning:"entitlement.limit.warning",EntitlementLimitReached:"entitlement.limit.reached",EntitlementSoftLimitWarning:"entitlement.soft_limit.warning",EntitlementSoftLimitReached:"entitlement.soft_limit.reached",EntitlementTierLimitWarning:"entitlement.tier_limit.warning",EntitlementTierLimitReached:"entitlement.tier_limit.reached",CreditLimitWarning:"credit.limit.warning",CreditLimitReached:"credit.limit.reached",CompanyPlanChange:"company.plan_change"};var ys={Active:"active",Inactive:"inactive"};var Ag={Licensed:"licensed",Metered:"metered"};var Fg={BasePlan:"base_plan",BillingProduct:"billing_product",Company:"company",Credit:"credit",CrmProduct:"crm_product",Metric:"metric",Plan:"plan",Trait:"trait",User:"user"};var Ig={AllTime:"all_time",CurrentDay:"current_day",CurrentMonth:"current_month",CurrentWeek:"current_week"};var Kg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Lg={Eq:"eq",Ne:"ne",Gt:"gt",Lt:"lt",Gte:"gte",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Gg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Ng={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Xg={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Hg={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var Wg={Company:"company",Metric:"metric",Trait:"trait",User:"user",Plan:"plan",BillingProduct:"billing_product",CrmProduct:"crm_product",BasePlan:"base_plan"};var Jg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var $g={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Zg={Eq:"eq",Ne:"ne",Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var Yg={GlobalOverride:"global_override",CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Standard:"standard",Default:"default"};var Qg={Free:"free",Plan:"plan",Purchased:"purchased"};var ew={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var rw={Days:"days",BillingPeriods:"billing_periods"};var ow={Monthly:"monthly",Yearly:"yearly",Daily:"daily",Weekly:"weekly"};var tw={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var iw={PlanPeriod:"plan_period",NoReset:"no_reset"};var aw={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var sw={Free:"free",Plan:"plan",Purchased:"purchased"};var nw={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited",Unknown:"unknown"};var cw={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var pw={Free:"free",Plan:"plan",Purchased:"purchased"};var lw={Checkout:"checkout",CompanyUpsert:"company_upsert",FallbackPlan:"fallback_plan",ManagePlan:"manage_plan",Migration:"migration",PlanBillingProductChanged:"plan_billing_product_changed",PlanDeleted:"plan_deleted",Quickstart:"quickstart",SubscriptionChange:"subscription_change"};var mw={AppUser:"app_user",ApiKey:"api_key",System:"system",TemporaryAccessToken:"temporary_access_token"};var uw={Fallback:"fallback",Initial:"initial",Trait:"trait",TrialExpiry:"trial_expiry"};var dw={Downgrade:"downgrade",Invalid:"invalid",Subscribe:"subscribe",Unsubscribe:"unsubscribe",Upgrade:"upgrade",UpgradeTrial:"upgrade_trial"};var hw={Default:"default",GlobalOverride:"global_override",CompanyOverride:"company_override",CompanyOverrideUsageExceeded:"company_override_usage_exceeded",PlanEntitlement:"plan_entitlement",PlanEntitlementUsageExceeded:"plan_entitlement_usage_exceeded",Standard:"standard"};var gw={Bool:"bool",Date:"date",Int:"int",String:"string"};var ww={User:"user",Company:"company"};var yw={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var zw={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Rw={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var bw={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var pe=(w,t,o)=>JSON.stringify(w,t,o);var c=class w extends Error{constructor({message:t,statusCode:o,body:r,rawResponse:i}){super(fw({message:t,statusCode:o,body:r})),Object.setPrototypeOf(this,w.prototype),this.statusCode=o,this.body=r,this.rawResponse=i}};function fw({message:w,statusCode:t,body:o}){let r=[];return w!=null&&r.push(w),t!=null&&r.push(`Status code: ${t.toString()}`),o!=null&&r.push(`Body: ${pe(o,void 0,2)}`),r.join(`
2
+ `)}var R=class w extends Error{constructor(t){super(t),Object.setPrototypeOf(this,w.prototype)}};var P=class w extends c{constructor(t,o){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var S=class w extends c{constructor(t,o){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var x=class w extends c{constructor(t,o){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var E=class w extends c{constructor(t,o){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var U=class w extends c{constructor(t,o){super({message:"InternalServerError",statusCode:500,body:t,rawResponse:o}),Object.setPrototypeOf(this,w.prototype)}};var yr=require("timers"),He=class{constructor({maxItems:t=1e3,ttl:o=5e3}={}){this.accessCounter=0;this.cache=new Map,this.maxItems=t,this.defaultTTL=o}async get(t){let o=this.cache.get(t);if(o){if(o.expiration<=Date.now()){this.evictItem(t,o);return}return this.accessCounter++,o.accessCounter=this.accessCounter,this.cache.set(t,o),o.value}}async set(t,o,r){if(this.maxItems===0)return;let i=r??this.defaultTTL,m=this.cache.get(t);m&&this.evictItem(t,m),this.evictExpiredItems(),this.evictLRUItems(),this.accessCounter++;let g={value:o,accessCounter:this.accessCounter,expiration:Date.now()+i,timeoutId:(0,yr.setTimeout)(()=>this.evictItem(t,g),i)};this.cache.set(t,g)}resetCache(){this.cache.forEach(t=>{t.timeoutId&&(0,yr.clearTimeout)(t.timeoutId)}),this.cache.clear(),this.accessCounter=0}evictItem(t,o){o.timeoutId&&(0,yr.clearTimeout)(o.timeoutId),this.cache.delete(t)}evictExpiredItems(){this.cache.forEach((t,o)=>{t.expiration<=Date.now()&&this.evictItem(o,t)})}evictLRUItems(){for(;this.cache.size>=this.maxItems;){let t,o=Number.MAX_SAFE_INTEGER;this.cache.forEach((r,i)=>{r.accessCounter<o&&(t=i,o=r.accessCounter)}),t&&this.evictItem(t,this.cache.get(t))}}};var f={Default:"https://api.schematichq.com"};var Ae;typeof globalThis.Headers<"u"?Ae=globalThis.Headers:Ae=class zs{constructor(t){if(this.headers=new Map,t)if(t instanceof zs)t.forEach((o,r)=>this.append(r,o));else if(Array.isArray(t))for(let[o,r]of t)if(typeof o=="string"&&typeof r=="string")this.append(o,r);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[o,r]of Object.entries(t))if(typeof r=="string")this.append(o,r);else throw new TypeError("Header values must be strings")}append(t,o){let r=t.toLowerCase(),i=this.headers.get(r)||[];this.headers.set(r,[...i,o])}delete(t){let o=t.toLowerCase();this.headers.delete(o)}get(t){let o=t.toLowerCase(),r=this.headers.get(o);return r?r.join(", "):null}has(t){let o=t.toLowerCase();return this.headers.has(o)}set(t,o){let r=t.toLowerCase();this.headers.set(r,[o])}forEach(t,o){let r=o?t.bind(o):t;this.headers.forEach((i,m)=>r(i.join(", "),m,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,o]of this.headers.entries())yield[t,o.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let t of this.headers.values())yield t.join(", ")}[Symbol.iterator](){return this.entries()}};var Fe={headers:new Ae,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},Ie={headers:new Ae,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function We(w){return{headers:w.headers,redirected:w.redirected,status:w.status,statusText:w.statusText,type:w.type,url:w.url}}var Rs=H(require("qs"));function xr(w,t){return Object.keys(t??{}).length>0?`${w}?${Rs.default.stringify(t,{arrayFormat:"repeat"})}`:w}var h=_w();function _w(){return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.name==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!process.versions?.node?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:{type:"unknown"}}async function Er(){return h.type==="node"&&h.parsedVersion!=null&&h.parsedVersion>=18?fetch:h.type==="node"?(await import("node-fetch")).default:typeof fetch=="function"?fetch:(await import("node-fetch")).default}async function Ur({body:w,type:t}){return t.includes("json")?pe(w):w}async function Us(w){return h.type==="node"&&h.parsedVersion!=null&&h.parsedVersion>=18?new(await Promise.resolve().then(()=>(fs(),bs))).Node18UniversalStreamWrapper(w):h.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(Ss(),_s))).UndiciStreamWrapper(w):new(await Promise.resolve().then(()=>(Es(),xs))).NodePre18StreamWrapper(w)}async function Pr(w,t){if(w.body!=null&&t==="blob")return await w.blob();if(w.body!=null&&t==="arrayBuffer")return await w.arrayBuffer();if(w.body!=null&&t==="sse")return w.body;if(w.body!=null&&t==="streaming")return Us(w.body);if(w.body!=null&&t==="text")return await w.text();{let o=await w.text();if(o.length>0)try{return JSON.parse(o)}catch{return{ok:!1,error:{reason:"non-json",statusCode:w.status,rawBody:o}}}else return}}var Sw="timeout";function Ps(w){let t=new AbortController,o=setTimeout(()=>t.abort(Sw),w);return{signal:t.signal,abortId:o}}function Cs(...w){let t=w.length===1&&Array.isArray(w[0])?w[0]:w,o=new AbortController;for(let r of t){if(r.aborted){o.abort(r?.reason);break}r.addEventListener("abort",()=>o.abort(r?.reason),{signal:o.signal})}return o.signal}var Cr=async(w,t,o,r,i,m,g,p,s)=>{let l=[],u;if(m!=null){let{signal:C,abortId:O}=Ps(m);u=O,l.push(C)}g!=null&&l.push(g);let z=Cs(l),y=await w(t,{method:o,headers:r,body:i,signal:z,credentials:p?"include":void 0,duplex:s});return u!=null&&clearTimeout(u),y};function xw(w){let t=1+(Math.random()*2-1)*.2;return w*t}async function Tr(w,t=2){let o=await w();for(let r=0;r<t&&([408,429].includes(o.status)||o.status>=500);++r){let i=Math.min(1e3*Math.pow(2,r),6e4),m=xw(i);await new Promise(g=>setTimeout(g,m)),o=await w()}return o}async function Ew(w){let t={};if(w.body!==void 0&&w.contentType!=null&&(t["Content-Type"]=w.contentType),w.headers!=null)for(let[m,g]of Object.entries(w.headers))g!=null&&(t[m]=g);let o=xr(w.url,w.queryParameters),r=await Ur({body:w.body,type:w.requestType==="json"?"json":"other"}),i=await Er();try{let m=await Tr(async()=>Cr(i,o,w.method,t,r,w.timeoutMs,w.abortSignal,w.withCredentials,w.duplex),w.maxRetries),g=await Pr(m,w.responseType);return m.status>=200&&m.status<400?{ok:!0,body:g,headers:m.headers,rawResponse:We(m)}:{ok:!1,error:{reason:"status-code",statusCode:m.status,body:g},rawResponse:We(m)}}catch(m){return w.abortSignal!=null&&w.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Fe}:m instanceof Error&&m.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:Fe}:m instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:m.message},rawResponse:Ie}:{ok:!1,error:{reason:"unknown",errorMessage:pe(m)},rawResponse:Ie}}}var _=Ew;var d={get:async w=>typeof w=="function"?w():w};var b=class w extends Promise{constructor(t){super(o=>{o(void 0)}),this.innerPromise=t}static fromFunction(t,...o){return new w(t(...o))}static interceptFunction(t){return(...o)=>w.fromPromise(t(...o))}static fromPromise(t){return new w(t)}static fromExecutor(t){let o=new Promise(t);return new w(o)}static fromResult(t){let o=Promise.resolve(t);return new w(o)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,o){return this.unwrap().then(t,o)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}async withRawResponse(){return await this.innerPromise}};var e={};re(e,{JsonError:()=>Je,ParseError:()=>$e,any:()=>Ls,bigint:()=>vs,boolean:()=>Gs,booleanLiteral:()=>Ks,date:()=>Os,discriminant:()=>Qs,enum_:()=>Or,getObjectLikeUtils:()=>ye,getObjectUtils:()=>Ke,getSchemaUtils:()=>F,isProperty:()=>Ce,lazy:()=>Bs,lazyObject:()=>As,list:()=>jr,number:()=>Ns,object:()=>Br,objectWithoutOptionalProperties:()=>Ms,optional:()=>Zo,property:()=>ks,record:()=>Js,set:()=>$s,string:()=>Xs,stringLiteral:()=>Is,transform:()=>Yo,undiscriminatedUnion:()=>Ys,union:()=>rn,unknown:()=>Hs,withParsedProperties:()=>et});var k={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function A(w,t){return`Expected ${t}. Received ${Uw(w)}.`}function Uw(w){if(Array.isArray(w))return"list";if(w===null)return"null";if(w instanceof BigInt)return"BigInt";switch(typeof w){case"string":return`"${w}"`;case"bigint":case"number":case"boolean":case"undefined":return`${w}`}return typeof w}function Y(w){return{...w,json:Ts(w.json),parse:Ts(w.parse)}}function Ts(w){return(t,o)=>{let r=w(t,o),{skipValidation:i=!1}=o??{};return!r.ok&&i?(console.warn(["Failed to validate.",...r.errors.map(m=>" - "+(m.path.length>0?`${m.path.join(".")}: ${m.message}`:m.message))].join(`
3
+ `)),{ok:!0,value:t}):r}}function vr(w){return w.path.length===0?w.message:`${w.path.join(" -> ")}: ${w.message}`}var Je=class w extends Error{constructor(o){super(o.map(vr).join("; "));this.errors=o;Object.setPrototypeOf(this,w.prototype)}};var $e=class w extends Error{constructor(o){super(o.map(vr).join("; "));this.errors=o;Object.setPrototypeOf(this,w.prototype)}};function F(w){return{nullable:()=>Pw(w),optional:()=>Zo(w),optionalNullable:()=>Cw(w),transform:t=>Yo(w,t),parseOrThrow:(t,o)=>{let r=w.parse(t,o);if(r.ok)return r.value;throw new $e(r.errors)},jsonOrThrow:(t,o)=>{let r=w.json(t,o);if(r.ok)return r.value;throw new Je(r.errors)}}}function Pw(w){let t={parse:(o,r)=>o==null?{ok:!0,value:null}:w.parse(o,r),json:(o,r)=>o==null?{ok:!0,value:null}:w.json(o,r),getType:()=>k.NULLABLE};return{...t,...F(t)}}function Zo(w){let t={parse:(o,r)=>o==null?{ok:!0,value:void 0}:w.parse(o,r),json:(o,r)=>r?.omitUndefined&&o===void 0?{ok:!0,value:void 0}:o==null?{ok:!0,value:null}:w.json(o,r),getType:()=>k.OPTIONAL};return{...t,...F(t)}}function Cw(w){let t={parse:(o,r)=>o===void 0?{ok:!0,value:void 0}:o===null?{ok:!0,value:null}:w.parse(o,r),json:(o,r)=>o===void 0?{ok:!0,value:void 0}:o===null?{ok:!0,value:null}:w.json(o,r),getType:()=>k.OPTIONAL_NULLABLE};return{...t,...F(t)}}function Yo(w,t){let o={parse:(r,i)=>{let m=w.parse(r,i);return m.ok?{ok:!0,value:t.transform(m.value)}:m},json:(r,i)=>{let m=t.untransform(r);return w.json(m,i)},getType:()=>w.getType()};return{...o,...F(o)}}function vs(){let w={parse:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:o,message:A(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:o,message:A(t,"bigint")}]}:{ok:!0,value:t},getType:()=>k.BIGINT};return{...Y(w),...F(w)}}var Tw=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Os(){let w={parse:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:o,message:A(t,"string")}]}:Tw.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:o,message:A(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:o=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:o,message:A(t,"Date object")}]},getType:()=>k.DATE};return{...Y(w),...F(w)}}function te(w,t){return()=>{let o={parse:t,json:t,getType:()=>w};return{...Y(o),...F(o)}}}function Or(w){let t=new Set(w);return te(k.ENUM,(r,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:m=[]}={})=>typeof r!="string"?{ok:!1,errors:[{path:m,message:A(r,"string")}]}:!t.has(r)&&!i?{ok:!1,errors:[{path:m,message:A(r,"enum")}]}:{ok:!0,value:r})()}function Bs(w){let t=Qo(w);return{...t,...F(t)}}function Qo(w){return{parse:(t,o)=>Ze(w).parse(t,o),json:(t,o)=>Ze(w).json(t,o),getType:()=>Ze(w).getType()}}function Ze(w){let t=w;return t.__zurg_memoized==null&&(t.__zurg_memoized=w()),t.__zurg_memoized}function zr(w){return Object.entries(w)}function Rr(w,t){let o=new Set(t);return Object.entries(w).reduce((r,[i,m])=>(o.has(i)&&(r[i]=m),r),{})}function Pe(w){if(typeof w!="object"||w===null)return!1;if(Object.getPrototypeOf(w)===null)return!0;let t=w;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(w)===t}function br(w){return Object.keys(w)}function js(w,t){let o=[],r=[];for(let i of w)t(i)?o.push(i):r.push(i);return[o,r]}function ye(w){return{withParsedProperties:t=>et(w,t)}}function et(w,t){let o={parse:(r,i)=>{let m=w.parse(r,i);if(!m.ok)return m;let g=Object.entries(t).reduce((p,[s,l])=>({...p,[s]:typeof l=="function"?l(m.value):l}),{});return{ok:!0,value:{...m.value,...g}}},json:(r,i)=>{if(!Pe(r))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:A(r,"object")}]};let m=new Set(Object.keys(t)),g=Rr(r,Object.keys(r).filter(p=>!m.has(p)));return w.json(g,i)},getType:()=>w.getType()};return{...o,...F(o),...ye(o)}}function ks(w,t){return{rawKey:w,valueSchema:t,isProperty:!0}}function Ce(w){return w.isProperty}function Br(w){let t={_getRawProperties:()=>Object.entries(w).map(([o,r])=>Ce(r)?r.rawKey:o),_getParsedProperties:()=>br(w),parse:(o,r)=>{let i={},m=[];for(let[g,p]of zr(w)){let s=Ce(p)?p.rawKey:g,l=Ce(p)?p.valueSchema:p,u={rawKey:s,parsedKey:g,valueSchema:l};i[s]=u,qs(l)&&m.push(s)}return Ds({value:o,requiredKeys:m,getProperty:g=>{let p=i[g];if(p!=null)return{transformedKey:p.parsedKey,transform:s=>p.valueSchema.parse(s,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],g]})}},unrecognizedObjectKeys:r?.unrecognizedObjectKeys,skipValidation:r?.skipValidation,breadcrumbsPrefix:r?.breadcrumbsPrefix,omitUndefined:r?.omitUndefined})},json:(o,r)=>{let i=[];for(let[m,g]of zr(w)){let p=Ce(g)?g.valueSchema:g;qs(p)&&i.push(m)}return Ds({value:o,requiredKeys:i,getProperty:m=>{let g=w[m];if(g!=null)return Ce(g)?{transformedKey:g.rawKey,transform:p=>g.valueSchema.json(p,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],m]})}:{transformedKey:m,transform:p=>g.json(p,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],m]})}},unrecognizedObjectKeys:r?.unrecognizedObjectKeys,skipValidation:r?.skipValidation,breadcrumbsPrefix:r?.breadcrumbsPrefix,omitUndefined:r?.omitUndefined})},getType:()=>k.OBJECT};return{...Y(t),...F(t),...ye(t),...Ke(t)}}function Ds({value:w,requiredKeys:t,getProperty:o,unrecognizedObjectKeys:r="fail",skipValidation:i=!1,breadcrumbsPrefix:m=[]}){if(!Pe(w))return{ok:!1,errors:[{path:m,message:A(w,"object")}]};let g=new Set(t),p=[],s={};for(let[l,u]of Object.entries(w)){let z=o(l);if(z!=null){g.delete(l);let y=z.transform(u);y.ok?s[z.transformedKey]=y.value:(s[l]=u,p.push(...y.errors))}else switch(r){case"fail":p.push({path:[...m,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":s[l]=u;break}}return p.push(...t.filter(l=>g.has(l)).map(l=>({path:m,message:`Missing required key "${l}"`}))),p.length===0||i?{ok:!0,value:s}:{ok:!1,errors:p}}function Ke(w){return{extend:t=>{let o={_getParsedProperties:()=>[...w._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...w._getRawProperties(),...t._getRawProperties()],parse:(r,i)=>Vs({extensionKeys:t._getRawProperties(),value:r,transformBase:m=>w.parse(m,i),transformExtension:m=>t.parse(m,i)}),json:(r,i)=>Vs({extensionKeys:t._getParsedProperties(),value:r,transformBase:m=>w.json(m,i),transformExtension:m=>t.json(m,i)}),getType:()=>k.OBJECT};return{...o,...F(o),...ye(o),...Ke(o)}},passthrough:()=>{let t={_getParsedProperties:()=>w._getParsedProperties(),_getRawProperties:()=>w._getRawProperties(),parse:(o,r)=>{let i=w.parse(o,{...r,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...o,...i.value}}:i},json:(o,r)=>{let i=w.json(o,{...r,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...o,...i.value}}:i},getType:()=>k.OBJECT};return{...t,...F(t),...ye(t),...Ke(t)}}}}function Vs({extensionKeys:w,value:t,transformBase:o,transformExtension:r}){let i=new Set(w),[m,g]=js(br(t),l=>i.has(l)),p=o(Rr(t,g)),s=r(Rr(t,m));return p.ok&&s.ok?{ok:!0,value:{...p.value,...s.value}}:{ok:!1,errors:[...p.ok?[]:p.errors,...s.ok?[]:s.errors]}}function qs(w){return!vw(w)}function vw(w){switch(w.getType()){case k.ANY:case k.UNKNOWN:case k.OPTIONAL:case k.OPTIONAL_NULLABLE:return!0;default:return!1}}function Ms(w){return Br(w)}function As(w){let t={...Qo(w),_getRawProperties:()=>Ze(w)._getRawProperties(),_getParsedProperties:()=>Ze(w)._getParsedProperties()};return{...t,...F(t),...ye(t),...Ke(t)}}function jr(w){let t={parse:(o,r)=>Fs(o,(i,m)=>w.parse(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),json:(o,r)=>Fs(o,(i,m)=>w.json(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),getType:()=>k.LIST};return{...Y(t),...F(t)}}function Fs(w,t){return Array.isArray(w)?w.map((r,i)=>t(r,i)).reduce((r,i)=>{if(r.ok&&i.ok)return{ok:!0,value:[...r.value,i.value]};let m=[];return r.ok||m.push(...r.errors),i.ok||m.push(...i.errors),{ok:!1,errors:m}},{ok:!0,value:[]}):{ok:!1,errors:[{message:A(w,"list"),path:[]}]}}function Is(w){return te(k.STRING_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===w?{ok:!0,value:w}:{ok:!1,errors:[{path:r,message:A(o,`"${w}"`)}]})()}function Ks(w){return te(k.BOOLEAN_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===w?{ok:!0,value:w}:{ok:!1,errors:[{path:r,message:A(o,`${w.toString()}`)}]})()}var Ls=te(k.ANY,w=>({ok:!0,value:w}));var Gs=te(k.BOOLEAN,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="boolean"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:A(w,"boolean")}]});var Ns=te(k.NUMBER,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="number"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:A(w,"number")}]});var Xs=te(k.STRING,(w,{breadcrumbsPrefix:t=[]}={})=>typeof w=="string"?{ok:!0,value:w}:{ok:!1,errors:[{path:t,message:A(w,"string")}]});var Hs=te(k.UNKNOWN,w=>({ok:!0,value:w}));function Js(w,t){let o={parse:(r,i)=>Ws({value:r,isKeyNumeric:w.getType()===k.NUMBER,transformKey:m=>w.parse(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${m} (key)`]}),transformValue:(m,g)=>t.parse(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${g}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(r,i)=>Ws({value:r,isKeyNumeric:w.getType()===k.NUMBER,transformKey:m=>w.json(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${m} (key)`]}),transformValue:(m,g)=>t.json(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${g}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>k.RECORD};return{...Y(o),...F(o)}}function Ws({value:w,isKeyNumeric:t,transformKey:o,transformValue:r,breadcrumbsPrefix:i=[]}){return Pe(w)?zr(w).reduce((m,[g,p])=>{if(p===void 0)return m;let s=m,l=g;if(t){let C=g.length>0?Number(g):NaN;isNaN(C)||(l=C)}let u=o(l),z=r(p,l);if(s.ok&&u.ok&&z.ok)return{ok:!0,value:{...s.value,[u.value]:z.value}};let y=[];return s.ok||y.push(...s.errors),u.ok||y.push(...u.errors),z.ok||y.push(...z.errors),{ok:!1,errors:y}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:A(w,"object")}]}}function $s(w){let t=jr(w),o={parse:(r,i)=>{let m=t.parse(r,i);return m.ok?{ok:!0,value:new Set(m.value)}:m},json:(r,i)=>r instanceof Set?t.json([...r],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:A(r,"Set")}]},getType:()=>k.SET};return{...Y(o),...F(o)}}function Ys(w){let t={parse:(o,r)=>Zs((i,m)=>i.parse(o,m),w,r),json:(o,r)=>Zs((i,m)=>i.json(o,m),w,r),getType:()=>k.UNDISCRIMINATED_UNION};return{...Y(t),...F(t)}}function Zs(w,t,o){let r=[];for(let[i,m]of t.entries()){let g=w(m,{...o,skipValidation:!1});if(g.ok)return g;for(let p of g.errors)r.push({path:p.path,message:`[Variant ${i}] ${p.message}`})}return{ok:!1,errors:r}}function Qs(w,t){return{parsedDiscriminant:w,rawDiscriminant:t}}function rn(w,t){let o=typeof w=="string"?w:w.rawDiscriminant,r=typeof w=="string"?w:w.parsedDiscriminant,i=Or(br(t)),m={parse:(g,p)=>en({value:g,discriminant:o,transformedDiscriminant:r,transformDiscriminantValue:s=>i.parse(s,{allowUnrecognizedEnumValues:p?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...p?.breadcrumbsPrefix??[],o]}),getAdditionalPropertiesSchema:s=>t[s],allowUnrecognizedUnionMembers:p?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(s,l)=>l.parse(s,p),breadcrumbsPrefix:p?.breadcrumbsPrefix}),json:(g,p)=>en({value:g,discriminant:r,transformedDiscriminant:o,transformDiscriminantValue:s=>i.json(s,{allowUnrecognizedEnumValues:p?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...p?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:s=>t[s],allowUnrecognizedUnionMembers:p?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(s,l)=>l.json(s,p),breadcrumbsPrefix:p?.breadcrumbsPrefix}),getType:()=>k.UNION};return{...Y(m),...F(m),...ye(m)}}function en({value:w,discriminant:t,transformedDiscriminant:o,transformDiscriminantValue:r,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:m=!1,transformAdditionalProperties:g,breadcrumbsPrefix:p=[]}){if(!Pe(w))return{ok:!1,errors:[{path:p,message:A(w,"object")}]};let{[t]:s,...l}=w;if(s==null)return{ok:!1,errors:[{path:p,message:`Missing discriminant ("${t}")`}]};let u=r(s);if(!u.ok)return{ok:!1,errors:u.errors};let z=i(u.value);if(z==null)return m?{ok:!0,value:{[o]:u.value,...l}}:{ok:!1,errors:[{path:[...p,t],message:"Unexpected discriminant value"}]};let y=g(l,z);return y.ok?{ok:!0,value:{[o]:s,...y.value}}:y}var ui=H(require("url-join"));var ae=H(require("url-join"));var on=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var me=e.object({createdAt:e.property("created_at",e.date()),description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),lastUsedAt:e.property("last_used_at",e.date().optional()),name:e.string(),scopes:e.list(e.string()),updatedAt:e.property("updated_at",e.date())});var tn=e.object({data:e.list(me),params:on});var an=e.object({createdAt:e.property("created_at",e.date()),description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),lastUsedAt:e.property("last_used_at",e.date().optional()),name:e.string(),scopes:e.list(e.string()),secret:e.string(),updatedAt:e.property("updated_at",e.date())});var sn=e.object({data:an,params:e.record(e.string(),e.unknown())});var nn=e.object({data:me,params:e.record(e.string(),e.unknown())});var cn=e.object({data:me,params:e.record(e.string(),e.unknown())});var M=e.object({deleted:e.boolean().optional()});var pn=e.object({data:M,params:e.record(e.string(),e.unknown())});var ln=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),requireEnvironment:e.property("require_environment",e.boolean().optional())});var j=e.object({count:e.number().optional()});var mn=e.object({data:j,params:ln});var un=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),requestType:e.property("request_type",e.string().optional())});var kr=e.object({apiKeyId:e.property("api_key_id",e.string()),endedAt:e.property("ended_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),method:e.string(),reqBody:e.property("req_body",e.string().optional()),requestType:e.property("request_type",e.string().optional()),resourceId:e.property("resource_id",e.number().optional()),resourceIdString:e.property("resource_id_string",e.string().optional()),resourceName:e.property("resource_name",e.string().optional()),resourceType:e.property("resource_type",e.string().optional()),respCode:e.property("resp_code",e.number().optional()),secondaryResource:e.property("secondary_resource",e.string().optional()),startedAt:e.property("started_at",e.date()),url:e.string(),userName:e.property("user_name",e.string().optional())});var dn=e.object({data:e.list(kr),params:un});var hn=e.object({apiKey:e.property("api_key",me.optional()),apiKeyId:e.property("api_key_id",e.string()),endedAt:e.property("ended_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),id:e.string(),method:e.string(),reqBody:e.property("req_body",e.string().optional()),requestType:e.property("request_type",e.string().optional()),resourceId:e.property("resource_id",e.number().optional()),resourceIdString:e.property("resource_id_string",e.string().optional()),resourceName:e.property("resource_name",e.string().optional()),resourceType:e.property("resource_type",e.string().optional()),respBody:e.property("resp_body",e.string().optional()),respCode:e.property("resp_code",e.number().optional()),secondaryResource:e.property("secondary_resource",e.string().optional()),startedAt:e.property("started_at",e.date()),url:e.string(),userAgent:e.property("user_agent",e.string().optional()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var gn=e.object({data:hn,params:e.record(e.string(),e.unknown())});var wn=e.object({environmentId:e.property("environment_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),requestType:e.property("request_type",e.string().optional())});var yn=e.object({data:j,params:wn});var zn=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var Ye=e.object({createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",e.string()),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Rn=e.object({data:e.list(Ye),params:zn});var bn=e.enum_(["development","staging","production"]);var fn=e.object({apiKeys:e.property("api_keys",e.list(me)),createdAt:e.property("created_at",e.date()),environmentType:e.property("environment_type",e.string()),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var _n=e.object({data:fn,params:e.record(e.string(),e.unknown())});var Sn=e.object({data:Ye,params:e.record(e.string(),e.unknown())});var xn=e.enum_(["development","staging","production"]);var En=e.object({data:Ye,params:e.record(e.string(),e.unknown())});var Un=e.object({data:M,params:e.record(e.string(),e.unknown())});var Pn=e.object({ok:e.boolean()});var Cn=e.object({data:Pn,params:e.record(e.string(),e.unknown())});var rt=e.object({description:e.string().optional(),environmentId:e.property("environment_id",e.string().optional()),name:e.string()});var ot=e.object({description:e.string().optional(),name:e.string().optional()});var tt=e.object({environmentType:e.property("environment_type",bn),name:e.string()});var it=e.object({environmentType:e.property("environment_type",xn.optional()),name:e.string().optional()});var Tn=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Dr=e.object({accountId:e.property("account_id",e.string()),amountOff:e.property("amount_off",e.number().optional()),currency:e.string().optional(),duration:e.string().optional(),durationInMonths:e.property("duration_in_months",e.number().optional()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),isActive:e.property("is_active",e.boolean()),maxRedemptions:e.property("max_redemptions",e.number().optional()),metadata:e.record(e.string(),e.unknown()),name:e.string(),percentOff:e.property("percent_off",e.number().optional()),timesRedeemed:e.property("times_redeemed",e.number()),validFrom:e.property("valid_from",e.date().optional()),validUntil:e.property("valid_until",e.date().optional())});var vn=e.object({data:e.list(Dr),params:Tn});var On=e.object({data:Dr,params:e.record(e.string(),e.unknown())});var Bn=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),failedToImport:e.property("failed_to_import",e.boolean()),id:e.string(),name:e.string(),updatedAt:e.property("updated_at",e.date())});var jn=e.object({data:Bn,params:e.record(e.string(),e.unknown())});var kn=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),failedToImport:e.property("failed_to_import",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),q:e.string().optional()});var Dn=e.object({currency:e.string(),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),meteredUsage:e.property("metered_usage",e.boolean()),perUnitPrice:e.property("per_unit_price",e.number()),totalPrice:e.property("total_price",e.number())});var Vn=e.object({companyId:e.property("company_id",e.string().optional()),deletedAt:e.property("deleted_at",e.date().optional()),email:e.string(),externalId:e.property("external_id",e.string()),failedToImport:e.property("failed_to_import",e.boolean()),id:e.string(),name:e.string(),subscriptions:e.list(Dn),updatedAt:e.property("updated_at",e.date())});var qn=e.object({data:e.list(Vn),params:kn});var Mn=e.object({companyIds:e.property("company_ids",e.list(e.string()).optional()),failedToImport:e.property("failed_to_import",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),q:e.string().optional()});var An=e.object({data:j,params:Mn});var Fn=e.object({companyId:e.property("company_id",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),subscriptionExternalId:e.property("subscription_external_id",e.string().optional())});var le=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string().optional()),id:e.string(),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),updatedAt:e.property("updated_at",e.date()),url:e.string().optional()});var In=e.object({data:e.list(le),params:Fn});var Kn=e.object({data:le,params:e.record(e.string(),e.unknown())});var Ln=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Vr=e.object({dispalyName:e.property("dispaly_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string()),externalPriceId:e.property("external_price_id",e.string()),id:e.string()});var Gn=e.object({data:e.list(Vr),params:Ln});var Nn=e.object({data:Vr,params:e.record(e.string(),e.unknown())});var Xn=e.object({companyId:e.property("company_id",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var ce=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),customerExternalId:e.property("customer_external_id",e.string()),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),paymentMethodType:e.property("payment_method_type",e.string()),updatedAt:e.property("updated_at",e.date())});var Hn=e.object({data:e.list(ce),params:Xn});var Wn=e.object({data:ce,params:e.record(e.string(),e.unknown())});var Jn=e.enum_(["volume","graduated"]);var $n=e.enum_(["licensed","metered"]);var Zn=e.enum_(["volume","graduated"]);var Yn=e.enum_(["licensed","metered"]);var Qn=e.object({forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),ids:e.list(e.string()).optional(),interval:e.string().optional(),limit:e.number().optional(),offset:e.number().optional(),price:e.number().optional(),productId:e.property("product_id",e.string().optional()),q:e.string().optional(),requiresPaymentMethod:e.property("requires_payment_method",e.boolean().optional()),tiersMode:e.property("tiers_mode",Zn.optional()),usageType:e.property("usage_type",Yn.optional())});var qr=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),upTo:e.property("up_to",e.number().optional())});var Q=e.object({billingScheme:e.property("billing_scheme",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:e.string(),isActive:e.property("is_active",e.boolean()),meterEventName:e.property("meter_event_name",e.string().optional()),meterEventPayloadKey:e.property("meter_event_payload_key",e.string().optional()),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceId:e.property("price_id",e.string()),priceTier:e.property("price_tier",e.list(qr)),productExternalId:e.property("product_external_id",e.string()),productId:e.property("product_id",e.string()),productName:e.property("product_name",e.string()),tiersMode:e.property("tiers_mode",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",e.string())});var ec=e.object({data:e.list(Q),params:Qn});var rc=e.enum_(["per_unit","tiered"]);var oc=e.enum_(["volume","graduated"]);var tc=e.enum_(["licensed","metered"]);var I=e.object({currency:e.string(),externalPriceId:e.property("external_price_id",e.string()),id:e.string(),interval:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),scheme:e.string()});var ic=e.object({data:I,params:e.record(e.string(),e.unknown())});var ac=e.object({data:M,params:e.record(e.string(),e.unknown())});var sc=e.enum_(["licensed","metered"]);var nc=e.enum_(["licensed","metered"]);var cc=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",nc.optional()),q:e.string().optional(),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var pc=e.object({data:e.list(I),params:cc});var lc=e.object({data:M,params:e.record(e.string(),e.unknown())});var Qe=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string().optional(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),name:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),productId:e.property("product_id",e.string()),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var mc=e.object({data:Qe,params:e.record(e.string(),e.unknown())});var uc=e.enum_(["licensed","metered"]);var dc=e.enum_(["licensed","metered"]);var hc=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",dc.optional()),q:e.string().optional(),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var Te=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string().optional(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),name:e.string(),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),prices:e.list(I),productId:e.property("product_id",e.string()),quantity:e.number(),subscriptionCount:e.property("subscription_count",e.number()),updatedAt:e.property("updated_at",e.date())});var gc=e.object({data:e.list(Te),params:hc});var wc=e.enum_(["licensed","metered"]);var yc=e.enum_(["licensed","metered"]);var zc=e.object({ids:e.list(e.string()).optional(),isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional(),priceUsageType:e.property("price_usage_type",yc.optional()),q:e.string().optional(),withOneTimeCharges:e.property("with_one_time_charges",e.boolean().optional()),withPricesOnly:e.property("with_prices_only",e.boolean().optional()),withZeroPrice:e.property("with_zero_price",e.boolean().optional()),withoutLinkedToPlan:e.property("without_linked_to_plan",e.boolean().optional())});var Rc=e.object({data:j,params:zc});var bc=e.enum_(["subscribe","cancel"]);var fc=e.object({cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",e.string().optional())});var _c=e.object({data:fc,params:e.record(e.string(),e.unknown())});var at=e.object({amountOff:e.property("amount_off",e.number()),currency:e.string().optional(),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number()),externalId:e.property("external_id",e.string()),maxRedemptions:e.property("max_redemptions",e.number()),name:e.string(),percentOff:e.property("percent_off",e.number()),timesRedeemed:e.property("times_redeemed",e.number())});var st=e.object({companyId:e.property("company_id",e.string().optional()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),email:e.string(),externalId:e.property("external_id",e.string()),failedToImport:e.property("failed_to_import",e.boolean()),meta:e.record(e.string(),e.string()),name:e.string()});var nt=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),externalId:e.property("external_id",e.string().optional()),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),url:e.string().optional()});var ct=e.object({displayName:e.property("display_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string()),externalId:e.property("external_id",e.string())});var pt=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string()),externalId:e.property("external_id",e.string()),paymentMethodType:e.property("payment_method_type",e.string())});var Sc=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitDecimal:e.property("per_unit_decimal",e.string().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),priceExternalId:e.property("price_external_id",e.string()),upTo:e.property("up_to",e.number().optional())});var lt=e.object({billingScheme:e.property("billing_scheme",rc),currency:e.string(),externalAccountId:e.property("external_account_id",e.string()),interval:e.string(),isActive:e.property("is_active",e.boolean()),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number().optional()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceTiers:e.property("price_tiers",e.list(Sc)),productExternalId:e.property("product_external_id",e.string()),tiersMode:e.property("tiers_mode",oc.optional()),usageType:e.property("usage_type",tc)});var mt=e.object({externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean().optional()),name:e.string(),price:e.number()});var xc=e.object({couponExternalId:e.property("coupon_external_id",e.string()),customerFacingCode:e.property("customer_facing_code",e.string().optional()),endedAt:e.property("ended_at",e.date().optional()),externalId:e.property("external_id",e.string()),isActive:e.property("is_active",e.boolean()),promoCodeExternalId:e.property("promo_code_external_id",e.string().optional()),startedAt:e.property("started_at",e.date())});var Ec=e.enum_(["licensed","metered"]);var Uc=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),currency:e.string(),interval:e.string(),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number().optional()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),quantity:e.number(),subscriptionItemExternalId:e.property("subscription_item_external_id",e.string().optional()),usageType:e.property("usage_type",Ec)});var ut=e.object({cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodExternalId:e.property("default_payment_method_external_id",e.string().optional()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),discounts:e.list(xc),expiredAt:e.property("expired_at",e.date()),interval:e.string().optional(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number().optional()),periodStart:e.property("period_start",e.number().optional()),productExternalIds:e.property("product_external_ids",e.list(Uc)),status:e.string().optional(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",bc.optional())});var Pc=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var ze=e.object({burnStrategy:e.property("burn_strategy",e.string()),createdAt:e.property("created_at",e.date()),defaultExpiryUnit:e.property("default_expiry_unit",e.string()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",e.string()),description:e.string(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:I.optional(),product:Qe.optional(),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Cc=e.object({data:e.list(ze),params:Pc});var Tc=e.enum_(["plan_first_then_credit_bundles_first_in_first_out","first_in_first_out","last_in_first_out","expiration_priority"]);var vc=e.enum_(["none","rollover","expire"]);var Oc=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Bc=e.object({data:ze,params:e.record(e.string(),e.unknown())});var jc=e.enum_(["plan_first_then_credit_bundles_first_in_first_out","first_in_first_out","last_in_first_out","expiration_priority"]);var kc=e.enum_(["none","rollover","expire"]);var Dc=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Vc=e.object({data:M,params:e.record(e.string(),e.unknown())});var qc=e.enum_(["active","inactive"]);var Mc=e.enum_(["active","inactive"]);var Ac=e.object({bundleType:e.property("bundle_type",e.stringLiteral("fixed").optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:Mc.optional()});var ue=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",e.string()),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",e.string()),expiryUnit:e.property("expiry_unit",e.string()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:I.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:e.string(),unitPrice:e.property("unit_price",I.optional()),updatedAt:e.property("updated_at",e.date())});var Fc=e.object({data:e.list(ue),params:Ac});var Ic=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Kc=e.enum_(["days","billing_periods"]);var Lc=e.enum_(["active","inactive"]);var Gc=e.object({data:ue,params:e.record(e.string(),e.unknown())});var Nc=e.object({data:ue,params:e.record(e.string(),e.unknown())});var Xc=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Hc=e.enum_(["days","billing_periods"]);var Wc=e.enum_(["active","inactive"]);var Jc=e.object({data:ue,params:e.record(e.string(),e.unknown())});var $c=e.object({data:M,params:e.record(e.string(),e.unknown())});var Zc=e.enum_(["active","inactive"]);var Yc=e.enum_(["active","inactive"]);var Qc=e.object({bundleType:e.property("bundle_type",e.stringLiteral("fixed").optional()),creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),status:Yc.optional()});var ep=e.object({data:j,params:Qc});var rp=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var op=e.object({data:j,params:rp});var tp=e.enum_(["plan_change","manual","plan_period_reset","expired"]);var ve=e.object({companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),createdAt:e.property("created_at",e.date()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",e.string()),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),price:I.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),sourceLabel:e.property("source_label",e.string()),updatedAt:e.property("updated_at",e.date()),validFrom:e.property("valid_from",e.date().optional()),zeroedOutDate:e.property("zeroed_out_date",e.date().optional()),zeroedOutReason:e.property("zeroed_out_reason",e.string().optional())});var ip=e.object({data:ve,params:e.record(e.string(),e.unknown())});var ap=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var sp=e.enum_(["days","billing_periods"]);var np=e.object({data:ve,params:e.record(e.string(),e.unknown())});var cp=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var pp=e.enum_(["asc","desc"]);var lp=e.enum_(["asc","desc"]);var mp=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var up=e.object({companyId:e.property("company_id",e.string().optional()),dir:lp.optional(),limit:e.number().optional(),offset:e.number().optional(),order:mp.optional()});var dp=e.object({data:e.list(ve),params:up});var hp=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var gp=e.object({data:j,params:hp});var wp=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional()});var yp=e.object({data:e.list(ve),params:wp});var zp=e.enum_(["daily","weekly","monthly","raw"]);var Rp=e.enum_(["daily","weekly","monthly","raw"]);var bp=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),period:Rp.optional(),startTime:e.property("start_time",e.string().optional())});var fp=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var _p=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var Sp=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string()});var xp=e.object({billingCreditAutoTopupGrantCount:e.property("billing_credit_auto_topup_grant_count",e.number()),billingCreditId:e.property("billing_credit_id",e.string()),company:fp.optional(),companyId:e.property("company_id",e.string()),credit:_p.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:Sp.optional(),featureId:e.property("feature_id",e.string().optional()),firstTransactionAt:e.property("first_transaction_at",e.date()),freeGrantCount:e.property("free_grant_count",e.number()),grantCount:e.property("grant_count",e.number()),lastTransactionAt:e.property("last_transaction_at",e.date()),manuallyZeroedCount:e.property("manually_zeroed_count",e.number()),netChange:e.property("net_change",e.number()),planGrantCount:e.property("plan_grant_count",e.number()),purchasedGrantCount:e.property("purchased_grant_count",e.number()),timeBucket:e.property("time_bucket",e.date()),totalConsumed:e.property("total_consumed",e.number()),totalGranted:e.property("total_granted",e.number()),transactionCount:e.property("transaction_count",e.number()),usageCount:e.property("usage_count",e.number()),zeroedOutCount:e.property("zeroed_out_count",e.number())});var Ep=e.object({data:e.list(xp),params:bp});var Up=e.enum_(["daily","weekly","monthly","raw"]);var Pp=e.enum_(["daily","weekly","monthly","raw"]);var Cp=e.object({billingCreditId:e.property("billing_credit_id",e.string().optional()),companyId:e.property("company_id",e.string().optional()),endTime:e.property("end_time",e.string().optional()),featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),period:Pp.optional(),startTime:e.property("start_time",e.string().optional())});var Tp=e.object({data:j,params:Cp});var vp=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional())});var Re=e.object({autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupAmountType:e.property("auto_topup_amount_type",e.string().optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean()),autoTopupExpiryType:e.property("auto_topup_expiry_type",e.string().optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",e.string().optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),createdAt:e.property("created_at",e.date()),creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),creditPluralName:e.property("credit_plural_name",e.string().optional()),creditSingularName:e.property("credit_singular_name",e.string().optional()),expiryType:e.property("expiry_type",e.string().optional()),expiryUnit:e.property("expiry_unit",e.string().optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),resetCadence:e.property("reset_cadence",e.string()),resetStart:e.property("reset_start",e.string()),resetType:e.property("reset_type",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Op=e.object({data:e.list(Re),params:vp});var Bp=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var jp=e.enum_(["days","billing_periods"]);var kp=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Dp=e.enum_(["days","billing_periods"]);var Vp=e.enum_(["monthly","yearly","daily","weekly"]);var qp=e.enum_(["billing_period","first_of_month"]);var Mp=e.enum_(["plan_period","no_reset"]);var Ap=e.object({data:Re,params:e.record(e.string(),e.unknown())});var Fp=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Ip=e.enum_(["days","billing_periods"]);var Kp=e.enum_(["monthly","yearly","daily","weekly"]);var Lp=e.enum_(["billing_period","first_of_month"]);var Gp=e.enum_(["plan_period","no_reset"]);var Np=e.object({data:Re,params:e.record(e.string(),e.unknown())});var Xp=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional())});var Hp=e.object({data:M,params:Xp});var Wp=e.object({creditId:e.property("credit_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional())});var Jp=e.object({data:j,params:Wp});var dt=e.object({burnStrategy:e.property("burn_strategy",Tc.optional()),currency:e.string(),defaultExpiryUnit:e.property("default_expiry_unit",e.string().optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",vc.optional()),description:e.string(),icon:e.string().optional(),name:e.string(),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var ht=e.object({burnStrategy:e.property("burn_strategy",jc.optional()),defaultExpiryUnit:e.property("default_expiry_unit",e.stringLiteral("days").optional()),defaultExpiryUnitCount:e.property("default_expiry_unit_count",e.number().optional()),defaultRolloverPolicy:e.property("default_rollover_policy",kc.optional()),description:e.string(),icon:e.string().optional(),name:e.string(),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional())});var gt=e.object({bundleName:e.property("bundle_name",e.string()),bundleType:e.property("bundle_type",e.stringLiteral("fixed").optional()),creditId:e.property("credit_id",e.string()),currency:e.string(),expiryType:e.property("expiry_type",Ic.optional()),expiryUnit:e.property("expiry_unit",Kc.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:Lc.optional()});var wt=e.object({bundleName:e.property("bundle_name",e.string()),expiryType:e.property("expiry_type",Xc.optional()),expiryUnit:e.property("expiry_unit",Hc.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),pricePerUnit:e.property("price_per_unit",e.number()),pricePerUnitDecimal:e.property("price_per_unit_decimal",e.string().optional()),quantity:e.number().optional(),status:Wc.optional()});var yt=e.object({reason:tp.optional()});var zt=e.object({billingPeriodsCount:e.property("billing_periods_count",e.number().optional()),companyId:e.property("company_id",e.string()),creditId:e.property("credit_id",e.string()),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",ap.optional()),expiryUnit:e.property("expiry_unit",sp.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),quantity:e.number(),reason:e.string()});var Rt=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional()),autoTopupAmount:e.property("auto_topup_amount",e.number().optional()),autoTopupAmountType:e.property("auto_topup_amount_type",e.stringLiteral("credit").optional()),autoTopupEnabled:e.property("auto_topup_enabled",e.boolean().optional()),autoTopupExpiryType:e.property("auto_topup_expiry_type",Bp.optional()),autoTopupExpiryUnit:e.property("auto_topup_expiry_unit",jp.optional()),autoTopupExpiryUnitCount:e.property("auto_topup_expiry_unit_count",e.number().optional()),autoTopupThresholdPercent:e.property("auto_topup_threshold_percent",e.number().optional()),creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),expiryType:e.property("expiry_type",kp.optional()),expiryUnit:e.property("expiry_unit",Dp.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),planId:e.property("plan_id",e.string()),resetCadence:e.property("reset_cadence",Vp),resetStart:e.property("reset_start",qp),resetType:e.property("reset_type",Mp.optional())});var bt=e.object({applyToExisting:e.property("apply_to_existing",e.boolean().optional()),creditAmount:e.property("credit_amount",e.number().optional()),expiryType:e.property("expiry_type",Fp.optional()),expiryUnit:e.property("expiry_unit",Ip.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Kp),resetStart:e.property("reset_start",Lp),resetType:e.property("reset_type",Gp.optional())});var $p=e.object({cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),confirmPaymentIntentClientSecret:e.property("confirm_payment_intent_client_secret",e.string().optional()),confirmPaymentIntentId:e.property("confirm_payment_intent_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),metadata:e.record(e.string(),e.unknown()).optional(),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",e.string().optional())});var Zp=e.object({data:$p,params:e.record(e.string(),e.unknown())});var Mr=e.object({companyCount:e.property("company_count",e.number()),environmentId:e.property("environment_id",e.string()),eventCount:e.property("event_count",e.number()),eventSubtype:e.property("event_subtype",e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),userCount:e.property("user_count",e.number())});var er=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",e.string()),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",e.string().optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var $=e.object({createdAt:e.property("created_at",e.date()),displayName:e.property("display_name",e.string()),entityType:e.property("entity_type",e.string()),hierarchy:e.list(e.string()),id:e.string(),traitType:e.property("trait_type",e.string()),updatedAt:e.property("updated_at",e.date())});var Yp=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var Ar=e.object({comparisonTrait:e.property("comparison_trait",$.optional()),comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionGroupId:e.property("condition_group_id",e.string().optional()),conditionType:e.property("condition_type",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),metricValue:e.property("metric_value",e.number().optional()),operator:e.string(),resourceIds:e.property("resource_ids",e.list(e.string())),resources:e.list(Yp),ruleId:e.property("rule_id",e.string()),trait:$.optional(),traitEntityType:e.property("trait_entity_type",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Qp=e.object({conditions:e.list(Ar),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),ruleId:e.property("rule_id",e.string()),updatedAt:e.property("updated_at",e.date())});var Fr=e.object({conditionGroups:e.property("condition_groups",e.list(Qp)),conditions:e.list(Ar),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",e.string()),updatedAt:e.property("updated_at",e.date()),value:e.boolean()});var be=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),feature:er.optional(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",e.string()),id:e.string(),key:e.string(),lastCheckedAt:e.property("last_checked_at",e.date().optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),rules:e.list(Fr),updatedAt:e.property("updated_at",e.date())});var rr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var W=e.object({createdAt:e.property("created_at",e.date()),description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),eventSummary:e.property("event_summary",Mr.optional()),featureType:e.property("feature_type",e.string()),flags:e.list(be),icon:e.string(),id:e.string(),lifecyclePhase:e.property("lifecycle_phase",e.string().optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),plans:e.list(rr),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),trait:$.optional(),traitId:e.property("trait_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var ee=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Te.optional()),chargeType:e.property("charge_type",e.string()),companyCount:e.property("company_count",e.number()),controlledBy:e.property("controlled_by",e.string()),createdAt:e.property("created_at",e.date()),description:e.string(),features:e.list(W),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Re).optional()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",I.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",I.optional()),planType:e.property("plan_type",e.string()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",I.optional())});var Le=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),consumptionRate:e.property("consumption_rate",e.number().optional()),featureId:e.property("feature_id",e.string()),meteredPrice:e.property("metered_price",Q.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",Q.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueType:e.property("value_type",e.string()),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Q.optional())});var or=e.object({addedOn:e.property("added_on",e.date().optional()),billingProductExternalId:e.property("billing_product_external_id",e.string().optional()),billingProductId:e.property("billing_product_id",e.string().optional()),description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string(),planPeriod:e.property("plan_period",e.string().optional()),planPrice:e.property("plan_price",e.number().optional())});var Ir=e.object({amountOff:e.property("amount_off",e.number().optional()),couponId:e.property("coupon_id",e.string()),couponName:e.property("coupon_name",e.string()),currency:e.string().optional(),customerFacingCode:e.property("customer_facing_code",e.string().optional()),discountExternalId:e.property("discount_external_id",e.string()),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number().optional()),endedAt:e.property("ended_at",e.date().optional()),isActive:e.property("is_active",e.boolean()),percentOff:e.property("percent_off",e.number().optional()),promoCodeExternalId:e.property("promo_code_external_id",e.string().optional()),startedAt:e.property("started_at",e.date()),subscriptionExternalId:e.property("subscription_external_id",e.string())});var Kr=e.object({billingScheme:e.property("billing_scheme",e.string()),billingThreshold:e.property("billing_threshold",e.number().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),id:e.string(),interval:e.string(),meterId:e.property("meter_id",e.string().optional()),name:e.string(),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),priceId:e.property("price_id",e.string()),priceTier:e.property("price_tier",e.list(qr)),quantity:e.number(),subscriptionId:e.property("subscription_id",e.string()),subscriptionItemExternalId:e.property("subscription_item_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",e.string())});var Oe=e.object({cancelAt:e.property("cancel_at",e.number().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),companyId:e.property("company_id",e.string().optional()),createdAt:e.property("created_at",e.date()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),defaultPaymentMethodId:e.property("default_payment_method_id",e.string().optional()),discounts:e.list(Ir),expiredAt:e.property("expired_at",e.date().optional()),id:e.string(),interval:e.string(),latestInvoice:e.property("latest_invoice",le.optional()),metadata:e.record(e.string(),e.unknown()).optional(),paymentMethod:e.property("payment_method",ce.optional()),periodEnd:e.property("period_end",e.number()),periodStart:e.property("period_start",e.number()),products:e.list(Kr),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.number().optional()),trialEndSetting:e.property("trial_end_setting",e.string().optional())});var tr=e.object({createdAt:e.property("created_at",e.date()),definition:$.optional(),definitionId:e.property("definition_id",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var Lr=e.object({createdAt:e.property("created_at",e.date()),entityType:e.property("entity_type",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date())});var ir=e.object({createdAt:e.property("created_at",e.date()),definition:Lr.optional(),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var Gr=e.object({accountId:e.property("account_id",e.string()),capturedAtMax:e.property("captured_at_max",e.date()),capturedAtMin:e.property("captured_at_min",e.date()),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string()),monthReset:e.property("month_reset",e.string()),period:e.string(),validUntil:e.property("valid_until",e.date().optional()),value:e.number()});var Nr=e.object({description:e.string().optional(),id:e.string(),imageUrl:e.property("image_url",e.string().optional()),name:e.string()});var el=e.enum_(["bool","date","int","string"]);var rl=e.enum_(["user","company"]);var ft=e.object({comparableType:e.property("comparable_type",el),entityType:e.property("entity_type",rl),id:e.string()});var ol=e.enum_(["base_plan","billing_product","company","credit","crm_product","metric","plan","trait","user"]);var tl=e.enum_(["all_time","current_day","current_month","current_week"]);var il=e.enum_(["first_of_month","billing_cycle"]);var al=e.enum_(["eq","ne","gt","lt","gte","lte","is_empty","not_empty"]);var Xr=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",ft.optional()),conditionType:e.property("condition_type",ol),consumptionRate:e.property("consumption_rate",e.number().optional()),creditId:e.property("credit_id",e.string().optional()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",tl.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",il.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:al,resourceIds:e.property("resource_ids",e.list(e.string())),traitDefinition:e.property("trait_definition",ft.optional()),traitValue:e.property("trait_value",e.string())});var sl=e.object({conditions:e.list(Xr)});var nl=e.enum_(["default","global_override","company_override","company_override_usage_exceeded","plan_entitlement","plan_entitlement_usage_exceeded","standard"]);var Hr=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(sl)),conditions:e.list(Xr),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",nl),value:e.boolean()});var K=e.object({addOns:e.property("add_ons",e.list(or)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",Oe.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(Oe)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ce.optional()),entityTraits:e.property("entity_traits",e.list(tr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(ir),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Gr),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ce)),plan:or.optional(),plans:e.list(Nr),rules:e.list(Hr),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var cl=e.enum_(["boolean","numeric","trait","unlimited"]);var pl=e.object({createdAt:e.property("created_at",e.date()),externalUserId:e.property("external_user_id",e.string()),externalUserName:e.property("external_user_name",e.string()),id:e.string(),note:e.string(),updatedAt:e.property("updated_at",e.date())});var de=e.object({company:K.optional(),companyId:e.property("company_id",e.string()),consumptionRate:e.property("consumption_rate",e.number().optional()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expirationDate:e.property("expiration_date",e.date().optional()),feature:er.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),notes:e.list(pl),ruleId:e.property("rule_id",e.string().optional()),ruleIdUsageExceeded:e.property("rule_id_usage_exceeded",e.string().optional()),updatedAt:e.property("updated_at",e.date()),valueBool:e.property("value_bool",e.boolean().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",$.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",e.string())});var ll=e.enum_(["free","plan","purchased"]);var Be=e.object({creditTypeIcon:e.property("credit_type_icon",e.string().optional()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",ll),quantity:e.number()});var ml=e.enum_(["free","plan","purchased"]);var je=e.object({audienceType:e.property("audience_type",e.string().optional()),createdAt:e.property("created_at",e.date()),description:e.string(),icon:e.string(),id:e.string(),name:e.string(),planType:e.property("plan_type",e.string()),updatedAt:e.property("updated_at",e.date())});var ie=e.object({billingThreshold:e.property("billing_threshold",e.number().optional()),consumptionRate:e.property("consumption_rate",e.number().optional()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),feature:er.optional(),featureId:e.property("feature_id",e.string()),id:e.string(),meteredMonthlyPrice:e.property("metered_monthly_price",Q.optional()),meteredYearlyPrice:e.property("metered_yearly_price",Q.optional()),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),plan:je.optional(),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",e.string().optional()),ruleId:e.property("rule_id",e.string()),ruleIdUsageExceeded:e.property("rule_id_usage_exceeded",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageBasedProduct:e.property("usage_based_product",Qe.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCredit:e.property("value_credit",ze.optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTrait:e.property("value_trait",$.optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",e.string())});var ke=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",cl),companyOverride:e.property("company_override",de.optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(Be).optional()),creditGrantReason:e.property("credit_grant_reason",ml.optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditUsed:e.property("credit_used",e.number().optional()),effectiveLimit:e.property("effective_limit",e.number().optional()),effectivePrice:e.property("effective_price",e.number().optional()),entitlementExpirationDate:e.property("entitlement_expiration_date",e.date().optional()),entitlementId:e.property("entitlement_id",e.string()),entitlementSource:e.property("entitlement_source",e.string().optional()),entitlementType:e.property("entitlement_type",e.string()),feature:W.optional(),hasValidAllocation:e.property("has_valid_allocation",e.boolean().optional()),isUnlimited:e.property("is_unlimited",e.boolean().optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",Q.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:je.optional(),planEntitlement:e.property("plan_entitlement",ie.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Q.optional())});var De=e.object({features:e.list(ke)});var ul=e.object({bundle:ue.optional(),quantity:e.number(),total:e.number()});var Ve=e.object({cancelAt:e.property("cancel_at",e.date().optional()),cancelAtPeriodEnd:e.property("cancel_at_period_end",e.boolean()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),discounts:e.list(Ir),expiredAt:e.property("expired_at",e.date().optional()),interval:e.string(),latestInvoice:e.property("latest_invoice",le.optional()),paymentMethod:e.property("payment_method",ce.optional()),products:e.list(Kr),status:e.string(),subscriptionExternalId:e.property("subscription_external_id",e.string()),totalPrice:e.property("total_price",e.number()),trialEnd:e.property("trial_end",e.date().optional())});var dl=e.object({activeAddOns:e.property("active_add_ons",e.list(ee)),activePlan:e.property("active_plan",ee.optional()),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Le)),availableCreditBundles:e.property("available_credit_bundles",e.list(ue)),company:K.optional(),featureUsage:e.property("feature_usage",De.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(ul)),selectedPlan:e.property("selected_plan",ee.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(Le)),subscription:Ve.optional()});var hl=e.object({data:dl,params:e.record(e.string(),e.unknown())});var gl=e.object({amount:e.number(),description:e.string(),priceId:e.property("price_id",e.string()),proration:e.boolean(),quantity:e.number()});var wl=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),newCharges:e.property("new_charges",e.number()),percentOff:e.property("percent_off",e.number()),periodStart:e.property("period_start",e.date()),promoCodeApplied:e.property("promo_code_applied",e.boolean()),proration:e.number(),taxAmount:e.property("tax_amount",e.number().optional()),taxDisplayName:e.property("tax_display_name",e.string().optional()),taxRequireBillingDetails:e.property("tax_require_billing_details",e.boolean()),trialEnd:e.property("trial_end",e.date().optional()),upcomingInvoiceLineItems:e.property("upcoming_invoice_line_items",e.list(gl))});var Wr=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),finance:wl.optional(),newCharges:e.property("new_charges",e.number()),paymentMethodRequired:e.property("payment_method_required",e.boolean()),percentOff:e.property("percent_off",e.number()),periodStart:e.property("period_start",e.date()),promoCodeApplied:e.property("promo_code_applied",e.boolean()),proration:e.number(),trialEnd:e.property("trial_end",e.date().optional()),usageViolations:e.property("usage_violations",e.list(ke))});var yl=e.object({data:Wr,params:e.record(e.string(),e.unknown())});var zl=e.object({company:K.optional(),success:e.boolean()});var Rl=e.object({data:zl,params:e.record(e.string(),e.unknown())});var bl=e.object({subscriptionChangePreview:e.property("subscription_change_preview",Wr.optional())});var fl=e.object({data:bl,params:e.record(e.string(),e.unknown())});var _l=e.object({data:Oe,params:e.record(e.string(),e.unknown())});var _t=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var St=e.object({trialEnd:e.property("trial_end",e.date().optional())});var Sl=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional(),withSubscription:e.property("with_subscription",e.boolean().optional()),withoutFeatureOverrideFor:e.property("without_feature_override_for",e.string().optional()),withoutPlan:e.property("without_plan",e.boolean().optional())});var xl=e.object({data:e.list(K),params:Sl});var El=e.object({data:K,params:e.record(e.string(),e.unknown())});var Ul=e.object({data:K,params:e.record(e.string(),e.unknown())});var Pl=e.object({cancelSubscription:e.property("cancel_subscription",e.boolean().optional()),prorate:e.boolean().optional()});var Cl=e.object({data:M,params:Pl});var Tl=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional(),withSubscription:e.property("with_subscription",e.boolean().optional()),withoutFeatureOverrideFor:e.property("without_feature_override_for",e.string().optional()),withoutPlan:e.property("without_plan",e.boolean().optional())});var vl=e.object({data:j,params:Tl});var Ol=e.enum_(["asc","desc"]);var Bl=e.enum_(["asc","desc"]);var jl=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),displayProperties:e.property("display_properties",e.list(e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),monetizedSubscriptions:e.property("monetized_subscriptions",e.boolean().optional()),offset:e.number().optional(),planIds:e.property("plan_ids",e.list(e.string()).optional()),q:e.string().optional(),sortOrderColumn:e.property("sort_order_column",e.string().optional()),sortOrderDirection:e.property("sort_order_direction",Bl.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(e.string()).optional()),subscriptionTypes:e.property("subscription_types",e.list(e.string()).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var kl=e.object({data:j,params:jl});var Dl=e.object({data:K,params:e.record(e.string(),e.unknown())});var ar=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var Vl=e.object({data:ar,params:e.record(e.string(),e.unknown())});var ql=e.enum_(["asc","desc"]);var Ml=e.enum_(["asc","desc"]);var Al=e.object({creditTypeIds:e.property("credit_type_ids",e.list(e.string()).optional()),displayProperties:e.property("display_properties",e.list(e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),monetizedSubscriptions:e.property("monetized_subscriptions",e.boolean().optional()),offset:e.number().optional(),planIds:e.property("plan_ids",e.list(e.string()).optional()),q:e.string().optional(),sortOrderColumn:e.property("sort_order_column",e.string().optional()),sortOrderDirection:e.property("sort_order_direction",Ml.optional()),subscriptionStatuses:e.property("subscription_statuses",e.list(e.string()).optional()),subscriptionTypes:e.property("subscription_types",e.list(e.string()).optional()),withoutPlan:e.property("without_plan",e.boolean().optional()),withoutSubscription:e.property("without_subscription",e.boolean().optional())});var Fl=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(Be)),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditTypeName:e.property("credit_type_name",e.string().optional()),creditUsed:e.property("credit_used",e.number().optional())});var Il=e.object({creditTypeId:e.property("credit_type_id",e.string().optional()),creditUsage:e.property("credit_usage",Fl.optional()),entitlementSource:e.property("entitlement_source",e.string()),entitlementValueType:e.property("entitlement_value_type",e.string()),featureId:e.property("feature_id",e.string()),featureName:e.property("feature_name",e.string()),featureType:e.property("feature_type",e.string()),hardLimit:e.property("hard_limit",e.string()),hasAccess:e.property("has_access",e.boolean()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",Q.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),softLimit:e.property("soft_limit",e.string()),usage:e.string(),valueNumeric:e.property("value_numeric",e.number().optional()),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Q.optional())});var Kl=e.object({addOns:e.property("add_ons",e.list(or)),billingCreditBalances:e.property("billing_credit_balances",e.record(e.string(),e.number()).optional()),billingSubscription:e.property("billing_subscription",Oe.optional()),billingSubscriptions:e.property("billing_subscriptions",e.list(Oe)),createdAt:e.property("created_at",e.date()),defaultPaymentMethod:e.property("default_payment_method",ce.optional()),entityTraits:e.property("entity_traits",e.list(tr)),environmentId:e.property("environment_id",e.string()),featureUsage:e.property("feature_usage",e.list(Il)),id:e.string(),keys:e.list(ir),lastSeenAt:e.property("last_seen_at",e.date().optional()),logoUrl:e.property("logo_url",e.string().optional()),metrics:e.list(Gr),name:e.string(),paymentMethods:e.property("payment_methods",e.list(ce)),plan:or.optional(),plans:e.list(Nr),rules:e.list(Hr),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date()),userCount:e.property("user_count",e.number())});var Ll=e.object({data:e.list(Kl),params:Al});var Gl=e.object({keys:e.record(e.string(),e.string()).optional()});var Nl=e.object({data:K,params:Gl});var Xl=e.object({companyId:e.property("company_id",e.string().optional()),dealStage:e.property("deal_stage",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var xt=e.record(e.string(),e.unknown());var Hl=e.object({billingFrequency:e.property("billing_frequency",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),description:e.string(),discountPercentage:e.property("discount_percentage",xt.optional()),id:e.string(),name:e.string(),price:e.number(),quantity:e.number(),termMonth:e.property("term_month",e.number().optional()),totalDiscount:e.property("total_discount",xt.optional()),updatedAt:e.property("updated_at",e.date())});var Wl=e.object({dealArr:e.property("deal_arr",e.string()),dealExternalId:e.property("deal_external_id",e.string()),dealMrr:e.property("deal_mrr",e.string()),dealName:e.property("deal_name",e.string().optional()),lineItems:e.property("line_items",e.list(Hl))});var Jl=e.object({data:e.list(Wl),params:Xl});var $l=e.object({companyId:e.property("company_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),userId:e.property("user_id",e.string().optional())});var sr=e.object({company:ar.optional(),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),id:e.string(),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string())});var Zl=e.object({data:e.list(sr),params:$l});var Yl=e.object({data:sr,params:e.record(e.string(),e.unknown())});var Ql=e.object({data:M,params:e.record(e.string(),e.unknown())});var em=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional()});var rm=e.object({data:e.list(Ve),params:em});var om=e.object({data:K,params:e.record(e.string(),e.unknown())});var tm=e.enum_(["company","user"]);var im=e.enum_(["company","user"]);var am=e.object({entityType:e.property("entity_type",im.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var sm=e.object({data:e.list(Lr),params:am});var nm=e.enum_(["company","user"]);var cm=e.enum_(["company","user"]);var pm=e.object({entityType:e.property("entity_type",cm.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var lm=e.object({data:j,params:pm});var mm=e.enum_(["company","user"]);var um=e.enum_(["boolean","currency","date","number","string","url"]);var dm=e.enum_(["company","user"]);var hm=e.enum_(["boolean","currency","date","number","string","url"]);var gm=e.object({entityType:e.property("entity_type",dm.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",hm.optional())});var wm=e.object({data:e.list($),params:gm});var ym=e.enum_(["company","user"]);var zm=e.enum_(["boolean","currency","date","number","string","url"]);var Rm=e.object({data:$,params:e.record(e.string(),e.unknown())});var bm=e.object({data:$,params:e.record(e.string(),e.unknown())});var fm=e.enum_(["boolean","currency","date","number","string","url"]);var _m=e.object({data:$,params:e.record(e.string(),e.unknown())});var Sm=e.enum_(["company","user"]);var xm=e.enum_(["boolean","currency","date","number","string","url"]);var Em=e.enum_(["company","user"]);var Um=e.enum_(["boolean","currency","date","number","string","url"]);var Pm=e.object({entityType:e.property("entity_type",Em.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",Um.optional())});var Cm=e.object({data:j,params:Pm});var Tm=e.object({definitionId:e.property("definition_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var vm=e.object({definitionId:e.property("definition_id",e.string()),value:e.string()});var Om=e.object({data:e.list(vm),params:Tm});var Bm=e.object({action:e.string().optional(),basePlanAction:e.property("base_plan_action",e.string().optional()),companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),planIds:e.property("plan_ids",e.list(e.string()).optional())});var jm=e.enum_(["checkout","company_upsert","fallback_plan","manage_plan","migration","plan_billing_product_changed","plan_deleted","quickstart","subscription_change"]);var km=e.enum_(["app_user","api_key","system","temporary_access_token"]);var fr=e.object({deleted:e.boolean(),description:e.string(),icon:e.string(),id:e.string(),name:e.string()});var Dm=e.enum_(["fallback","initial","trait","trial_expiry"]);var Vm=e.enum_(["downgrade","invalid","subscribe","unsubscribe","upgrade","upgrade_trial"]);var qm=e.object({featureId:e.property("feature_id",e.string()),hierarchy:e.list(e.string()),reason:e.string(),traitId:e.property("trait_id",e.string()),traitName:e.property("trait_name",e.string()),traitType:e.property("trait_type",e.string()),value:e.string()});var Jr=e.object({action:jm,actorType:e.property("actor_type",km),addOnsAdded:e.property("add_ons_added",e.list(fr)),addOnsRemoved:e.property("add_ons_removed",e.list(fr)),apiKey:e.property("api_key",me.optional()),apiKeyRequest:e.property("api_key_request",kr.optional()),basePlan:e.property("base_plan",fr.optional()),basePlanAction:e.property("base_plan_action",Dm.optional()),company:ar.optional(),companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),previousBasePlan:e.property("previous_base_plan",fr.optional()),requestId:e.property("request_id",e.string().optional()),subscriptionChangeAction:e.property("subscription_change_action",Vm.optional()),traitsUpdated:e.property("traits_updated",e.list(qm)),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var Mm=e.object({data:e.list(Jr),params:Bm});var Am=e.object({data:Jr,params:e.record(e.string(),e.unknown())});var Fm=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitIds:e.property("trait_ids",e.list(e.string()).optional())});var fe=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),planId:e.property("plan_id",e.string()),planType:e.property("plan_type",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var Im=e.object({data:e.list(fe),params:Fm});var Km=e.object({data:fe,params:e.record(e.string(),e.unknown())});var Lm=e.object({data:fe,params:e.record(e.string(),e.unknown())});var Gm=e.object({data:fe,params:e.record(e.string(),e.unknown())});var Nm=e.object({data:M,params:e.record(e.string(),e.unknown())});var Xm=e.object({data:e.list(fe),params:e.record(e.string(),e.unknown())});var Hm=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitIds:e.property("trait_ids",e.list(e.string()).optional())});var Wm=e.object({data:j,params:Hm});var he=e.object({companyMemberships:e.property("company_memberships",e.list(sr)),createdAt:e.property("created_at",e.date()),entityTraits:e.property("entity_traits",e.list(tr)),environmentId:e.property("environment_id",e.string()),id:e.string(),keys:e.list(ir),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string(),traits:e.record(e.string(),e.unknown()).optional(),updatedAt:e.property("updated_at",e.date())});var Jm=e.object({data:he,params:e.record(e.string(),e.unknown())});var $m=e.object({companyId:e.property("company_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var Zm=e.object({data:e.list(he),params:$m});var Ym=e.object({data:he,params:e.record(e.string(),e.unknown())});var Qm=e.object({data:he,params:e.record(e.string(),e.unknown())});var eu=e.object({data:M,params:e.record(e.string(),e.unknown())});var ru=e.object({companyId:e.property("company_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),q:e.string().optional()});var ou=e.object({data:j,params:ru});var tu=e.object({data:he,params:e.record(e.string(),e.unknown())});var $r=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),id:e.string(),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var iu=e.object({data:$r,params:e.record(e.string(),e.unknown())});var au=e.object({keys:e.record(e.string(),e.string()).optional()});var su=e.object({data:he,params:au});var Et=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var Ut=e.object({displayName:e.property("display_name",e.string().optional()),entityType:e.property("entity_type",ym),hierarchy:e.list(e.string()),traitType:e.property("trait_type",zm)});var Pt=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",fm)});var Ct=e.object({planId:e.property("plan_id",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var Tt=e.object({planId:e.property("plan_id",e.string()),traitValue:e.property("trait_value",e.string())});var nu=e.object({traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var vt=e.object({planId:e.property("plan_id",e.string()),traits:e.list(nu)});var cu=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutExpired:e.property("without_expired",e.boolean().optional())});var pu=e.object({data:e.list(de),params:cu});var lu=e.enum_(["all_time","current_month","current_week","current_day"]);var mu=e.enum_(["first_of_month","billing_cycle"]);var uu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var du=e.object({data:de,params:e.record(e.string(),e.unknown())});var hu=e.object({data:de,params:e.record(e.string(),e.unknown())});var gu=e.enum_(["all_time","current_month","current_week","current_day"]);var wu=e.enum_(["first_of_month","billing_cycle"]);var yu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var zu=e.object({data:de,params:e.record(e.string(),e.unknown())});var Ru=e.object({data:M,params:e.record(e.string(),e.unknown())});var bu=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutExpired:e.property("without_expired",e.boolean().optional())});var fu=e.object({data:j,params:bu});var _u=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Su=e.enum_(["boolean","numeric","trait","unlimited"]);var xu=e.enum_(["free","plan","purchased"]);var Eu=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(Be).optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditTypeName:e.property("credit_type_name",e.string().optional()),creditUsed:e.property("credit_used",e.number().optional())});var Uu=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Su),company:K.optional(),companyOverride:e.property("company_override",de.optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),creditGrantCounts:e.property("credit_grant_counts",e.record(e.string(),e.number()).optional()),creditGrantDetails:e.property("credit_grant_details",e.list(Be).optional()),creditGrantReason:e.property("credit_grant_reason",xu.optional()),creditRemaining:e.property("credit_remaining",e.number().optional()),creditTotal:e.property("credit_total",e.number().optional()),creditTypeIcon:e.property("credit_type_icon",e.string().optional()),creditUsage:e.property("credit_usage",Eu.optional()),creditUsed:e.property("credit_used",e.number().optional()),effectiveLimit:e.property("effective_limit",e.number().optional()),effectivePrice:e.property("effective_price",e.number().optional()),entitlementExpirationDate:e.property("entitlement_expiration_date",e.date().optional()),entitlementId:e.property("entitlement_id",e.string()),entitlementSource:e.property("entitlement_source",e.string().optional()),entitlementType:e.property("entitlement_type",e.string()),feature:W.optional(),hasValidAllocation:e.property("has_valid_allocation",e.boolean().optional()),isUnlimited:e.property("is_unlimited",e.boolean().optional()),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),monthlyUsageBasedPrice:e.property("monthly_usage_based_price",Q.optional()),overuse:e.number().optional(),percentUsed:e.property("percent_used",e.number().optional()),period:e.string().optional(),plan:je.optional(),planEntitlement:e.property("plan_entitlement",ie.optional()),priceBehavior:e.property("price_behavior",e.string().optional()),softLimit:e.property("soft_limit",e.number().optional()),usage:e.number().optional(),yearlyUsageBasedPrice:e.property("yearly_usage_based_price",Q.optional())});var Pu=e.object({data:e.list(Uu),params:_u});var Cu=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Tu=e.object({data:j,params:Cu});var vu=e.object({companyId:e.property("company_id",e.string().optional()),companyKeys:e.property("company_keys",e.record(e.string(),e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutNegativeEntitlements:e.property("without_negative_entitlements",e.boolean().optional())});var Ou=e.object({data:e.list(ke),params:vu});var Bu=e.object({companyId:e.property("company_id",e.string().optional()),companyKeys:e.property("company_keys",e.record(e.string(),e.string()).optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutNegativeEntitlements:e.property("without_negative_entitlements",e.boolean().optional())});var ju=e.object({data:j,params:Bu});var ku=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Du=e.enum_(["boolean","numeric","trait","unlimited","unknown"]);var Vu=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Du),company:K.optional(),entitlementId:e.property("entitlement_id",e.string()),entitlementType:e.property("entitlement_type",e.string()),feature:W.optional(),metricResetAt:e.property("metric_reset_at",e.date().optional()),monthReset:e.property("month_reset",e.string().optional()),period:e.string().optional(),plan:je.optional(),usage:e.number().optional(),user:$r.optional()});var qu=e.object({data:e.list(Vu),params:ku});var Mu=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Au=e.object({data:j,params:Mu});var Fu=e.object({featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var Iu=e.object({data:e.list(ie),params:Fu});var Ku=e.enum_(["all_time","current_month","current_week","current_day"]);var Lu=e.enum_(["first_of_month","billing_cycle"]);var Gu=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var Nu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Xu=e.object({data:ie,params:e.record(e.string(),e.unknown())});var Hu=e.object({data:ie,params:e.record(e.string(),e.unknown())});var Wu=e.enum_(["all_time","current_month","current_week","current_day"]);var Ju=e.enum_(["first_of_month","billing_cycle"]);var $u=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var Zu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Yu=e.object({data:ie,params:e.record(e.string(),e.unknown())});var Qu=e.object({data:M,params:e.record(e.string(),e.unknown())});var ed=e.object({featureId:e.property("feature_id",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planId:e.property("plan_id",e.string().optional()),planIds:e.property("plan_ids",e.list(e.string()).optional()),q:e.string().optional(),withMeteredProducts:e.property("with_metered_products",e.boolean().optional())});var rd=e.object({data:j,params:ed});var od=e.object({keys:e.record(e.string(),e.string()).optional()});var td=e.object({data:De,params:od});var Ot=e.object({companyId:e.property("company_id",e.string()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",lu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",mu.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",uu)});var Bt=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),metricPeriod:e.property("metric_period",gu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",wu.optional()),note:e.string().optional(),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",yu)});var ge=e.object({flatAmount:e.property("flat_amount",e.number().optional()),perUnitPrice:e.property("per_unit_price",e.number().optional()),perUnitPriceDecimal:e.property("per_unit_price_decimal",e.string().optional()),upTo:e.property("up_to",e.number().optional())});var jt=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",Ku.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Lu.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ge).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),planId:e.property("plan_id",e.string()),priceBehavior:e.property("price_behavior",Gu.optional()),priceTiers:e.property("price_tiers",e.list(ge).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",e.string().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Nu),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ge).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var kt=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),currency:e.string().optional(),metricPeriod:e.property("metric_period",Wu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Ju.optional()),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ge).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),priceBehavior:e.property("price_behavior",$u.optional()),priceTiers:e.property("price_tiers",e.list(ge).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",e.string().optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Zu),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ge).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var id=e.object({data:K,params:e.record(e.string(),e.unknown())});var ad=e.enum_(["plan","add_on"]);var sd=e.enum_(["plan","add_on"]);var nd=e.object({companyId:e.property("company_id",e.string().optional()),forFallbackPlan:e.property("for_fallback_plan",e.boolean().optional()),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),hasProductId:e.property("has_product_id",e.boolean().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",sd.optional()),q:e.string().optional(),requiresPaymentMethod:e.property("requires_payment_method",e.boolean().optional()),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional()),withoutProductId:e.property("without_product_id",e.boolean().optional())});var cd=e.object({data:e.list(ee),params:nd});var pd=e.enum_(["plan","add_on"]);var ld=e.object({data:ee,params:e.record(e.string(),e.unknown())});var md=e.object({data:ee,params:e.record(e.string(),e.unknown())});var ud=e.object({data:ee,params:e.record(e.string(),e.unknown())});var dd=e.object({data:M,params:e.record(e.string(),e.unknown())});var hd=e.enum_(["one_time","recurring","free"]);var gd=e.object({accountId:e.property("account_id",e.string()),billingProductId:e.property("billing_product_id",e.string()),chargeType:e.property("charge_type",e.string()),controlledBy:e.property("controlled_by",e.string()),environmentId:e.property("environment_id",e.string()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPriceId:e.property("monthly_price_id",e.string().optional()),oneTimePriceId:e.property("one_time_price_id",e.string().optional()),planId:e.property("plan_id",e.string()),trialDays:e.property("trial_days",e.number().optional()),yearlyPriceId:e.property("yearly_price_id",e.string().optional())});var wd=e.object({data:gd,params:e.record(e.string(),e.unknown())});var yd=e.enum_(["plan","add_on"]);var zd=e.enum_(["plan","add_on"]);var Rd=e.object({companyId:e.property("company_id",e.string().optional()),forFallbackPlan:e.property("for_fallback_plan",e.boolean().optional()),forInitialPlan:e.property("for_initial_plan",e.boolean().optional()),forTrialExpiryPlan:e.property("for_trial_expiry_plan",e.boolean().optional()),hasProductId:e.property("has_product_id",e.boolean().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),planType:e.property("plan_type",zd.optional()),q:e.string().optional(),requiresPaymentMethod:e.property("requires_payment_method",e.boolean().optional()),withoutEntitlementFor:e.property("without_entitlement_for",e.string().optional()),withoutPaidProductId:e.property("without_paid_product_id",e.boolean().optional()),withoutProductId:e.property("without_product_id",e.boolean().optional())});var bd=e.object({data:j,params:Rd});var fd=e.object({planId:e.property("plan_id",e.string().optional())});var _d=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var Sd=e.object({data:e.list(_d),params:fd});var Dt=e.object({addOnIds:e.property("add_on_ids",e.list(e.string())),basePlanId:e.property("base_plan_id",e.string().optional())});var Vt=e.object({description:e.string(),icon:e.string().optional(),name:e.string(),planType:e.property("plan_type",pd)});var qt=e.object({description:e.string().optional(),icon:e.string().optional(),name:e.string()});var Mt=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),chargeType:e.property("charge_type",hd),currency:e.string().optional(),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",e.number().optional()),monthlyPriceId:e.property("monthly_price_id",e.string().optional()),oneTimePrice:e.property("one_time_price",e.number().optional()),oneTimePriceId:e.property("one_time_price_id",e.string().optional()),trialDays:e.property("trial_days",e.number().optional()),yearlyPrice:e.property("yearly_price",e.number().optional()),yearlyPriceId:e.property("yearly_price_id",e.string().optional())});var xd=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var we=e.object({ast:e.record(e.string(),e.number()).optional(),createdAt:e.property("created_at",e.date()),id:e.string(),name:e.string(),state:e.string(),type:e.string(),updatedAt:e.property("updated_at",e.date())});var Ed=e.object({data:e.list(we),params:xd});var Ud=e.enum_(["entitlement","billing"]);var Pd=e.object({data:we,params:e.record(e.string(),e.unknown())});var Cd=e.object({data:we,params:e.record(e.string(),e.unknown())});var Td=e.enum_(["entitlement","billing"]);var vd=e.enum_(["draft","live"]);var Od=e.object({data:we,params:e.record(e.string(),e.unknown())});var Bd=e.object({data:M,params:e.record(e.string(),e.unknown())});var jd=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var kd=e.object({data:j,params:jd});var Dd=e.object({companyId:e.property("company_id",e.string().optional()),componentId:e.property("component_id",e.string().optional())});var nr=e.object({ctaText:e.property("cta_text",e.string()),ctaWebSite:e.property("cta_web_site",e.string()),priceText:e.property("price_text",e.string())});var Vd=e.object({billingCreditAutoTopupAmount:e.property("billing_credit_auto_topup_amount",e.number().optional()),billingCreditAutoTopupAmountType:e.property("billing_credit_auto_topup_amount_type",e.string().optional()),billingCreditAutoTopupEnabled:e.property("billing_credit_auto_topup_enabled",e.boolean()),billingCreditAutoTopupExpiryType:e.property("billing_credit_auto_topup_expiry_type",e.string().optional()),billingCreditAutoTopupExpiryUnit:e.property("billing_credit_auto_topup_expiry_unit",e.string().optional()),billingCreditAutoTopupExpiryUnitCount:e.property("billing_credit_auto_topup_expiry_unit_count",e.number().optional()),billingCreditAutoTopupThresholdPercent:e.property("billing_credit_auto_topup_threshold_percent",e.number().optional()),createdAt:e.property("created_at",e.date()),creditAmount:e.property("credit_amount",e.number()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",e.string().optional()),expiryUnit:e.property("expiry_unit",e.string().optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),id:e.string(),planId:e.property("plan_id",e.string()),planName:e.property("plan_name",e.string()),pluralName:e.property("plural_name",e.string().optional()),resetCadence:e.property("reset_cadence",e.string()),resetStart:e.property("reset_start",e.string()),resetType:e.property("reset_type",e.string()),singularName:e.property("singular_name",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var cr=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Te.optional()),chargeType:e.property("charge_type",e.string()),companyCanTrial:e.property("company_can_trial",e.boolean()),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",e.string()),createdAt:e.property("created_at",e.date()),current:e.boolean(),custom:e.boolean(),customPlanConfig:e.property("custom_plan_config",nr.optional()),description:e.string(),entitlements:e.list(ie),features:e.list(W),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Vd)),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",I.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",I.optional()),planType:e.property("plan_type",e.string()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),usageViolations:e.property("usage_violations",e.list(ke)),valid:e.boolean(),yearlyPrice:e.property("yearly_price",I.optional())});var qe=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var Zr=e.object({badgeVisibility:e.property("badge_visibility",e.boolean()),checkout:e.boolean()});var Yr=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean())});var _r=e.object({billingScheme:e.property("billing_scheme",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),id:e.string(),interval:e.string(),isActive:e.property("is_active",e.boolean()),meterId:e.property("meter_id",e.string().optional()),packageSize:e.property("package_size",e.number()),price:e.number(),priceDecimal:e.property("price_decimal",e.string().optional()),priceExternalId:e.property("price_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),tiersMode:e.property("tiers_mode",e.string().optional()),updatedAt:e.property("updated_at",e.date()),usageType:e.property("usage_type",e.string())});var Qr=e.object({billingInvoiceId:e.property("billing_invoice_id",e.string().optional()),bundleType:e.property("bundle_type",e.string()),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string().optional()),creditIcon:e.property("credit_icon",e.string().optional()),creditId:e.property("credit_id",e.string()),creditName:e.property("credit_name",e.string()),expiryType:e.property("expiry_type",e.string()),expiryUnit:e.property("expiry_unit",e.string()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),hasGrants:e.property("has_grants",e.boolean()),id:e.string(),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),price:_r.optional(),quantity:e.number().optional(),singularName:e.property("singular_name",e.string().optional()),status:e.string(),unitPrice:e.property("unit_price",_r.optional()),updatedAt:e.property("updated_at",e.date())});var eo=e.object({billingCreditBundleId:e.property("billing_credit_bundle_id",e.string().optional()),billingCreditId:e.property("billing_credit_id",e.string()),companyId:e.property("company_id",e.string()),companyName:e.property("company_name",e.string()),createdAt:e.property("created_at",e.date()),creditDescription:e.property("credit_description",e.string()),creditIcon:e.property("credit_icon",e.string().optional()),creditName:e.property("credit_name",e.string()),expiresAt:e.property("expires_at",e.date().optional()),expiryType:e.property("expiry_type",e.string().optional()),expiryUnit:e.property("expiry_unit",e.string().optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),grantReason:e.property("grant_reason",e.string()),id:e.string(),planId:e.property("plan_id",e.string().optional()),planName:e.property("plan_name",e.string().optional()),pluralName:e.property("plural_name",e.string().optional()),price:_r.optional(),quantity:e.number(),quantityRemaining:e.property("quantity_remaining",e.number()),quantityUsed:e.property("quantity_used",e.number()),singularName:e.property("singular_name",e.string().optional()),sourceLabel:e.property("source_label",e.string()),updatedAt:e.property("updated_at",e.date()),validFrom:e.property("valid_from",e.date().optional()),zeroedOutDate:e.property("zeroed_out_date",e.date().optional()),zeroedOutReason:e.property("zeroed_out_reason",e.string().optional())});var ro=e.object({accountId:e.property("account_id",e.string().optional()),publishableKey:e.property("publishable_key",e.string().optional()),schematicPublishableKey:e.property("schematic_publishable_key",e.string()),setupIntentClientSecret:e.property("setup_intent_client_secret",e.string().optional())});var qd=e.object({activeAddOns:e.property("active_add_ons",e.list(cr)),activePlans:e.property("active_plans",e.list(cr)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Le)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(qe)),capabilities:Zr.optional(),checkoutSettings:e.property("checkout_settings",Yr),company:K.optional(),component:we.optional(),creditBundles:e.property("credit_bundles",e.list(Qr)),creditGrants:e.property("credit_grants",e.list(eo)),defaultPlan:e.property("default_plan",ee.optional()),featureUsage:e.property("feature_usage",De.optional()),invoices:e.list(le),postTrialPlan:e.property("post_trial_plan",ee.optional()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),stripeEmbed:e.property("stripe_embed",ro.optional()),subscription:Ve.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",le.optional())});var Md=e.object({data:qd,params:Dd});var At=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Ud),name:e.string()});var Ft=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",Td.optional()),name:e.string().optional(),state:vd.optional()});var oo=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),dealId:e.property("deal_id",e.string().optional()),environmentId:e.property("environment_id",e.string()),productExternalId:e.property("product_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Ad=e.object({data:oo,params:e.record(e.string(),e.unknown())});var Fd=e.object({data:oo,params:e.record(e.string(),e.unknown())});var Id=e.object({accountId:e.property("account_id",e.string()),arr:e.string(),companyExternalId:e.property("company_external_id",e.string().optional()),createdAt:e.property("created_at",e.date()),dealExternalId:e.property("deal_external_id",e.string()),dealId:e.property("deal_id",e.string()),environmentId:e.property("environment_id",e.string()),mrr:e.string(),name:e.string().optional(),productExternalId:e.property("product_external_id",e.string().optional()),updatedAt:e.property("updated_at",e.date())});var Kd=e.object({data:Id,params:e.record(e.string(),e.unknown())});var Ld=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var to=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),currency:e.string(),environmentId:e.property("environment_id",e.string()),externalId:e.property("external_id",e.string()),name:e.string(),price:e.string(),productId:e.property("product_id",e.string()),quantity:e.number(),updatedAt:e.property("updated_at",e.date())});var Gd=e.object({data:e.list(to),params:Ld});var Nd=e.object({data:to,params:e.record(e.string(),e.unknown())});var It=e.object({dealExternalId:e.property("deal_external_id",e.string()),lineItemExternalId:e.property("line_item_external_id",e.string())});var Kt=e.object({amount:e.string(),discountPercentage:e.property("discount_percentage",e.string().optional()),interval:e.string(),lineItemExternalId:e.property("line_item_external_id",e.string()),productExternalId:e.property("product_external_id",e.string()),quantity:e.number(),termMonth:e.property("term_month",e.number().optional()),totalDiscount:e.property("total_discount",e.string().optional())});var Lt=e.object({arr:e.string().optional(),crmCompanyId:e.property("crm_company_id",e.string().optional()),crmCompanyKey:e.property("crm_company_key",e.string()),crmProductId:e.property("crm_product_id",e.string().optional()),crmType:e.property("crm_type",e.string()),dealExternalId:e.property("deal_external_id",e.string()),dealName:e.property("deal_name",e.string().optional()),dealStage:e.property("deal_stage",e.string().optional()),mrr:e.string().optional()});var Gt=e.object({currency:e.string(),description:e.string(),externalId:e.property("external_id",e.string()),interval:e.string(),name:e.string(),price:e.string(),quantity:e.number(),sku:e.string()});var Xd=e.object({accountId:e.property("account_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),exportType:e.property("export_type",e.string()),id:e.string(),metadata:e.string(),outputFileType:e.property("output_file_type",e.string()),status:e.string(),updatedAt:e.property("updated_at",e.date())});var Hd=e.object({data:Xd,params:e.record(e.string(),e.unknown())});var Nt=e.object({metadata:e.string()});var io=e.object({capturedAt:e.property("captured_at",e.date()),eventId:e.property("event_id",e.string().optional()),remoteAddr:e.property("remote_addr",e.string()),remoteIp:e.property("remote_ip",e.string()),userAgent:e.property("user_agent",e.string())});var Wd=e.object({events:e.list(io)});var Jd=e.object({data:Wd,params:e.record(e.string(),e.unknown())});var $d=e.object({eventSubtypes:e.property("event_subtypes",e.list(e.string()).optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Zd=e.object({data:e.list(Mr),params:$d});var Xt=e.enum_(["identify","track","flag_check"]);var Yd=e.enum_(["identify","track","flag_check"]);var Qd=e.object({companyId:e.property("company_id",e.string().optional()),eventSubtype:e.property("event_subtype",e.string().optional()),eventTypes:e.property("event_types",e.list(Yd).optional()),flagId:e.property("flag_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),userId:e.property("user_id",e.string().optional())});var ao=e.object({apiKey:e.property("api_key",e.string().optional()),body:e.record(e.string(),e.unknown()),bodyPreview:e.property("body_preview",e.string()),capturedAt:e.property("captured_at",e.date()),company:rr.optional(),companyId:e.property("company_id",e.string().optional()),enrichedAt:e.property("enriched_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),errorMessage:e.property("error_message",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string())),features:e.list(rr),id:e.string(),loadedAt:e.property("loaded_at",e.date().optional()),processedAt:e.property("processed_at",e.date().optional()),quantity:e.number(),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),subtype:e.string().optional(),type:e.string(),updatedAt:e.property("updated_at",e.date()),user:rr.optional(),userId:e.property("user_id",e.string().optional())});var eh=e.object({data:e.list(ao),params:Qd});var rh=e.object({data:io,params:e.record(e.string(),e.unknown())});var oh=e.object({data:ao,params:e.record(e.string(),e.unknown())});var th=e.object({connected:e.boolean(),environmentId:e.property("environment_id",e.string()),lastEventAt:e.property("last_event_at",e.date().optional())});var ih=e.object({data:th,params:e.record(e.string(),e.unknown())});var ah=e.object({company:e.record(e.string(),e.string()).optional(),event:e.string(),quantity:e.number().optional(),traits:e.record(e.string(),e.unknown()).optional(),user:e.record(e.string(),e.string()).optional()});var sh=e.object({companyId:e.property("company_id",e.string().optional()),error:e.string().optional(),flagId:e.property("flag_id",e.string().optional()),flagKey:e.property("flag_key",e.string()),reason:e.string(),reqCompany:e.property("req_company",e.record(e.string(),e.string()).optional()),reqUser:e.property("req_user",e.record(e.string(),e.string()).optional()),ruleId:e.property("rule_id",e.string().optional()),userId:e.property("user_id",e.string().optional()),value:e.boolean()});var nh=e.object({keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var ch=e.object({company:nh.optional(),keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var ph=e.undiscriminatedUnion([ah,sh,ch]);var lh=e.enum_(["identify","track","flag_check"]);var so=e.object({body:ph.optional(),eventType:e.property("event_type",lh),sentAt:e.property("sent_at",e.date().optional())});var Ht=e.object({events:e.list(so)});var mh=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutCompanyOverrideFor:e.property("without_company_override_for",e.string().optional()),withoutPlanEntitlementFor:e.property("without_plan_entitlement_for",e.string().optional())});var uh=e.object({data:e.list(W),params:mh});var dh=e.enum_(["boolean","event","trait"]);var hh=e.enum_(["add_on","alpha","beta","deprecated","ga","in_plan","inactive","internal_testing","legacy"]);var gh=e.object({data:W,params:e.record(e.string(),e.unknown())});var wh=e.object({data:W,params:e.record(e.string(),e.unknown())});var yh=e.enum_(["boolean","event","trait"]);var zh=e.enum_(["add_on","alpha","beta","deprecated","ga","in_plan","inactive","internal_testing","legacy"]);var Rh=e.object({data:W,params:e.record(e.string(),e.unknown())});var bh=e.object({data:M,params:e.record(e.string(),e.unknown())});var fh=e.object({booleanRequireEvent:e.property("boolean_require_event",e.boolean().optional()),featureType:e.property("feature_type",e.list(e.string()).optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),withoutCompanyOverrideFor:e.property("without_company_override_for",e.string().optional()),withoutPlanEntitlementFor:e.property("without_plan_entitlement_for",e.string().optional())});var _h=e.object({data:j,params:fh});var Sh=e.object({featureId:e.property("feature_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var xh=e.object({data:e.list(be),params:Sh});var Eh=e.object({data:be,params:e.record(e.string(),e.unknown())});var Uh=e.object({data:be,params:e.record(e.string(),e.unknown())});var Ph=e.object({data:be,params:e.record(e.string(),e.unknown())});var Ch=e.object({data:M,params:e.record(e.string(),e.unknown())});var Th=e.object({createdAt:e.property("created_at",e.date()),defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",e.string()),id:e.string(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),updatedAt:e.property("updated_at",e.date())});var vh=e.object({flag:Th.optional(),rules:e.list(Fr)});var Oh=e.object({data:vh,params:e.record(e.string(),e.unknown())});var no=e.object({companyId:e.property("company_id",e.string().optional()),error:e.string().optional(),featureAllocation:e.property("feature_allocation",e.number().optional()),featureUsage:e.property("feature_usage",e.number().optional()),featureUsageEvent:e.property("feature_usage_event",e.string().optional()),featureUsagePeriod:e.property("feature_usage_period",e.string().optional()),featureUsageResetAt:e.property("feature_usage_reset_at",e.date().optional()),flag:e.string(),flagId:e.property("flag_id",e.string().optional()),reason:e.string(),ruleId:e.property("rule_id",e.string().optional()),ruleType:e.property("rule_type",e.string().optional()),userId:e.property("user_id",e.string().optional()),value:e.boolean()});var Bh=e.object({data:no,params:e.record(e.string(),e.unknown())});var jh=e.object({flags:e.list(no)});var kh=e.object({data:jh,params:e.record(e.string(),e.unknown())});var Dh=e.object({featureId:e.property("feature_id",e.string().optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Vh=e.object({data:j,params:Dh});var co=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",e.stringLiteral("boolean")),id:e.string().optional(),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var Wt=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",dh),flag:co.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",hh.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional())});var Jt=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",yh.optional()),flag:co.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",zh.optional()),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string().optional(),pluralName:e.property("plural_name",e.string().optional()),singularName:e.property("singular_name",e.string().optional()),traitId:e.property("trait_id",e.string().optional())});var qh=e.enum_(["company","metric","trait","user","plan","billing_product","crm_product","base_plan"]);var Mh=e.enum_(["all_time","current_month","current_week","current_day"]);var Ah=e.enum_(["first_of_month","billing_cycle"]);var Fh=e.enum_(["eq","ne","gt","gte","lt","lte","is_empty","not_empty"]);var pr=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionType:e.property("condition_type",qh),creditCost:e.property("credit_cost",e.number().optional()),creditId:e.property("credit_id",e.string().optional()),eventSubtype:e.property("event_subtype",e.string().optional()),id:e.string().optional(),metricPeriod:e.property("metric_period",Mh.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Ah.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:Fh,resourceIds:e.property("resource_ids",e.list(e.string())),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string().optional())});var po=e.object({conditions:e.list(pr),flagId:e.property("flag_id",e.string().optional()),id:e.string().optional()});var Ih=e.enum_(["global_override","company_override","plan_entitlement","standard","default"]);var Kh=e.object({conditionGroups:e.property("condition_groups",e.list(po)),conditions:e.list(pr),id:e.string().optional(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",Ih.optional()),value:e.boolean()});var $t=e.object({rules:e.list(Kh)});var lo=e.object({ctaText:e.property("cta_text",e.string()),ctaWebSite:e.property("cta_web_site",e.string()),priceText:e.property("price_text",e.string())});var Ge=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Te.optional()),chargeType:e.property("charge_type",e.string()),companyCount:e.property("company_count",e.number()),compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),controlledBy:e.property("controlled_by",e.string()),createdAt:e.property("created_at",e.date()),customPlanConfig:e.property("custom_plan_config",lo.optional()),description:e.string(),entitlements:e.list(ie),features:e.list(W),icon:e.string(),id:e.string(),includedCreditGrants:e.property("included_credit_grants",e.list(Re).optional()),isCustom:e.property("is_custom",e.boolean()),isDefault:e.property("is_default",e.boolean()),isFree:e.property("is_free",e.boolean()),isTrialable:e.property("is_trialable",e.boolean()),monthlyPrice:e.property("monthly_price",I.optional()),name:e.string(),oneTimePrice:e.property("one_time_price",I.optional()),planType:e.property("plan_type",e.string()),trialDays:e.property("trial_days",e.number().optional()),updatedAt:e.property("updated_at",e.date()),yearlyPrice:e.property("yearly_price",I.optional())});var mo=e.object({collectAddress:e.property("collect_address",e.boolean()),collectEmail:e.property("collect_email",e.boolean()),collectPhone:e.property("collect_phone",e.boolean())});var Lh=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var Zt=e.object({entitlements:e.list(Lh).optional(),planId:e.property("plan_id",e.string())});var lr=e.object({bundleId:e.string()});var Gh=e.object({addOns:e.property("add_ons",e.list(Ge)),checkoutSettings:e.property("checkout_settings",mo),customPlanConfig:e.property("custom_plan_config",lo.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),defaultPlan:e.property("default_plan",Ge.optional()),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlan:e.property("fallback_plan",Ge.optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlan:e.property("initial_plan",Ge.optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPrice:e.property("initial_plan_price",I.optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnList:e.property("ordered_add_on_list",e.list(Zt)),orderedBundleList:e.property("ordered_bundle_list",e.list(lr)),orderedPlanList:e.property("ordered_plan_list",e.list(Zt)),plans:e.list(Ge),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlan:e.property("trial_expiry_plan",Ge.optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPrice:e.property("trial_expiry_plan_price",I.optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var Nh=e.object({data:Gh,params:e.record(e.string(),e.unknown())});var Xh=e.object({compatiblePlanIds:e.property("compatible_plan_ids",e.list(e.string())),sourcePlanId:e.property("source_plan_id",e.string())});var Hh=e.object({entitlementId:e.property("entitlement_id",e.string()),visible:e.boolean().optional()});var Ue=e.object({entitlements:e.list(Hh).optional(),planId:e.property("plan_id",e.string())});var uo=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Xh)),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutSettings:e.property("checkout_settings",mo),defaultPlanId:e.property("default_plan_id",e.string().optional()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),id:e.string(),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOnIds:e.property("ordered_add_on_ids",e.list(Ue)),planIds:e.property("plan_ids",e.list(Ue)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",e.boolean()),taxCollectionEnabled:e.property("tax_collection_enabled",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var Wh=e.object({data:uo,params:e.record(e.string(),e.unknown())});var Jh=e.object({data:uo,params:e.record(e.string(),e.unknown())});var Yt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(qe).optional()),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutCollectAddress:e.property("checkout_collect_address",e.boolean()),checkoutCollectEmail:e.property("checkout_collect_email",e.boolean()),checkoutCollectPhone:e.property("checkout_collect_phone",e.boolean()),customPlanConfig:e.property("custom_plan_config",nr.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),enableTaxCollection:e.property("enable_tax_collection",e.boolean()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOns:e.property("ordered_add_ons",e.list(Ue)),orderedBundleList:e.property("ordered_bundle_list",e.list(lr)),orderedPlans:e.property("ordered_plans",e.list(Ue)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var Qt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(qe).optional()),addOnIds:e.property("add_on_ids",e.list(e.string())),checkoutCollectAddress:e.property("checkout_collect_address",e.boolean()),checkoutCollectEmail:e.property("checkout_collect_email",e.boolean()),checkoutCollectPhone:e.property("checkout_collect_phone",e.boolean()),customPlanConfig:e.property("custom_plan_config",nr.optional()),customPlanId:e.property("custom_plan_id",e.string().optional()),enableTaxCollection:e.property("enable_tax_collection",e.boolean()),fallbackPlanId:e.property("fallback_plan_id",e.string().optional()),initialPlanId:e.property("initial_plan_id",e.string().optional()),initialPlanPriceId:e.property("initial_plan_price_id",e.string().optional()),orderedAddOns:e.property("ordered_add_ons",e.list(Ue)),orderedBundleList:e.property("ordered_bundle_list",e.list(lr)),orderedPlans:e.property("ordered_plans",e.list(Ue)),preventDowngradesWhenOverLimit:e.property("prevent_downgrades_when_over_limit",e.boolean()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),syncCustomerBillingDetailsForTax:e.property("sync_customer_billing_details_for_tax",e.boolean()),trialDays:e.property("trial_days",e.number().optional()),trialExpiryPlanId:e.property("trial_expiry_plan_id",e.string().optional()),trialExpiryPlanPriceId:e.property("trial_expiry_plan_price_id",e.string().optional()),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional())});var $h=e.object({apiKeyId:e.property("api_key_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expiredAt:e.property("expired_at",e.date()),id:e.string(),resourceType:e.property("resource_type",e.string()),token:e.string(),updatedAt:e.property("updated_at",e.date())});var Zh=e.object({data:$h,params:e.record(e.string(),e.unknown())});var ei=e.object({lookup:e.record(e.string(),e.string()),resource_type:e.string()});var Yh=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),webhookId:e.property("webhook_id",e.string().optional())});var mr=e.object({creditId:e.property("credit_id",e.string())});var ur=e.object({featureId:e.property("feature_id",e.string())});var _e=e.object({createdAt:e.property("created_at",e.date()),creditTriggerConfigs:e.property("credit_trigger_configs",e.list(mr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(ur).optional()),id:e.string(),name:e.string(),requestTypes:e.property("request_types",e.list(e.string())),secret:e.string(),status:e.string(),updatedAt:e.property("updated_at",e.date()),url:e.string()});var ho=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",e.string()),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),updatedAt:e.property("updated_at",e.date()),webhook:_e.optional(),webhookId:e.property("webhook_id",e.string())});var Qh=e.object({data:e.list(ho),params:Yh});var eg=e.object({data:ho,params:e.record(e.string(),e.unknown())});var rg=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),webhookId:e.property("webhook_id",e.string().optional())});var og=e.object({data:j,params:rg});var tg=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var ig=e.object({data:e.list(_e),params:tg});var ag=e.enum_(["company.updated","user.updated","plan.updated","plan.entitlement.updated","company.override.updated","feature.updated","flag.updated","flag_rules.updated","company.created","user.created","plan.created","plan.entitlement.created","company.override.created","feature.created","flag.created","company.deleted","user.deleted","plan.deleted","plan.entitlement.deleted","company.override.deleted","feature.deleted","flag.deleted","test.send","subscription.trial.ended","entitlement.limit.warning","entitlement.limit.reached","entitlement.soft_limit.warning","entitlement.soft_limit.reached","entitlement.tier_limit.warning","entitlement.tier_limit.reached","credit.limit.warning","credit.limit.reached","company.plan_change"]);var sg=e.object({data:_e,params:e.record(e.string(),e.unknown())});var ng=e.object({data:_e,params:e.record(e.string(),e.unknown())});var cg=e.enum_(["company.updated","user.updated","plan.updated","plan.entitlement.updated","company.override.updated","feature.updated","flag.updated","flag_rules.updated","company.created","user.created","plan.created","plan.entitlement.created","company.override.created","feature.created","flag.created","company.deleted","user.deleted","plan.deleted","plan.entitlement.deleted","company.override.deleted","feature.deleted","flag.deleted","test.send","subscription.trial.ended","entitlement.limit.warning","entitlement.limit.reached","entitlement.soft_limit.warning","entitlement.soft_limit.reached","entitlement.tier_limit.warning","entitlement.tier_limit.reached","credit.limit.warning","credit.limit.reached","company.plan_change"]);var pg=e.enum_(["active","inactive"]);var lg=e.object({data:_e,params:e.record(e.string(),e.unknown())});var mg=e.object({data:M,params:e.record(e.string(),e.unknown())});var ug=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var dg=e.object({data:j,params:ug});var ri=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(mr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(ur).optional()),name:e.string(),requestTypes:e.property("request_types",e.list(ag)),url:e.string()});var oi=e.object({creditTriggerConfigs:e.property("credit_trigger_configs",e.list(mr).optional()),entitlementTriggerConfigs:e.property("entitlement_trigger_configs",e.list(ur).optional()),name:e.string().optional(),requestTypes:e.property("request_types",e.list(cg).optional()),status:pg.optional(),url:e.string().optional()});var a=e.object({error:e.string()});var go=e.object({addOnId:e.property("add_on_id",e.string()),priceId:e.property("price_id",e.string())});var dr=e.object({bundleId:e.property("bundle_id",e.string()),quantity:e.number()});var hr=e.object({priceId:e.property("price_id",e.string()),quantity:e.number()});var ti=e.object({addOnIds:e.property("add_on_ids",e.list(go)),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(dr)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(hr)),paymentMethodId:e.property("payment_method_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional()),skipTrial:e.property("skip_trial",e.boolean())});var iie=e.object({addOnIds:e.property("add_on_ids",e.list(go)),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(dr)),newPlanId:e.property("new_plan_id",e.string()),newPriceId:e.property("new_price_id",e.string()),payInAdvance:e.property("pay_in_advance",e.list(hr)),paymentMethodId:e.property("payment_method_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional()),skipTrial:e.property("skip_trial",e.boolean())});var ii=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var nie=e.object({companyId:e.property("company_id",e.string()),createdAt:e.property("created_at",e.date()),id:e.string(),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string())});var Sie=e.object({activeAddOns:e.property("active_add_ons",e.list(cr)),activePlans:e.property("active_plans",e.list(cr)),activeUsageBasedEntitlements:e.property("active_usage_based_entitlements",e.list(Le)),addOnCompatibilities:e.property("add_on_compatibilities",e.list(qe)),capabilities:Zr.optional(),checkoutSettings:e.property("checkout_settings",Yr),company:K.optional(),component:we.optional(),creditBundles:e.property("credit_bundles",e.list(Qr)),creditGrants:e.property("credit_grants",e.list(eo)),defaultPlan:e.property("default_plan",ee.optional()),featureUsage:e.property("feature_usage",De.optional()),postTrialPlan:e.property("post_trial_plan",ee.optional()),showCredits:e.property("show_credits",e.boolean()),showPeriodToggle:e.property("show_period_toggle",e.boolean()),showZeroPriceAsFree:e.property("show_zero_price_as_free",e.boolean()),stripeEmbed:e.property("stripe_embed",ro.optional()),subscription:Ve.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",le.optional())});var Eie=e.object({amountOff:e.property("amount_off",e.number()),currency:e.string().optional(),duration:e.string(),durationInMonths:e.property("duration_in_months",e.number()),maxRedemptions:e.property("max_redemptions",e.number()),name:e.string(),percentOff:e.property("percent_off",e.number()),timesRedeemed:e.property("times_redeemed",e.number())});var hg=e.enum_(["all_time","current_month","current_week","current_day"]);var gg=e.enum_(["first_of_month","billing_cycle"]);var wg=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var jie=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),featureId:e.property("feature_id",e.string()),metricPeriod:e.property("metric_period",hg.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",gg.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",wg)});var ai=e.object({defaultValue:e.property("default_value",e.boolean()),description:e.string(),featureId:e.property("feature_id",e.string().optional()),flagType:e.property("flag_type",e.stringLiteral("boolean")),key:e.string(),maintainerId:e.property("maintainer_id",e.string().optional()),name:e.string()});var yg=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var zg=e.enum_(["days","billing_periods"]);var Rg=e.enum_(["monthly","yearly","daily","weekly"]);var bg=e.enum_(["billing_period","first_of_month"]);var fg=e.enum_(["plan_period","no_reset"]);var Xie=e.object({expiryType:e.property("expiry_type",yg.optional()),expiryUnit:e.property("expiry_unit",zg.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),resetCadence:e.property("reset_cadence",Rg),resetStart:e.property("reset_start",bg),resetType:e.property("reset_type",fg.optional())});var Wie=e.object({createdAt:e.property("created_at",e.date()),definitionId:e.property("definition_id",e.string()),entityId:e.property("entity_id",e.string()),entityType:e.property("entity_type",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),key:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var $ie=e.object({createdAt:e.property("created_at",e.date()),definitionId:e.property("definition_id",e.string()),environmentId:e.property("environment_id",e.string()),id:e.string(),updatedAt:e.property("updated_at",e.date()),value:e.string()});var Yie=e.object({apiKey:e.property("api_key",e.string().optional()),body:e.record(e.string(),e.unknown()),bodyPreview:e.property("body_preview",e.string()),capturedAt:e.property("captured_at",e.date()),companyId:e.property("company_id",e.string().optional()),enrichedAt:e.property("enriched_at",e.date().optional()),environmentId:e.property("environment_id",e.string().optional()),errorMessage:e.property("error_message",e.string().optional()),featureIds:e.property("feature_ids",e.list(e.string())),id:e.string(),loadedAt:e.property("loaded_at",e.date().optional()),processedAt:e.property("processed_at",e.date().optional()),quantity:e.number(),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),subtype:e.string().optional(),type:e.string(),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional())});var eae=e.object({amountDue:e.property("amount_due",e.number()),amountPaid:e.property("amount_paid",e.number()),amountRemaining:e.property("amount_remaining",e.number()),collectionMethod:e.property("collection_method",e.string()),currency:e.string(),customerExternalId:e.property("customer_external_id",e.string()),dueDate:e.property("due_date",e.date().optional()),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),subscriptionExternalId:e.property("subscription_external_id",e.string().optional()),subtotal:e.number(),url:e.string().optional()});var si=e.object({keys:e.record(e.string(),e.string())});var _g=e.object({planId:e.property("plan_id",e.string()),priceId:e.property("price_id",e.string().optional())});var ni=e.object({addOnSelections:e.property("add_on_selections",e.list(_g)),basePlanId:e.property("base_plan_id",e.string().optional()),basePlanPriceId:e.property("base_plan_price_id",e.string().optional()),companyId:e.property("company_id",e.string()),couponExternalId:e.property("coupon_external_id",e.string().optional()),creditBundles:e.property("credit_bundles",e.list(dr)),payInAdvanceEntitlements:e.property("pay_in_advance_entitlements",e.list(hr)),paymentMethodExternalId:e.property("payment_method_external_id",e.string().optional()),promoCode:e.property("promo_code",e.string().optional())});var cae=e.object({displayName:e.property("display_name",e.string()),eventName:e.property("event_name",e.string()),eventPayloadKey:e.property("event_payload_key",e.string())});var lae=e.object({accountLast4:e.property("account_last4",e.string().optional()),accountName:e.property("account_name",e.string().optional()),bankName:e.property("bank_name",e.string().optional()),billingEmail:e.property("billing_email",e.string().optional()),billingName:e.property("billing_name",e.string().optional()),cardBrand:e.property("card_brand",e.string().optional()),cardExpMonth:e.property("card_exp_month",e.number().optional()),cardExpYear:e.property("card_exp_year",e.number().optional()),cardLast4:e.property("card_last4",e.string().optional()),customerExternalId:e.property("customer_external_id",e.string()),paymentMethodType:e.property("payment_method_type",e.string())});var uae=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),ruleId:e.property("rule_id",e.string()),updatedAt:e.property("updated_at",e.date())});var hae=e.object({comparisonTraitId:e.property("comparison_trait_id",e.string().optional()),conditionGroupId:e.property("condition_group_id",e.string().optional()),conditionType:e.property("condition_type",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),eventSubtype:e.property("event_subtype",e.string().optional()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),metricPeriod:e.property("metric_period",e.string().optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",e.string().optional()),metricValue:e.property("metric_value",e.number().optional()),operator:e.string(),resourceIds:e.property("resource_ids",e.list(e.string())),ruleId:e.property("rule_id",e.string()),traitEntityType:e.property("trait_entity_type",e.string().optional()),traitId:e.property("trait_id",e.string().optional()),traitValue:e.property("trait_value",e.string()),updatedAt:e.property("updated_at",e.date())});var wae=e.object({createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),flagId:e.property("flag_id",e.string().optional()),id:e.string(),name:e.string(),priority:e.number(),ruleType:e.property("rule_type",e.string()),updatedAt:e.property("updated_at",e.date()),value:e.boolean()});var zae=e.object({apiKeyId:e.property("api_key_id",e.string()),createdAt:e.property("created_at",e.date()),environmentId:e.property("environment_id",e.string()),expiredAt:e.property("expired_at",e.date()),id:e.string(),resourceType:e.property("resource_type",e.string()),updatedAt:e.property("updated_at",e.date())});var Sg=e.enum_(["all_time","current_month","current_week","current_day"]);var xg=e.enum_(["first_of_month","billing_cycle"]);var Eg=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Uae=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),metricPeriod:e.property("metric_period",Sg.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",xg.optional()),valueBool:e.property("value_bool",e.boolean().optional()),valueCreditId:e.property("value_credit_id",e.string().optional()),valueNumeric:e.property("value_numeric",e.number().optional()),valueTraitId:e.property("value_trait_id",e.string().optional()),valueType:e.property("value_type",Eg)});var vae=e.object({conditionGroups:e.property("condition_groups",e.list(po)),conditions:e.list(pr),name:e.string(),priority:e.number(),value:e.boolean()});var ci=e.object({id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var pi=e.object({incr:e.number().optional(),keys:e.record(e.string(),e.string()),set:e.string().optional(),trait:e.string(),updateOnly:e.property("update_only",e.boolean().optional())});var li=e.object({companies:e.list(e.record(e.string(),e.string())).optional(),company:e.record(e.string(),e.string()).optional(),companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var Dae=e.object({companyId:e.property("company_id",e.string().optional()),companyIds:e.property("company_ids",e.list(e.string()).optional()),id:e.string().optional(),keys:e.record(e.string(),e.string()),lastSeenAt:e.property("last_seen_at",e.date().optional()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional(),updateOnly:e.property("update_only",e.boolean().optional())});var Ug=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var Fae=e.object({billingProductId:e.property("billing_product_id",e.string().optional()),billingThreshold:e.property("billing_threshold",e.number().optional()),currency:e.string().optional(),monthlyMeteredPriceId:e.property("monthly_metered_price_id",e.string().optional()),monthlyPriceTiers:e.property("monthly_price_tiers",e.list(ge).optional()),monthlyUnitPrice:e.property("monthly_unit_price",e.number().optional()),monthlyUnitPriceDecimal:e.property("monthly_unit_price_decimal",e.string().optional()),overageBillingProductId:e.property("overage_billing_product_id",e.string().optional()),priceBehavior:e.property("price_behavior",Ug.optional()),priceTiers:e.property("price_tiers",e.list(ge).optional()),softLimit:e.property("soft_limit",e.number().optional()),tierMode:e.property("tier_mode",e.string().optional()),yearlyMeteredPriceId:e.property("yearly_metered_price_id",e.string().optional()),yearlyPriceTiers:e.property("yearly_price_tiers",e.list(ge).optional()),yearlyUnitPrice:e.property("yearly_unit_price",e.number().optional()),yearlyUnitPriceDecimal:e.property("yearly_unit_price_decimal",e.string().optional())});var Kae=e.object({createdAt:e.property("created_at",e.date()),id:e.string(),payload:e.string().optional(),requestType:e.property("request_type",e.string()),responseCode:e.property("response_code",e.number().optional()),sentAt:e.property("sent_at",e.date().optional()),status:e.string(),updatedAt:e.property("updated_at",e.date()),webhookId:e.property("webhook_id",e.string())});var wo=class{constructor(t={}){this._options=t}listApiKeys(t,o){return b.fromPromise(this.__listApiKeys(t,o))}async __listApiKeys(t,o){let{environmentId:r,requireEnvironment:i,limit:m,offset:g}=t,p={};r!=null&&(p.environment_id=r),p.require_environment=i.toString(),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-keys"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:tn.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-keys.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}createApiKey(t,o){return b.fromPromise(this.__createApiKey(t,o))}async __createApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-keys"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:rt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:sn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /api-keys.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getApiKey(t,o){return b.fromPromise(this.__getApiKey(t,o))}async __getApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-keys/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:nn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-keys/{api_key_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateApiKey(t,o={},r){return b.fromPromise(this.__updateApiKey(t,o,r))}async __updateApiKey(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-keys/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ot.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:cn.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /api-keys/{api_key_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteApiKey(t,o){return b.fromPromise(this.__deleteApiKey(t,o))}async __deleteApiKey(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-keys/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:pn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /api-keys/{api_key_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countApiKeys(t,o){return b.fromPromise(this.__countApiKeys(t,o))}async __countApiKeys(t,o){let{environmentId:r,requireEnvironment:i,limit:m,offset:g}=t,p={};r!=null&&(p.environment_id=r),p.require_environment=i.toString(),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-keys/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:mn.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-keys/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listApiRequests(t={},o){return b.fromPromise(this.__listApiRequests(t,o))}async __listApiRequests(t={},o){let{q:r,requestType:i,environmentId:m,limit:g,offset:p}=t,s={};r!=null&&(s.q=r),i!=null&&(s.request_type=i),m!=null&&(s.environment_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-requests"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:dn.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-requests.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getApiRequest(t,o){return b.fromPromise(this.__getApiRequest(t,o))}async __getApiRequest(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`api-requests/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:gn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-requests/{api_request_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countApiRequests(t={},o){return b.fromPromise(this.__countApiRequests(t,o))}async __countApiRequests(t={},o){let{q:r,requestType:i,environmentId:m,limit:g,offset:p}=t,s={};r!=null&&(s.q=r),i!=null&&(s.request_type=i),m!=null&&(s.environment_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"api-requests/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:yn.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /api-requests/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}listEnvironments(t={},o){return b.fromPromise(this.__listEnvironments(t,o))}async __listEnvironments(t={},o){let{ids:r,limit:i,offset:m}=t,g={};r!=null&&(Array.isArray(r)?g.ids=r.map(s=>s):g.ids=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"environments"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:Rn.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /environments.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createEnvironment(t,o){return b.fromPromise(this.__createEnvironment(t,o))}async __createEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"environments"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:tt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:_n.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /environments.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEnvironment(t,o){return b.fromPromise(this.__getEnvironment(t,o))}async __getEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`environments/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Sn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /environments/{environment_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateEnvironment(t,o={},r){return b.fromPromise(this.__updateEnvironment(t,o,r))}async __updateEnvironment(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`environments/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:it.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:En.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /environments/{environment_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteEnvironment(t,o){return b.fromPromise(this.__deleteEnvironment(t,o))}async __deleteEnvironment(t,o){let r=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`environments/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Un.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /environments/{environment_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}quickstart(t){return b.fromPromise(this.__quickstart(t))}async __quickstart(t){let o=await(this._options.fetcher??_)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"quickstart"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:Cn.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new P(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 401:throw new S(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 403:throw new x(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 404:throw new E(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 500:throw new U(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /quickstart.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var X=H(require("url-join"));var yo=class{constructor(t={}){this._options=t}listCoupons(t={},o){return b.fromPromise(this.__listCoupons(t,o))}async __listCoupons(t={},o){let{isActive:r,q:i,limit:m,offset:g}=t,p={};r!=null&&(p.is_active=r.toString()),i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/coupons"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:vn.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/coupons.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertBillingCoupon(t,o){return b.fromPromise(this.__upsertBillingCoupon(t,o))}async __upsertBillingCoupon(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/coupons"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:at.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:On.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/coupons.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingCustomer(t,o){return b.fromPromise(this.__upsertBillingCustomer(t,o))}async __upsertBillingCustomer(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/customer/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:st.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:jn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/customer/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCustomersWithSubscriptions(t={},o){return b.fromPromise(this.__listCustomersWithSubscriptions(t,o))}async __listCustomersWithSubscriptions(t={},o){let{companyIds:r,name:i,failedToImport:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.company_ids=r.map(z=>z):l.company_ids=r),i!=null&&(l.name=i),m!=null&&(l.failed_to_import=m.toString()),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/customers"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:qn.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/customers.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}countCustomers(t={},o){return b.fromPromise(this.__countCustomers(t,o))}async __countCustomers(t={},o){let{companyIds:r,name:i,failedToImport:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.company_ids=r.map(z=>z):l.company_ids=r),i!=null&&(l.name=i),m!=null&&(l.failed_to_import=m.toString()),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/customers/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:An.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/customers/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}listInvoices(t,o){return b.fromPromise(this.__listInvoices(t,o))}async __listInvoices(t,o){let{companyId:r,customerExternalId:i,subscriptionExternalId:m,limit:g,offset:p}=t,s={};r!=null&&(s.company_id=r),s.customer_external_id=i,s.subscription_external_id=m,g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/invoices"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:In.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/invoices.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}upsertInvoice(t,o){return b.fromPromise(this.__upsertInvoice(t,o))}async __upsertInvoice(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/invoices"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:nt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Kn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/invoices.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listMeters(t={},o){return b.fromPromise(this.__listMeters(t,o))}async __listMeters(t={},o){let{displayName:r,limit:i,offset:m}=t,g={};r!=null&&(g.display_name=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/meter"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:Gn.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/meter.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}upsertBillingMeter(t,o){return b.fromPromise(this.__upsertBillingMeter(t,o))}async __upsertBillingMeter(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/meter/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ct.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Nn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/meter/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listPaymentMethods(t,o){return b.fromPromise(this.__listPaymentMethods(t,o))}async __listPaymentMethods(t,o){let{companyId:r,customerExternalId:i,limit:m,offset:g}=t,p={};r!=null&&(p.company_id=r),p.customer_external_id=i,m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/payment-methods"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Hn.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/payment-methods.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertPaymentMethod(t,o){return b.fromPromise(this.__upsertPaymentMethod(t,o))}async __upsertPaymentMethod(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/payment-methods"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:pt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Wn.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/payment-methods.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}searchBillingPrices(t={},o){return b.fromPromise(this.__searchBillingPrices(t,o))}async __searchBillingPrices(t={},o){let{forInitialPlan:r,forTrialExpiryPlan:i,ids:m,productId:g,interval:p,price:s,q:l,requiresPaymentMethod:u,tiersMode:z,usageType:y,limit:C,offset:O}=t,T={};r!=null&&(T.for_initial_plan=r.toString()),i!=null&&(T.for_trial_expiry_plan=i.toString()),m!=null&&(Array.isArray(m)?T.ids=m.map(q=>q):T.ids=m),g!=null&&(T.product_id=g),p!=null&&(T.interval=p),s!=null&&(T.price=s.toString()),l!=null&&(T.q=l),u!=null&&(T.requires_payment_method=u.toString()),z!=null&&(T.tiers_mode=Jn.jsonOrThrow(z,{unrecognizedObjectKeys:"strip"})),y!=null&&(T.usage_type=$n.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})),C!=null&&(T.limit=C.toString()),O!=null&&(T.offset=O.toString());let V=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/price"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:T,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(V.ok)return{data:ec.parseOrThrow(V.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:V.rawResponse};if(V.error.reason==="status-code")switch(V.error.statusCode){case 400:throw new P(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 401:throw new S(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 403:throw new x(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 404:throw new E(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);case 500:throw new U(a.parseOrThrow(V.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),V.rawResponse);default:throw new c({statusCode:V.error.statusCode,body:V.error.body,rawResponse:V.rawResponse})}switch(V.error.reason){case"non-json":throw new c({statusCode:V.error.statusCode,body:V.error.rawBody,rawResponse:V.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/price.");case"unknown":throw new c({message:V.error.errorMessage,rawResponse:V.rawResponse})}}upsertBillingPrice(t,o){return b.fromPromise(this.__upsertBillingPrice(t,o))}async __upsertBillingPrice(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/price/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:lt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ic.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/price/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteBillingProduct(t,o){return b.fromPromise(this.__deleteBillingProduct(t,o))}async __deleteBillingProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/product/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ac.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/product/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listProductPrices(t={},o){return b.fromPromise(this.__listProductPrices(t,o))}async __listProductPrices(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:p,withOneTimeCharges:s,withZeroPrice:l,withPricesOnly:u,isActive:z,limit:y,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(V=>V):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=sc.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.without_linked_to_plan=p.toString()),s!=null&&(O.with_one_time_charges=s.toString()),l!=null&&(O.with_zero_price=l.toString()),u!=null&&(O.with_prices_only=u.toString()),z!=null&&(O.is_active=z.toString()),y!=null&&(O.limit=y.toString()),C!=null&&(O.offset=C.toString());let T=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/product/prices"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:pc.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new P(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new S(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new x(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new U(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new c({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case"non-json":throw new c({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/product/prices.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}deleteProductPrice(t,o){return b.fromPromise(this.__deleteProductPrice(t,o))}async __deleteProductPrice(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/product/prices/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:lc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/product/prices/{billing_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingProduct(t,o){return b.fromPromise(this.__upsertBillingProduct(t,o))}async __upsertBillingProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/product/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:mt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:mc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/product/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBillingProducts(t={},o){return b.fromPromise(this.__listBillingProducts(t,o))}async __listBillingProducts(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:p,withOneTimeCharges:s,withZeroPrice:l,withPricesOnly:u,isActive:z,limit:y,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(V=>V):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=uc.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.without_linked_to_plan=p.toString()),s!=null&&(O.with_one_time_charges=s.toString()),l!=null&&(O.with_zero_price=l.toString()),u!=null&&(O.with_prices_only=u.toString()),z!=null&&(O.is_active=z.toString()),y!=null&&(O.limit=y.toString()),C!=null&&(O.offset=C.toString());let T=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/products"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:gc.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new P(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new S(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new x(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new U(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new c({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case"non-json":throw new c({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/products.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}countBillingProducts(t={},o){return b.fromPromise(this.__countBillingProducts(t,o))}async __countBillingProducts(t={},o){let{ids:r,name:i,q:m,priceUsageType:g,withoutLinkedToPlan:p,withOneTimeCharges:s,withZeroPrice:l,withPricesOnly:u,isActive:z,limit:y,offset:C}=t,O={};r!=null&&(Array.isArray(r)?O.ids=r.map(V=>V):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),g!=null&&(O.price_usage_type=wc.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(O.without_linked_to_plan=p.toString()),s!=null&&(O.with_one_time_charges=s.toString()),l!=null&&(O.with_zero_price=l.toString()),u!=null&&(O.with_prices_only=u.toString()),z!=null&&(O.is_active=z.toString()),y!=null&&(O.limit=y.toString()),C!=null&&(O.offset=C.toString());let T=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/products/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:O,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(T.ok)return{data:Rc.parseOrThrow(T.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:T.rawResponse};if(T.error.reason==="status-code")switch(T.error.statusCode){case 400:throw new P(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 401:throw new S(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 403:throw new x(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 404:throw new E(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);case 500:throw new U(a.parseOrThrow(T.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),T.rawResponse);default:throw new c({statusCode:T.error.statusCode,body:T.error.body,rawResponse:T.rawResponse})}switch(T.error.reason){case"non-json":throw new c({statusCode:T.error.statusCode,body:T.error.rawBody,rawResponse:T.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/products/count.");case"unknown":throw new c({message:T.error.errorMessage,rawResponse:T.rawResponse})}}upsertBillingSubscription(t,o){return b.fromPromise(this.__upsertBillingSubscription(t,o))}async __upsertBillingSubscription(t,o){let r=await(this._options.fetcher??_)({url:(0,X.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/subscription/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ut.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:_c.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/subscription/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var G=H(require("url-join"));var zo=class{constructor(t={}){this._options=t}listBillingCredits(t={},o){return b.fromPromise(this.__listBillingCredits(t,o))}async __listBillingCredits(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(l=>l):p.ids=r),i!=null&&(p.name=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Cc.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}createBillingCredit(t,o){return b.fromPromise(this.__createBillingCredit(t,o))}async __createBillingCredit(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:dt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Oc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/credits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSingleBillingCredit(t,o){return b.fromPromise(this.__getSingleBillingCredit(t,o))}async __getSingleBillingCredit(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Bc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/{credit_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateBillingCredit(t,o,r){return b.fromPromise(this.__updateBillingCredit(t,o,r))}async __updateBillingCredit(t,o,r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ht.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Dc.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /billing/credits/{credit_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}softDeleteBillingCredit(t,o){return b.fromPromise(this.__softDeleteBillingCredit(t,o))}async __softDeleteBillingCredit(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Vc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/credits/{credit_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCreditBundles(t={},o){return b.fromPromise(this.__listCreditBundles(t,o))}async __listCreditBundles(t={},o){let{ids:r,creditId:i,status:m,bundleType:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(z=>z):l.ids=r),i!=null&&(l.credit_id=i),m!=null&&(l.status=qc.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.bundle_type=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Fc.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/bundles.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createCreditBundle(t,o){return b.fromPromise(this.__createCreditBundle(t,o))}async __createCreditBundle(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:gt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Gc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/credits/bundles.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCreditBundle(t,o){return b.fromPromise(this.__getCreditBundle(t,o))}async __getCreditBundle(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/bundles/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Nc.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/bundles/{bundle_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCreditBundleDetails(t,o,r){return b.fromPromise(this.__updateCreditBundleDetails(t,o,r))}async __updateCreditBundleDetails(t,o,r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/bundles/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:wt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Jc.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /billing/credits/bundles/{bundle_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteCreditBundle(t,o){return b.fromPromise(this.__deleteCreditBundle(t,o))}async __deleteCreditBundle(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/bundles/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:$c.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/credits/bundles/{bundle_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countCreditBundles(t={},o){return b.fromPromise(this.__countCreditBundles(t,o))}async __countCreditBundles(t={},o){let{ids:r,creditId:i,status:m,bundleType:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(z=>z):l.ids=r),i!=null&&(l.credit_id=i),m!=null&&(l.status=Zc.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(l.bundle_type=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/bundles/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:ep.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/bundles/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}countBillingCredits(t={},o){return b.fromPromise(this.__countBillingCredits(t,o))}async __countBillingCredits(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(l=>l):p.ids=r),i!=null&&(p.name=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:op.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}zeroOutGrant(t,o={},r){return b.fromPromise(this.__zeroOutGrant(t,o,r))}async __zeroOutGrant(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/grants/${encodeURIComponent(t)}/zero-out`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:yt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:ip.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /billing/credits/grants/{grant_id}/zero-out.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}grantBillingCreditsToCompany(t,o){return b.fromPromise(this.__grantBillingCreditsToCompany(t,o))}async __grantBillingCreditsToCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/company"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:zt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:np.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/credits/grants/company.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCompanyGrants(t={},o){return b.fromPromise(this.__listCompanyGrants(t,o))}async __listCompanyGrants(t={},o){let{companyId:r,order:i,dir:m,limit:g,offset:p}=t,s={};r!=null&&(s.company_id=r),i!=null&&(s.order=cp.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"})),m!=null&&(s.dir=pp.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/company/list"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:dp.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/grants/company/list.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}countBillingCreditsGrants(t={},o){return b.fromPromise(this.__countBillingCreditsGrants(t,o))}async __countBillingCreditsGrants(t={},o){let{creditId:r,ids:i,limit:m,offset:g}=t,p={};r!=null&&(p.credit_id=r),i!=null&&(Array.isArray(i)?p.ids=i.map(l=>l):p.ids=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:gp.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/grants/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listGrantsForCredit(t={},o){return b.fromPromise(this.__listGrantsForCredit(t,o))}async __listGrantsForCredit(t={},o){let{creditId:r,ids:i,limit:m,offset:g}=t,p={};r!=null&&(p.credit_id=r),i!=null&&(Array.isArray(i)?p.ids=i.map(l=>l):p.ids=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/grants/list"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:yp.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/grants/list.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getEnrichedCreditLedger(t,o){return b.fromPromise(this.__getEnrichedCreditLedger(t,o))}async __getEnrichedCreditLedger(t,o){let{companyId:r,billingCreditId:i,featureId:m,period:g,startTime:p,endTime:s,limit:l,offset:u}=t,z={};z.company_id=r,i!=null&&(z.billing_credit_id=i),m!=null&&(z.feature_id=m),z.period=zp.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}),p!=null&&(z.start_time=p),s!=null&&(z.end_time=s),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/ledger"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:Ep.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/ledger.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}countCreditLedger(t,o){return b.fromPromise(this.__countCreditLedger(t,o))}async __countCreditLedger(t,o){let{companyId:r,billingCreditId:i,featureId:m,period:g,startTime:p,endTime:s,limit:l,offset:u}=t,z={};z.company_id=r,i!=null&&(z.billing_credit_id=i),m!=null&&(z.feature_id=m),z.period=Up.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"}),p!=null&&(z.start_time=p),s!=null&&(z.end_time=s),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/ledger/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:Tp.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/ledger/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}listBillingPlanCreditGrants(t={},o){return b.fromPromise(this.__listBillingPlanCreditGrants(t,o))}async __listBillingPlanCreditGrants(t={},o){let{creditId:r,planId:i,planIds:m,ids:g,limit:p,offset:s}=t,l={};r!=null&&(l.credit_id=r),i!=null&&(l.plan_id=i),m!=null&&(Array.isArray(m)?l.plan_ids=m.map(z=>z):l.plan_ids=m),g!=null&&(Array.isArray(g)?l.ids=g.map(z=>z):l.ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Op.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/plan-grants.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createBillingPlanCreditGrant(t,o){return b.fromPromise(this.__createBillingPlanCreditGrant(t,o))}async __createBillingPlanCreditGrant(t,o){let r=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Rt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ap.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /billing/credits/plan-grants.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateBillingPlanCreditGrant(t,o,r){return b.fromPromise(this.__updateBillingPlanCreditGrant(t,o,r))}async __updateBillingPlanCreditGrant(t,o,r){let i=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/plan-grants/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:bt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Np.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /billing/credits/plan-grants/{plan_grant_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteBillingPlanCreditGrant(t,o={},r){return b.fromPromise(this.__deleteBillingPlanCreditGrant(t,o,r))}async __deleteBillingPlanCreditGrant(t,o={},r){let{applyToExisting:i}=o,m={};i!=null&&(m.apply_to_existing=i.toString());let g=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`billing/credits/plan-grants/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",queryParameters:m,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(g.ok)return{data:Hp.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 400:throw new P(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 401:throw new S(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new U(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new c({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new c({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /billing/credits/plan-grants/{plan_grant_id}.");case"unknown":throw new c({message:g.error.errorMessage,rawResponse:g.rawResponse})}}countBillingPlanCreditGrants(t={},o){return b.fromPromise(this.__countBillingPlanCreditGrants(t,o))}async __countBillingPlanCreditGrants(t={},o){let{creditId:r,planId:i,planIds:m,ids:g,limit:p,offset:s}=t,l={};r!=null&&(l.credit_id=r),i!=null&&(l.plan_id=i),m!=null&&(Array.isArray(m)?l.plan_ids=m.map(z=>z):l.plan_ids=m),g!=null&&(Array.isArray(g)?l.ids=g.map(z=>z):l.ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,G.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"billing/credits/plan-grants/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Jp.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/credits/plan-grants/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Ne=H(require("url-join"));var Ro=class{constructor(t={}){this._options=t}internal(t,o){return b.fromPromise(this.__internal(t,o))}async __internal(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"checkout-internal"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ti.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Zp.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /checkout-internal.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCheckoutData(t,o){return b.fromPromise(this.__getCheckoutData(t,o))}async __getCheckoutData(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"checkout-internal/data"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:_t.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:hl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /checkout-internal/data.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}previewCheckoutInternal(t,o){return b.fromPromise(this.__previewCheckoutInternal(t,o))}async __previewCheckoutInternal(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"checkout-internal/preview"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ti.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:yl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /checkout-internal/preview.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}managePlan(t,o){return b.fromPromise(this.__managePlan(t,o))}async __managePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"manage-plan"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ni.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Rl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /manage-plan.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}previewManagePlan(t,o){return b.fromPromise(this.__previewManagePlan(t,o))}async __previewManagePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"manage-plan/preview"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ni.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:fl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /manage-plan/preview.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCustomerSubscriptionTrialEnd(t,o={},r){return b.fromPromise(this.__updateCustomerSubscriptionTrialEnd(t,o,r))}async __updateCustomerSubscriptionTrialEnd(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`subscription/${encodeURIComponent(t)}/edit-trial-end`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:St.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:_l.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /subscription/{subscription_id}/edit-trial-end.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var D=H(require("url-join"));var bo=class{constructor(t={}){this._options=t}listCompanies(t={},o){return b.fromPromise(this.__listCompanies(t,o))}async __listCompanies(t={},o){let{ids:r,planId:i,q:m,withoutFeatureOverrideFor:g,withoutPlan:p,withSubscription:s,limit:l,offset:u}=t,z={};r!=null&&(Array.isArray(r)?z.ids=r.map(C=>C):z.ids=r),i!=null&&(z.plan_id=i),m!=null&&(z.q=m),g!=null&&(z.without_feature_override_for=g),p!=null&&(z.without_plan=p.toString()),s!=null&&(z.with_subscription=s.toString()),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:xl.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}upsertCompany(t,o){return b.fromPromise(this.__upsertCompany(t,o))}async __upsertCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ci.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:El.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /companies.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCompany(t,o){return b.fromPromise(this.__getCompany(t,o))}async __getCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`companies/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ul.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/{company_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompany(t,o={},r){return b.fromPromise(this.__deleteCompany(t,o,r))}async __deleteCompany(t,o={},r){let{cancelSubscription:i,prorate:m}=o,g={};i!=null&&(g.cancel_subscription=i.toString()),m!=null&&(g.prorate=m.toString());let p=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`companies/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(p.ok)return{data:Cl.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /companies/{company_id}.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}countCompanies(t={},o){return b.fromPromise(this.__countCompanies(t,o))}async __countCompanies(t={},o){let{ids:r,planId:i,q:m,withoutFeatureOverrideFor:g,withoutPlan:p,withSubscription:s,limit:l,offset:u}=t,z={};r!=null&&(Array.isArray(r)?z.ids=r.map(C=>C):z.ids=r),i!=null&&(z.plan_id=i),m!=null&&(z.q=m),g!=null&&(z.without_feature_override_for=g),p!=null&&(z.without_plan=p.toString()),s!=null&&(z.with_subscription=s.toString()),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:vl.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}countCompaniesForAdvancedFilter(t={},o){return b.fromPromise(this.__countCompaniesForAdvancedFilter(t,o))}async __countCompaniesForAdvancedFilter(t={},o){let{ids:r,planIds:i,featureIds:m,creditTypeIds:g,subscriptionStatuses:p,subscriptionTypes:s,monetizedSubscriptions:l,q:u,withoutPlan:z,withoutSubscription:y,sortOrderColumn:C,sortOrderDirection:O,displayProperties:T,limit:V,offset:q}=t,v={};r!=null&&(Array.isArray(r)?v.ids=r.map(L=>L):v.ids=r),i!=null&&(Array.isArray(i)?v.plan_ids=i.map(L=>L):v.plan_ids=i),m!=null&&(Array.isArray(m)?v.feature_ids=m.map(L=>L):v.feature_ids=m),g!=null&&(Array.isArray(g)?v.credit_type_ids=g.map(L=>L):v.credit_type_ids=g),p!=null&&(Array.isArray(p)?v.subscription_statuses=p.map(L=>L):v.subscription_statuses=p),s!=null&&(Array.isArray(s)?v.subscription_types=s.map(L=>L):v.subscription_types=s),l!=null&&(v.monetized_subscriptions=l.toString()),u!=null&&(v.q=u),z!=null&&(v.without_plan=z.toString()),y!=null&&(v.without_subscription=y.toString()),C!=null&&(v.sort_order_column=C),O!=null&&(v.sort_order_direction=Ol.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?v.display_properties=T.map(L=>L):v.display_properties=T),V!=null&&(v.limit=V.toString()),q!=null&&(v.offset=q.toString());let B=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/count2"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:v,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(B.ok)return{data:kl.parseOrThrow(B.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:B.rawResponse};if(B.error.reason==="status-code")switch(B.error.statusCode){case 400:throw new P(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new S(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new x(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new E(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new U(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);default:throw new c({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse})}switch(B.error.reason){case"non-json":throw new c({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/count2.");case"unknown":throw new c({message:B.error.errorMessage,rawResponse:B.rawResponse})}}createCompany(t,o){return b.fromPromise(this.__createCompany(t,o))}async __createCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/create"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ci.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Dl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /companies/create.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompanyByKeys(t,o){return b.fromPromise(this.__deleteCompanyByKeys(t,o))}async __deleteCompanyByKeys(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/delete"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:si.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Vl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /companies/delete.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCompaniesForAdvancedFilter(t={},o){return b.fromPromise(this.__listCompaniesForAdvancedFilter(t,o))}async __listCompaniesForAdvancedFilter(t={},o){let{ids:r,planIds:i,featureIds:m,creditTypeIds:g,subscriptionStatuses:p,subscriptionTypes:s,monetizedSubscriptions:l,q:u,withoutPlan:z,withoutSubscription:y,sortOrderColumn:C,sortOrderDirection:O,displayProperties:T,limit:V,offset:q}=t,v={};r!=null&&(Array.isArray(r)?v.ids=r.map(L=>L):v.ids=r),i!=null&&(Array.isArray(i)?v.plan_ids=i.map(L=>L):v.plan_ids=i),m!=null&&(Array.isArray(m)?v.feature_ids=m.map(L=>L):v.feature_ids=m),g!=null&&(Array.isArray(g)?v.credit_type_ids=g.map(L=>L):v.credit_type_ids=g),p!=null&&(Array.isArray(p)?v.subscription_statuses=p.map(L=>L):v.subscription_statuses=p),s!=null&&(Array.isArray(s)?v.subscription_types=s.map(L=>L):v.subscription_types=s),l!=null&&(v.monetized_subscriptions=l.toString()),u!=null&&(v.q=u),z!=null&&(v.without_plan=z.toString()),y!=null&&(v.without_subscription=y.toString()),C!=null&&(v.sort_order_column=C),O!=null&&(v.sort_order_direction=ql.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?v.display_properties=T.map(L=>L):v.display_properties=T),V!=null&&(v.limit=V.toString()),q!=null&&(v.offset=q.toString());let B=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/list2"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:v,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(B.ok)return{data:Ll.parseOrThrow(B.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:B.rawResponse};if(B.error.reason==="status-code")switch(B.error.statusCode){case 400:throw new P(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 401:throw new S(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 403:throw new x(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 404:throw new E(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);case 500:throw new U(a.parseOrThrow(B.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),B.rawResponse);default:throw new c({statusCode:B.error.statusCode,body:B.error.body,rawResponse:B.rawResponse})}switch(B.error.reason){case"non-json":throw new c({statusCode:B.error.statusCode,body:B.error.rawBody,rawResponse:B.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/list2.");case"unknown":throw new c({message:B.error.errorMessage,rawResponse:B.rawResponse})}}lookupCompany(t,o){return b.fromPromise(this.__lookupCompany(t,o))}async __lookupCompany(t,o){let{keys:r}=t,i={};i.keys=pe(r);let m=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"companies/lookup"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:Nl.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/lookup.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}getActiveDeals(t,o){return b.fromPromise(this.__getActiveDeals(t,o))}async __getActiveDeals(t,o){let{companyId:r,dealStage:i,limit:m,offset:g}=t,p={};p.company_id=r,p.deal_stage=i,m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-crm-deals"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Jl.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-crm-deals.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listCompanyMemberships(t={},o){return b.fromPromise(this.__listCompanyMemberships(t,o))}async __listCompanyMemberships(t={},o){let{companyId:r,userId:i,limit:m,offset:g}=t,p={};r!=null&&(p.company_id=r),i!=null&&(p.user_id=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-memberships"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Zl.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-memberships.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getOrCreateCompanyMembership(t,o){return b.fromPromise(this.__getOrCreateCompanyMembership(t,o))}async __getOrCreateCompanyMembership(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-memberships"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Et.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Yl.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /company-memberships.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteCompanyMembership(t,o){return b.fromPromise(this.__deleteCompanyMembership(t,o))}async __deleteCompanyMembership(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-memberships/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ql.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /company-memberships/{company_membership_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getActiveCompanySubscription(t={},o){return b.fromPromise(this.__getActiveCompanySubscription(t,o))}async __getActiveCompanySubscription(t={},o){let{companyId:r,companyIds:i,limit:m,offset:g}=t,p={};r!=null&&(p.company_id=r),i!=null&&(Array.isArray(i)?p.company_ids=i.map(l=>l):p.company_ids=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-subscriptions"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:rm.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-subscriptions.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertCompanyTrait(t,o){return b.fromPromise(this.__upsertCompanyTrait(t,o))}async __upsertCompanyTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-traits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:pi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:om.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /company-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listEntityKeyDefinitions(t={},o){return b.fromPromise(this.__listEntityKeyDefinitions(t,o))}async __listEntityKeyDefinitions(t={},o){let{entityType:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.entity_type=tm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-key-definitions"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:sm.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-key-definitions.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}countEntityKeyDefinitions(t={},o){return b.fromPromise(this.__countEntityKeyDefinitions(t,o))}async __countEntityKeyDefinitions(t={},o){let{entityType:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.entity_type=nm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-key-definitions/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:lm.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-key-definitions/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}listEntityTraitDefinitions(t={},o){return b.fromPromise(this.__listEntityTraitDefinitions(t,o))}async __listEntityTraitDefinitions(t={},o){let{entityType:r,ids:i,q:m,traitType:g,limit:p,offset:s}=t,l={};r!=null&&(l.entity_type=mm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.q=m),g!=null&&(l.trait_type=um.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-definitions"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:wm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-trait-definitions.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}getOrCreateEntityTraitDefinition(t,o){return b.fromPromise(this.__getOrCreateEntityTraitDefinition(t,o))}async __getOrCreateEntityTraitDefinition(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-definitions"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ut.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Rm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /entity-trait-definitions.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEntityTraitDefinition(t,o){return b.fromPromise(this.__getEntityTraitDefinition(t,o))}async __getEntityTraitDefinition(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`entity-trait-definitions/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:bm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-trait-definitions/{entity_trait_definition_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateEntityTraitDefinition(t,o,r){return b.fromPromise(this.__updateEntityTraitDefinition(t,o,r))}async __updateEntityTraitDefinition(t,o,r){let i=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`entity-trait-definitions/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Pt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:_m.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /entity-trait-definitions/{entity_trait_definition_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}countEntityTraitDefinitions(t={},o){return b.fromPromise(this.__countEntityTraitDefinitions(t,o))}async __countEntityTraitDefinitions(t={},o){let{entityType:r,ids:i,q:m,traitType:g,limit:p,offset:s}=t,l={};r!=null&&(l.entity_type=Sm.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.q=m),g!=null&&(l.trait_type=xm.jsonOrThrow(g,{unrecognizedObjectKeys:"strip"})),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-definitions/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Cm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-trait-definitions/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}getEntityTraitValues(t,o){return b.fromPromise(this.__getEntityTraitValues(t,o))}async __getEntityTraitValues(t,o){let{definitionId:r,q:i,limit:m,offset:g}=t,p={};p.definition_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"entity-trait-values"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Om.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /entity-trait-values.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPlanChanges(t={},o){return b.fromPromise(this.__listPlanChanges(t,o))}async __listPlanChanges(t={},o){let{action:r,basePlanAction:i,companyId:m,companyIds:g,planIds:p,limit:s,offset:l}=t,u={};r!=null&&(u.action=r),i!=null&&(u.base_plan_action=i),m!=null&&(u.company_id=m),g!=null&&(Array.isArray(g)?u.company_ids=g.map(y=>y):u.company_ids=g),p!=null&&(Array.isArray(p)?u.plan_ids=p.map(y=>y):u.plan_ids=p),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let z=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-changes"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(z.ok)return{data:Mm.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new P(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 401:throw new S(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 403:throw new x(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 404:throw new E(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 500:throw new U(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);default:throw new c({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse})}switch(z.error.reason){case"non-json":throw new c({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-changes.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}getPlanChange(t,o){return b.fromPromise(this.__getPlanChange(t,o))}async __getPlanChange(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-changes/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Am.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-changes/{plan_change_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listPlanTraits(t={},o){return b.fromPromise(this.__listPlanTraits(t,o))}async __listPlanTraits(t={},o){let{ids:r,planId:i,traitId:m,traitIds:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(z=>z):l.ids=r),i!=null&&(l.plan_id=i),m!=null&&(l.trait_id=m),g!=null&&(Array.isArray(g)?l.trait_ids=g.map(z=>z):l.trait_ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Im.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-traits.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createPlanTrait(t,o){return b.fromPromise(this.__createPlanTrait(t,o))}async __createPlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ct.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Km.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plan-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlanTrait(t,o){return b.fromPromise(this.__getPlanTrait(t,o))}async __getPlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-traits/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Lm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-traits/{plan_trait_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanTrait(t,o,r){return b.fromPromise(this.__updatePlanTrait(t,o,r))}async __updatePlanTrait(t,o,r){let i=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-traits/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Tt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Gm.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plan-traits/{plan_trait_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlanTrait(t,o){return b.fromPromise(this.__deletePlanTrait(t,o))}async __deletePlanTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-traits/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Nm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /plan-traits/{plan_trait_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanTraitsBulk(t,o){return b.fromPromise(this.__updatePlanTraitsBulk(t,o))}async __updatePlanTraitsBulk(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits/bulk"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:vt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Xm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plan-traits/bulk.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countPlanTraits(t={},o){return b.fromPromise(this.__countPlanTraits(t,o))}async __countPlanTraits(t={},o){let{ids:r,planId:i,traitId:m,traitIds:g,limit:p,offset:s}=t,l={};r!=null&&(Array.isArray(r)?l.ids=r.map(z=>z):l.ids=r),i!=null&&(l.plan_id=i),m!=null&&(l.trait_id=m),g!=null&&(Array.isArray(g)?l.trait_ids=g.map(z=>z):l.trait_ids=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-traits/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Wm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-traits/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}upsertUserTrait(t,o){return b.fromPromise(this.__upsertUserTrait(t,o))}async __upsertUserTrait(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"user-traits"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:pi.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Jm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /user-traits.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listUsers(t={},o){return b.fromPromise(this.__listUsers(t,o))}async __listUsers(t={},o){let{companyId:r,ids:i,planId:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(l.company_id=r),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.plan_id=m),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Zm.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /users.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}upsertUser(t,o){return b.fromPromise(this.__upsertUser(t,o))}async __upsertUser(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:li.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ym.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /users.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getUser(t,o){return b.fromPromise(this.__getUser(t,o))}async __getUser(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`users/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Qm.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /users/{user_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteUser(t,o){return b.fromPromise(this.__deleteUser(t,o))}async __deleteUser(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`users/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:eu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /users/{user_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countUsers(t={},o){return b.fromPromise(this.__countUsers(t,o))}async __countUsers(t={},o){let{companyId:r,ids:i,planId:m,q:g,limit:p,offset:s}=t,l={};r!=null&&(l.company_id=r),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.plan_id=m),g!=null&&(l.q=g),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:ou.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new P(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 401:throw new S(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 403:throw new x(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 404:throw new E(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);case 500:throw new U(a.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),u.rawResponse);default:throw new c({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new c({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /users/count.");case"unknown":throw new c({message:u.error.errorMessage,rawResponse:u.rawResponse})}}createUser(t,o){return b.fromPromise(this.__createUser(t,o))}async __createUser(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/create"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:li.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:tu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /users/create.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteUserByKeys(t,o){return b.fromPromise(this.__deleteUserByKeys(t,o))}async __deleteUserByKeys(t,o){let r=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/delete"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:si.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:iu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /users/delete.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}lookupUser(t,o){return b.fromPromise(this.__lookupUser(t,o))}async __lookupUser(t,o){let{keys:r}=t,i={};i.keys=pe(r);let m=await(this._options.fetcher??_)({url:(0,D.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"users/lookup"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:su.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /users/lookup.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var J=H(require("url-join"));var fo=class{constructor(t={}){this._options=t}listCompanyOverrides(t={},o){return b.fromPromise(this.__listCompanyOverrides(t,o))}async __listCompanyOverrides(t={},o){let{companyId:r,companyIds:i,featureId:m,featureIds:g,ids:p,withoutExpired:s,q:l,limit:u,offset:z}=t,y={};r!=null&&(y.company_id=r),i!=null&&(Array.isArray(i)?y.company_ids=i.map(O=>O):y.company_ids=i),m!=null&&(y.feature_id=m),g!=null&&(Array.isArray(g)?y.feature_ids=g.map(O=>O):y.feature_ids=g),p!=null&&(Array.isArray(p)?y.ids=p.map(O=>O):y.ids=p),s!=null&&(y.without_expired=s.toString()),l!=null&&(y.q=l),u!=null&&(y.limit=u.toString()),z!=null&&(y.offset=z.toString());let C=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-overrides"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:pu.parseOrThrow(C.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-overrides.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}createCompanyOverride(t,o){return b.fromPromise(this.__createCompanyOverride(t,o))}async __createCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-overrides"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ot.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:du.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /company-overrides.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getCompanyOverride(t,o){return b.fromPromise(this.__getCompanyOverride(t,o))}async __getCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-overrides/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:hu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-overrides/{company_override_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCompanyOverride(t,o,r){return b.fromPromise(this.__updateCompanyOverride(t,o,r))}async __updateCompanyOverride(t,o,r){let i=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-overrides/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Bt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:zu.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /company-overrides/{company_override_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteCompanyOverride(t,o){return b.fromPromise(this.__deleteCompanyOverride(t,o))}async __deleteCompanyOverride(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-overrides/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ru.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /company-overrides/{company_override_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countCompanyOverrides(t={},o){return b.fromPromise(this.__countCompanyOverrides(t,o))}async __countCompanyOverrides(t={},o){let{companyId:r,companyIds:i,featureId:m,featureIds:g,ids:p,withoutExpired:s,q:l,limit:u,offset:z}=t,y={};r!=null&&(y.company_id=r),i!=null&&(Array.isArray(i)?y.company_ids=i.map(O=>O):y.company_ids=i),m!=null&&(y.feature_id=m),g!=null&&(Array.isArray(g)?y.feature_ids=g.map(O=>O):y.feature_ids=g),p!=null&&(Array.isArray(p)?y.ids=p.map(O=>O):y.ids=p),s!=null&&(y.without_expired=s.toString()),l!=null&&(y.q=l),u!=null&&(y.limit=u.toString()),z!=null&&(y.offset=z.toString());let C=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"company-overrides/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:fu.parseOrThrow(C.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /company-overrides/count.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}listFeatureCompanies(t,o){return b.fromPromise(this.__listFeatureCompanies(t,o))}async __listFeatureCompanies(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-companies"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Pu.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-companies.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}countFeatureCompanies(t,o){return b.fromPromise(this.__countFeatureCompanies(t,o))}async __countFeatureCompanies(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-companies/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Tu.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-companies/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listFeatureUsage(t={},o){return b.fromPromise(this.__listFeatureUsage(t,o))}async __listFeatureUsage(t={},o){let{companyId:r,companyKeys:i,featureIds:m,q:g,withoutNegativeEntitlements:p,limit:s,offset:l}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.company_keys=pe(i)),m!=null&&(Array.isArray(m)?u.feature_ids=m.map(y=>y):u.feature_ids=m),g!=null&&(u.q=g),p!=null&&(u.without_negative_entitlements=p.toString()),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let z=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-usage"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(z.ok)return{data:Ou.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new P(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 401:throw new S(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 403:throw new x(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 404:throw new E(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 500:throw new U(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);default:throw new c({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse})}switch(z.error.reason){case"non-json":throw new c({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-usage.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}countFeatureUsage(t={},o){return b.fromPromise(this.__countFeatureUsage(t,o))}async __countFeatureUsage(t={},o){let{companyId:r,companyKeys:i,featureIds:m,q:g,withoutNegativeEntitlements:p,limit:s,offset:l}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.company_keys=pe(i)),m!=null&&(Array.isArray(m)?u.feature_ids=m.map(y=>y):u.feature_ids=m),g!=null&&(u.q=g),p!=null&&(u.without_negative_entitlements=p.toString()),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let z=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-usage/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(z.ok)return{data:ju.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new P(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 401:throw new S(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 403:throw new x(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 404:throw new E(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 500:throw new U(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);default:throw new c({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse})}switch(z.error.reason){case"non-json":throw new c({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-usage/count.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}listFeatureUsers(t,o){return b.fromPromise(this.__listFeatureUsers(t,o))}async __listFeatureUsers(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-users"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:qu.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-users.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}countFeatureUsers(t,o){return b.fromPromise(this.__countFeatureUsers(t,o))}async __countFeatureUsers(t,o){let{featureId:r,q:i,limit:m,offset:g}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"feature-users/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Au.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /feature-users/count.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPlanEntitlements(t={},o){return b.fromPromise(this.__listPlanEntitlements(t,o))}async __listPlanEntitlements(t={},o){let{featureId:r,featureIds:i,ids:m,planId:g,planIds:p,q:s,withMeteredProducts:l,limit:u,offset:z}=t,y={};r!=null&&(y.feature_id=r),i!=null&&(Array.isArray(i)?y.feature_ids=i.map(O=>O):y.feature_ids=i),m!=null&&(Array.isArray(m)?y.ids=m.map(O=>O):y.ids=m),g!=null&&(y.plan_id=g),p!=null&&(Array.isArray(p)?y.plan_ids=p.map(O=>O):y.plan_ids=p),s!=null&&(y.q=s),l!=null&&(y.with_metered_products=l.toString()),u!=null&&(y.limit=u.toString()),z!=null&&(y.offset=z.toString());let C=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:Iu.parseOrThrow(C.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-entitlements.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}createPlanEntitlement(t,o){return b.fromPromise(this.__createPlanEntitlement(t,o))}async __createPlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:jt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Xu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plan-entitlements.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlanEntitlement(t,o){return b.fromPromise(this.__getPlanEntitlement(t,o))}async __getPlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-entitlements/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Hu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-entitlements/{plan_entitlement_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanEntitlement(t,o,r){return b.fromPromise(this.__updatePlanEntitlement(t,o,r))}async __updatePlanEntitlement(t,o,r){let i=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-entitlements/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:kt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Yu.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plan-entitlements/{plan_entitlement_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlanEntitlement(t,o){return b.fromPromise(this.__deletePlanEntitlement(t,o))}async __deletePlanEntitlement(t,o){let r=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-entitlements/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Qu.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /plan-entitlements/{plan_entitlement_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countPlanEntitlements(t={},o){return b.fromPromise(this.__countPlanEntitlements(t,o))}async __countPlanEntitlements(t={},o){let{featureId:r,featureIds:i,ids:m,planId:g,planIds:p,q:s,withMeteredProducts:l,limit:u,offset:z}=t,y={};r!=null&&(y.feature_id=r),i!=null&&(Array.isArray(i)?y.feature_ids=i.map(O=>O):y.feature_ids=i),m!=null&&(Array.isArray(m)?y.ids=m.map(O=>O):y.ids=m),g!=null&&(y.plan_id=g),p!=null&&(Array.isArray(p)?y.plan_ids=p.map(O=>O):y.plan_ids=p),s!=null&&(y.q=s),l!=null&&(y.with_metered_products=l.toString()),u!=null&&(y.limit=u.toString()),z!=null&&(y.offset=z.toString());let C=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-entitlements/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:y,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(C.ok)return{data:rd.parseOrThrow(C.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new P(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 401:throw new S(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 403:throw new x(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 404:throw new E(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);case 500:throw new U(a.parseOrThrow(C.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),C.rawResponse);default:throw new c({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new c({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-entitlements/count.");case"unknown":throw new c({message:C.error.errorMessage,rawResponse:C.rawResponse})}}getFeatureUsageByCompany(t,o){return b.fromPromise(this.__getFeatureUsageByCompany(t,o))}async __getFeatureUsageByCompany(t,o){let{keys:r}=t,i={};i.keys=pe(r);let m=await(this._options.fetcher??_)({url:(0,J.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"usage-by-company"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:td.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /usage-by-company.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Se=H(require("url-join"));var _o=class{constructor(t={}){this._options=t}updateCompanyPlans(t,o,r){return b.fromPromise(this.__updateCompanyPlans(t,o,r))}async __updateCompanyPlans(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`company-plans/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Dt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:id.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /company-plans/{company_plan_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}listPlans(t={},o){return b.fromPromise(this.__listPlans(t,o))}async __listPlans(t={},o){let{companyId:r,forFallbackPlan:i,forInitialPlan:m,forTrialExpiryPlan:g,hasProductId:p,ids:s,planType:l,q:u,requiresPaymentMethod:z,withoutEntitlementFor:y,withoutProductId:C,withoutPaidProductId:O,limit:T,offset:V}=t,q={};r!=null&&(q.company_id=r),i!=null&&(q.for_fallback_plan=i.toString()),m!=null&&(q.for_initial_plan=m.toString()),g!=null&&(q.for_trial_expiry_plan=g.toString()),p!=null&&(q.has_product_id=p.toString()),s!=null&&(Array.isArray(s)?q.ids=s.map(B=>B):q.ids=s),l!=null&&(q.plan_type=ad.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),u!=null&&(q.q=u),z!=null&&(q.requires_payment_method=z.toString()),y!=null&&(q.without_entitlement_for=y),C!=null&&(q.without_product_id=C.toString()),O!=null&&(q.without_paid_product_id=O.toString()),T!=null&&(q.limit=T.toString()),V!=null&&(q.offset=V.toString());let v=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:q,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(v.ok)return{data:cd.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new S(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new U(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new c({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}switch(v.error.reason){case"non-json":throw new c({statusCode:v.error.statusCode,body:v.error.rawBody,rawResponse:v.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plans.");case"unknown":throw new c({message:v.error.errorMessage,rawResponse:v.rawResponse})}}createPlan(t,o){return b.fromPromise(this.__createPlan(t,o))}async __createPlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Vt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ld.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plans.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getPlan(t,o){return b.fromPromise(this.__getPlan(t,o))}async __getPlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:md.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plans/{plan_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlan(t,o,r){return b.fromPromise(this.__updatePlan(t,o,r))}async __updatePlan(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:qt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:ud.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plans/{plan_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deletePlan(t,o){return b.fromPromise(this.__deletePlan(t,o))}async __deletePlan(t,o){let r=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:dd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /plans/{plan_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertBillingProductPlan(t,o,r){return b.fromPromise(this.__upsertBillingProductPlan(t,o,r))}async __upsertBillingProductPlan(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plans/${encodeURIComponent(t)}/billing_products`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Mt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:wd.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plans/{plan_id}/billing_products.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}countPlans(t={},o){return b.fromPromise(this.__countPlans(t,o))}async __countPlans(t={},o){let{companyId:r,forFallbackPlan:i,forInitialPlan:m,forTrialExpiryPlan:g,hasProductId:p,ids:s,planType:l,q:u,requiresPaymentMethod:z,withoutEntitlementFor:y,withoutProductId:C,withoutPaidProductId:O,limit:T,offset:V}=t,q={};r!=null&&(q.company_id=r),i!=null&&(q.for_fallback_plan=i.toString()),m!=null&&(q.for_initial_plan=m.toString()),g!=null&&(q.for_trial_expiry_plan=g.toString()),p!=null&&(q.has_product_id=p.toString()),s!=null&&(Array.isArray(s)?q.ids=s.map(B=>B):q.ids=s),l!=null&&(q.plan_type=yd.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),u!=null&&(q.q=u),z!=null&&(q.requires_payment_method=z.toString()),y!=null&&(q.without_entitlement_for=y),C!=null&&(q.without_product_id=C.toString()),O!=null&&(q.without_paid_product_id=O.toString()),T!=null&&(q.limit=T.toString()),V!=null&&(q.offset=V.toString());let v=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:q,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(v.ok)return{data:bd.parseOrThrow(v.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:v.rawResponse};if(v.error.reason==="status-code")switch(v.error.statusCode){case 400:throw new P(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 401:throw new S(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 403:throw new x(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 404:throw new E(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);case 500:throw new U(a.parseOrThrow(v.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),v.rawResponse);default:throw new c({statusCode:v.error.statusCode,body:v.error.body,rawResponse:v.rawResponse})}switch(v.error.reason){case"non-json":throw new c({statusCode:v.error.statusCode,body:v.error.rawBody,rawResponse:v.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plans/count.");case"unknown":throw new c({message:v.error.errorMessage,rawResponse:v.rawResponse})}}listPlanIssues(t,o){return b.fromPromise(this.__listPlanIssues(t,o))}async __listPlanIssues(t,o){let{planId:r}=t,i={};i.plan_id=r;let m=await(this._options.fetcher??_)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plans/issues"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:i,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(m.ok)return{data:Sd.parseOrThrow(m.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 400:throw new P(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 401:throw new S(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 403:throw new x(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 404:throw new E(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);case 500:throw new U(a.parseOrThrow(m.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),m.rawResponse);default:throw new c({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new c({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plans/issues.");case"unknown":throw new c({message:m.error.errorMessage,rawResponse:m.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Me=H(require("url-join"));var So=class{constructor(t={}){this._options=t}listComponents(t={},o){return b.fromPromise(this.__listComponents(t,o))}async __listComponents(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:Ed.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /components.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createComponent(t,o){return b.fromPromise(this.__createComponent(t,o))}async __createComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:At.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Pd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /components.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getComponent(t,o){return b.fromPromise(this.__getComponent(t,o))}async __getComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`components/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Cd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /components/{component_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateComponent(t,o={},r){return b.fromPromise(this.__updateComponent(t,o,r))}async __updateComponent(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`components/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Ft.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Od.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /components/{component_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteComponent(t,o){return b.fromPromise(this.__deleteComponent(t,o))}async __deleteComponent(t,o){let r=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`components/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Bd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /components/{component_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countComponents(t={},o){return b.fromPromise(this.__countComponents(t,o))}async __countComponents(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:kd.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /components/count.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}previewComponentData(t={},o){return b.fromPromise(this.__previewComponentData(t,o))}async __previewComponentData(t={},o){let{companyId:r,componentId:i}=t,m={};r!=null&&(m.company_id=r),i!=null&&(m.component_id=i);let g=await(this._options.fetcher??_)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"components/preview-data"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:m,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(g.ok)return{data:Md.parseOrThrow(g.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:g.rawResponse};if(g.error.reason==="status-code")switch(g.error.statusCode){case 401:throw new S(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 403:throw new x(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 404:throw new E(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);case 500:throw new U(a.parseOrThrow(g.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),g.rawResponse);default:throw new c({statusCode:g.error.statusCode,body:g.error.body,rawResponse:g.rawResponse})}switch(g.error.reason){case"non-json":throw new c({statusCode:g.error.statusCode,body:g.error.rawBody,rawResponse:g.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /components/preview-data.");case"unknown":throw new c({message:g.error.errorMessage,rawResponse:g.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var gr=H(require("url-join"));var xo=class{constructor(t={}){this._options=t}upsertDealLineItemAssociation(t,o){return b.fromPromise(this.__upsertDealLineItemAssociation(t,o))}async __upsertDealLineItemAssociation(t,o){let r=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/associations/deal-line-item"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:It.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ad.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /crm/associations/deal-line-item.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertLineItem(t,o){return b.fromPromise(this.__upsertLineItem(t,o))}async __upsertLineItem(t,o){let r=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/deal-line-item/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Kt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Fd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /crm/deal-line-item/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}upsertCrmDeal(t,o){return b.fromPromise(this.__upsertCrmDeal(t,o))}async __upsertCrmDeal(t,o){let r=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/deals/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Lt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Kd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /crm/deals/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listCrmProducts(t={},o){return b.fromPromise(this.__listCrmProducts(t,o))}async __listCrmProducts(t={},o){let{ids:r,name:i,limit:m,offset:g}=t,p={};r!=null&&(Array.isArray(r)?p.ids=r.map(l=>l):p.ids=r),i!=null&&(p.name=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/products"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Gd.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /crm/products.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}upsertCrmProduct(t,o){return b.fromPromise(this.__upsertCrmProduct(t,o))}async __upsertCrmProduct(t,o){let r=await(this._options.fetcher??_)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"crm/products/upsert"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Gt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Nd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /crm/products/upsert.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var mi=H(require("url-join"));var Eo=class{constructor(t={}){this._options=t}createDataExport(t,o){return b.fromPromise(this.__createDataExport(t,o))}async __createDataExport(t,o){let r=await(this._options.fetcher??_)({url:(0,mi.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"data-exports"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:{...Nt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),export_type:"company-feature-usage",output_file_type:"csv"},timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Hd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /data-exports.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getDataExportArtifact(t,o){return b.fromPromise(this.__getDataExportArtifact(t,o))}async __getDataExportArtifact(t,o){let r=await(this._options.fetcher??_)({url:(0,mi.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`data-exports/${encodeURIComponent(t)}/artifact`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",responseType:"streaming",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /data-exports/{data_export_id}/artifact.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Xe=H(require("url-join"));var Uo=class{constructor(t={}){this._options=t}createEventBatch(t,o){return b.fromPromise(this.__createEventBatch(t,o))}async __createEventBatch(t,o){let r=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"event-batch"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Ht.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Jd.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /event-batch.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEventSummaries(t={},o){return b.fromPromise(this.__getEventSummaries(t,o))}async __getEventSummaries(t={},o){let{q:r,eventSubtypes:i,limit:m,offset:g}=t,p={};r!=null&&(p.q=r),i!=null&&(Array.isArray(i)?p.event_subtypes=i.map(l=>l):p.event_subtypes=i),m!=null&&(p.limit=m.toString()),g!=null&&(p.offset=g.toString());let s=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"event-types"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:p,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(s.ok)return{data:Zd.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new P(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 401:throw new S(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 403:throw new x(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 404:throw new E(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);case 500:throw new U(a.parseOrThrow(s.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),s.rawResponse);default:throw new c({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new c({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /event-types.");case"unknown":throw new c({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listEvents(t={},o){return b.fromPromise(this.__listEvents(t,o))}async __listEvents(t={},o){let{companyId:r,eventSubtype:i,eventTypes:m,flagId:g,userId:p,limit:s,offset:l}=t,u={};r!=null&&(u.company_id=r),i!=null&&(u.event_subtype=i),m!=null&&(Array.isArray(m)?u.event_types=m.map(y=>Xt.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})):u.event_types=Xt.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),g!=null&&(u.flag_id=g),p!=null&&(u.user_id=p),s!=null&&(u.limit=s.toString()),l!=null&&(u.offset=l.toString());let z=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"events"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(z.ok)return{data:eh.parseOrThrow(z.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:z.rawResponse};if(z.error.reason==="status-code")switch(z.error.statusCode){case 400:throw new P(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 401:throw new S(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 403:throw new x(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 404:throw new E(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);case 500:throw new U(a.parseOrThrow(z.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),z.rawResponse);default:throw new c({statusCode:z.error.statusCode,body:z.error.body,rawResponse:z.rawResponse})}switch(z.error.reason){case"non-json":throw new c({statusCode:z.error.statusCode,body:z.error.rawBody,rawResponse:z.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /events.");case"unknown":throw new c({message:z.error.errorMessage,rawResponse:z.rawResponse})}}createEvent(t,o){return b.fromPromise(this.__createEvent(t,o))}async __createEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"events"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:so.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:rh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /events.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getEvent(t,o){return b.fromPromise(this.__getEvent(t,o))}async __getEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`events/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:oh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /events/{event_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getSegmentIntegrationStatus(t){return b.fromPromise(this.__getSegmentIntegrationStatus(t))}async __getSegmentIntegrationStatus(t){let o=await(this._options.fetcher??_)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"segment-integration"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:ih.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new S(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 403:throw new x(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 404:throw new E(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 500:throw new U(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /segment-integration.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var se=H(require("url-join"));var Po=class{constructor(t={}){this._options=t}listFeatures(t={},o){return b.fromPromise(this.__listFeatures(t,o))}async __listFeatures(t={},o){let{ids:r,q:i,withoutCompanyOverrideFor:m,withoutPlanEntitlementFor:g,featureType:p,booleanRequireEvent:s,limit:l,offset:u}=t,z={};r!=null&&(Array.isArray(r)?z.ids=r.map(C=>C):z.ids=r),i!=null&&(z.q=i),m!=null&&(z.without_company_override_for=m),g!=null&&(z.without_plan_entitlement_for=g),p!=null&&(Array.isArray(p)?z.feature_type=p.map(C=>C):z.feature_type=p),s!=null&&(z.boolean_require_event=s.toString()),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"features"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:uh.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /features.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}createFeature(t,o){return b.fromPromise(this.__createFeature(t,o))}async __createFeature(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"features"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Wt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:gh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /features.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getFeature(t,o){return b.fromPromise(this.__getFeature(t,o))}async __getFeature(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`features/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:wh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /features/{feature_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateFeature(t,o={},r){return b.fromPromise(this.__updateFeature(t,o,r))}async __updateFeature(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`features/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Jt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Rh.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /features/{feature_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFeature(t,o){return b.fromPromise(this.__deleteFeature(t,o))}async __deleteFeature(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`features/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:bh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /features/{feature_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countFeatures(t={},o){return b.fromPromise(this.__countFeatures(t,o))}async __countFeatures(t={},o){let{ids:r,q:i,withoutCompanyOverrideFor:m,withoutPlanEntitlementFor:g,featureType:p,booleanRequireEvent:s,limit:l,offset:u}=t,z={};r!=null&&(Array.isArray(r)?z.ids=r.map(C=>C):z.ids=r),i!=null&&(z.q=i),m!=null&&(z.without_company_override_for=m),g!=null&&(z.without_plan_entitlement_for=g),p!=null&&(Array.isArray(p)?z.feature_type=p.map(C=>C):z.feature_type=p),s!=null&&(z.boolean_require_event=s.toString()),l!=null&&(z.limit=l.toString()),u!=null&&(z.offset=u.toString());let y=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"features/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:z,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(y.ok)return{data:_h.parseOrThrow(y.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:y.rawResponse};if(y.error.reason==="status-code")switch(y.error.statusCode){case 400:throw new P(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 401:throw new S(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 403:throw new x(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 404:throw new E(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);case 500:throw new U(a.parseOrThrow(y.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),y.rawResponse);default:throw new c({statusCode:y.error.statusCode,body:y.error.body,rawResponse:y.rawResponse})}switch(y.error.reason){case"non-json":throw new c({statusCode:y.error.statusCode,body:y.error.rawBody,rawResponse:y.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /features/count.");case"unknown":throw new c({message:y.error.errorMessage,rawResponse:y.rawResponse})}}listFlags(t={},o){return b.fromPromise(this.__listFlags(t,o))}async __listFlags(t={},o){let{featureId:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.feature_id=r),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:xh.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /flags.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}createFlag(t,o){return b.fromPromise(this.__createFlag(t,o))}async __createFlag(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ai.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Eh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /flags.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getFlag(t,o){return b.fromPromise(this.__getFlag(t,o))}async __getFlag(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Uh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /flags/{flag_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateFlag(t,o,r){return b.fromPromise(this.__updateFlag(t,o,r))}async __updateFlag(t,o,r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ai.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Ph.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /flags/{flag_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteFlag(t,o){return b.fromPromise(this.__deleteFlag(t,o))}async __deleteFlag(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Ch.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /flags/{flag_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateFlagRules(t,o,r){return b.fromPromise(this.__updateFlagRules(t,o,r))}async __updateFlagRules(t,o,r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}/rules`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:$t.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Oh.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /flags/{flag_id}/rules.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}checkFlag(t,o,r){return b.fromPromise(this.__checkFlag(t,o,r))}async __checkFlag(t,o,r){let i=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`flags/${encodeURIComponent(t)}/check`),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ii.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Bh.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /flags/{key}/check.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}checkFlags(t,o){return b.fromPromise(this.__checkFlags(t,o))}async __checkFlags(t,o){let r=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags/check"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ii.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:kh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /flags/check.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countFlags(t={},o){return b.fromPromise(this.__countFlags(t,o))}async __countFlags(t={},o){let{featureId:r,ids:i,q:m,limit:g,offset:p}=t,s={};r!=null&&(s.feature_id=r),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"flags/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:Vh.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /flags/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Co=H(require("url-join"));var To=class{constructor(t={}){this._options=t}getPlanGroup(t){return b.fromPromise(this.__getPlanGroup(t))}async __getPlanGroup(t){let o=await(this._options.fetcher??_)({url:(0,Co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-groups"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...t?.headers},contentType:"application/json",requestType:"json",timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:Nh.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 401:throw new S(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 403:throw new x(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 404:throw new E(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);case 500:throw new U(a.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),o.rawResponse);default:throw new c({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new c({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /plan-groups.");case"unknown":throw new c({message:o.error.errorMessage,rawResponse:o.rawResponse})}}createPlanGroup(t,o){return b.fromPromise(this.__createPlanGroup(t,o))}async __createPlanGroup(t,o){let r=await(this._options.fetcher??_)({url:(0,Co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"plan-groups"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:Yt.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Wh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /plan-groups.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePlanGroup(t,o,r){return b.fromPromise(this.__updatePlanGroup(t,o,r))}async __updatePlanGroup(t,o,r){let i=await(this._options.fetcher??_)({url:(0,Co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-groups/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:Qt.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:Jh.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plan-groups/{plan_group_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Pg=H(require("url-join"));var vo=class{constructor(t={}){this._options=t}issueTemporaryAccessToken(t,o){return b.fromPromise(this.__issueTemporaryAccessToken(t,o))}async __issueTemporaryAccessToken(t,o){let r=await(this._options.fetcher??_)({url:(0,Pg.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"temporary-access-tokens"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:{...ei.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),resource_type:"company"},timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Zh.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /temporary-access-tokens.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var xe=H(require("url-join"));var Oo=class{constructor(t={}){this._options=t}listWebhookEvents(t={},o){return b.fromPromise(this.__listWebhookEvents(t,o))}async __listWebhookEvents(t={},o){let{ids:r,q:i,webhookId:m,limit:g,offset:p}=t,s={};r!=null&&(Array.isArray(r)?s.ids=r.map(u=>u):s.ids=r),i!=null&&(s.q=i),m!=null&&(s.webhook_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhook-events"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:Qh.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhook-events.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}getWebhookEvent(t,o){return b.fromPromise(this.__getWebhookEvent(t,o))}async __getWebhookEvent(t,o){let r=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhook-events/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:eg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhook-events/{webhook_event_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countWebhookEvents(t={},o){return b.fromPromise(this.__countWebhookEvents(t,o))}async __countWebhookEvents(t={},o){let{ids:r,q:i,webhookId:m,limit:g,offset:p}=t,s={};r!=null&&(Array.isArray(r)?s.ids=r.map(u=>u):s.ids=r),i!=null&&(s.q=i),m!=null&&(s.webhook_id=m),g!=null&&(s.limit=g.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhook-events/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:og.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new P(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 401:throw new S(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 403:throw new x(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 404:throw new E(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);case 500:throw new U(a.parseOrThrow(l.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),l.rawResponse);default:throw new c({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new c({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhook-events/count.");case"unknown":throw new c({message:l.error.errorMessage,rawResponse:l.rawResponse})}}listWebhooks(t={},o){return b.fromPromise(this.__listWebhooks(t,o))}async __listWebhooks(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhooks"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:ig.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhooks.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createWebhook(t,o){return b.fromPromise(this.__createWebhook(t,o))}async __createWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhooks"),method:"POST",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",body:ri.jsonOrThrow(t,{unrecognizedObjectKeys:"strip"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:sg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling POST /webhooks.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWebhook(t,o){return b.fromPromise(this.__getWebhook(t,o))}async __getWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhooks/${encodeURIComponent(t)}`),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:ng.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhooks/{webhook_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateWebhook(t,o={},r){return b.fromPromise(this.__updateWebhook(t,o,r))}async __updateWebhook(t,o={},r){let i=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhooks/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:oi.jsonOrThrow(o,{unrecognizedObjectKeys:"strip"}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return{data:lg.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new P(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 401:throw new S(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 403:throw new x(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 404:throw new E(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);case 500:throw new U(a.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),i.rawResponse);default:throw new c({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new c({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /webhooks/{webhook_id}.");case"unknown":throw new c({message:i.error.errorMessage,rawResponse:i.rawResponse})}}deleteWebhook(t,o){return b.fromPromise(this.__deleteWebhook(t,o))}async __deleteWebhook(t,o){let r=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`webhooks/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:mg.parseOrThrow(r.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new P(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 401:throw new S(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 403:throw new x(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 404:throw new E(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);case 500:throw new U(a.parseOrThrow(r.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),r.rawResponse);default:throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /webhooks/{webhook_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}countWebhooks(t={},o){return b.fromPromise(this.__countWebhooks(t,o))}async __countWebhooks(t={},o){let{q:r,limit:i,offset:m}=t,g={};r!=null&&(g.q=r),i!=null&&(g.limit=i.toString()),m!=null&&(g.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,"webhooks/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:g,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:dg.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new P(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 401:throw new S(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 403:throw new x(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 404:throw new E(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);case 500:throw new U(a.parseOrThrow(p.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),p.rawResponse);default:throw new c({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new c({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /webhooks/count.");case"unknown":throw new c({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var Bo=class{constructor(t={}){this._options=t}get accounts(){return this._accounts??=new wo(this._options)}get billing(){return this._billing??=new yo(this._options)}get credits(){return this._credits??=new zo(this._options)}get checkout(){return this._checkout??=new Ro(this._options)}get companies(){return this._companies??=new bo(this._options)}get entitlements(){return this._entitlements??=new fo(this._options)}get plans(){return this._plans??=new _o(this._options)}get components(){return this._components??=new So(this._options)}get crm(){return this._crm??=new xo(this._options)}get dataexports(){return this._dataexports??=new Eo(this._options)}get events(){return this._events??=new Uo(this._options)}get features(){return this._features??=new Po(this._options)}get plangroups(){return this._plangroups??=new To(this._options)}get accesstokens(){return this._accesstokens??=new vo(this._options)}get webhooks(){return this._webhooks??=new Oo(this._options)}putPlanAudiencesPlanAudienceId(t,o){return b.fromPromise(this.__putPlanAudiencesPlanAudienceId(t,o))}async __putPlanAudiencesPlanAudienceId(t,o){let r=await(this._options.fetcher??_)({url:(0,ui.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-audiences/${encodeURIComponent(t)}`),method:"PUT",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling PUT /plan-audiences/{plan_audience_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deletePlanAudiencesPlanAudienceId(t,o){return b.fromPromise(this.__deletePlanAudiencesPlanAudienceId(t,o))}async __deletePlanAudiencesPlanAudienceId(t,o){let r=await(this._options.fetcher??_)({url:(0,ui.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Default,`plan-audiences/${encodeURIComponent(t)}`),method:"DELETE",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.6","User-Agent":"@schematichq/schematic-typescript-node/1.2.6","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:void 0,rawResponse:r.rawResponse};if(r.error.reason==="status-code")throw new c({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse});switch(r.error.reason){case"non-json":throw new c({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new R("Timeout exceeded when calling DELETE /plan-audiences/{plan_audience_id}.");case"unknown":throw new c({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getCustomAuthorizationHeaders(){return{"X-Schematic-Api-Key":await d.get(this._options.apiKey)}}};var wr=class{error(t,...o){console.error(t,...o)}warn(t,...o){console.warn(t,...o)}info(t,...o){console.info(t,...o)}debug(t,...o){console.debug(t,...o)}};var Xw=1e3,Hw=1e3,Ww=3,Jw=1e3,jo=class{constructor(t,o){this.events=[];this.intervalId=null;this.shutdown=!1;this.stopped=!1;this.flushing=!1;let{logger:r=new wr,maxSize:i=Hw,interval:m=Xw,offline:g=!1,maxRetries:p=Ww,initialRetryDelay:s=Jw}=o||{};this.eventsApi=t,this.interval=m,this.logger=r,this.maxSize=i,this.offline=g,this.maxRetries=p,this.initialRetryDelay=s,this.startPeriodicFlush()}async flush(){if(!(this.events.length===0||this.flushing)){this.flushing=!0;try{let t=[...this.events];this.events=[];let o=0,r=!1,i=null;for(;o<=this.maxRetries&&!r;)try{o>0&&this.logger.info(`Retrying event batch submission (attempt ${o} of ${this.maxRetries})`),await this.eventsApi.createEventBatch({events:t}),r=!0}catch(m){if(i=m,o++,o<=this.maxRetries){let g=this.initialRetryDelay*Math.pow(2,o-1),p=Math.random()*.1*g,s=g+p;this.logger.warn(`Event batch submission failed: ${m}. Retrying in ${(s/1e3).toFixed(2)} seconds...`),process.env.NODE_ENV!=="test"&&await new Promise(l=>setTimeout(l,s))}}r?o>0&&this.logger.info(`Event batch submission succeeded after ${o} retries`):this.logger.error(`Event batch submission failed after ${this.maxRetries} retries:`,i)}finally{this.flushing=!1}}}async push(t){if(!this.offline){if(this.stopped){this.logger.error("Event buffer is stopped, not accepting new events");return}this.events.length>=this.maxSize&&!this.flushing&&await this.flush(),this.events.push(t)}}async stop(){this.shutdown=!0,this.stopped=!0,this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),await this.flush()}startPeriodicFlush(){this.offline||this.intervalId||(this.intervalId=setInterval(async()=>{this.shutdown||await this.flush()},this.interval))}};function Cg(w){return async function(o){let r={};if(w&&Object.assign(r,w),o.body!==void 0&&o.contentType!=null&&(r["Content-Type"]=o.contentType),o.headers!=null)for(let[p,s]of Object.entries(o.headers))s!=null&&(r[p]=s);let i=xr(o.url,o.queryParameters),m=await Ur({body:o.body,type:o.requestType==="json"?"json":"other"}),g=await Er();try{let p=await Tr(async()=>Cr(g,i,o.method,r,m,o.timeoutMs,o.abortSignal,o.withCredentials,o.duplex),o.maxRetries),s=await Pr(p,o.responseType),l=We(p);return p.status>=200&&p.status<400?{ok:!0,body:s,headers:p.headers,rawResponse:l}:{ok:!1,error:{reason:"status-code",statusCode:p.status,body:s},rawResponse:l}}catch(p){return o.abortSignal!=null&&o.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:Fe}:p instanceof Error&&p.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:Fe}:p instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:p.message},rawResponse:Ie}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(p)},rawResponse:Ie}}}}async function $w(w){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new Ae,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var Tg=$w;var ko=class extends Bo{constructor(t){let{apiKey:o="",basePath:r,eventBufferInterval:i,flagDefaults:m={},logger:g=new wr}=t??{},{offline:p=!1}=t??{},s={};t?.environmentId&&(s["X-Schematic-Environment-Id"]=t.environmentId),t?.headers&&Object.assign(s,t.headers),p?o!==""&&g.debug("Offline mode enabled, ignoring API key"):o===""&&!p&&(g.warn("No API key was provided, running in offline mode"),p=!0),super({apiKey:o,environment:r,fetcher:p?Tg:Cg(s)}),this.logger=g,this.eventBuffer=new jo(this.events,{interval:i,logger:g,offline:p}),this.flagCheckCacheProviders=t?.cacheProviders?.flagChecks??[new He],this.flagDefaults=m,this.offline=p}async checkFlag(t,o){if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag value for flag ${o}`),this.getFlagDefault(o);try{let r=JSON.stringify({evalCtx:t,key:o});for(let m of this.flagCheckCacheProviders){let g=await m.get(r);if(g!==void 0)return this.logger.debug(`${m.constructor.name} cache hit for flag ${o}`),g}let i=await this.features.checkFlag(o,t);if(i.data.value===void 0)return this.logger.debug(`No value returned from feature flag API for flag ${o}, falling back to default`),this.getFlagDefault(o);for(let m of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${o} in ${m.constructor.name}`),await m.set(r,i.data.value);return this.logger.debug(`Feature flag API response for ${o}: ${JSON.stringify(i.data)}`),i.data.value}catch(r){return this.logger.error(`Error checking flag ${o}: ${r}`),this.getFlagDefault(o)}}async checkFlags(t,o){if(this.offline)return this.logger.debug(`Offline mode enabled, returning default flag values for flags ${o?o.join(", "):"all"}`),o&&o.length>0?o.map(r=>({flag:r,value:this.getFlagDefault(r),reason:"Offline mode - using default value"})):[];try{if(!o||o.length===0)return this.logger.debug("No specific flag keys provided, calling standard checkFlags API"),(await this.features.checkFlags(t)).data.flags;let r=new Map,i=[];for(let s of o){let l=JSON.stringify({evalCtx:t,key:s}),u=!1;for(let z of this.flagCheckCacheProviders){let y=await z.get(l);if(y!==void 0){this.logger.debug(`${z.constructor.name} cache hit for flag ${s}`),r.set(s,{flag:s,value:y,reason:"Retrieved from cache"}),u=!0;break}}u||i.push(s)}if(i.length===0)return this.logger.debug(`All ${o.length} flags found in cache`),o.map(s=>r.get(s));this.logger.debug(`Cache miss for ${i.length} flags: ${i.join(", ")}, calling API`);let g=(await this.features.checkFlags(t)).data.flags,p=[];for(let s of o){let l=g.find(u=>u.flag===s);if(l){let u=JSON.stringify({evalCtx:t,key:s});for(let z of this.flagCheckCacheProviders)this.logger.debug(`Caching value for flag ${u} in ${z.constructor.name}`),await z.set(u,l.value);p.push(l)}else{let u=r.get(s);if(u)p.push(u);else{this.logger.debug(`Flag ${s} not found in API response or cache, using default value`);let z={flag:s,value:this.getFlagDefault(s),reason:"Flag not found - using default value"};p.push(z)}}}return this.logger.debug(`Checked ${o.length} flags: used fresh API values for consistency (${i.length} were cache misses)`),p}catch(r){return this.logger.error(`Error checking flags ${o?o.join(", "):"all"}: ${r}`),o&&o.length>0?o.map(i=>({flag:i,value:this.getFlagDefault(i),reason:`Error occurred - using default value: ${r}`})):[]}}async close(){return this.eventBuffer.stop()}async identify(t){if(!this.offline)try{await this.enqueueEvent("identify",t)}catch(o){this.logger.error(`Error sending identify event: ${o}`)}}async track(t){if(!this.offline)try{await this.enqueueEvent("track",t)}catch(o){this.logger.error(`Error sending track event: ${o}`)}}setFlagDefault(t,o){this.flagDefaults[t]=o}setFlagDefaults(t){Object.assign(this.flagDefaults,t)}getFlagDefault(t){return this.flagDefaults[t]??!1}async enqueueEvent(t,o){try{this.eventBuffer.push({eventType:t,body:o,sentAt:new Date})}catch(r){this.logger.error(`Error enqueueing ${t} event: ${r}`)}}};var Do=H(require("crypto")),di="X-Schematic-Webhook-Signature",hi="X-Schematic-Webhook-Timestamp",Ee=class w extends Error{constructor(t){super(t),Object.setPrototypeOf(this,w.prototype),this.name="WebhookSignatureError"}static missingSignature(){return new w("Missing webhook signature header")}static missingTimestamp(){return new w("Missing webhook timestamp header")}static invalidSignature(){return new w("Invalid webhook signature")}};function Vo(w,t,o){let r=Buffer.isBuffer(w)?w:Buffer.from(w),i=Buffer.concat([r,Buffer.from(`+${t}`)]),m=Do.createHmac("sha256",o);return m.update(i),m.digest()}function Og(w,t,o){return Vo(w,t,o).toString("hex")}function gi(w,t,o,r){if(!t)throw Ee.missingSignature();if(!o)throw Ee.missingTimestamp();let i;try{i=Buffer.from(t,"hex")}catch(g){throw new Ee(`Invalid signature format: ${g?.message||"Unknown error"}`)}let m=Vo(w,o,r);if(i.length!==m.length||!Do.timingSafeEqual(i,m))throw Ee.invalidSignature()}function Bg(w,t,o,r={}){let i=w.headers,m=r.signatureHeader||di,g=r.timestampHeader||hi,p=vg(i,m),s=vg(i,g),l;if(o!==void 0)l=o;else if("rawBody"in w&&w.rawBody)l=w.rawBody;else throw new Ee("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");gi(l,p,s,t)}function vg(w,t){let o=w[t]||w[t.toLowerCase()];return Array.isArray(o)?o[0]||"":o||""}0&&(module.exports={LocalCache,Schematic,SchematicClient,SchematicEnvironment,SchematicError,SchematicTimeoutError,WEBHOOK_SIGNATURE_HEADER,WEBHOOK_TIMESTAMP_HEADER,WebhookSignatureError,computeHexSignature,computeSignature,verifySignature,verifyWebhookSignature});