@schematichq/schematic-typescript-node 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Client.d.ts +11 -57
- package/dist/api/resources/companies/client/Client.d.ts +35 -0
- package/dist/api/resources/companies/client/requests/ListPlanChangesRequest.d.ts +28 -0
- package/dist/api/resources/companies/client/requests/index.d.ts +1 -0
- package/dist/api/resources/{features/types/CountAudienceCompaniesResponse.d.ts → companies/types/GetPlanChangeResponse.d.ts} +2 -2
- package/dist/api/resources/companies/types/ListPlanChangesParams.d.ts +17 -0
- package/dist/api/resources/{features/types/CountAudienceUsersResponse.d.ts → companies/types/ListPlanChangesResponse.d.ts} +3 -3
- package/dist/api/resources/companies/types/index.d.ts +3 -0
- package/dist/api/resources/credits/client/Client.d.ts +24 -24
- package/dist/api/resources/features/client/Client.d.ts +0 -112
- package/dist/api/resources/features/types/index.d.ts +0 -4
- package/dist/api/resources/index.d.ts +3 -3
- package/dist/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +0 -1
- package/dist/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +0 -1
- package/dist/api/resources/plans/client/Client.d.ts +0 -58
- package/dist/api/resources/plans/client/requests/index.d.ts +0 -1
- package/dist/api/resources/plans/types/index.d.ts +0 -3
- package/dist/api/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.d.ts +2 -1
- package/dist/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.d.ts +2 -1
- package/dist/api/types/CreateOrUpdateConditionGroupRequestBody.d.ts +0 -1
- package/dist/api/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +1 -2
- package/dist/api/types/PlanChangeResponseData.d.ts +29 -0
- package/dist/api/types/PlanChangeResponseDataAction.d.ts +14 -0
- package/dist/api/types/PlanChangeResponseDataActorType.d.ts +10 -0
- package/dist/api/types/PlanChangeResponseDataBasePlanAction.d.ts +13 -0
- package/dist/api/types/PlanChangeResponseDataSubscriptionChangeAction.d.ts +15 -0
- package/dist/api/types/PlanSnapshotView.d.ts +10 -0
- package/dist/api/types/RuleConditionDetailResponseData.d.ts +0 -1
- package/dist/api/types/RuleConditionGroupDetailResponseData.d.ts +0 -1
- package/dist/api/types/RuleConditionGroupResponseData.d.ts +0 -1
- package/dist/api/types/RuleConditionResponseData.d.ts +0 -1
- package/dist/api/types/RuleDetailResponseData.d.ts +0 -1
- package/dist/api/types/RuleResponseData.d.ts +0 -1
- package/dist/api/types/SubscriptionTraitUpdate.d.ts +12 -0
- package/dist/api/types/index.d.ts +7 -4
- package/dist/index.js +3 -3
- package/dist/serialization/resources/companies/types/GetPlanChangeResponse.d.ts +14 -0
- package/dist/serialization/resources/companies/types/ListPlanChangesParams.d.ts +18 -0
- package/dist/serialization/resources/companies/types/ListPlanChangesResponse.d.ts +15 -0
- package/dist/serialization/resources/companies/types/index.d.ts +3 -0
- package/dist/serialization/resources/features/types/index.d.ts +0 -4
- package/dist/serialization/resources/index.d.ts +3 -3
- package/dist/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +0 -1
- package/dist/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +0 -1
- package/dist/serialization/resources/plans/client/requests/index.d.ts +0 -1
- package/dist/serialization/resources/plans/types/index.d.ts +0 -3
- package/dist/serialization/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.d.ts +1 -1
- package/dist/serialization/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.d.ts +1 -1
- package/dist/serialization/types/CreateOrUpdateConditionGroupRequestBody.d.ts +0 -1
- package/dist/serialization/types/CreateOrUpdateRuleRequestBodyRuleType.d.ts +1 -1
- package/dist/serialization/types/PlanChangeResponseData.d.ts +40 -0
- package/dist/serialization/types/PlanChangeResponseDataAction.d.ts +10 -0
- package/dist/serialization/types/PlanChangeResponseDataActorType.d.ts +10 -0
- package/dist/serialization/types/PlanChangeResponseDataBasePlanAction.d.ts +10 -0
- package/dist/serialization/types/PlanChangeResponseDataSubscriptionChangeAction.d.ts +10 -0
- package/dist/serialization/types/PlanSnapshotView.d.ts +16 -0
- package/dist/serialization/types/RuleConditionDetailResponseData.d.ts +0 -1
- package/dist/serialization/types/RuleConditionGroupDetailResponseData.d.ts +0 -1
- package/dist/serialization/types/RuleConditionGroupResponseData.d.ts +0 -1
- package/dist/serialization/types/RuleConditionResponseData.d.ts +0 -1
- package/dist/serialization/types/RuleDetailResponseData.d.ts +0 -1
- package/dist/serialization/types/RuleResponseData.d.ts +0 -1
- package/dist/serialization/types/SubscriptionTraitUpdate.d.ts +18 -0
- package/dist/serialization/types/index.d.ts +7 -4
- package/package.json +1 -1
- package/dist/api/resources/features/types/ListAudienceCompaniesResponse.d.ts +0 -9
- package/dist/api/resources/features/types/ListAudienceUsersResponse.d.ts +0 -9
- package/dist/api/resources/plans/client/requests/UpdateAudienceRequestBody.d.ts +0 -25
- package/dist/api/resources/plans/types/DeleteAudienceResponse.d.ts +0 -9
- package/dist/api/resources/plans/types/GetAudienceResponse.d.ts +0 -9
- package/dist/api/resources/plans/types/UpdateAudienceResponse.d.ts +0 -9
- package/dist/api/types/AudienceRequestBody.d.ts +0 -13
- package/dist/api/types/PaginationFilter.d.ts +0 -9
- package/dist/api/types/PlanAudienceDetailResponseData.d.ts +0 -18
- package/dist/api/types/PlanAudienceResponseData.d.ts +0 -15
- package/dist/serialization/resources/features/types/CountAudienceCompaniesResponse.d.ts +0 -14
- package/dist/serialization/resources/features/types/CountAudienceUsersResponse.d.ts +0 -14
- package/dist/serialization/resources/features/types/ListAudienceCompaniesResponse.d.ts +0 -14
- package/dist/serialization/resources/features/types/ListAudienceUsersResponse.d.ts +0 -14
- package/dist/serialization/resources/plans/client/requests/UpdateAudienceRequestBody.d.ts +0 -15
- package/dist/serialization/resources/plans/types/DeleteAudienceResponse.d.ts +0 -14
- package/dist/serialization/resources/plans/types/GetAudienceResponse.d.ts +0 -14
- package/dist/serialization/resources/plans/types/UpdateAudienceResponse.d.ts +0 -14
- package/dist/serialization/types/AudienceRequestBody.d.ts +0 -18
- package/dist/serialization/types/PaginationFilter.d.ts +0 -13
- package/dist/serialization/types/PlanAudienceDetailResponseData.d.ts +0 -25
- 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
|
|
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 tg=Object.create;var Sr=Object.defineProperty;var ig=Object.getOwnPropertyDescriptor;var ag=Object.getOwnPropertyNames;var sg=Object.getPrototypeOf,ng=Object.prototype.hasOwnProperty;var Mo=(g,t)=>()=>(g&&(t=g(g=0)),t);var re=(g,t)=>{for(var o in t)Sr(g,o,{get:t[o],enumerable:!0})},gi=(g,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ag(t))!ng.call(g,i)&&i!==o&&Sr(g,i,{get:()=>t[i],enumerable:!(r=ig(t,i))||r.enumerable});return g};var H=(g,t,o)=>(o=g!=null?tg(sg(g)):{},gi(t||!g||!g.__esModule?Sr(o,"default",{value:g,enumerable:!0}):o,g)),cg=g=>gi(Sr({},"__esModule",{value:!0}),g);var us={};re(us,{Node18UniversalStreamWrapper:()=>Wo});var Wo,ds=Mo(()=>{"use strict";Wo=class g{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 g)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 g?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.on("error",async o=>{t instanceof g?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 g)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 g?t._end():t instanceof WritableStream?t.getWriter().close():t.end()}),this.off("error",async o=>{t instanceof g?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 hs={};re(hs,{UndiciStreamWrapper:()=>Jo});var Jo,gs=Mo(()=>{"use strict";Jo=class g{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 g)t._write(o);else{let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}}),this.on("end",()=>{t instanceof g?t._end():t.getWriter().close()}),this.on("error",o=>{t instanceof g?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 g)t._write(o);else{let r=t.getWriter();r.write(o).then(()=>r.releaseLock())}}),this.off("end",()=>{t instanceof g?t._end():t.getWriter().close()}),this.off("error",o=>{t instanceof g?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 ws={};re(ws,{NodePre18StreamWrapper:()=>$o});var $o,ys=Mo(()=>{"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 pw={};re(pw,{LocalCache:()=>He,Schematic:()=>Z,SchematicClient:()=>ko,SchematicEnvironment:()=>f,SchematicError:()=>c,SchematicTimeoutError:()=>R,WEBHOOK_SIGNATURE_HEADER:()=>ui,WEBHOOK_TIMESTAMP_HEADER:()=>di,WebhookSignatureError:()=>xe,computeHexSignature:()=>rg,computeSignature:()=>Do,verifySignature:()=>hi,verifyWebhookSignature:()=>og});module.exports=cg(pw);var Z={};re(Z,{BadRequestError:()=>P,BillingProductPricingUsageType:()=>pg,CountBillingProductsRequestPriceUsageType:()=>Ti,CountBillingProductsResponseParamsPriceUsageType:()=>vi,CountCompaniesForAdvancedFilterRequestSortOrderDirection:()=>pa,CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>la,CountCreditBundlesRequestStatus:()=>Gi,CountCreditBundlesResponseParamsStatus:()=>Ni,CountCreditLedgerRequestPeriod:()=>ra,CountCreditLedgerResponseParamsPeriod:()=>oa,CountEntityKeyDefinitionsRequestEntityType:()=>ga,CountEntityKeyDefinitionsResponseParamsEntityType:()=>wa,CountEntityTraitDefinitionsRequestEntityType:()=>xa,CountEntityTraitDefinitionsRequestTraitType:()=>Ea,CountEntityTraitDefinitionsResponseParamsEntityType:()=>Ua,CountEntityTraitDefinitionsResponseParamsTraitType:()=>Pa,CountPlansRequestPlanType:()=>Xa,CountPlansResponseParamsPlanType:()=>Ha,CreateBillingCreditRequestBodyBurnStrategy:()=>ji,CreateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Bi,CreateBillingPlanCreditGrantRequestBodyExpiryType:()=>ta,CreateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>ia,CreateBillingPlanCreditGrantRequestBodyResetCadence:()=>aa,CreateBillingPlanCreditGrantRequestBodyResetStart:()=>sa,CreateBillingPlanCreditGrantRequestBodyResetType:()=>na,CreateBillingPriceRequestBodyBillingScheme:()=>_i,CreateBillingPriceRequestBodyTiersMode:()=>Si,CreateBillingPriceRequestBodyUsageType:()=>xi,CreateBillingSubscriptionRequestBodyTrialEndSetting:()=>Oi,CreateCompanyCreditGrantExpiryType:()=>Hi,CreateCompanyCreditGrantExpiryUnit:()=>Wi,CreateCompanyOverrideRequestBodyMetricPeriod:()=>Ca,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Ta,CreateCompanyOverrideRequestBodyValueType:()=>va,CreateComponentRequestBodyEntityType:()=>Wa,CreateCreditBundleRequestBodyExpiryType:()=>qi,CreateCreditBundleRequestBodyExpiryUnit:()=>Ai,CreateCreditBundleRequestBodyStatus:()=>Fi,CreateEntitlementReqCommonMetricPeriod:()=>lg,CreateEntitlementReqCommonMetricPeriodMonthReset:()=>mg,CreateEntitlementReqCommonValueType:()=>ug,CreateEntityTraitDefinitionRequestBodyEntityType:()=>fa,CreateEntityTraitDefinitionRequestBodyTraitType:()=>_a,CreateEnvironmentRequestBodyEnvironmentType:()=>wi,CreateEventRequestBodyEventType:()=>dg,CreateFeatureRequestBodyFeatureType:()=>rs,CreateFeatureRequestBodyLifecyclePhase:()=>os,CreateOrUpdateConditionRequestBodyConditionType:()=>hg,CreateOrUpdateConditionRequestBodyMetricPeriod:()=>gg,CreateOrUpdateConditionRequestBodyMetricPeriodMonthReset:()=>wg,CreateOrUpdateConditionRequestBodyOperator:()=>yg,CreateOrUpdateRuleRequestBodyRuleType:()=>zg,CreatePlanEntitlementRequestBodyMetricPeriod:()=>ka,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Va,CreatePlanEntitlementRequestBodyPriceBehavior:()=>Da,CreatePlanEntitlementRequestBodyValueType:()=>Ma,CreatePlanRequestBodyPlanType:()=>Ga,CreateWebhookRequestBodyRequestTypesItem:()=>ns,CreditGrantDetailGrantReason:()=>Rg,FeatureCompanyResponseDataAllocationType:()=>bg,FeatureCompanyResponseDataCreditGrantReason:()=>fg,FeatureCompanyUserResponseDataAllocationType:()=>_g,FeatureUsageResponseDataAllocationType:()=>Sg,FeatureUsageResponseDataCreditGrantReason:()=>xg,ForbiddenError:()=>x,GetEnrichedCreditLedgerRequestPeriod:()=>Qi,GetEnrichedCreditLedgerResponseParamsPeriod:()=>ea,InternalServerError:()=>U,ListBillingProductsRequestPriceUsageType:()=>Pi,ListBillingProductsResponseParamsPriceUsageType:()=>Ci,ListCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ma,ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>ua,ListCompanyGrantsRequestDir:()=>$i,ListCompanyGrantsRequestOrder:()=>Ji,ListCompanyGrantsResponseParamsDir:()=>Zi,ListCompanyGrantsResponseParamsOrder:()=>Yi,ListCreditBundlesRequestStatus:()=>Di,ListCreditBundlesResponseParamsStatus:()=>Mi,ListEntityKeyDefinitionsRequestEntityType:()=>da,ListEntityKeyDefinitionsResponseParamsEntityType:()=>ha,ListEntityTraitDefinitionsRequestEntityType:()=>ya,ListEntityTraitDefinitionsRequestTraitType:()=>za,ListEntityTraitDefinitionsResponseParamsEntityType:()=>Ra,ListEntityTraitDefinitionsResponseParamsTraitType:()=>ba,ListEventsRequestEventTypesItem:()=>Qa,ListEventsResponseParamsEventTypesItem:()=>es,ListPlansRequestPlanType:()=>Ka,ListPlansResponseParamsPlanType:()=>La,ListProductPricesRequestPriceUsageType:()=>Ei,ListProductPricesResponseParamsPriceUsageType:()=>Ui,NotFoundError:()=>E,PlanChangeResponseDataAction:()=>Eg,PlanChangeResponseDataActorType:()=>Ug,PlanChangeResponseDataBasePlanAction:()=>Pg,PlanChangeResponseDataSubscriptionChangeAction:()=>Cg,SearchBillingPricesRequestTiersMode:()=>zi,SearchBillingPricesRequestUsageType:()=>Ri,SearchBillingPricesResponseParamsTiersMode:()=>bi,SearchBillingPricesResponseParamsUsageType:()=>fi,UnauthorizedError:()=>S,UpdateBillingCreditRequestBodyBurnStrategy:()=>ki,UpdateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Vi,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>Oa,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ja,UpdateCompanyOverrideRequestBodyValueType:()=>Ba,UpdateComponentRequestBodyEntityType:()=>Ja,UpdateComponentRequestBodyState:()=>$a,UpdateCreditBundleDetailsRequestBodyExpiryType:()=>Ii,UpdateCreditBundleDetailsRequestBodyExpiryUnit:()=>Ki,UpdateCreditBundleDetailsRequestBodyStatus:()=>Li,UpdateEntitlementReqCommonMetricPeriod:()=>Tg,UpdateEntitlementReqCommonMetricPeriodMonthReset:()=>vg,UpdateEntitlementReqCommonValueType:()=>Og,UpdateEntityTraitDefinitionRequestBodyTraitType:()=>Sa,UpdateEnvironmentRequestBodyEnvironmentType:()=>yi,UpdateFeatureRequestBodyFeatureType:()=>ts,UpdateFeatureRequestBodyLifecyclePhase:()=>is,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>qa,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Aa,UpdatePlanEntitlementRequestBodyPriceBehavior:()=>Fa,UpdatePlanEntitlementRequestBodyValueType:()=>Ia,UpdateWebhookRequestBodyRequestTypesItem:()=>cs,UpdateWebhookRequestBodyStatus:()=>ps,UpsertBillingProductRequestBodyChargeType:()=>Na,UsageBasedEntitlementRequestBodyPriceBehavior:()=>jg,ZeroOutGrantRequestBodyReason:()=>Xi,accesstokens:()=>ss,accounts:()=>qo,billing:()=>Ao,checkout:()=>ca,companies:()=>Io,components:()=>Go,credits:()=>Fo,crm:()=>Za,dataexports:()=>Ya,entitlements:()=>Ko,events:()=>No,features:()=>Xo,plangroups:()=>as,plans:()=>Lo,webhooks:()=>Ho});var qo={};re(qo,{CreateEnvironmentRequestBodyEnvironmentType:()=>wi,UpdateEnvironmentRequestBodyEnvironmentType:()=>yi});var wi={Development:"development",Staging:"staging",Production:"production"};var yi={Development:"development",Staging:"staging",Production:"production"};var Ao={};re(Ao,{CountBillingProductsRequestPriceUsageType:()=>Ti,CountBillingProductsResponseParamsPriceUsageType:()=>vi,CreateBillingPriceRequestBodyBillingScheme:()=>_i,CreateBillingPriceRequestBodyTiersMode:()=>Si,CreateBillingPriceRequestBodyUsageType:()=>xi,CreateBillingSubscriptionRequestBodyTrialEndSetting:()=>Oi,ListBillingProductsRequestPriceUsageType:()=>Pi,ListBillingProductsResponseParamsPriceUsageType:()=>Ci,ListProductPricesRequestPriceUsageType:()=>Ei,ListProductPricesResponseParamsPriceUsageType:()=>Ui,SearchBillingPricesRequestTiersMode:()=>zi,SearchBillingPricesRequestUsageType:()=>Ri,SearchBillingPricesResponseParamsTiersMode:()=>bi,SearchBillingPricesResponseParamsUsageType:()=>fi});var zi={Volume:"volume",Graduated:"graduated"};var Ri={Licensed:"licensed",Metered:"metered"};var bi={Volume:"volume",Graduated:"graduated"};var fi={Licensed:"licensed",Metered:"metered"};var _i={PerUnit:"per_unit",Tiered:"tiered"};var Si={Volume:"volume",Graduated:"graduated"};var xi={Licensed:"licensed",Metered:"metered"};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={Subscribe:"subscribe",Cancel:"cancel"};var Fo={};re(Fo,{CountCreditBundlesRequestStatus:()=>Gi,CountCreditBundlesResponseParamsStatus:()=>Ni,CountCreditLedgerRequestPeriod:()=>ra,CountCreditLedgerResponseParamsPeriod:()=>oa,CreateBillingCreditRequestBodyBurnStrategy:()=>ji,CreateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Bi,CreateBillingPlanCreditGrantRequestBodyExpiryType:()=>ta,CreateBillingPlanCreditGrantRequestBodyExpiryUnit:()=>ia,CreateBillingPlanCreditGrantRequestBodyResetCadence:()=>aa,CreateBillingPlanCreditGrantRequestBodyResetStart:()=>sa,CreateBillingPlanCreditGrantRequestBodyResetType:()=>na,CreateCompanyCreditGrantExpiryType:()=>Hi,CreateCompanyCreditGrantExpiryUnit:()=>Wi,CreateCreditBundleRequestBodyExpiryType:()=>qi,CreateCreditBundleRequestBodyExpiryUnit:()=>Ai,CreateCreditBundleRequestBodyStatus:()=>Fi,GetEnrichedCreditLedgerRequestPeriod:()=>Qi,GetEnrichedCreditLedgerResponseParamsPeriod:()=>ea,ListCompanyGrantsRequestDir:()=>$i,ListCompanyGrantsRequestOrder:()=>Ji,ListCompanyGrantsResponseParamsDir:()=>Zi,ListCompanyGrantsResponseParamsOrder:()=>Yi,ListCreditBundlesRequestStatus:()=>Di,ListCreditBundlesResponseParamsStatus:()=>Mi,UpdateBillingCreditRequestBodyBurnStrategy:()=>ki,UpdateBillingCreditRequestBodyDefaultRolloverPolicy:()=>Vi,UpdateCreditBundleDetailsRequestBodyExpiryType:()=>Ii,UpdateCreditBundleDetailsRequestBodyExpiryUnit:()=>Ki,UpdateCreditBundleDetailsRequestBodyStatus:()=>Li,ZeroOutGrantRequestBodyReason:()=>Xi});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 Bi={None:"none",Rollover:"rollover",Expire:"expire"};var ki={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 Di={Active:"active",Inactive:"inactive"};var Mi={Active:"active",Inactive:"inactive"};var qi={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Ai={Days:"days",BillingPeriods:"billing_periods"};var Fi={Active:"active",Inactive:"inactive"};var Ii={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Ki={Days:"days",BillingPeriods:"billing_periods"};var Li={Active:"active",Inactive:"inactive"};var Gi={Active:"active",Inactive:"inactive"};var Ni={Active:"active",Inactive:"inactive"};var Xi={PlanChange:"plan_change",Manual:"manual",PlanPeriodReset:"plan_period_reset",Expired:"expired"};var Hi={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var Wi={Days:"days",BillingPeriods:"billing_periods"};var Ji={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var $i={Asc:"asc",Desc:"desc"};var Zi={Asc:"asc",Desc:"desc"};var Yi={CreatedAt:"created_at",ExpiresAt:"expires_at",Quantity:"quantity",QuantityRemaining:"quantity_remaining"};var Qi={Daily:"daily",Weekly:"weekly",Monthly:"monthly",Raw:"raw"};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={Duration:"duration",NoExpiry:"no_expiry",EndOfTrial:"end_of_trial",EndOfBillingPeriod:"end_of_billing_period",EndOfNextBillingPeriod:"end_of_next_billing_period"};var ia={Days:"days",BillingPeriods:"billing_periods"};var aa={Monthly:"monthly",Yearly:"yearly",Daily:"daily",Weekly:"weekly"};var sa={BillingPeriod:"billing_period",FirstOfMonth:"first_of_month"};var na={PlanPeriod:"plan_period",NoReset:"no_reset"};var ca={};var Io={};re(Io,{CountCompaniesForAdvancedFilterRequestSortOrderDirection:()=>pa,CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>la,CountEntityKeyDefinitionsRequestEntityType:()=>ga,CountEntityKeyDefinitionsResponseParamsEntityType:()=>wa,CountEntityTraitDefinitionsRequestEntityType:()=>xa,CountEntityTraitDefinitionsRequestTraitType:()=>Ea,CountEntityTraitDefinitionsResponseParamsEntityType:()=>Ua,CountEntityTraitDefinitionsResponseParamsTraitType:()=>Pa,CreateEntityTraitDefinitionRequestBodyEntityType:()=>fa,CreateEntityTraitDefinitionRequestBodyTraitType:()=>_a,ListCompaniesForAdvancedFilterRequestSortOrderDirection:()=>ma,ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection:()=>ua,ListEntityKeyDefinitionsRequestEntityType:()=>da,ListEntityKeyDefinitionsResponseParamsEntityType:()=>ha,ListEntityTraitDefinitionsRequestEntityType:()=>ya,ListEntityTraitDefinitionsRequestTraitType:()=>za,ListEntityTraitDefinitionsResponseParamsEntityType:()=>Ra,ListEntityTraitDefinitionsResponseParamsTraitType:()=>ba,UpdateEntityTraitDefinitionRequestBodyTraitType:()=>Sa});var pa={Asc:"asc",Desc:"desc"};var la={Asc:"asc",Desc:"desc"};var ma={Asc:"asc",Desc:"desc"};var ua={Asc:"asc",Desc:"desc"};var da={Company:"company",User:"user"};var ha={Company:"company",User:"user"};var ga={Company:"company",User:"user"};var wa={Company:"company",User:"user"};var ya={Company:"company",User:"user"};var za={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Ra={Company:"company",User:"user"};var ba={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var fa={Company:"company",User:"user"};var _a={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var Sa={Boolean:"boolean",Currency:"currency",Date:"date",Number:"number",String:"string",Url:"url"};var xa={Company:"company",User:"user"};var Ea={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 Ko={};re(Ko,{CreateCompanyOverrideRequestBodyMetricPeriod:()=>Ca,CreateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>Ta,CreateCompanyOverrideRequestBodyValueType:()=>va,CreatePlanEntitlementRequestBodyMetricPeriod:()=>ka,CreatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Va,CreatePlanEntitlementRequestBodyPriceBehavior:()=>Da,CreatePlanEntitlementRequestBodyValueType:()=>Ma,UpdateCompanyOverrideRequestBodyMetricPeriod:()=>Oa,UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset:()=>ja,UpdateCompanyOverrideRequestBodyValueType:()=>Ba,UpdatePlanEntitlementRequestBodyMetricPeriod:()=>qa,UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset:()=>Aa,UpdatePlanEntitlementRequestBodyPriceBehavior:()=>Fa,UpdatePlanEntitlementRequestBodyValueType:()=>Ia});var Ca={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Ta={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var va={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Oa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var ja={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Ba={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 Va={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Da={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var Ma={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var qa={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var Aa={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Fa={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var Ia={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var Lo={};re(Lo,{CountPlansRequestPlanType:()=>Xa,CountPlansResponseParamsPlanType:()=>Ha,CreatePlanRequestBodyPlanType:()=>Ga,ListPlansRequestPlanType:()=>Ka,ListPlansResponseParamsPlanType:()=>La,UpsertBillingProductRequestBodyChargeType:()=>Na});var Ka={Plan:"plan",AddOn:"add_on"};var La={Plan:"plan",AddOn:"add_on"};var Ga={Plan:"plan",AddOn:"add_on"};var Na={OneTime:"one_time",Recurring:"recurring",Free:"free"};var Xa={Plan:"plan",AddOn:"add_on"};var Ha={Plan:"plan",AddOn:"add_on"};var Go={};re(Go,{CreateComponentRequestBodyEntityType:()=>Wa,UpdateComponentRequestBodyEntityType:()=>Ja,UpdateComponentRequestBodyState:()=>$a});var Wa={Entitlement:"entitlement",Billing:"billing"};var Ja={Entitlement:"entitlement",Billing:"billing"};var $a={Draft:"draft",Live:"live"};var Za={};var Ya={};var No={};re(No,{ListEventsRequestEventTypesItem:()=>Qa,ListEventsResponseParamsEventTypesItem:()=>es});var Qa={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var es={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var Xo={};re(Xo,{CreateFeatureRequestBodyFeatureType:()=>rs,CreateFeatureRequestBodyLifecyclePhase:()=>os,UpdateFeatureRequestBodyFeatureType:()=>ts,UpdateFeatureRequestBodyLifecyclePhase:()=>is});var rs={Boolean:"boolean",Event:"event",Trait:"trait"};var os={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",InPlan:"in_plan",Inactive:"inactive",InternalTesting:"internal_testing",Legacy:"legacy"};var ts={Boolean:"boolean",Event:"event",Trait:"trait"};var is={AddOn:"add_on",Alpha:"alpha",Beta:"beta",Deprecated:"deprecated",Ga:"ga",InPlan:"in_plan",Inactive:"inactive",InternalTesting:"internal_testing",Legacy:"legacy"};var as={};var ss={};var Ho={};re(Ho,{CreateWebhookRequestBodyRequestTypesItem:()=>ns,UpdateWebhookRequestBodyRequestTypesItem:()=>cs,UpdateWebhookRequestBodyStatus:()=>ps});var ns={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 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",CompanyPlanChange:"company.plan_change"};var ps={Active:"active",Inactive:"inactive"};var pg={Licensed:"licensed",Metered:"metered"};var lg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var mg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var ug={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var dg={Identify:"identify",Track:"track",FlagCheck:"flag_check"};var hg={Company:"company",Metric:"metric",Trait:"trait",User:"user",Plan:"plan",BillingProduct:"billing_product",CrmProduct:"crm_product",BasePlan:"base_plan"};var gg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var wg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var yg={Eq:"eq",Ne:"ne",Gt:"gt",Gte:"gte",Lt:"lt",Lte:"lte",IsEmpty:"is_empty",NotEmpty:"not_empty"};var zg={GlobalOverride:"global_override",CompanyOverride:"company_override",PlanEntitlement:"plan_entitlement",Standard:"standard",Default:"default"};var Rg={Free:"free",Plan:"plan",Purchased:"purchased"};var bg={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var fg={Free:"free",Plan:"plan",Purchased:"purchased"};var _g={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited",Unknown:"unknown"};var Sg={Boolean:"boolean",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var xg={Free:"free",Plan:"plan",Purchased:"purchased"};var Eg={Checkout:"checkout",CompanyUpsert:"company_upsert",FallbackPlan:"fallback_plan",ManagePlan:"manage_plan",PlanBillingProductChanged:"plan_billing_product_changed",PlanDeleted:"plan_deleted",Quickstart:"quickstart",SubscriptionChange:"subscription_change"};var Ug={AppUser:"app_user",ApiKey:"api_key",System:"system",TemporaryAccessToken:"temporary_access_token"};var Pg={Fallback:"fallback",Initial:"initial",Trait:"trait",TrialExpiry:"trial_expiry"};var Cg={Downgrade:"downgrade",Invalid:"invalid",Subscribe:"subscribe",Unsubscribe:"unsubscribe",Upgrade:"upgrade",UpgradeTrial:"upgrade_trial"};var Tg={AllTime:"all_time",CurrentMonth:"current_month",CurrentWeek:"current_week",CurrentDay:"current_day"};var vg={FirstOfMonth:"first_of_month",BillingCycle:"billing_cycle"};var Og={Boolean:"boolean",Credit:"credit",Numeric:"numeric",Trait:"trait",Unlimited:"unlimited"};var jg={PayAsYouGo:"pay_as_you_go",PayInAdvance:"pay_in_advance",Overage:"overage",CreditBurndown:"credit_burndown",Tier:"tier"};var pe=(g,t,o)=>JSON.stringify(g,t,o);var c=class g extends Error{constructor({message:t,statusCode:o,body:r,rawResponse:i}){super(Bg({message:t,statusCode:o,body:r})),Object.setPrototypeOf(this,g.prototype),this.statusCode=o,this.body=r,this.rawResponse=i}};function Bg({message:g,statusCode:t,body:o}){let r=[];return g!=null&&r.push(g),t!=null&&r.push(`Status code: ${t.toString()}`),o!=null&&r.push(`Body: ${pe(o,void 0,2)}`),r.join(`
|
|
2
|
+
`)}var R=class g extends Error{constructor(t){super(t),Object.setPrototypeOf(this,g.prototype)}};var P=class g extends c{constructor(t,o){super({message:"BadRequestError",statusCode:400,body:t,rawResponse:o}),Object.setPrototypeOf(this,g.prototype)}};var S=class g extends c{constructor(t,o){super({message:"UnauthorizedError",statusCode:401,body:t,rawResponse:o}),Object.setPrototypeOf(this,g.prototype)}};var x=class g extends c{constructor(t,o){super({message:"ForbiddenError",statusCode:403,body:t,rawResponse:o}),Object.setPrototypeOf(this,g.prototype)}};var E=class g extends c{constructor(t,o){super({message:"NotFoundError",statusCode:404,body:t,rawResponse:o}),Object.setPrototypeOf(this,g.prototype)}};var U=class g extends c{constructor(t,o){super({message:"InternalServerError",statusCode:500,body:t,rawResponse:o}),Object.setPrototypeOf(this,g.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 w={value:o,accessCounter:this.accessCounter,expiration:Date.now()+i,timeoutId:(0,yr.setTimeout)(()=>this.evictItem(t,w),i)};this.cache.set(t,w)}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 ls{constructor(t){if(this.headers=new Map,t)if(t instanceof ls)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(g){return{headers:g.headers,redirected:g.redirected,status:g.status,statusText:g.statusText,type:g.type,url:g.url}}var ms=H(require("qs"));function xr(g,t){return Object.keys(t??{}).length>0?`${g}?${ms.default.stringify(t,{arrayFormat:"repeat"})}`:g}var h=kg();function kg(){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:g,type:t}){return t.includes("json")?pe(g):g}async function zs(g){return h.type==="node"&&h.parsedVersion!=null&&h.parsedVersion>=18?new(await Promise.resolve().then(()=>(ds(),us))).Node18UniversalStreamWrapper(g):h.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(gs(),hs))).UndiciStreamWrapper(g):new(await Promise.resolve().then(()=>(ys(),ws))).NodePre18StreamWrapper(g)}async function Pr(g,t){if(g.body!=null&&t==="blob")return await g.blob();if(g.body!=null&&t==="arrayBuffer")return await g.arrayBuffer();if(g.body!=null&&t==="sse")return g.body;if(g.body!=null&&t==="streaming")return zs(g.body);if(g.body!=null&&t==="text")return await g.text();{let o=await g.text();if(o.length>0)try{return JSON.parse(o)}catch{return{ok:!1,error:{reason:"non-json",statusCode:g.status,rawBody:o}}}else return}}var Vg="timeout";function Rs(g){let t=new AbortController,o=setTimeout(()=>t.abort(Vg),g);return{signal:t.signal,abortId:o}}function bs(...g){let t=g.length===1&&Array.isArray(g[0])?g[0]:g,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(g,t,o,r,i,m,w,p,s)=>{let l=[],u;if(m!=null){let{signal:C,abortId:O}=Rs(m);u=O,l.push(C)}w!=null&&l.push(w);let z=bs(l),y=await g(t,{method:o,headers:r,body:i,signal:z,credentials:p?"include":void 0,duplex:s});return u!=null&&clearTimeout(u),y};function Dg(g){let t=1+(Math.random()*2-1)*.2;return g*t}async function Tr(g,t=2){let o=await g();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=Dg(i);await new Promise(w=>setTimeout(w,m)),o=await g()}return o}async function Mg(g){let t={};if(g.body!==void 0&&g.contentType!=null&&(t["Content-Type"]=g.contentType),g.headers!=null)for(let[m,w]of Object.entries(g.headers))w!=null&&(t[m]=w);let o=xr(g.url,g.queryParameters),r=await Ur({body:g.body,type:g.requestType==="json"?"json":"other"}),i=await Er();try{let m=await Tr(async()=>Cr(i,o,g.method,t,r,g.timeoutMs,g.abortSignal,g.withCredentials,g.duplex),g.maxRetries),w=await Pr(m,g.responseType);return m.status>=200&&m.status<400?{ok:!0,body:w,headers:m.headers,rawResponse:We(m)}:{ok:!1,error:{reason:"status-code",statusCode:m.status,body:w},rawResponse:We(m)}}catch(m){return g.abortSignal!=null&&g.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 _=Mg;var d={get:async g=>typeof g=="function"?g():g};var b=class g extends Promise{constructor(t){super(o=>{o(void 0)}),this.innerPromise=t}static fromFunction(t,...o){return new g(t(...o))}static interceptFunction(t){return(...o)=>g.fromPromise(t(...o))}static fromPromise(t){return new g(t)}static fromExecutor(t){let o=new Promise(t);return new g(o)}static fromResult(t){let o=Promise.resolve(t);return new g(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:()=>Vs,bigint:()=>_s,boolean:()=>Ds,booleanLiteral:()=>ks,date:()=>Ss,discriminant:()=>Ns,enum_:()=>Or,getObjectLikeUtils:()=>ye,getObjectUtils:()=>Ke,getSchemaUtils:()=>F,isProperty:()=>Pe,lazy:()=>xs,lazyObject:()=>Os,list:()=>Br,number:()=>Ms,object:()=>jr,objectWithoutOptionalProperties:()=>vs,optional:()=>Zo,property:()=>Us,record:()=>Is,set:()=>Ks,string:()=>qs,stringLiteral:()=>Bs,transform:()=>Yo,undiscriminatedUnion:()=>Gs,union:()=>Hs,unknown:()=>As,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(g,t){return`Expected ${t}. Received ${qg(g)}.`}function qg(g){if(Array.isArray(g))return"list";if(g===null)return"null";if(g instanceof BigInt)return"BigInt";switch(typeof g){case"string":return`"${g}"`;case"bigint":case"number":case"boolean":case"undefined":return`${g}`}return typeof g}function Y(g){return{...g,json:fs(g.json),parse:fs(g.parse)}}function fs(g){return(t,o)=>{let r=g(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(g){return g.path.length===0?g.message:`${g.path.join(" -> ")}: ${g.message}`}var Je=class g extends Error{constructor(o){super(o.map(vr).join("; "));this.errors=o;Object.setPrototypeOf(this,g.prototype)}};var $e=class g extends Error{constructor(o){super(o.map(vr).join("; "));this.errors=o;Object.setPrototypeOf(this,g.prototype)}};function F(g){return{nullable:()=>Ag(g),optional:()=>Zo(g),optionalNullable:()=>Fg(g),transform:t=>Yo(g,t),parseOrThrow:(t,o)=>{let r=g.parse(t,o);if(r.ok)return r.value;throw new $e(r.errors)},jsonOrThrow:(t,o)=>{let r=g.json(t,o);if(r.ok)return r.value;throw new Je(r.errors)}}}function Ag(g){let t={parse:(o,r)=>o==null?{ok:!0,value:null}:g.parse(o,r),json:(o,r)=>o==null?{ok:!0,value:null}:g.json(o,r),getType:()=>k.NULLABLE};return{...t,...F(t)}}function Zo(g){let t={parse:(o,r)=>o==null?{ok:!0,value:void 0}:g.parse(o,r),json:(o,r)=>r?.omitUndefined&&o===void 0?{ok:!0,value:void 0}:o==null?{ok:!0,value:null}:g.json(o,r),getType:()=>k.OPTIONAL};return{...t,...F(t)}}function Fg(g){let t={parse:(o,r)=>o===void 0?{ok:!0,value:void 0}:o===null?{ok:!0,value:null}:g.parse(o,r),json:(o,r)=>o===void 0?{ok:!0,value:void 0}:o===null?{ok:!0,value:null}:g.json(o,r),getType:()=>k.OPTIONAL_NULLABLE};return{...t,...F(t)}}function Yo(g,t){let o={parse:(r,i)=>{let m=g.parse(r,i);return m.ok?{ok:!0,value:t.transform(m.value)}:m},json:(r,i)=>{let m=t.untransform(r);return g.json(m,i)},getType:()=>g.getType()};return{...o,...F(o)}}function _s(){let g={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(g),...F(g)}}var Ig=/^([+-]?\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 Ss(){let g={parse:(t,{breadcrumbsPrefix:o=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:o,message:A(t,"string")}]}:Ig.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(g),...F(g)}}function te(g,t){return()=>{let o={parse:t,json:t,getType:()=>g};return{...Y(o),...F(o)}}}function Or(g){let t=new Set(g);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 xs(g){let t=Qo(g);return{...t,...F(t)}}function Qo(g){return{parse:(t,o)=>Ze(g).parse(t,o),json:(t,o)=>Ze(g).json(t,o),getType:()=>Ze(g).getType()}}function Ze(g){let t=g;return t.__zurg_memoized==null&&(t.__zurg_memoized=g()),t.__zurg_memoized}function zr(g){return Object.entries(g)}function Rr(g,t){let o=new Set(t);return Object.entries(g).reduce((r,[i,m])=>(o.has(i)&&(r[i]=m),r),{})}function Ue(g){if(typeof g!="object"||g===null)return!1;if(Object.getPrototypeOf(g)===null)return!0;let t=g;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(g)===t}function br(g){return Object.keys(g)}function Es(g,t){let o=[],r=[];for(let i of g)t(i)?o.push(i):r.push(i);return[o,r]}function ye(g){return{withParsedProperties:t=>et(g,t)}}function et(g,t){let o={parse:(r,i)=>{let m=g.parse(r,i);if(!m.ok)return m;let w=Object.entries(t).reduce((p,[s,l])=>({...p,[s]:typeof l=="function"?l(m.value):l}),{});return{ok:!0,value:{...m.value,...w}}},json:(r,i)=>{if(!Ue(r))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:A(r,"object")}]};let m=new Set(Object.keys(t)),w=Rr(r,Object.keys(r).filter(p=>!m.has(p)));return g.json(w,i)},getType:()=>g.getType()};return{...o,...F(o),...ye(o)}}function Us(g,t){return{rawKey:g,valueSchema:t,isProperty:!0}}function Pe(g){return g.isProperty}function jr(g){let t={_getRawProperties:()=>Object.entries(g).map(([o,r])=>Pe(r)?r.rawKey:o),_getParsedProperties:()=>br(g),parse:(o,r)=>{let i={},m=[];for(let[w,p]of zr(g)){let s=Pe(p)?p.rawKey:w,l=Pe(p)?p.valueSchema:p,u={rawKey:s,parsedKey:w,valueSchema:l};i[s]=u,Ts(l)&&m.push(s)}return Ps({value:o,requiredKeys:m,getProperty:w=>{let p=i[w];if(p!=null)return{transformedKey:p.parsedKey,transform:s=>p.valueSchema.parse(s,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],w]})}},unrecognizedObjectKeys:r?.unrecognizedObjectKeys,skipValidation:r?.skipValidation,breadcrumbsPrefix:r?.breadcrumbsPrefix,omitUndefined:r?.omitUndefined})},json:(o,r)=>{let i=[];for(let[m,w]of zr(g)){let p=Pe(w)?w.valueSchema:w;Ts(p)&&i.push(m)}return Ps({value:o,requiredKeys:i,getProperty:m=>{let w=g[m];if(w!=null)return Pe(w)?{transformedKey:w.rawKey,transform:p=>w.valueSchema.json(p,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],m]})}:{transformedKey:m,transform:p=>w.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 Ps({value:g,requiredKeys:t,getProperty:o,unrecognizedObjectKeys:r="fail",skipValidation:i=!1,breadcrumbsPrefix:m=[]}){if(!Ue(g))return{ok:!1,errors:[{path:m,message:A(g,"object")}]};let w=new Set(t),p=[],s={};for(let[l,u]of Object.entries(g)){let z=o(l);if(z!=null){w.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=>w.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(g){return{extend:t=>{let o={_getParsedProperties:()=>[...g._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...g._getRawProperties(),...t._getRawProperties()],parse:(r,i)=>Cs({extensionKeys:t._getRawProperties(),value:r,transformBase:m=>g.parse(m,i),transformExtension:m=>t.parse(m,i)}),json:(r,i)=>Cs({extensionKeys:t._getParsedProperties(),value:r,transformBase:m=>g.json(m,i),transformExtension:m=>t.json(m,i)}),getType:()=>k.OBJECT};return{...o,...F(o),...ye(o),...Ke(o)}},passthrough:()=>{let t={_getParsedProperties:()=>g._getParsedProperties(),_getRawProperties:()=>g._getRawProperties(),parse:(o,r)=>{let i=g.parse(o,{...r,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...o,...i.value}}:i},json:(o,r)=>{let i=g.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 Cs({extensionKeys:g,value:t,transformBase:o,transformExtension:r}){let i=new Set(g),[m,w]=Es(br(t),l=>i.has(l)),p=o(Rr(t,w)),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 Ts(g){return!Kg(g)}function Kg(g){switch(g.getType()){case k.ANY:case k.UNKNOWN:case k.OPTIONAL:case k.OPTIONAL_NULLABLE:return!0;default:return!1}}function vs(g){return jr(g)}function Os(g){let t={...Qo(g),_getRawProperties:()=>Ze(g)._getRawProperties(),_getParsedProperties:()=>Ze(g)._getParsedProperties()};return{...t,...F(t),...ye(t),...Ke(t)}}function Br(g){let t={parse:(o,r)=>js(o,(i,m)=>g.parse(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),json:(o,r)=>js(o,(i,m)=>g.json(i,{...r,breadcrumbsPrefix:[...r?.breadcrumbsPrefix??[],`[${m}]`]})),getType:()=>k.LIST};return{...Y(t),...F(t)}}function js(g,t){return Array.isArray(g)?g.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(g,"list"),path:[]}]}}function Bs(g){return te(k.STRING_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===g?{ok:!0,value:g}:{ok:!1,errors:[{path:r,message:A(o,`"${g}"`)}]})()}function ks(g){return te(k.BOOLEAN_LITERAL,(o,{breadcrumbsPrefix:r=[]}={})=>o===g?{ok:!0,value:g}:{ok:!1,errors:[{path:r,message:A(o,`${g.toString()}`)}]})()}var Vs=te(k.ANY,g=>({ok:!0,value:g}));var Ds=te(k.BOOLEAN,(g,{breadcrumbsPrefix:t=[]}={})=>typeof g=="boolean"?{ok:!0,value:g}:{ok:!1,errors:[{path:t,message:A(g,"boolean")}]});var Ms=te(k.NUMBER,(g,{breadcrumbsPrefix:t=[]}={})=>typeof g=="number"?{ok:!0,value:g}:{ok:!1,errors:[{path:t,message:A(g,"number")}]});var qs=te(k.STRING,(g,{breadcrumbsPrefix:t=[]}={})=>typeof g=="string"?{ok:!0,value:g}:{ok:!1,errors:[{path:t,message:A(g,"string")}]});var As=te(k.UNKNOWN,g=>({ok:!0,value:g}));function Is(g,t){let o={parse:(r,i)=>Fs({value:r,isKeyNumeric:g.getType()===k.NUMBER,transformKey:m=>g.parse(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${m} (key)`]}),transformValue:(m,w)=>t.parse(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${w}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(r,i)=>Fs({value:r,isKeyNumeric:g.getType()===k.NUMBER,transformKey:m=>g.json(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${m} (key)`]}),transformValue:(m,w)=>t.json(m,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${w}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>k.RECORD};return{...Y(o),...F(o)}}function Fs({value:g,isKeyNumeric:t,transformKey:o,transformValue:r,breadcrumbsPrefix:i=[]}){return Ue(g)?zr(g).reduce((m,[w,p])=>{if(p===void 0)return m;let s=m,l=w;if(t){let C=w.length>0?Number(w):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(g,"object")}]}}function Ks(g){let t=Br(g),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 Gs(g){let t={parse:(o,r)=>Ls((i,m)=>i.parse(o,m),g,r),json:(o,r)=>Ls((i,m)=>i.json(o,m),g,r),getType:()=>k.UNDISCRIMINATED_UNION};return{...Y(t),...F(t)}}function Ls(g,t,o){let r=[];for(let[i,m]of t.entries()){let w=g(m,{...o,skipValidation:!1});if(w.ok)return w;for(let p of w.errors)r.push({path:p.path,message:`[Variant ${i}] ${p.message}`})}return{ok:!1,errors:r}}function Ns(g,t){return{parsedDiscriminant:g,rawDiscriminant:t}}function Hs(g,t){let o=typeof g=="string"?g:g.rawDiscriminant,r=typeof g=="string"?g:g.parsedDiscriminant,i=Or(br(t)),m={parse:(w,p)=>Xs({value:w,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:(w,p)=>Xs({value:w,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 Xs({value:g,discriminant:t,transformedDiscriminant:o,transformDiscriminantValue:r,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:m=!1,transformAdditionalProperties:w,breadcrumbsPrefix:p=[]}){if(!Ue(g))return{ok:!1,errors:[{path:p,message:A(g,"object")}]};let{[t]:s,...l}=g;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=w(l,z);return y.ok?{ok:!0,value:{[o]:s,...y.value}}:y}var mi=H(require("url-join"));var ae=H(require("url-join"));var Ws=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 Js=e.object({data:e.list(me),params:Ws});var $s=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 Zs=e.object({data:$s,params:e.record(e.string(),e.unknown())});var Ys=e.object({data:me,params:e.record(e.string(),e.unknown())});var Qs=e.object({data:me,params:e.record(e.string(),e.unknown())});var q=e.object({deleted:e.boolean().optional()});var en=e.object({data:q,params:e.record(e.string(),e.unknown())});var rn=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 B=e.object({count:e.number().optional()});var on=e.object({data:B,params:rn});var tn=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 an=e.object({data:e.list(kr),params:tn});var sn=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 nn=e.object({data:sn,params:e.record(e.string(),e.unknown())});var cn=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 pn=e.object({data:B,params:cn});var ln=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 mn=e.object({data:e.list(Ye),params:ln});var un=e.enum_(["development","staging","production"]);var dn=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 hn=e.object({data:dn,params:e.record(e.string(),e.unknown())});var gn=e.object({data:Ye,params:e.record(e.string(),e.unknown())});var wn=e.enum_(["development","staging","production"]);var yn=e.object({data:Ye,params:e.record(e.string(),e.unknown())});var zn=e.object({data:q,params:e.record(e.string(),e.unknown())});var Rn=e.object({ok:e.boolean()});var bn=e.object({data:Rn,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",un),name:e.string()});var it=e.object({environmentType:e.property("environment_type",wn.optional()),name:e.string().optional()});var fn=e.object({isActive:e.property("is_active",e.boolean().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Vr=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 _n=e.object({data:e.list(Vr),params:fn});var Sn=e.object({data:Vr,params:e.record(e.string(),e.unknown())});var xn=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 En=e.object({data:xn,params:e.record(e.string(),e.unknown())});var Un=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 Pn=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 Cn=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(Pn),updatedAt:e.property("updated_at",e.date())});var Tn=e.object({data:e.list(Cn),params:Un});var vn=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 On=e.object({data:B,params:vn});var jn=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 Bn=e.object({data:e.list(le),params:jn});var kn=e.object({data:le,params:e.record(e.string(),e.unknown())});var Vn=e.object({displayName:e.property("display_name",e.string().optional()),limit:e.number().optional(),offset:e.number().optional()});var Dr=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 Dn=e.object({data:e.list(Dr),params:Vn});var Mn=e.object({data:Dr,params:e.record(e.string(),e.unknown())});var qn=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 An=e.object({data:e.list(ce),params:qn});var Fn=e.object({data:ce,params:e.record(e.string(),e.unknown())});var In=e.enum_(["volume","graduated"]);var Kn=e.enum_(["licensed","metered"]);var Ln=e.enum_(["volume","graduated"]);var Gn=e.enum_(["licensed","metered"]);var Nn=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",Ln.optional()),usageType:e.property("usage_type",Gn.optional())});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 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(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 Xn=e.object({data:e.list(Q),params:Nn});var Hn=e.enum_(["per_unit","tiered"]);var Wn=e.enum_(["volume","graduated"]);var Jn=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 $n=e.object({data:I,params:e.record(e.string(),e.unknown())});var Zn=e.object({data:q,params:e.record(e.string(),e.unknown())});var Yn=e.enum_(["licensed","metered"]);var Qn=e.enum_(["licensed","metered"]);var ec=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",Qn.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:e.list(I),params:ec});var oc=e.object({data:q,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 tc=e.object({data:Qe,params:e.record(e.string(),e.unknown())});var ic=e.enum_(["licensed","metered"]);var ac=e.enum_(["licensed","metered"]);var sc=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 Ce=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 nc=e.object({data:e.list(Ce),params:sc});var cc=e.enum_(["licensed","metered"]);var pc=e.enum_(["licensed","metered"]);var lc=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",pc.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 mc=e.object({data:B,params:lc});var uc=e.enum_(["subscribe","cancel"]);var dc=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 hc=e.object({data:dc,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 gc=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",Hn),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(gc)),productExternalId:e.property("product_external_id",e.string()),tiersMode:e.property("tiers_mode",Wn.optional()),usageType:e.property("usage_type",Jn)});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 wc=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 yc=e.enum_(["licensed","metered"]);var zc=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",yc)});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(wc),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(zc)),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",uc.optional())});var Rc=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 bc=e.object({data:e.list(ze),params:Rc});var fc=e.enum_(["plan_first_then_credit_bundles_first_in_first_out","first_in_first_out","last_in_first_out","expiration_priority"]);var _c=e.enum_(["none","rollover","expire"]);var Sc=e.object({data:ze,params:e.record(e.string(),e.unknown())});var xc=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Ec=e.enum_(["plan_first_then_credit_bundles_first_in_first_out","first_in_first_out","last_in_first_out","expiration_priority"]);var Uc=e.enum_(["none","rollover","expire"]);var Pc=e.object({data:ze,params:e.record(e.string(),e.unknown())});var Cc=e.object({data:q,params:e.record(e.string(),e.unknown())});var Tc=e.enum_(["active","inactive"]);var vc=e.enum_(["active","inactive"]);var Oc=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:vc.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 jc=e.object({data:e.list(ue),params:Oc});var Bc=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 Vc=e.enum_(["active","inactive"]);var Dc=e.object({data:ue,params:e.record(e.string(),e.unknown())});var Mc=e.object({data:ue,params:e.record(e.string(),e.unknown())});var qc=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Ac=e.enum_(["days","billing_periods"]);var Fc=e.enum_(["active","inactive"]);var Ic=e.object({data:ue,params:e.record(e.string(),e.unknown())});var Kc=e.object({data:q,params:e.record(e.string(),e.unknown())});var Lc=e.enum_(["active","inactive"]);var Gc=e.enum_(["active","inactive"]);var Nc=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:Gc.optional()});var Xc=e.object({data:B,params:Nc});var Hc=e.object({ids:e.list(e.string()).optional(),limit:e.number().optional(),name:e.string().optional(),offset:e.number().optional()});var Wc=e.object({data:B,params:Hc});var Jc=e.enum_(["plan_change","manual","plan_period_reset","expired"]);var Te=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 $c=e.object({data:Te,params:e.record(e.string(),e.unknown())});var Zc=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Yc=e.enum_(["days","billing_periods"]);var Qc=e.object({data:Te,params:e.record(e.string(),e.unknown())});var ep=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var rp=e.enum_(["asc","desc"]);var op=e.enum_(["asc","desc"]);var tp=e.enum_(["created_at","expires_at","quantity","quantity_remaining"]);var ip=e.object({companyId:e.property("company_id",e.string().optional()),dir:op.optional(),limit:e.number().optional(),offset:e.number().optional(),order:tp.optional()});var ap=e.object({data:e.list(Te),params:ip});var sp=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 np=e.object({data:B,params:sp});var cp=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 pp=e.object({data:e.list(Te),params:cp});var lp=e.enum_(["daily","weekly","monthly","raw"]);var mp=e.enum_(["daily","weekly","monthly","raw"]);var up=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:mp.optional(),startTime:e.property("start_time",e.string().optional())});var dp=e.object({id:e.string(),logoUrl:e.property("logo_url",e.string().optional()),name:e.string()});var hp=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 gp=e.object({description:e.string().optional(),icon:e.string().optional(),id:e.string(),name:e.string()});var wp=e.object({billingCreditId:e.property("billing_credit_id",e.string()),company:dp.optional(),companyId:e.property("company_id",e.string()),credit:hp.optional(),expiredGrantCount:e.property("expired_grant_count",e.number()),feature:gp.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 yp=e.object({data:e.list(wp),params:up});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({data:B,params:bp});var _p=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 Sp=e.object({data:e.list(ve),params:_p});var xp=e.enum_(["duration","no_expiry","end_of_trial","end_of_billing_period","end_of_next_billing_period"]);var Ep=e.enum_(["days","billing_periods"]);var Up=e.enum_(["monthly","yearly","daily","weekly"]);var Pp=e.enum_(["billing_period","first_of_month"]);var Cp=e.enum_(["plan_period","no_reset"]);var Tp=e.object({data:ve,params:e.record(e.string(),e.unknown())});var vp=e.object({data:q,params:e.record(e.string(),e.unknown())});var Op=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:B,params:Op});var dt=e.object({burnStrategy:e.property("burn_strategy",fc.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",_c.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",Ec.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",Uc.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",Bc.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:Vc.optional()});var wt=e.object({bundleName:e.property("bundle_name",e.string()),expiryType:e.property("expiry_type",qc.optional()),expiryUnit:e.property("expiry_unit",Ac.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:Fc.optional()});var yt=e.object({reason:Jc.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",Zc.optional()),expiryUnit:e.property("expiry_unit",Yc.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),quantity:e.number(),reason:e.string()});var Rt=e.object({creditAmount:e.property("credit_amount",e.number()),creditId:e.property("credit_id",e.string()),expiryType:e.property("expiry_type",xp.optional()),expiryUnit:e.property("expiry_unit",Ep.optional()),expiryUnitCount:e.property("expiry_unit_count",e.number().optional()),planId:e.property("plan_id",e.string()),resetCadence:e.property("reset_cadence",Up),resetStart:e.property("reset_start",Pp),resetType:e.property("reset_type",Cp.optional())});var Bp=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 kp=e.object({data:Bp,params:e.record(e.string(),e.unknown())});var qr=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 Vp=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(Vp),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 Dp=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(Dp)),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 Re=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",qr.optional()),featureType:e.property("feature_type",e.string()),flags:e.list(Re),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",Ce.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",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(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 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 bt=e.object({comparableType:e.property("comparable_type",e.string()),entityType:e.property("entity_type",e.string()),id:e.string()});var Xr=e.object({accountId:e.property("account_id",e.string()),comparisonTraitDefinition:e.property("comparison_trait_definition",bt.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",bt.optional()),traitValue:e.property("trait_value",e.string())});var Mp=e.object({conditions:e.list(Xr)});var Hr=e.object({accountId:e.property("account_id",e.string()),conditionGroups:e.property("condition_groups",e.list(Mp)),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",e.string()),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 qp=e.enum_(["boolean","numeric","trait","unlimited"]);var Ap=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(Ap),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 Fp=e.enum_(["free","plan","purchased"]);var je=e.object({creditTypeIcon:e.property("credit_type_icon",e.string().optional()),expiresAt:e.property("expires_at",e.date().optional()),grantReason:e.property("grant_reason",Fp),quantity:e.number()});var Ip=e.enum_(["free","plan","purchased"]);var Be=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:Be.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",qp),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(je).optional()),creditGrantReason:e.property("credit_grant_reason",Ip.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:Be.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 Ve=e.object({features:e.list(ke)});var Kp=e.object({bundle:ue.optional(),quantity:e.number(),total:e.number()});var De=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 Lp=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",Ve.optional()),selectedCreditBundles:e.property("selected_credit_bundles",e.list(Kp)),selectedPlan:e.property("selected_plan",ee.optional()),selectedUsageBasedEntitlements:e.property("selected_usage_based_entitlements",e.list(Le)),subscription:De.optional()});var Gp=e.object({data:Lp,params:e.record(e.string(),e.unknown())});var Np=e.object({amount:e.number(),description:e.string(),priceId:e.property("price_id",e.string()),proration:e.boolean(),quantity:e.number()});var Xp=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(Np))});var Wr=e.object({amountOff:e.property("amount_off",e.number()),dueNow:e.property("due_now",e.number()),finance:Xp.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 Hp=e.object({data:Wr,params:e.record(e.string(),e.unknown())});var Wp=e.object({company:K.optional(),success:e.boolean()});var Jp=e.object({data:Wp,params:e.record(e.string(),e.unknown())});var $p=e.object({subscriptionChangePreview:e.property("subscription_change_preview",Wr.optional())});var Zp=e.object({data:$p,params:e.record(e.string(),e.unknown())});var Yp=e.object({data:Oe,params:e.record(e.string(),e.unknown())});var ft=e.object({companyId:e.property("company_id",e.string()),selectedPlanId:e.property("selected_plan_id",e.string().optional())});var _t=e.object({trialEnd:e.property("trial_end",e.date().optional())});var Qp=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 el=e.object({data:e.list(K),params:Qp});var rl=e.object({data:K,params:e.record(e.string(),e.unknown())});var ol=e.object({data:K,params:e.record(e.string(),e.unknown())});var tl=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 al=e.object({data:B,params:il});var sl=e.enum_(["asc","desc"]);var nl=e.enum_(["asc","desc"]);var cl=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",nl.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 pl=e.object({data:B,params:cl});var ll=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 ml=e.object({data:ar,params:e.record(e.string(),e.unknown())});var ul=e.enum_(["asc","desc"]);var dl=e.enum_(["asc","desc"]);var hl=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",dl.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 gl=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(je)),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 wl=e.object({creditTypeId:e.property("credit_type_id",e.string().optional()),creditUsage:e.property("credit_usage",gl.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 yl=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(wl)),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 zl=e.object({data:e.list(yl),params:hl});var Rl=e.object({keys:e.record(e.string(),e.string()).optional()});var bl=e.object({data:K,params:Rl});var fl=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 St=e.record(e.string(),e.unknown());var _l=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",St.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",St.optional()),updatedAt:e.property("updated_at",e.date())});var Sl=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(_l))});var xl=e.object({data:e.list(Sl),params:fl});var El=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 Ul=e.object({data:e.list(sr),params:El});var Pl=e.object({data:sr,params:e.record(e.string(),e.unknown())});var Cl=e.object({data:q,params:e.record(e.string(),e.unknown())});var Tl=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 vl=e.object({data:e.list(De),params:Tl});var Ol=e.object({data:K,params:e.record(e.string(),e.unknown())});var jl=e.enum_(["company","user"]);var Bl=e.enum_(["company","user"]);var kl=e.object({entityType:e.property("entity_type",Bl.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Vl=e.object({data:e.list(Lr),params:kl});var Dl=e.enum_(["company","user"]);var Ml=e.enum_(["company","user"]);var ql=e.object({entityType:e.property("entity_type",Ml.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Al=e.object({data:B,params:ql});var Fl=e.enum_(["company","user"]);var Il=e.enum_(["boolean","currency","date","number","string","url"]);var Kl=e.enum_(["company","user"]);var Ll=e.enum_(["boolean","currency","date","number","string","url"]);var Gl=e.object({entityType:e.property("entity_type",Kl.optional()),ids:e.list(e.string()).optional(),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional(),traitType:e.property("trait_type",Ll.optional())});var Nl=e.object({data:e.list($),params:Gl});var Xl=e.enum_(["company","user"]);var Hl=e.enum_(["boolean","currency","date","number","string","url"]);var Wl=e.object({data:$,params:e.record(e.string(),e.unknown())});var Jl=e.object({data:$,params:e.record(e.string(),e.unknown())});var $l=e.enum_(["boolean","currency","date","number","string","url"]);var Zl=e.object({data:$,params:e.record(e.string(),e.unknown())});var Yl=e.enum_(["company","user"]);var Ql=e.enum_(["boolean","currency","date","number","string","url"]);var em=e.enum_(["company","user"]);var rm=e.enum_(["boolean","currency","date","number","string","url"]);var om=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",rm.optional())});var tm=e.object({data:B,params:om});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 am=e.object({definitionId:e.property("definition_id",e.string()),value:e.string()});var sm=e.object({data:e.list(am),params:im});var nm=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 cm=e.enum_(["checkout","company_upsert","fallback_plan","manage_plan","plan_billing_product_changed","plan_deleted","quickstart","subscription_change"]);var pm=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 lm=e.enum_(["fallback","initial","trait","trial_expiry"]);var mm=e.enum_(["downgrade","invalid","subscribe","unsubscribe","upgrade","upgrade_trial"]);var um=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:cm,actorType:e.property("actor_type",pm),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",lm.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",mm.optional()),traitsUpdated:e.property("traits_updated",e.list(um)),updatedAt:e.property("updated_at",e.date()),userId:e.property("user_id",e.string().optional()),userName:e.property("user_name",e.string().optional())});var dm=e.object({data:e.list(Jr),params:nm});var hm=e.object({data:Jr,params:e.record(e.string(),e.unknown())});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 be=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 wm=e.object({data:e.list(be),params:gm});var ym=e.object({data:be,params:e.record(e.string(),e.unknown())});var zm=e.object({data:be,params:e.record(e.string(),e.unknown())});var Rm=e.object({data:be,params:e.record(e.string(),e.unknown())});var bm=e.object({data:q,params:e.record(e.string(),e.unknown())});var fm=e.object({data:e.list(be),params:e.record(e.string(),e.unknown())});var _m=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 Sm=e.object({data:B,params:_m});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 xm=e.object({data:he,params:e.record(e.string(),e.unknown())});var Em=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 Um=e.object({data:e.list(he),params:Em});var Pm=e.object({data:he,params:e.record(e.string(),e.unknown())});var Cm=e.object({data:he,params:e.record(e.string(),e.unknown())});var Tm=e.object({data:q,params:e.record(e.string(),e.unknown())});var vm=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 Om=e.object({data:B,params:vm});var jm=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 Bm=e.object({data:$r,params:e.record(e.string(),e.unknown())});var km=e.object({keys:e.record(e.string(),e.string()).optional()});var Vm=e.object({data:he,params:km});var xt=e.object({companyId:e.property("company_id",e.string()),userId:e.property("user_id",e.string())});var Et=e.object({displayName:e.property("display_name",e.string().optional()),entityType:e.property("entity_type",Xl),hierarchy:e.list(e.string()),traitType:e.property("trait_type",Hl)});var Ut=e.object({displayName:e.property("display_name",e.string().optional()),traitType:e.property("trait_type",$l)});var Pt=e.object({planId:e.property("plan_id",e.string()),traitId:e.property("trait_id",e.string()),traitValue:e.property("trait_value",e.string())});var Ct=e.object({planId:e.property("plan_id",e.string()),traitValue:e.property("trait_value",e.string())});var Dm=e.object({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()),traits:e.list(Dm)});var Mm=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 qm=e.object({data:e.list(de),params:Mm});var Am=e.enum_(["all_time","current_month","current_week","current_day"]);var Fm=e.enum_(["first_of_month","billing_cycle"]);var Im=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Km=e.object({data:de,params:e.record(e.string(),e.unknown())});var Lm=e.object({data:de,params:e.record(e.string(),e.unknown())});var Gm=e.enum_(["all_time","current_month","current_week","current_day"]);var Nm=e.enum_(["first_of_month","billing_cycle"]);var Xm=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Hm=e.object({data:de,params:e.record(e.string(),e.unknown())});var Wm=e.object({data:q,params:e.record(e.string(),e.unknown())});var Jm=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 $m=e.object({data:B,params:Jm});var Zm=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var Ym=e.enum_(["boolean","numeric","trait","unlimited"]);var Qm=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(je).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 ru=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",Ym),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(je).optional()),creditGrantReason:e.property("credit_grant_reason",Qm.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:Be.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 ou=e.object({data:e.list(ru),params:Zm});var tu=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var iu=e.object({data:B,params:tu});var au=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 su=e.object({data:e.list(ke),params:au});var nu=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 cu=e.object({data:B,params:nu});var pu=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.enum_(["boolean","numeric","trait","unlimited","unknown"]);var mu=e.object({access:e.boolean(),allocation:e.number().optional(),allocationType:e.property("allocation_type",lu),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:Be.optional(),usage:e.number().optional(),user:$r.optional()});var uu=e.object({data:e.list(mu),params:pu});var du=e.object({featureId:e.property("feature_id",e.string().optional()),limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var hu=e.object({data:B,params:du});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 wu=e.object({data:e.list(ie),params:gu});var yu=e.enum_(["all_time","current_month","current_week","current_day"]);var zu=e.enum_(["first_of_month","billing_cycle"]);var Ru=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var bu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var fu=e.object({data:ie,params:e.record(e.string(),e.unknown())});var _u=e.object({data:ie,params:e.record(e.string(),e.unknown())});var Su=e.enum_(["all_time","current_month","current_week","current_day"]);var xu=e.enum_(["first_of_month","billing_cycle"]);var Eu=e.enum_(["pay_as_you_go","pay_in_advance","overage","credit_burndown","tier"]);var Uu=e.enum_(["boolean","credit","numeric","trait","unlimited"]);var Pu=e.object({data:ie,params:e.record(e.string(),e.unknown())});var Cu=e.object({data:q,params:e.record(e.string(),e.unknown())});var Tu=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 vu=e.object({data:B,params:Tu});var Ou=e.object({keys:e.record(e.string(),e.string()).optional()});var ju=e.object({data:Ve,params:Ou});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",Am.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Fm.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",Im)});var Ot=e.object({creditConsumptionRate:e.property("credit_consumption_rate",e.number().optional()),expirationDate:e.property("expiration_date",e.date().optional()),metricPeriod:e.property("metric_period",Gm.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",Nm.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",Xm)});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",yu.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",zu.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",Ru.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",bu),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 Bt=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",Su.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",xu.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",Eu.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",Uu),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 Bu=e.object({data:K,params:e.record(e.string(),e.unknown())});var ku=e.enum_(["plan","add_on"]);var Vu=e.enum_(["plan","add_on"]);var Du=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",Vu.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 Mu=e.object({data:e.list(ee),params:Du});var qu=e.enum_(["plan","add_on"]);var Au=e.object({data:ee,params:e.record(e.string(),e.unknown())});var Fu=e.object({data:ee,params:e.record(e.string(),e.unknown())});var Iu=e.object({data:ee,params:e.record(e.string(),e.unknown())});var Ku=e.object({data:q,params:e.record(e.string(),e.unknown())});var Lu=e.enum_(["one_time","recurring","free"]);var Gu=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 Nu=e.object({data:Gu,params:e.record(e.string(),e.unknown())});var Xu=e.enum_(["plan","add_on"]);var Hu=e.enum_(["plan","add_on"]);var Wu=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",Hu.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 Ju=e.object({data:B,params:Wu});var $u=e.object({planId:e.property("plan_id",e.string().optional())});var Zu=e.object({code:e.string(),description:e.string(),detail:e.string().optional(),id:e.string().optional()});var Yu=e.object({data:e.list(Zu),params:$u});var kt=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",qu)});var Dt=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",Lu),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 Qu=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:Qu});var rd=e.enum_(["entitlement","billing"]);var od=e.object({data:we,params:e.record(e.string(),e.unknown())});var td=e.object({data:we,params:e.record(e.string(),e.unknown())});var id=e.enum_(["entitlement","billing"]);var ad=e.enum_(["draft","live"]);var sd=e.object({data:we,params:e.record(e.string(),e.unknown())});var nd=e.object({data:q,params:e.record(e.string(),e.unknown())});var cd=e.object({limit:e.number().optional(),offset:e.number().optional(),q:e.string().optional()});var pd=e.object({data:B,params:cd});var ld=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 md=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 cr=e.object({audienceType:e.property("audience_type",e.string().optional()),billingProduct:e.property("billing_product",Ce.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(md)),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 Me=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 ud=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(Me)),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",Ve.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:De.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",le.optional())});var dd=e.object({data:ud,params:ld});var qt=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",rd),name:e.string()});var At=e.object({ast:e.record(e.string(),e.number()).optional(),entityType:e.property("entity_type",id.optional()),name:e.string().optional(),state:ad.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 hd=e.object({data:oo,params:e.record(e.string(),e.unknown())});var gd=e.object({data:oo,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 yd=e.object({data:wd,params:e.record(e.string(),e.unknown())});var zd=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 Rd=e.object({data:e.list(to),params:zd});var bd=e.object({data:to,params:e.record(e.string(),e.unknown())});var Ft=e.object({dealExternalId:e.property("deal_external_id",e.string()),lineItemExternalId:e.property("line_item_external_id",e.string())});var It=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 Kt=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 Lt=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 fd=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 _d=e.object({data:fd,params:e.record(e.string(),e.unknown())});var Gt=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 Sd=e.object({events:e.list(io)});var xd=e.object({data:Sd,params:e.record(e.string(),e.unknown())});var Ed=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 Ud=e.object({data:e.list(qr),params:Ed});var Nt=e.enum_(["identify","track","flag_check"]);var Pd=e.enum_(["identify","track","flag_check"]);var Cd=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(Pd).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 Td=e.object({data:e.list(ao),params:Cd});var vd=e.object({data:io,params:e.record(e.string(),e.unknown())});var Od=e.object({data:ao,params:e.record(e.string(),e.unknown())});var jd=e.object({connected:e.boolean(),environmentId:e.property("environment_id",e.string()),lastEventAt:e.property("last_event_at",e.date().optional())});var Bd=e.object({data:jd,params:e.record(e.string(),e.unknown())});var kd=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 Vd=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 Dd=e.object({keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var Md=e.object({company:Dd.optional(),keys:e.record(e.string(),e.string()),name:e.string().optional(),traits:e.record(e.string(),e.unknown()).optional()});var qd=e.undiscriminatedUnion([kd,Vd,Md]);var Ad=e.enum_(["identify","track","flag_check"]);var so=e.object({body:qd.optional(),eventType:e.property("event_type",Ad),sentAt:e.property("sent_at",e.date().optional())});var Xt=e.object({events:e.list(so)});var Fd=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 Id=e.object({data:e.list(W),params:Fd});var Kd=e.enum_(["boolean","event","trait"]);var Ld=e.enum_(["add_on","alpha","beta","deprecated","ga","in_plan","inactive","internal_testing","legacy"]);var Gd=e.object({data:W,params:e.record(e.string(),e.unknown())});var Nd=e.object({data:W,params:e.record(e.string(),e.unknown())});var Xd=e.enum_(["boolean","event","trait"]);var Hd=e.enum_(["add_on","alpha","beta","deprecated","ga","in_plan","inactive","internal_testing","legacy"]);var Wd=e.object({data:W,params:e.record(e.string(),e.unknown())});var Jd=e.object({data:q,params:e.record(e.string(),e.unknown())});var $d=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 Zd=e.object({data:B,params:$d});var Yd=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 Qd=e.object({data:e.list(Re),params:Yd});var eh=e.object({data:Re,params:e.record(e.string(),e.unknown())});var rh=e.object({data:Re,params:e.record(e.string(),e.unknown())});var oh=e.object({data:Re,params:e.record(e.string(),e.unknown())});var th=e.object({data:q,params:e.record(e.string(),e.unknown())});var ih=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 ah=e.object({flag:ih.optional(),rules:e.list(Fr)});var sh=e.object({data:ah,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 nh=e.object({data:no,params:e.record(e.string(),e.unknown())});var ch=e.object({flags:e.list(no)});var ph=e.object({data:ch,params:e.record(e.string(),e.unknown())});var lh=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 mh=e.object({data:B,params:lh});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 Ht=e.object({description:e.string(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",Kd),flag:co.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",Ld.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 Wt=e.object({description:e.string().optional(),eventSubtype:e.property("event_subtype",e.string().optional()),featureType:e.property("feature_type",Xd.optional()),flag:co.optional(),icon:e.string().optional(),lifecyclePhase:e.property("lifecycle_phase",Hd.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 uh=e.enum_(["company","metric","trait","user","plan","billing_product","crm_product","base_plan"]);var dh=e.enum_(["all_time","current_month","current_week","current_day"]);var hh=e.enum_(["first_of_month","billing_cycle"]);var gh=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",uh),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",dh.optional()),metricPeriodMonthReset:e.property("metric_period_month_reset",hh.optional()),metricValue:e.property("metric_value",e.number().optional()),operator:gh,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 wh=e.enum_(["global_override","company_override","plan_entitlement","standard","default"]);var yh=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",wh.optional()),value:e.boolean()});var Jt=e.object({rules:e.list(yh)});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",Ce.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(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",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 zh=e.object({planEntitlementId:e.property("plan_entitlement_id",e.string()),visible:e.boolean().optional()});var $t=e.object({entitlements:e.list(zh).optional(),planId:e.property("plan_id",e.string())});var lr=e.object({bundleId:e.string()});var Rh=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($t)),orderedBundleList:e.property("ordered_bundle_list",e.list(lr)),orderedPlanList:e.property("ordered_plan_list",e.list($t)),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 bh=e.object({data:Rh,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 Ee=e.object({entitlements:e.list(_h).optional(),planId:e.property("plan_id",e.string())});var uo=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",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(Ee)),planIds:e.property("plan_ids",e.list(Ee)),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:uo,params:e.record(e.string(),e.unknown())});var xh=e.object({data:uo,params:e.record(e.string(),e.unknown())});var Zt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Me).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(Ee)),orderedBundleList:e.property("ordered_bundle_list",e.list(lr)),orderedPlans:e.property("ordered_plans",e.list(Ee)),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 Yt=e.object({addOnCompatibilities:e.property("add_on_compatibilities",e.list(Me).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(Ee)),orderedBundleList:e.property("ordered_bundle_list",e.list(lr)),orderedPlans:e.property("ordered_plans",e.list(Ee)),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 Eh=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:Eh,params:e.record(e.string(),e.unknown())});var Qt=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 mr=e.object({creditId:e.property("credit_id",e.string())});var ur=e.object({featureId:e.property("feature_id",e.string())});var fe=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:fe.optional(),webhookId:e.property("webhook_id",e.string())});var Ch=e.object({data:e.list(ho),params:Ph});var Th=e.object({data:ho,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:B,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(fe),params:jh});var kh=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 Vh=e.object({data:fe,params:e.record(e.string(),e.unknown())});var Dh=e.object({data:fe,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","company.plan_change"]);var qh=e.enum_(["active","inactive"]);var Ah=e.object({data:fe,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:B,params:Ih});var ei=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(kh)),url:e.string()});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().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 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 oi=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 Dre=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 ti=e.object({company:e.record(e.string(),e.string()).optional(),user:e.record(e.string(),e.string()).optional()});var Are=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 roe=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(Me)),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",Ve.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:De.optional(),trialPaymentMethodRequired:e.property("trial_payment_method_required",e.boolean().optional()),upcomingInvoice:e.property("upcoming_invoice",le.optional())});var toe=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 moe=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 ii=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 hoe=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 zoe=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 boe=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 ai=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 si=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(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 Coe=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 voe=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 joe=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 koe=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 Doe=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 qoe=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 Xoe=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 $oe=e.object({conditionGroups:e.property("condition_groups",e.list(po)),conditions:e.list(pr),name:e.string(),priority:e.number(),value:e.boolean()});var ni=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 ci=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 pi=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 rte=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 ste=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",$h.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 cte=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:w}=t,p={};r!=null&&(p.environment_id=r),p.require_environment=i.toString(),m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Js.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Zs.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Qs.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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:w}=t,p={};r!=null&&(p.environment_id=r),p.require_environment=i.toString(),m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:on.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:w,offset:p}=t,s={};r!=null&&(s.q=r),i!=null&&(s.request_type=i),m!=null&&(s.environment_id=m),w!=null&&(s.limit=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:an.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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-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:w,offset:p}=t,s={};r!=null&&(s.q=r),i!=null&&(s.request_type=i),m!=null&&(s.environment_id=m),w!=null&&(s.limit=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:pn.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,w={};r!=null&&(Array.isArray(r)?w.ids=r.map(s=>s):w.ids=r),i!=null&&(w.limit=i.toString()),m!=null&&(w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:mn.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:hn.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 /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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:yn.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:zn.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:bn.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:w}=t,p={};r!=null&&(p.is_active=r.toString()),i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:_n.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 /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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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:w,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()),w!=null&&(l.q=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Tn.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:w,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()),w!=null&&(l.q=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:On.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:w,offset:p}=t,s={};r!=null&&(s.company_id=r),s.customer_external_id=i,s.subscription_external_id=m,w!=null&&(s.limit=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Bn.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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,w={};r!=null&&(w.display_name=r),i!=null&&(w.limit=i.toString()),m!=null&&(w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:w,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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Mn.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:w}=t,p={};r!=null&&(p.company_id=r),p.customer_external_id=i,m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:An.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Fn.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:w,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(M=>M):T.ids=m),w!=null&&(T.product_id=w),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=In.jsonOrThrow(z,{unrecognizedObjectKeys:"strip"})),y!=null&&(T.usage_type=Kn.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})),C!=null&&(T.limit=C.toString()),O!=null&&(T.offset=O.toString());let D=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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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(D.ok)return{data:Xn.parseOrThrow(D.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:D.rawResponse};if(D.error.reason==="status-code")switch(D.error.statusCode){case 400:throw new P(a.parseOrThrow(D.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),D.rawResponse);case 401:throw new S(a.parseOrThrow(D.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),D.rawResponse);case 403:throw new x(a.parseOrThrow(D.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),D.rawResponse);case 404:throw new E(a.parseOrThrow(D.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),D.rawResponse);case 500:throw new U(a.parseOrThrow(D.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),D.rawResponse);default:throw new c({statusCode:D.error.statusCode,body:D.error.body,rawResponse:D.rawResponse})}switch(D.error.reason){case"non-json":throw new c({statusCode:D.error.statusCode,body:D.error.rawBody,rawResponse:D.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /billing/price.");case"unknown":throw new c({message:D.error.errorMessage,rawResponse:D.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:$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 /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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Zn.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:w,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(D=>D):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),w!=null&&(O.price_usage_type=Yn.jsonOrThrow(w,{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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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/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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:tc.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:w,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(D=>D):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),w!=null&&(O.price_usage_type=ic.jsonOrThrow(w,{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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:nc.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:w,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(D=>D):O.ids=r),i!=null&&(O.name=i),m!=null&&(O.q=m),w!=null&&(O.price_usage_type=cc.jsonOrThrow(w,{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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:mc.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:hc.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:w}=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()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:bc.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:xc.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Pc.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Cc.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:w,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=Tc.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),w!=null&&(l.bundle_type=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:jc.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Ic.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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:w,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=Lc.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),w!=null&&(l.bundle_type=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Xc.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:w}=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()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Wc.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:$c.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Qc.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:w,offset:p}=t,s={};r!=null&&(s.company_id=r),i!=null&&(s.order=ep.jsonOrThrow(i,{unrecognizedObjectKeys:"strip"})),m!=null&&(s.dir=rp.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),w!=null&&(s.limit=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:ap.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:w}=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()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:np.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:w}=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()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:pp.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:w,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=lp.jsonOrThrow(w,{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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:yp.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:w,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(w,{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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:fp.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:w,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),w!=null&&(Array.isArray(w)?l.ids=w.map(z=>z):l.ids=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Sp.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Tp.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})}}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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:vp.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/plan-grants/{plan_grant_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:w,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),w!=null&&(Array.isArray(w)?l.ids=w.map(z=>z):l.ids=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:kp.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Gp.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Jp.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 /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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Yp.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 V=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:w,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),w!=null&&(z.without_feature_override_for=w),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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:el.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 /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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:ol.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){return b.fromPromise(this.__deleteCompany(t,o))}async __deleteCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:tl.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 /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:w,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),w!=null&&(z.without_feature_override_for=w),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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:al.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:w,subscriptionStatuses:p,subscriptionTypes:s,monetizedSubscriptions:l,q:u,withoutPlan:z,withoutSubscription:y,sortOrderColumn:C,sortOrderDirection:O,displayProperties:T,limit:D,offset:M}=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),w!=null&&(Array.isArray(w)?v.credit_type_ids=w.map(L=>L):v.credit_type_ids=w),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=sl.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?v.display_properties=T.map(L=>L):v.display_properties=T),D!=null&&(v.limit=D.toString()),M!=null&&(v.offset=M.toString());let j=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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(j.ok)return{data:pl.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new P(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new S(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new x(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new E(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new U(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new c({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}switch(j.error.reason){case"non-json":throw new c({statusCode:j.error.statusCode,body:j.error.rawBody,rawResponse:j.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/count2.");case"unknown":throw new c({message:j.error.errorMessage,rawResponse:j.rawResponse})}}createCompany(t,o){return b.fromPromise(this.__createCompany(t,o))}async __createCompany(t,o){let r=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:ll.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:ml.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:w,subscriptionStatuses:p,subscriptionTypes:s,monetizedSubscriptions:l,q:u,withoutPlan:z,withoutSubscription:y,sortOrderColumn:C,sortOrderDirection:O,displayProperties:T,limit:D,offset:M}=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),w!=null&&(Array.isArray(w)?v.credit_type_ids=w.map(L=>L):v.credit_type_ids=w),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=ul.jsonOrThrow(O,{unrecognizedObjectKeys:"strip"})),T!=null&&(Array.isArray(T)?v.display_properties=T.map(L=>L):v.display_properties=T),D!=null&&(v.limit=D.toString()),M!=null&&(v.offset=M.toString());let j=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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(j.ok)return{data:zl.parseOrThrow(j.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:j.rawResponse};if(j.error.reason==="status-code")switch(j.error.statusCode){case 400:throw new P(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 401:throw new S(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 403:throw new x(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 404:throw new E(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);case 500:throw new U(a.parseOrThrow(j.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),j.rawResponse);default:throw new c({statusCode:j.error.statusCode,body:j.error.body,rawResponse:j.rawResponse})}switch(j.error.reason){case"non-json":throw new c({statusCode:j.error.statusCode,body:j.error.rawBody,rawResponse:j.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /companies/list2.");case"unknown":throw new c({message:j.error.errorMessage,rawResponse:j.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:bl.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:w}=t,p={};p.company_id=r,p.deal_stage=i,m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.toString());let s=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:xl.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:w}=t,p={};r!=null&&(p.company_id=r),i!=null&&(p.user_id=i),m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.toString());let s=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Ul.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Cl.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:w}=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()),w!=null&&(p.offset=w.toString());let s=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:vl.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Ol.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:w,offset:p}=t,s={};r!=null&&(s.entity_type=jl.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),w!=null&&(s.limit=w.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Vl.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:w,offset:p}=t,s={};r!=null&&(s.entity_type=Dl.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?s.ids=i.map(u=>u):s.ids=i),m!=null&&(s.q=m),w!=null&&(s.limit=w.toString()),p!=null&&(s.offset=p.toString());let l=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Al.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:w,limit:p,offset:s}=t,l={};r!=null&&(l.entity_type=Fl.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.q=m),w!=null&&(l.trait_type=Il.jsonOrThrow(w,{unrecognizedObjectKeys:"strip"})),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Nl.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Zl.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:w,limit:p,offset:s}=t,l={};r!=null&&(l.entity_type=Yl.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"})),i!=null&&(Array.isArray(i)?l.ids=i.map(z=>z):l.ids=i),m!=null&&(l.q=m),w!=null&&(l.trait_type=Ql.jsonOrThrow(w,{unrecognizedObjectKeys:"strip"})),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:tm.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:w}=t,p={};p.definition_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.toString());let s=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:sm.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:w,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),w!=null&&(Array.isArray(w)?u.company_ids=w.map(y=>y):u.company_ids=w),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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:dm.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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:w,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),w!=null&&(Array.isArray(w)?l.trait_ids=w.map(z=>z):l.trait_ids=w),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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.");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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 /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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:zm.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Rm.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:fm.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:w,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),w!=null&&(Array.isArray(w)?l.trait_ids=w.map(z=>z):l.trait_ids=w),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Sm.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 /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:w,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),w!=null&&(l.q=w),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Um.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Pm.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Cm.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Tm.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:w,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),w!=null&&(l.q=w),p!=null&&(l.limit=p.toString()),s!=null&&(l.offset=s.toString());let u=await(this._options.fetcher??_)({url:(0,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Om.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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 /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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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,V.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Vm.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:w,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),w!=null&&(Array.isArray(w)?y.feature_ids=w.map(O=>O):y.feature_ids=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:qm.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 /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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 /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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Hm.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Wm.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:w,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),w!=null&&(Array.isArray(w)?y.feature_ids=w.map(O=>O):y.feature_ids=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:$m.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:w}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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:w}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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:w,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),w!=null&&(u.q=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:su.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:w,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),w!=null&&(u.q=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:cu.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:w}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:uu.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:w}=t,p={};p.feature_id=r,i!=null&&(p.q=i),m!=null&&(p.limit=m.toString()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:hu.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:w,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),w!=null&&(y.plan_id=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:wu.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:fu.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:_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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Pu.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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:w,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),w!=null&&(y.plan_id=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:vu.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:ju.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 _e=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,_e.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Bu.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:w,hasProductId:p,ids:s,planType:l,q:u,requiresPaymentMethod:z,withoutEntitlementFor:y,withoutProductId:C,withoutPaidProductId:O,limit:T,offset:D}=t,M={};r!=null&&(M.company_id=r),i!=null&&(M.for_fallback_plan=i.toString()),m!=null&&(M.for_initial_plan=m.toString()),w!=null&&(M.for_trial_expiry_plan=w.toString()),p!=null&&(M.has_product_id=p.toString()),s!=null&&(Array.isArray(s)?M.ids=s.map(j=>j):M.ids=s),l!=null&&(M.plan_type=ku.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),u!=null&&(M.q=u),z!=null&&(M.requires_payment_method=z.toString()),y!=null&&(M.without_entitlement_for=y),C!=null&&(M.without_product_id=C.toString()),O!=null&&(M.without_paid_product_id=O.toString()),T!=null&&(M.limit=T.toString()),D!=null&&(M.offset=D.toString());let v=await(this._options.fetcher??_)({url:(0,_e.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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(v.ok)return{data:Mu.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,_e.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Au.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,_e.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Fu.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,_e.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Iu.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,_e.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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,_e.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Nu.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:w,hasProductId:p,ids:s,planType:l,q:u,requiresPaymentMethod:z,withoutEntitlementFor:y,withoutProductId:C,withoutPaidProductId:O,limit:T,offset:D}=t,M={};r!=null&&(M.company_id=r),i!=null&&(M.for_fallback_plan=i.toString()),m!=null&&(M.for_initial_plan=m.toString()),w!=null&&(M.for_trial_expiry_plan=w.toString()),p!=null&&(M.has_product_id=p.toString()),s!=null&&(Array.isArray(s)?M.ids=s.map(j=>j):M.ids=s),l!=null&&(M.plan_type=Xu.jsonOrThrow(l,{unrecognizedObjectKeys:"strip"})),u!=null&&(M.q=u),z!=null&&(M.requires_payment_method=z.toString()),y!=null&&(M.without_entitlement_for=y),C!=null&&(M.without_product_id=C.toString()),O!=null&&(M.without_paid_product_id=O.toString()),T!=null&&(M.limit=T.toString()),D!=null&&(M.offset=D.toString());let v=await(this._options.fetcher??_)({url:(0,_e.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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(v.ok)return{data:Ju.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,_e.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Yu.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 qe=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,w={};r!=null&&(w.q=r),i!=null&&(w.limit=i.toString()),m!=null&&(w.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,qe.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:w,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,qe.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:od.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,qe.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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,qe.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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,qe.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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,w={};r!=null&&(w.q=r),i!=null&&(w.limit=i.toString()),m!=null&&(w.offset=m.toString());let p=await(this._options.fetcher??_)({url:(0,qe.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:w,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(p.ok)return{data:pd.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 w=await(this._options.fetcher??_)({url:(0,qe.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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(w.ok)return{data:dd.parseOrThrow(w.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:w.rawResponse};if(w.error.reason==="status-code")switch(w.error.statusCode){case 401:throw new S(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 403:throw new x(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 404:throw new E(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);case 500:throw new U(a.parseOrThrow(w.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),w.rawResponse);default:throw new c({statusCode:w.error.statusCode,body:w.error.body,rawResponse:w.rawResponse})}switch(w.error.reason){case"non-json":throw new c({statusCode:w.error.statusCode,body:w.error.rawBody,rawResponse:w.rawResponse});case"timeout":throw new R("Timeout exceeded when calling GET /components/preview-data.");case"unknown":throw new c({message:w.error.errorMessage,rawResponse:w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 /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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:gd.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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:w}=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()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Rd.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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 li=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,li.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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"}),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:_d.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,li.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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:w}=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()),w!=null&&(p.offset=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Ud.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:w,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=>Nt.jsonOrThrow(y,{unrecognizedObjectKeys:"strip"})):u.event_types=Nt.jsonOrThrow(m,{unrecognizedObjectKeys:"strip"})),w!=null&&(u.flag_id=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Td.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Od.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Bd.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:w,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),w!=null&&(z.without_plan_entitlement_for=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Id.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Gd.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 /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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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:w,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),w!=null&&(z.without_plan_entitlement_for=w),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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Zd.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:w,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),w!=null&&(s.limit=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:Qd.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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}.");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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:sh.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:nh.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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:w,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),w!=null&&(s.limit=w.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:mh.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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: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 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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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:xh.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 Zh=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,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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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"}),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 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 Se=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:w,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),w!=null&&(s.limit=w.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,"webhook-events"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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,Se.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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:w,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),w!=null&&(s.limit=w.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,"webhook-events/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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,w={};r!=null&&(w.q=r),i!=null&&(w.limit=i.toString()),m!=null&&(w.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,"webhooks"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:w,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 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,Se.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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"}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(r.ok)return{data:Vh.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,Se.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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,Se.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...r?.headers},contentType:"application/json",requestType:"json",body:ri.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 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,Se.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 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,w={};r!=null&&(w.q=r),i!=null&&(w.limit=i.toString()),m!=null&&(w.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,"webhooks/count"),method:"GET",headers:{"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@schematichq/schematic-typescript-node","X-Fern-SDK-Version":"1.2.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","X-Fern-Runtime":h.type,"X-Fern-Runtime-Version":h.version,...await this._getCustomAuthorizationHeaders(),...o?.headers},contentType:"application/json",queryParameters:w,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 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 jo=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,mi.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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,mi.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.5","User-Agent":"@schematichq/schematic-typescript-node/1.2.5","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 iw=1e3,aw=1e3,sw=3,nw=1e3,Bo=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=aw,interval:m=iw,offline:w=!1,maxRetries:p=sw,initialRetryDelay:s=nw}=o||{};this.eventsApi=t,this.interval=m,this.logger=r,this.maxSize=i,this.offline=w,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 w=this.initialRetryDelay*Math.pow(2,o-1),p=Math.random()*.1*w,s=w+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(g){return async function(o){let r={};if(g&&Object.assign(r,g),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"}),w=await Er();try{let p=await Tr(async()=>Cr(w,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 cw(g){return{ok:!0,body:{},headers:{"Content-Type":"application/json"},rawResponse:{headers:new Ae,redirected:!1,status:200,statusText:"OK",type:"basic",url:""}}}var Qh=cw;var ko=class extends jo{constructor(t){let{apiKey:o="",basePath:r,eventBufferInterval:i,flagDefaults:m={},logger:w=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!==""&&w.debug("Offline mode enabled, ignoring API key"):o===""&&!p&&(w.warn("No API key was provided, running in offline mode"),p=!0),super({apiKey:o,environment:r,fetcher:p?Qh:Yh(s)}),this.logger=w,this.eventBuffer=new Bo(this.events,{interval:i,logger:w,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 w=await m.get(r);if(w!==void 0)return this.logger.debug(`${m.constructor.name} cache hit for flag ${o}`),w}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 w=(await this.features.checkFlags(t)).data.flags,p=[];for(let s of o){let l=w.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 Vo=H(require("crypto")),ui="X-Schematic-Webhook-Signature",di="X-Schematic-Webhook-Timestamp",xe=class g extends Error{constructor(t){super(t),Object.setPrototypeOf(this,g.prototype),this.name="WebhookSignatureError"}static missingSignature(){return new g("Missing webhook signature header")}static missingTimestamp(){return new g("Missing webhook timestamp header")}static invalidSignature(){return new g("Invalid webhook signature")}};function Do(g,t,o){let r=Buffer.isBuffer(g)?g:Buffer.from(g),i=Buffer.concat([r,Buffer.from(`+${t}`)]),m=Vo.createHmac("sha256",o);return m.update(i),m.digest()}function rg(g,t,o){return Do(g,t,o).toString("hex")}function hi(g,t,o,r){if(!t)throw xe.missingSignature();if(!o)throw xe.missingTimestamp();let i;try{i=Buffer.from(t,"hex")}catch(w){throw new xe(`Invalid signature format: ${w?.message||"Unknown error"}`)}let m=Do(g,o,r);if(i.length!==m.length||!Vo.timingSafeEqual(i,m))throw xe.invalidSignature()}function og(g,t,o,r={}){let i=g.headers,m=r.signatureHeader||ui,w=r.timestampHeader||di,p=eg(i,m),s=eg(i,w),l;if(o!==void 0)l=o;else if("rawBody"in g&&g.rawBody)l=g.rawBody;else throw new xe("Request body is not available. Provide the body as a parameter or ensure req.rawBody exists.");hi(l,p,s,t)}function eg(g,t){let o=g[t]||g[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});
|