@amp-labs/react 1.17.7 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,17 +23,33 @@ This repository contains the Ampersand React library, a set of React components
23
23
 
24
24
  ## Prerequisites
25
25
  - React version 18+
26
- - Chakra 2.4.4+ (https://chakra-ui.com/getting-started)
26
+
27
+ ### Legacy (@amp-labs/react 1.x.x)
28
+ Requires
29
+ - Chakra 2.4.4 - 2.10 (https://chakra-ui.com/getting-started)
27
30
  - Chakra peer dependencies: @emotion/react, @emotion/styled, framer-motion
28
31
 
29
32
  ## Installation
30
33
 
31
- In your repo, use `npm` to install the package:
34
+ In your repo, use `npm` or `yarn` to install the package [`@amp-labs/react`](https://www.npmjs.com/package/@amp-labs/react):
32
35
 
33
36
  ```sh
34
37
  npm install @amp-labs/react
35
38
  ```
36
39
 
40
+ ```sh
41
+ yarn add @amp-labs/react
42
+ ```
43
+
44
+ ### Migrating to @amp-labs/react 2.0+ from 1.x.x
45
+ @amp-labs/react 2.0+ no longer requires chakra as a dependency. Chakra dependencies (@chakra-ui/react @emotion/react @emotion/styled framer-motion)
46
+ are no longer required.
47
+
48
+ @amp-labs/react now ships with its own stylesheet which also allows users to override colors,
49
+ fonts, and other css variables. See [Usage changes](#changes-with-2.0)
50
+
51
+
52
+ ### Legacy (@amp-labs/react 1.x.x)
37
53
  If you are using yarn, you'll have to also install the peer dependencies.
38
54
  ```
39
55
  yarn add @amp-labs/react @chakra-ui/react @emotion/react @emotion/styled framer-motion
@@ -43,6 +59,33 @@ yarn add @amp-labs/react @chakra-ui/react @emotion/react @emotion/styled framer-
43
59
 
44
60
  Please visit [our documentation](https://docs.withampersand.com/v1.0/docs/embeddable-ui-components) to learn more about how to use this library.
45
61
 
62
+ ### Changes with 2.0
63
+ In addition to importing components, the default stylesheet must also be imported. You may also override
64
+ `--amp` css variables from default [styles](https://github.com/amp-labs/react/blob/main/src/styles/variables.css) by importing your own stylesheet.
65
+
66
+ ```
67
+ import { AmpersandProvider } from '@amp-labs/react';
68
+ import '@amp-labs/react/styles'; // amp-labs style sheet
69
+ import './App.css'; // optional: your own css override
70
+
71
+ const options = {
72
+ project: 'PROJECT', // Your Ampersand project name or ID.
73
+ apiKey: 'API_KEY',// Your Ampersand API key.
74
+ };
75
+
76
+ function App() {
77
+ return (
78
+ // Wrap all your components inside AmpersandProvider.
79
+ // You can either do this at the App level,
80
+ // or further down in the component tree.
81
+ <AmpersandProvider options={options}>
82
+ // You can use any of the Ampersand components here.
83
+ ...
84
+ </AmpersandProvider>
85
+ )
86
+ }
87
+ ```
88
+
46
89
  ## License
47
90
 
48
91
  This repository is licensed under the **MIT license**.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react");require("react-dom");function Nl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const k=Nl(g),Os=g.createContext(null),Tl=Os.Provider,Je=()=>{const e=g.useContext(Os);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Se=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e))(Se||{});const Es=g.createContext(void 0);function Zt(){const e=g.useContext(Es);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Rl=(()=>{const e={};return Object.values(Se).forEach(t=>{e[t]={}}),e})();function Al({children:e}){const[t,n]=g.useState(Rl),r=g.useCallback((d,f,m=!0)=>{n(p=>{const v={...p};return v[d]=v[d]||{},v[d][f]=m,v})},[n]),i=g.useCallback((d,f)=>{var m;return!!((m=t[d])!=null&&m[f])},[t]),o=g.useCallback((d,f)=>{var m;return(m=t[d])==null?void 0:m[f]},[t]),s=g.useCallback((d,f)=>{n(m=>{var v;const p={...m};return(v=p[d])==null||delete v[f],p})},[n]),a=g.useCallback(d=>{n(f=>{const m={...f};return m[d]={},m})},[n]),c=g.useCallback((d,f)=>{n(m=>{const p={...m};return p[d]=p[d]||{},f.forEach(v=>{p[d][v]=!0}),p})},[n]),l=g.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:c,getError:o}),[t,n,r,i,s,a,c,o]);return u.jsx(Es.Provider,{value:l,children:e})}function Pl(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Dl="_box_1is6l_1",Ai={box:Dl};function vn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Ai.box} ${t}`:Ai.box,style:n,children:e})}const jl="_container_1wvzr_1",Pi={container:jl};function Xn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Pi.container} ${t}`:Pi.container,style:n,children:e})}const Fl="_errorBoxContainer_4sdb2_1",Ml="_errorBox_4sdb2_1",kl="_errorText_4sdb2_20",Qr={errorBoxContainer:Fl,errorBox:Ml,errorText:kl};function Lt({message:e}){return u.jsxs(Xn,{className:Qr.errorBoxContainer,children:[u.jsx(Pl,{}),u.jsx(vn,{className:Qr.errorBox,children:u.jsx("p",{className:Qr.errorText,children:e})})]})}const Ll="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ss{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ll}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ts}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const $l=new Ss,Lr=class Lr{constructor(t=$l){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const a of this.middleware)a.onError&&(o=await a.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new Hl(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Lr.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new Ns(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(l=>i[l]===void 0?delete i[l]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},a={...s,...await o({init:s,context:t})},c={...a,body:Vl(a.body)||a.body instanceof URLSearchParams||Kl(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Lr.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Et=Lr;function Kl(e){return typeof Blob<"u"&&e instanceof Blob}function Vl(e){return typeof FormData<"u"&&e instanceof FormData}class Ns extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Hl extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class oe extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function L(e,t){const n=e[t];return n!=null}function Ts(e,t=""){return Object.keys(e).map(n=>Rs(n,e[n],t)).filter(n=>n.length>0).join("&")}function Rs(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return Rs(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ts(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Mo(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ae{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class xn{constructor(t){this.raw=t}async value(){}}class Ul{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Bl(e){return ql(e)}function ql(e,t){return e==null?e:{fieldUsed:L(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:L(e,"keyFormat")?e.keyFormat:void 0}}function Wl(e){return Jl(e)}function Jl(e,t){return e==null?e:{name:e.name,valuePrefix:L(e,"valuePrefix")?e.valuePrefix:void 0}}function zl(e){return Xl(e)}function Xl(e,t){return e==null?e:{name:e.name}}function Gl(e){return Yl(e)}function Yl(e,t){return e==null?e:{attachmentType:e.attachmentType,query:L(e,"query")?zl(e.query):void 0,header:L(e,"header")?Wl(e.header):void 0,docsURL:L(e,"docsURL")?e.docsURL:void 0}}function Zl(e){return Ql(e)}function Ql(e,t){return e}function eu(e){return tu(e)}function tu(e,t){return e==null?e:{days:L(e,"days")?e.days:void 0,fullHistory:L(e,"fullHistory")?e.fullHistory:void 0}}function nu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function As(e){return ru(e)}function ru(e,t){return e==null?e:{defaultPeriod:eu(e.defaultPeriod)}}function ou(e){if(e!==void 0)return e===null?null:{defaultPeriod:nu(e.defaultPeriod)}}function iu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function su(e){if(e!==void 0)return e===null?null:{defaultPeriod:iu(e.defaultPeriod)}}function au(e){return cu(e)}function cu(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function Ps(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function lu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:su(e.backfill)}}function uu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Mo(e.objects,lu)}}function du(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function fu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Mo(e.objects,du)}}function pu(e){return mu(e)}function mu(e,t){return e==null?e:{apiKeyAsBasic:L(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:L(e,"apiKeyAsBasicOpts")?Bl(e.apiKeyAsBasicOpts):void 0,docsURL:L(e,"docsURL")?e.docsURL:void 0}}function hu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function dr(e){return gu(e)}function gu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:L(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function vu(e){return yu(e)}function yu(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function wu(e){return Iu(e)}function Iu(e,t){return e==null?e:{provider:e.provider,read:L(e,"read")?e.read:void 0,write:L(e,"write")?e.write:void 0,proxy:L(e,"proxy")?au(e.proxy):void 0}}function Ds(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Ps(e.proxy)}}function _u(e){return bu(e)}function bu(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:wu(e.content)}}function xu(e){return Cu(e)}function Cu(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function js(e){return Ou(e)}function Ou(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function wr(e){return Eu(e)}function Eu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:L(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:L(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function Ir(e){return Su(e)}function Su(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:wr(e.providerApp),group:js(e.group),consumer:xu(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:L(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function Nu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Ds(e.content)}}function Tu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Nu(e.config)}}function Ru(e){return Au(e)}function Au(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function Pu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Du(e){return ju(e)}function ju(e,t){return e==null?e:{mode:L(e,"mode")?e.mode:void 0,pageSize:L(e,"pageSize")?e.pageSize:void 0}}function Fu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Mu(e){let t=!0;return t=t&&"fieldName"in e,t}function ku(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Lu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function $u(e){let t=!0;return t=t&&"mapToName"in e,t}function Fs(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:L(e,"default")?e.default:void 0,prompt:L(e,"prompt")?e.prompt:void 0}}function Ku(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Di(e){return Vu(e)}function Vu(e,t){return e==null?e:{...ku(e),...Fs(e)}}function ji(e){if(e!==void 0)return e===null?null:Mu(e)?Lu(e):$u(e)?Ku(e):{}}function Ms(e){return Hu(e)}function Hu(e,t){return e}function Uu(e){return Bu(e)}function Bu(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:L(e,"requiredFields")?e.requiredFields.map(Di):void 0,optionalFields:L(e,"optionalFields")?e.optionalFields.map(Di):void 0,optionalFieldsAuto:L(e,"optionalFieldsAuto")?Ms(e.optionalFieldsAuto):void 0,backfill:L(e,"backfill")?As(e.backfill):void 0,delivery:L(e,"delivery")?Du(e.delivery):void 0}}function qu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(ji),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(ji),optionalFieldsAuto:e.optionalFieldsAuto,backfill:ou(e.backfill),delivery:Fu(e.delivery)}}function Wu(e){return Ju(e)}function Ju(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Uu):void 0}}function zu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(qu)}}function Xu(e){return Gu(e)}function Gu(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:L(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function Yu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function Zu(e){return Qu(e)}function Qu(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Xu):void 0}}function ed(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Yu)}}function td(e){return nd(e)}function nd(e,t){return e==null?e:{name:e.name,displayName:L(e,"displayName")?e.displayName:void 0,provider:e.provider,read:L(e,"read")?Wu(e.read):void 0,write:L(e,"write")?Zu(e.write):void 0,proxy:L(e,"proxy")?Ru(e.proxy):void 0}}function rd(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:zu(e.read),write:ed(e.write),proxy:Pu(e.proxy)}}function od(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:rd(e.content)}}function id(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:od(e.latestRevision)}}function sd(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ad(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function cd(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function ld(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function ud(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function dd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function fd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:ld(e.basicAuth),oauth2ClientCredentials:ud(e.oauth2ClientCredentials),oauth2Password:dd(e.oauth2Password)}}function pd(e){return md(e)}function md(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function hd(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,displayName:e.displayName}}function eo(e){return gd(e)}function gd(e,t){return e==null?e:{...hd(e),...Fs(e)}}function vd(e){return yd(e)}function yd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:L(e,"requiredFields")?e.requiredFields.map(eo):void 0,optionalFields:L(e,"optionalFields")?e.optionalFields.map(eo):void 0,optionalFieldsAuto:L(e,"optionalFieldsAuto")?Ms(e.optionalFieldsAuto):void 0,allFields:L(e,"allFields")?e.allFields.map(eo):void 0,backfill:L(e,"backfill")?As(e.backfill):void 0}}function wd(e){return Id(e)}function Id(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(vd):void 0}}function _d(e){return bd(e)}function bd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function xd(e){return Cd(e)}function Cd(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(_d):void 0}}function Od(e){return Ed(e)}function Ed(e,t){return e==null?e:{name:e.name,displayName:L(e,"displayName")?e.displayName:void 0,provider:e.provider,read:L(e,"read")?wd(e.read):void 0,write:L(e,"write")?xd(e.write):void 0,proxy:L(e,"proxy")?pd(e.proxy):void 0}}function Sd(e){return Nd(e)}function Nd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Od(e.content)}}function Td(e){if(e!==void 0)return e===null?null:{providerAppId:e.providerAppId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,refreshToken:e.refreshToken,scopes:e.scopes}}function Rd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:Ds(e.content)}}function Ad(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Td(e.connection),config:Rd(e.config)}}function Ln(e){return Pd(e)}function Pd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:L(e,"group")?js(e.group):void 0,healthStatus:e.healthStatus,connection:Ir(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0,config:_u(e.config)}}function Dd(e){return jd(e)}function jd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:td(e.content)}}function Fi(e){return Fd(e)}function Fd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Dd(e.latestRevision)}}function Md(e){return kd(e)}function kd(e,t){return e==null?e:{iconURL:L(e,"iconURL")?e.iconURL:void 0,logoURL:L(e,"logoURL")?e.logoURL:void 0}}function Ld(e){return $d(e)}function $d(e,t){return e==null?e:{iconURL:L(e,"iconURL")?e.iconURL:void 0,logoURL:L(e,"logoURL")?e.logoURL:void 0}}function Kd(e){return Vd(e)}function Vd(e,t){return e==null?e:{regular:L(e,"regular")?Ld(e.regular):void 0,darkMode:L(e,"darkMode")?Md(e.darkMode):void 0}}function Hd(e){return Ud(e)}function Ud(e,t){return e==null?e:{workspaceRefField:L(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:L(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:L(e,"scopesField")?e.scopesField:void 0}}function Bd(e){return qd(e)}function qd(e,t){return e==null?e:{grantType:e.grantType,authURL:L(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:L(e,"audience")?e.audience:void 0,tokenMetadataFields:Hd(e.tokenMetadataFields),docsURL:L(e,"docsURL")?e.docsURL:void 0,authURLParams:L(e,"authURLParams")?e.authURLParams:void 0}}function Wd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function Jd(e){return zd(e)}function zd(e,t){return e==null?e:{bulkWrite:vu(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Mi(e){return Xd(e)}function Xd(e,t){return e==null?e:{name:e.name,authType:Zl(e.authType),baseURL:e.baseURL,oauth2Opts:L(e,"oauth2Opts")?Bd(e.oauth2Opts):void 0,apiKeyOpts:L(e,"apiKeyOpts")?Gl(e.apiKeyOpts):void 0,basicOpts:L(e,"basicOpts")?pu(e.basicOpts):void 0,support:Jd(e.support),providerOpts:e.providerOpts,displayName:L(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:L(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:L(e,"media")?Kd(e.media):void 0,labels:L(e,"labels")?e.labels:void 0}}function Gd(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:uu(e.read),write:fu(e.write),proxy:Ps(e.proxy)}}function Yd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Gd(e.content)}}function Zd(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Yd(e.config)}}function Qd(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Zd(e.installation)}}function ef(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function tf(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:ef(e.project)}}function nf(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function rf(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:nf(e.providerApp)}}class of extends Et{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:fd(t.generateConnectionParams)},n);return new Ae(o,s=>Ir(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Ir(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ir))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class sf extends Et{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new oe("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Tu(t.installation)},n);return new Ae(o,s=>Ln(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Ln(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async importInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new oe("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations:import".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Ad(t.installation)},n);return new Ae(o,s=>Ln(s))}async importInstallation(t,n){return await(await this.importInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ln))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new oe("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:Qd(t.installationUpdate)},n);return new Ae(o,s=>Ln(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class af extends Et{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:hu(t.batchUpsertIntegrationsRequest)},n);return new Ae(o,s=>s.map(Fi))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new oe("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:id(t.integration)},n);return new xn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Fi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class cf extends Et{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new oe("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:Wd(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Ae(o):new Ul(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class lf extends Et{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new oe("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:sd(t.project)},n);return new Ae(o,s=>dr(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>dr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ae(i,o=>o.map(dr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new oe("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:tf(t.projectUpdate)},n);return new Ae(o,s=>dr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class uf extends Et{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new oe("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Mi(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Ae(i,o=>Mo(o,Mi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class df extends Et{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new oe("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:ad(t.providerApp)},n);return new Ae(o,s=>wr(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(wr))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new oe("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:rf(t.providerAppUpdate)},n);return new Ae(o,s=>wr(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class ff extends Et{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:cd(t.revision)},n);return new xn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new oe("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Sd(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class pf{constructor(t){this.connectionApi=new of(t),this.installationApi=new sf(t),this.integrationApi=new af(t),this.oAuthApi=new cf(t),this.projectApi=new lf(t),this.providerApi=new uf(t),this.providerAppApi=new df(t),this.revisionApi=new ff(t)}}const mf="1.17.7",hf="v1",fr="https://api.withampersand.com";function ks(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return fr;case"mock":return"http://127.0.0.1:4010";case"":return fr;default:return e??fr}}catch{return fr}}const gf=(e,t)=>`${e}/${t}`;function vf(){return gf(ks(),hf)}const yf=ks(),wf=vf(),If=new Ss({basePath:wf,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":mf}});let _f=new pf(If);const Te=()=>_f,bf="_loader_6ubm6_1",xf="_rotate_6ubm6_1",Cf="_ball1_6ubm6_1",Of="_ball2_6ubm6_1",Ef={loader:bf,rotate:xf,ball1:Cf,ball2:Of};function Sf(){return u.jsx("span",{className:Ef.loader})}function $t(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(Sf,{})})}const Ye=async(e,t)=>{var n;if(e instanceof Ns){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),g=require("react");require("react-dom");function Nl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const k=Nl(g),Os=g.createContext(null),Tl=Os.Provider,Je=()=>{const e=g.useContext(Os);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Se=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e))(Se||{});const Es=g.createContext(void 0);function Zt(){const e=g.useContext(Es);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Rl=(()=>{const e={};return Object.values(Se).forEach(t=>{e[t]={}}),e})();function Al({children:e}){const[t,n]=g.useState(Rl),r=g.useCallback((d,f,m=!0)=>{n(p=>{const v={...p};return v[d]=v[d]||{},v[d][f]=m,v})},[n]),i=g.useCallback((d,f)=>{var m;return!!((m=t[d])!=null&&m[f])},[t]),o=g.useCallback((d,f)=>{var m;return(m=t[d])==null?void 0:m[f]},[t]),s=g.useCallback((d,f)=>{n(m=>{var v;const p={...m};return(v=p[d])==null||delete v[f],p})},[n]),a=g.useCallback(d=>{n(f=>{const m={...f};return m[d]={},m})},[n]),c=g.useCallback((d,f)=>{n(m=>{const p={...m};return p[d]=p[d]||{},f.forEach(v=>{p[d][v]=!0}),p})},[n]),l=g.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:c,getError:o}),[t,n,r,i,s,a,c,o]);return u.jsx(Es.Provider,{value:l,children:e})}function Pl(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Dl="_box_1is6l_1",Ai={box:Dl};function vn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Ai.box} ${t}`:Ai.box,style:n,children:e})}const jl="_container_1wvzr_1",Pi={container:jl};function Xn({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Pi.container} ${t}`:Pi.container,style:n,children:e})}const Fl="_errorBoxContainer_4sdb2_1",Ml="_errorBox_4sdb2_1",kl="_errorText_4sdb2_20",Qr={errorBoxContainer:Fl,errorBox:Ml,errorText:kl};function Lt({message:e}){return u.jsxs(Xn,{className:Qr.errorBoxContainer,children:[u.jsx(Pl,{}),u.jsx(vn,{className:Qr.errorBox,children:u.jsx("p",{className:Qr.errorText,children:e})})]})}const Ll="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ss{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ll}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ts}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const $l=new Ss,Lr=class Lr{constructor(t=$l){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const a of this.middleware)a.onError&&(o=await a.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new Hl(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Lr.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new Ns(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(l=>i[l]===void 0?delete i[l]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},a={...s,...await o({init:s,context:t})},c={...a,body:Vl(a.body)||a.body instanceof URLSearchParams||Kl(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Lr.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Et=Lr;function Kl(e){return typeof Blob<"u"&&e instanceof Blob}function Vl(e){return typeof FormData<"u"&&e instanceof FormData}class Ns extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Hl extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class oe extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function L(e,t){const n=e[t];return n!=null}function Ts(e,t=""){return Object.keys(e).map(n=>Rs(n,e[n],t)).filter(n=>n.length>0).join("&")}function Rs(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return Rs(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ts(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Mo(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ae{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class xn{constructor(t){this.raw=t}async value(){}}class Ul{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Bl(e){return ql(e)}function ql(e,t){return e==null?e:{fieldUsed:L(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:L(e,"keyFormat")?e.keyFormat:void 0}}function Wl(e){return Jl(e)}function Jl(e,t){return e==null?e:{name:e.name,valuePrefix:L(e,"valuePrefix")?e.valuePrefix:void 0}}function zl(e){return Xl(e)}function Xl(e,t){return e==null?e:{name:e.name}}function Gl(e){return Yl(e)}function Yl(e,t){return e==null?e:{attachmentType:e.attachmentType,query:L(e,"query")?zl(e.query):void 0,header:L(e,"header")?Wl(e.header):void 0,docsURL:L(e,"docsURL")?e.docsURL:void 0}}function Zl(e){return Ql(e)}function Ql(e,t){return e}function eu(e){return tu(e)}function tu(e,t){return e==null?e:{days:L(e,"days")?e.days:void 0,fullHistory:L(e,"fullHistory")?e.fullHistory:void 0}}function nu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function As(e){return ru(e)}function ru(e,t){return e==null?e:{defaultPeriod:eu(e.defaultPeriod)}}function ou(e){if(e!==void 0)return e===null?null:{defaultPeriod:nu(e.defaultPeriod)}}function iu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function su(e){if(e!==void 0)return e===null?null:{defaultPeriod:iu(e.defaultPeriod)}}function au(e){return cu(e)}function cu(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function Ps(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function lu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:su(e.backfill)}}function uu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Mo(e.objects,lu)}}function du(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function fu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Mo(e.objects,du)}}function pu(e){return mu(e)}function mu(e,t){return e==null?e:{apiKeyAsBasic:L(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:L(e,"apiKeyAsBasicOpts")?Bl(e.apiKeyAsBasicOpts):void 0,docsURL:L(e,"docsURL")?e.docsURL:void 0}}function hu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function dr(e){return gu(e)}function gu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:L(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function vu(e){return yu(e)}function yu(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function wu(e){return Iu(e)}function Iu(e,t){return e==null?e:{provider:e.provider,read:L(e,"read")?e.read:void 0,write:L(e,"write")?e.write:void 0,proxy:L(e,"proxy")?au(e.proxy):void 0}}function Ds(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Ps(e.proxy)}}function _u(e){return bu(e)}function bu(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:wu(e.content)}}function xu(e){return Cu(e)}function Cu(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function js(e){return Ou(e)}function Ou(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function wr(e){return Eu(e)}function Eu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:L(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:L(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function Ir(e){return Su(e)}function Su(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:wr(e.providerApp),group:js(e.group),consumer:xu(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:L(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0}}function Nu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Ds(e.content)}}function Tu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Nu(e.config)}}function Ru(e){return Au(e)}function Au(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function Pu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Du(e){return ju(e)}function ju(e,t){return e==null?e:{mode:L(e,"mode")?e.mode:void 0,pageSize:L(e,"pageSize")?e.pageSize:void 0}}function Fu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Mu(e){let t=!0;return t=t&&"fieldName"in e,t}function ku(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Lu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function $u(e){let t=!0;return t=t&&"mapToName"in e,t}function Fs(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:L(e,"default")?e.default:void 0,prompt:L(e,"prompt")?e.prompt:void 0}}function Ku(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Di(e){return Vu(e)}function Vu(e,t){return e==null?e:{...ku(e),...Fs(e)}}function ji(e){if(e!==void 0)return e===null?null:Mu(e)?Lu(e):$u(e)?Ku(e):{}}function Ms(e){return Hu(e)}function Hu(e,t){return e}function Uu(e){return Bu(e)}function Bu(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:L(e,"requiredFields")?e.requiredFields.map(Di):void 0,optionalFields:L(e,"optionalFields")?e.optionalFields.map(Di):void 0,optionalFieldsAuto:L(e,"optionalFieldsAuto")?Ms(e.optionalFieldsAuto):void 0,backfill:L(e,"backfill")?As(e.backfill):void 0,delivery:L(e,"delivery")?Du(e.delivery):void 0}}function qu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(ji),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(ji),optionalFieldsAuto:e.optionalFieldsAuto,backfill:ou(e.backfill),delivery:Fu(e.delivery)}}function Wu(e){return Ju(e)}function Ju(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Uu):void 0}}function zu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(qu)}}function Xu(e){return Gu(e)}function Gu(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:L(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function Yu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function Zu(e){return Qu(e)}function Qu(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(Xu):void 0}}function ed(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Yu)}}function td(e){return nd(e)}function nd(e,t){return e==null?e:{name:e.name,displayName:L(e,"displayName")?e.displayName:void 0,provider:e.provider,read:L(e,"read")?Wu(e.read):void 0,write:L(e,"write")?Zu(e.write):void 0,proxy:L(e,"proxy")?Ru(e.proxy):void 0}}function rd(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:zu(e.read),write:ed(e.write),proxy:Pu(e.proxy)}}function od(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:rd(e.content)}}function id(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:od(e.latestRevision)}}function sd(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ad(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function cd(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function ld(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function ud(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function dd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function fd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:ld(e.basicAuth),oauth2ClientCredentials:ud(e.oauth2ClientCredentials),oauth2Password:dd(e.oauth2Password)}}function pd(e){return md(e)}function md(e,t){return e==null?e:{enabled:L(e,"enabled")?e.enabled:void 0}}function hd(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,displayName:e.displayName}}function eo(e){return gd(e)}function gd(e,t){return e==null?e:{...hd(e),...Fs(e)}}function vd(e){return yd(e)}function yd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:L(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:L(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:L(e,"requiredFields")?e.requiredFields.map(eo):void 0,optionalFields:L(e,"optionalFields")?e.optionalFields.map(eo):void 0,optionalFieldsAuto:L(e,"optionalFieldsAuto")?Ms(e.optionalFieldsAuto):void 0,allFields:L(e,"allFields")?e.allFields.map(eo):void 0,backfill:L(e,"backfill")?As(e.backfill):void 0}}function wd(e){return Id(e)}function Id(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(vd):void 0}}function _d(e){return bd(e)}function bd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function xd(e){return Cd(e)}function Cd(e,t){return e==null?e:{objects:L(e,"objects")?e.objects.map(_d):void 0}}function Od(e){return Ed(e)}function Ed(e,t){return e==null?e:{name:e.name,displayName:L(e,"displayName")?e.displayName:void 0,provider:e.provider,read:L(e,"read")?wd(e.read):void 0,write:L(e,"write")?xd(e.write):void 0,proxy:L(e,"proxy")?pd(e.proxy):void 0}}function Sd(e){return Nd(e)}function Nd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Od(e.content)}}function Td(e){if(e!==void 0)return e===null?null:{providerAppId:e.providerAppId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,refreshToken:e.refreshToken,scopes:e.scopes}}function Rd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:Ds(e.content)}}function Ad(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Td(e.connection),config:Rd(e.config)}}function Ln(e){return Pd(e)}function Pd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:L(e,"group")?js(e.group):void 0,healthStatus:e.healthStatus,connection:Ir(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0,config:_u(e.config)}}function Dd(e){return jd(e)}function jd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:td(e.content)}}function Fi(e){return Fd(e)}function Fd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:L(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Dd(e.latestRevision)}}function Md(e){return kd(e)}function kd(e,t){return e==null?e:{iconURL:L(e,"iconURL")?e.iconURL:void 0,logoURL:L(e,"logoURL")?e.logoURL:void 0}}function Ld(e){return $d(e)}function $d(e,t){return e==null?e:{iconURL:L(e,"iconURL")?e.iconURL:void 0,logoURL:L(e,"logoURL")?e.logoURL:void 0}}function Kd(e){return Vd(e)}function Vd(e,t){return e==null?e:{regular:L(e,"regular")?Ld(e.regular):void 0,darkMode:L(e,"darkMode")?Md(e.darkMode):void 0}}function Hd(e){return Ud(e)}function Ud(e,t){return e==null?e:{workspaceRefField:L(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:L(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:L(e,"scopesField")?e.scopesField:void 0}}function Bd(e){return qd(e)}function qd(e,t){return e==null?e:{grantType:e.grantType,authURL:L(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:L(e,"audience")?e.audience:void 0,tokenMetadataFields:Hd(e.tokenMetadataFields),docsURL:L(e,"docsURL")?e.docsURL:void 0,authURLParams:L(e,"authURLParams")?e.authURLParams:void 0}}function Wd(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function Jd(e){return zd(e)}function zd(e,t){return e==null?e:{bulkWrite:vu(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Mi(e){return Xd(e)}function Xd(e,t){return e==null?e:{name:e.name,authType:Zl(e.authType),baseURL:e.baseURL,oauth2Opts:L(e,"oauth2Opts")?Bd(e.oauth2Opts):void 0,apiKeyOpts:L(e,"apiKeyOpts")?Gl(e.apiKeyOpts):void 0,basicOpts:L(e,"basicOpts")?pu(e.basicOpts):void 0,support:Jd(e.support),providerOpts:e.providerOpts,displayName:L(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:L(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:L(e,"media")?Kd(e.media):void 0,labels:L(e,"labels")?e.labels:void 0}}function Gd(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:uu(e.read),write:fu(e.write),proxy:Ps(e.proxy)}}function Yd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Gd(e.content)}}function Zd(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Yd(e.config)}}function Qd(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Zd(e.installation)}}function ef(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function tf(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:ef(e.project)}}function nf(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function rf(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:nf(e.providerApp)}}class of extends Et{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:fd(t.generateConnectionParams)},n);return new Ae(o,s=>Ir(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Ir(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ir))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class sf extends Et{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new oe("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Tu(t.installation)},n);return new Ae(o,s=>Ln(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Ln(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async importInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new oe("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations:import".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Ad(t.installation)},n);return new Ae(o,s=>Ln(s))}async importInstallation(t,n){return await(await this.importInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Ln))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new oe("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:Qd(t.installationUpdate)},n);return new Ae(o,s=>Ln(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class af extends Et{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:hu(t.batchUpsertIntegrationsRequest)},n);return new Ae(o,s=>s.map(Fi))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new oe("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:id(t.integration)},n);return new xn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(Fi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class cf extends Et{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new oe("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:Wd(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Ae(o):new Ul(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class lf extends Et{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new oe("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:sd(t.project)},n);return new Ae(o,s=>dr(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>dr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ae(i,o=>o.map(dr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new oe("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:tf(t.projectUpdate)},n);return new Ae(o,s=>dr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class uf extends Et{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new oe("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Mi(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Ae(i,o=>Mo(o,Mi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class df extends Et{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new oe("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:ad(t.providerApp)},n);return new Ae(o,s=>wr(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new xn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>s.map(wr))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new oe("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:rf(t.providerAppUpdate)},n);return new Ae(o,s=>wr(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class ff extends Et{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:cd(t.revision)},n);return new xn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new oe("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new Ae(o,s=>Sd(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class pf{constructor(t){this.connectionApi=new of(t),this.installationApi=new sf(t),this.integrationApi=new af(t),this.oAuthApi=new cf(t),this.projectApi=new lf(t),this.providerApi=new uf(t),this.providerAppApi=new df(t),this.revisionApi=new ff(t)}}const mf="2.0.1",hf="v1",fr="https://api.withampersand.com";function ks(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return fr;case"mock":return"http://127.0.0.1:4010";case"":return fr;default:return e??fr}}catch{return fr}}const gf=(e,t)=>`${e}/${t}`;function vf(){return gf(ks(),hf)}const yf=ks(),wf=vf(),If=new Ss({basePath:wf,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":mf}});let _f=new pf(If);const Te=()=>_f,bf="_loader_6ubm6_1",xf="_rotate_6ubm6_1",Cf="_ball1_6ubm6_1",Of="_ball2_6ubm6_1",Ef={loader:bf,rotate:xf,ball1:Cf,ball2:Of};function Sf(){return u.jsx("span",{className:Ef.loader})}function $t(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(Sf,{})})}const Ye=async(e,t)=>{var n;if(e instanceof Ns){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
2
2
  `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},Ls=g.createContext({integrations:null}),$s=()=>{const e=g.useContext(Ls);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Nf({projectIdOrName:e,children:t}){const n=Je(),{setError:r,isError:i}=Zt(),[o,s]=g.useState(null),[a,c]=g.useState(!0);g.useEffect(()=>{Te().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{c(!1),s(d||[])}).catch(d=>{console.error("Error retrieving integration information."),Ye(d),c(!1),r(Se.INTEGRATION_LIST,e)})},[e,n,r]);const l=g.useMemo(()=>({integrations:o}),[o]);return i(Se.INTEGRATION_LIST,e)?u.jsx(Lt,{message:"Error retrieving integrations for the project, double check the API key"}):u.jsx(Ls.Provider,{value:l,children:a?u.jsx($t,{}):t})}const Ks=g.createContext({project:null,appName:"",projectId:"",projectIdOrName:""}),De=()=>{const e=g.useContext(Ks);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Tf({projectIdOrName:e,children:t}){const n=Je(),{isError:r,setError:i}=Zt(),[o,s]=g.useState(null),[a,c]=g.useState(!0);g.useEffect(()=>{Te().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{c(!1),s(d)}).catch(d=>{console.error("Error loading Ampersand project."),Ye(d),i(Se.PROJECT,e),c(!1)})},[e,n,c,i]);const l=g.useMemo(()=>({projectId:(o==null?void 0:o.id)||"",projectIdOrName:e,project:o,appName:(o==null?void 0:o.appName)||""}),[e,o]);return r(Se.PROJECT,e)?u.jsx(Lt,{message:`Error loading project ${e}`}):u.jsx(Ks.Provider,{value:l,children:a?u.jsx($t,{}):t})}function Rf(e){const{options:{apiKey:t,projectId:n,project:r},children:i}=e,o=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!o)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return u.jsx(Al,{children:u.jsx(Tl,{value:t,children:u.jsx(Tf,{projectIdOrName:o,children:u.jsx(Nf,{projectIdOrName:o,children:i})})})})}const Vs=g.createContext(null);function Af(){const e=g.useContext(Vs);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
3
3
  component is wrapped with AmpersandProvider`);return e}function Un(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Qt(e,t){return(t==null?void 0:t.displayName)??Un(e)}const Pf=e=>e.split(`
4
4
  `).filter(n=>n.trim()!==""),Df=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,jf=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}},Hs=g.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function ut(){const e=g.useContext(Hs);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Ff({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:l}){const d=Je(),{projectId:f}=De(),{integrations:m}=$s(),{setError:p,isError:v}=Zt(),{isIntegrationDeleted:w,setIntegrationDeleted:I}=jf(),[O,y]=g.useState([]),[x,b]=g.useState(!0),_=(O==null?void 0:O[0])||null,E=g.useMemo(()=>Df(t,m||[]),[t,m]);g.useEffect(()=>{E===null&&(m!=null&&m.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,E,m]);const $=g.useCallback(z=>{y([z])},[y]),T=g.useCallback(()=>{E!=null&&E.id&&Te().installationApi.listInstallations({projectIdOrName:f,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(z=>{b(!1),y(z||[])}).catch(z=>{p(Se.INSTALLATION_LIST,E.id),b(!1),console.error("Error retrieving installation information: ",z)})},[E,f,d,p,i]),J=(E==null?void 0:E.id)||"";g.useEffect(()=>{T()},[T]);const q=g.useMemo(()=>({integrationId:(E==null?void 0:E.id)||"",provider:(E==null?void 0:E.provider)||"",integrationObj:E,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:_,setInstallation:$,resetInstallations:T,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:w,setIntegrationDeleted:I,fieldMapping:l}),[E,n,r,i,o,_,$,T,s,a,c,w,I,l]);if(E!==null){const z=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return v(Se.INSTALLATION_LIST,J)?u.jsx(Lt,{message:z}):u.jsx(Hs.Provider,{value:q,children:x?u.jsx($t,{}):e})}return u.jsx(Lt,{message:`Integration "${t}" not found`})}const Us=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Pn=()=>{const e=g.useContext(Us);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Bs({provider:e,groupRef:t,children:n}){const r=Je(),{projectId:i}=De(),[o,s]=g.useState(null),[a,c]=g.useState(null),[l,d]=g.useState(!0),{setError:f,isError:m}=Zt(),{provider:p}=ut();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const v=e||p;if(!v)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{Te().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:v},{headers:{"X-Api-Key":r??""}}).then(I=>{d(!1),s(I)}).catch(I=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),Ye(I),d(!1),f(Se.CONNECTION_LIST,i)})},[i,r,t,v,f]);const w=g.useMemo(()=>({connections:o,selectedConnection:a,setConnections:s,setSelectedConnection:c}),[o,a,s,c]);return m(Se.CONNECTION_LIST,i)?u.jsx(Lt,{message:"Error retrieving existing connections"}):u.jsx(Us.Provider,{value:w,children:l?u.jsx($t,{}):n})}var pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ko(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cr={exports:{}};Cr.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",m="[object Error]",p="[object Function]",v="[object GeneratorFunction]",w="[object Map]",I="[object Number]",O="[object Null]",y="[object Object]",x="[object Promise]",b="[object Proxy]",_="[object RegExp]",E="[object Set]",$="[object String]",T="[object Symbol]",J="[object Undefined]",q="[object WeakMap]",z="[object ArrayBuffer]",Y="[object DataView]",ee="[object Float32Array]",U="[object Float64Array]",se="[object Int8Array]",ne="[object Int16Array]",Q="[object Int32Array]",de="[object Uint8Array]",pe="[object Uint8ClampedArray]",S="[object Uint16Array]",P="[object Uint32Array]",M=/[\\^$.*+?()[\]{}|]/g,j=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,R={};R[ee]=R[U]=R[se]=R[ne]=R[Q]=R[de]=R[pe]=R[S]=R[P]=!0,R[a]=R[c]=R[z]=R[d]=R[Y]=R[f]=R[m]=R[p]=R[w]=R[I]=R[y]=R[_]=R[E]=R[$]=R[q]=!1;var X=typeof pr=="object"&&pr&&pr.Object===Object&&pr,G=typeof self=="object"&&self&&self.Object===Object&&self,K=X||G||Function("return this")(),Z=t&&!t.nodeType&&t,B=Z&&!0&&e&&!e.nodeType&&e,ae=B&&B.exports===Z,A=ae&&X.process,fe=function(){try{return A&&A.binding&&A.binding("util")}catch{}}(),V=fe&&fe.isTypedArray;function we(h,C){for(var N=-1,W=h==null?0:h.length,be=0,ce=[];++N<W;){var Ne=h[N];C(Ne,N,h)&&(ce[be++]=Ne)}return ce}function Pe(h,C){for(var N=-1,W=C.length,be=h.length;++N<W;)h[be+N]=C[N];return h}function He(h,C){for(var N=-1,W=h==null?0:h.length;++N<W;)if(C(h[N],N,h))return!0;return!1}function je(h,C){for(var N=-1,W=Array(h);++N<h;)W[N]=C(N);return W}function me(h){return function(C){return h(C)}}function gt(h,C){return h.has(C)}function Ue(h,C){return h==null?void 0:h[C]}function nt(h){var C=-1,N=Array(h.size);return h.forEach(function(W,be){N[++C]=[be,W]}),N}function vt(h,C){return function(N){return h(C(N))}}function yt(h){var C=-1,N=Array(h.size);return h.forEach(function(W){N[++C]=W}),N}var Be=Array.prototype,$e=Function.prototype,Fe=Object.prototype,Ce=K["__core-js_shared__"],wt=$e.toString,ze=Fe.hasOwnProperty,Tt=function(){var h=/[^.]+$/.exec(Ce&&Ce.keys&&Ce.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:""}(),Kt=Fe.toString,rt=RegExp("^"+wt.call(ze).replace(M,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=ae?K.Buffer:void 0,Rt=K.Symbol,Vt=K.Uint8Array,At=Fe.propertyIsEnumerable,tn=Be.splice,Ze=Rt?Rt.toStringTag:void 0,Pt=Object.getOwnPropertySymbols,Ht=Oe?Oe.isBuffer:void 0,nn=vt(Object.keys,Object),Ut=wn(K,"DataView"),xe=wn(K,"Map"),Xe=wn(K,"Promise"),te=wn(K,"Set"),ue=wn(K,"WeakMap"),Me=wn(Object,"create"),Dt=sn(Ut),H=sn(xe),re=sn(Xe),ie=sn(te),Re=sn(ue),ke=Rt?Rt.prototype:void 0,Qe=ke?ke.valueOf:void 0;function Ke(h){var C=-1,N=h==null?0:h.length;for(this.clear();++C<N;){var W=h[C];this.set(W[0],W[1])}}function qe(){this.__data__=Me?Me(null):{},this.size=0}function et(h){var C=this.has(h)&&delete this.__data__[h];return this.size-=C?1:0,C}function _e(h){var C=this.__data__;if(Me){var N=C[h];return N===r?void 0:N}return ze.call(C,h)?C[h]:void 0}function rn(h){var C=this.__data__;return Me?C[h]!==void 0:ze.call(C,h)}function Gr(h,C){var N=this.__data__;return this.size+=this.has(h)?0:1,N[h]=Me&&C===void 0?r:C,this}Ke.prototype.clear=qe,Ke.prototype.delete=et,Ke.prototype.get=_e,Ke.prototype.has=rn,Ke.prototype.set=Gr;function dt(h){var C=-1,N=h==null?0:h.length;for(this.clear();++C<N;){var W=h[C];this.set(W[0],W[1])}}function nr(){this.__data__=[],this.size=0}function rr(h){var C=this.__data__,N=sr(C,h);if(N<0)return!1;var W=C.length-1;return N==W?C.pop():tn.call(C,N,1),--this.size,!0}function or(h){var C=this.__data__,N=sr(C,h);return N<0?void 0:C[N][1]}function Ie(h){return sr(this.__data__,h)>-1}function It(h,C){var N=this.__data__,W=sr(N,h);return W<0?(++this.size,N.push([h,C])):N[W][1]=C,this}dt.prototype.clear=nr,dt.prototype.delete=rr,dt.prototype.get=or,dt.prototype.has=Ie,dt.prototype.set=It;function _t(h){var C=-1,N=h==null?0:h.length;for(this.clear();++C<N;){var W=h[C];this.set(W[0],W[1])}}function on(){this.size=0,this.__data__={hash:new Ke,map:new(xe||dt),string:new Ke}}function Yr(h){var C=ar(this,h).delete(h);return this.size-=C?1:0,C}function Fn(h){return ar(this,h).get(h)}function Zc(h){return ar(this,h).has(h)}function Qc(h,C){var N=ar(this,h),W=N.size;return N.set(h,C),this.size+=N.size==W?0:1,this}_t.prototype.clear=on,_t.prototype.delete=Yr,_t.prototype.get=Fn,_t.prototype.has=Zc,_t.prototype.set=Qc;function ir(h){var C=-1,N=h==null?0:h.length;for(this.__data__=new _t;++C<N;)this.add(h[C])}function el(h){return this.__data__.set(h,r),this}function tl(h){return this.__data__.has(h)}ir.prototype.add=ir.prototype.push=el,ir.prototype.has=tl;function Bt(h){var C=this.__data__=new dt(h);this.size=C.size}function nl(){this.__data__=new dt,this.size=0}function rl(h){var C=this.__data__,N=C.delete(h);return this.size=C.size,N}function ol(h){return this.__data__.get(h)}function il(h){return this.__data__.has(h)}function sl(h,C){var N=this.__data__;if(N instanceof dt){var W=N.__data__;if(!xe||W.length<n-1)return W.push([h,C]),this.size=++N.size,this;N=this.__data__=new _t(W)}return N.set(h,C),this.size=N.size,this}Bt.prototype.clear=nl,Bt.prototype.delete=rl,Bt.prototype.get=ol,Bt.prototype.has=il,Bt.prototype.set=sl;function al(h,C){var N=cr(h),W=!N&&bl(h),be=!N&&!W&&Zr(h),ce=!N&&!W&&!be&&Ti(h),Ne=N||W||be||ce,Ve=Ne?je(h.length,String):[],We=Ve.length;for(var Ee in h)ze.call(h,Ee)&&!(Ne&&(Ee=="length"||be&&(Ee=="offset"||Ee=="parent")||ce&&(Ee=="buffer"||Ee=="byteLength"||Ee=="byteOffset")||vl(Ee,We)))&&Ve.push(Ee);return Ve}function sr(h,C){for(var N=h.length;N--;)if(Oi(h[N][0],C))return N;return-1}function cl(h,C,N){var W=C(h);return cr(h)?W:Pe(W,N(h))}function Mn(h){return h==null?h===void 0?J:O:Ze&&Ze in Object(h)?hl(h):_l(h)}function _i(h){return kn(h)&&Mn(h)==a}function bi(h,C,N,W,be){return h===C?!0:h==null||C==null||!kn(h)&&!kn(C)?h!==h&&C!==C:ll(h,C,N,W,bi,be)}function ll(h,C,N,W,be,ce){var Ne=cr(h),Ve=cr(C),We=Ne?c:qt(h),Ee=Ve?c:qt(C);We=We==a?y:We,Ee=Ee==a?y:Ee;var ot=We==y,bt=Ee==y,Ge=We==Ee;if(Ge&&Zr(h)){if(!Zr(C))return!1;Ne=!0,ot=!1}if(Ge&&!ot)return ce||(ce=new Bt),Ne||Ti(h)?xi(h,C,N,W,be,ce):pl(h,C,We,N,W,be,ce);if(!(N&i)){var ft=ot&&ze.call(h,"__wrapped__"),pt=bt&&ze.call(C,"__wrapped__");if(ft||pt){var Wt=ft?h.value():h,jt=pt?C.value():C;return ce||(ce=new Bt),be(Wt,jt,N,W,ce)}}return Ge?(ce||(ce=new Bt),ml(h,C,N,W,be,ce)):!1}function ul(h){if(!Ni(h)||wl(h))return!1;var C=Ei(h)?rt:j;return C.test(sn(h))}function dl(h){return kn(h)&&Si(h.length)&&!!R[Mn(h)]}function fl(h){if(!Il(h))return nn(h);var C=[];for(var N in Object(h))ze.call(h,N)&&N!="constructor"&&C.push(N);return C}function xi(h,C,N,W,be,ce){var Ne=N&i,Ve=h.length,We=C.length;if(Ve!=We&&!(Ne&&We>Ve))return!1;var Ee=ce.get(h);if(Ee&&ce.get(C))return Ee==C;var ot=-1,bt=!0,Ge=N&o?new ir:void 0;for(ce.set(h,C),ce.set(C,h);++ot<Ve;){var ft=h[ot],pt=C[ot];if(W)var Wt=Ne?W(pt,ft,ot,C,h,ce):W(ft,pt,ot,h,C,ce);if(Wt!==void 0){if(Wt)continue;bt=!1;break}if(Ge){if(!He(C,function(jt,an){if(!gt(Ge,an)&&(ft===jt||be(ft,jt,N,W,ce)))return Ge.push(an)})){bt=!1;break}}else if(!(ft===pt||be(ft,pt,N,W,ce))){bt=!1;break}}return ce.delete(h),ce.delete(C),bt}function pl(h,C,N,W,be,ce,Ne){switch(N){case Y:if(h.byteLength!=C.byteLength||h.byteOffset!=C.byteOffset)return!1;h=h.buffer,C=C.buffer;case z:return!(h.byteLength!=C.byteLength||!ce(new Vt(h),new Vt(C)));case d:case f:case I:return Oi(+h,+C);case m:return h.name==C.name&&h.message==C.message;case _:case $:return h==C+"";case w:var Ve=nt;case E:var We=W&i;if(Ve||(Ve=yt),h.size!=C.size&&!We)return!1;var Ee=Ne.get(h);if(Ee)return Ee==C;W|=o,Ne.set(h,C);var ot=xi(Ve(h),Ve(C),W,be,ce,Ne);return Ne.delete(h),ot;case T:if(Qe)return Qe.call(h)==Qe.call(C)}return!1}function ml(h,C,N,W,be,ce){var Ne=N&i,Ve=Ci(h),We=Ve.length,Ee=Ci(C),ot=Ee.length;if(We!=ot&&!Ne)return!1;for(var bt=We;bt--;){var Ge=Ve[bt];if(!(Ne?Ge in C:ze.call(C,Ge)))return!1}var ft=ce.get(h);if(ft&&ce.get(C))return ft==C;var pt=!0;ce.set(h,C),ce.set(C,h);for(var Wt=Ne;++bt<We;){Ge=Ve[bt];var jt=h[Ge],an=C[Ge];if(W)var Ri=Ne?W(an,jt,Ge,C,h,ce):W(jt,an,Ge,h,C,ce);if(!(Ri===void 0?jt===an||be(jt,an,N,W,ce):Ri)){pt=!1;break}Wt||(Wt=Ge=="constructor")}if(pt&&!Wt){var lr=h.constructor,ur=C.constructor;lr!=ur&&"constructor"in h&&"constructor"in C&&!(typeof lr=="function"&&lr instanceof lr&&typeof ur=="function"&&ur instanceof ur)&&(pt=!1)}return ce.delete(h),ce.delete(C),pt}function Ci(h){return cl(h,Ol,gl)}function ar(h,C){var N=h.__data__;return yl(C)?N[typeof C=="string"?"string":"hash"]:N.map}function wn(h,C){var N=Ue(h,C);return ul(N)?N:void 0}function hl(h){var C=ze.call(h,Ze),N=h[Ze];try{h[Ze]=void 0;var W=!0}catch{}var be=Kt.call(h);return W&&(C?h[Ze]=N:delete h[Ze]),be}var gl=Pt?function(h){return h==null?[]:(h=Object(h),we(Pt(h),function(C){return At.call(h,C)}))}:El,qt=Mn;(Ut&&qt(new Ut(new ArrayBuffer(1)))!=Y||xe&&qt(new xe)!=w||Xe&&qt(Xe.resolve())!=x||te&&qt(new te)!=E||ue&&qt(new ue)!=q)&&(qt=function(h){var C=Mn(h),N=C==y?h.constructor:void 0,W=N?sn(N):"";if(W)switch(W){case Dt:return Y;case H:return w;case re:return x;case ie:return E;case Re:return q}return C});function vl(h,C){return C=C??s,!!C&&(typeof h=="number"||D.test(h))&&h>-1&&h%1==0&&h<C}function yl(h){var C=typeof h;return C=="string"||C=="number"||C=="symbol"||C=="boolean"?h!=="__proto__":h===null}function wl(h){return!!Tt&&Tt in h}function Il(h){var C=h&&h.constructor,N=typeof C=="function"&&C.prototype||Fe;return h===N}function _l(h){return Kt.call(h)}function sn(h){if(h!=null){try{return wt.call(h)}catch{}try{return h+""}catch{}}return""}function Oi(h,C){return h===C||h!==h&&C!==C}var bl=_i(function(){return arguments}())?_i:function(h){return kn(h)&&ze.call(h,"callee")&&!At.call(h,"callee")},cr=Array.isArray;function xl(h){return h!=null&&Si(h.length)&&!Ei(h)}var Zr=Ht||Sl;function Cl(h,C){return bi(h,C)}function Ei(h){if(!Ni(h))return!1;var C=Mn(h);return C==p||C==v||C==l||C==b}function Si(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=s}function Ni(h){var C=typeof h;return h!=null&&(C=="object"||C=="function")}function kn(h){return h!=null&&typeof h=="object"}var Ti=V?me(V):dl;function Ol(h){return xl(h)?al(h):fl(h)}function El(){return[]}function Sl(){return!1}e.exports=Cl})(Cr,Cr.exports);var Mf=Cr.exports;const kf=ko(Mf),fn="other",Or="uninstall-installation";function Xt(e){return!e.fieldName}function Lf(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function $f(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Xt(n)&&!!n.fieldName))||null}function Kf(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Xt(r)&&!!r.mapToName))||[]}function Vf(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Xt(n)&&!!n.fieldName))||null}const qs=(e,t)=>{var n,r,i;return(i=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:i[t]};function Hf(e){return Xt(e)?e.mapToName:e.fieldName}const Ws=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Un(s==null?void 0:s.objectName),completed:e?!!qs(e,s.objectName):!1})}),n},Js=e=>{var n;return{name:fn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Uf(e,t){var o;const n=Ws(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?Js(e):void 0;return i&&n.push(i),n}function zs(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(Se.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Lo(e,t){return kf(e,t)}const Bf=(e,t,n)=>{var p,v,w,I,O,y;if(!e)return null;const r=Lf(e,t),i=r&&$f(r),o=r&&Vf(r),s=r&&Kf(r),a=(r==null?void 0:r.allFields)||[],c=n==null?void 0:n.content,l=((w=(v=(p=c==null?void 0:c.read)==null?void 0:p.objects)==null?void 0:v[t])==null?void 0:w.selectedFields)||{},d=((y=(O=(I=c==null?void 0:c.read)==null?void 0:I.objects)==null?void 0:O[t])==null?void 0:y.selectedFieldMappings)||{},f={...l},m={...d};return{allFields:a,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:l,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:f,requiredMapFields:m}}},qf=(e,t)=>{var s,a;if(!e)return null;const n=(a=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:a.objects,r=Object.keys(n||{}),i={};r.forEach(c=>{i[c]=!0});const o={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:o}}};function Xs(e,t,n){var o,s;const r=(o=e==null?void 0:e.content)==null?void 0:o.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:Bf(r,t,n),write:qf(i,n)}}const Gs=(e,t,n,r)=>{const i=Xs(e,n,t);r(n,i)},Wf=(e,t,n)=>{const r=Uf(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=Xs(e,o,t))}),n(i)},Ys=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(Hf(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},Zs=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n};function Qs(e,t){return t[e]||void 0}async function $o({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:a,onInstallSuccess:c}){const l={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Te().installationApi.createInstallation(l,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){Ye(d,s)}}function $r(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Jf=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(i=>i.objectName===t)},zf=(e,t,n,r)=>{const i=Ys(e),o=Zs(e),s=Jf(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const a={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:o,backfill:s.backfill}}}}};return $r(n)&&(a.content.proxy={enabled:!0}),a},Xf=(e,t,n,r,i,o,s,a,c,l,d,f)=>{const m=zf(c,o,a,r);return m?$o({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:l,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ea=e=>{var o,s;const t={},n=(o=e.write)==null?void 0:o.writeObjects,r=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=r?Object.keys(r):[];return n&&n.forEach(a=>{const c=a.objectName;i.includes(c)&&(t[c]={objectName:c})}),t},Gf=e=>{const t=e.content.write;return t==null?void 0:t.objects},Yf=(e,t,n)=>{if(!Gf(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=ea(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return $r(t)&&(o.content.proxy={enabled:!0}),o},Zf=(e,t,n,r,i,o,s,a,c,l,d)=>{const f=Yf(a,s,r);return f?$o({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:c,setInstallation:l,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Qf={backgroundColor:"var(--amp-colors-status-critical-muted)",borderColor:"var(--amp-colors-status-critical-muted)",color:"var(--amp-colors-status-critical-dark)",padding:".5rem 1rem"};function ta({children:e,style:t}){return u.jsx(vn,{style:{...Qf,...t},children:e})}var na={exports:{}};/*!
@@ -1872,7 +1872,7 @@ class Np {
1872
1872
  this.connectionApi = new vp(t), this.installationApi = new yp(t), this.integrationApi = new wp(t), this.oAuthApi = new Ip(t), this.projectApi = new _p(t), this.providerApi = new bp(t), this.providerAppApi = new Op(t), this.revisionApi = new Cp(t);
1873
1873
  }
1874
1874
  }
1875
- const Ep = "1.17.7", Sp = "v1", _r = "https://api.withampersand.com";
1875
+ const Ep = "2.0.1", Sp = "v1", _r = "https://api.withampersand.com";
1876
1876
  function Xs() {
1877
1877
  try {
1878
1878
  const e = process.env.REACT_APP_AMP_SERVER;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amp-labs/react",
3
- "version": "1.17.7",
3
+ "version": "2.0.1",
4
4
  "description": "Ampersand React library.",
5
5
  "author": {
6
6
  "name": "Ampersand Labs",