@redocly/framework-plugin-apigee 0.1.0-next.10 → 0.1.0-next.12

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.
@@ -1 +1 @@
1
- var i=function(s,e,t,r){function n(o){return o instanceof t?o:new t(function(a){a(o)})}return new(t||(t=Promise))(function(o,a){function d(u){try{c(r.next(u))}catch(l){a(l)}}function p(u){try{c(r.throw(u))}catch(l){a(l)}}function c(u){u.done?o(u.value):n(u.value).then(d,p)}c((r=r.apply(s,e||[])).next())})};class h extends Error{constructor(e,t,r){super(t),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ApigeeApiError"})}}const U="developer.service.DeveloperDoesNotExist",f=1e3;function b(s){var e,t,r,n,o,a,d,p,c,u,l;try{const v=JSON.parse(s),m=(o=(n=(r=(t=(e=v.error)===null||e===void 0?void 0:e.details)===null||t===void 0?void 0:t[0])===null||r===void 0?void 0:r.violations)===null||n===void 0?void 0:n[0])===null||o===void 0?void 0:o.type;return{message:(c=(p=(a=v.error)===null||a===void 0?void 0:a.message)!==null&&p!==void 0?p:v.message)!==null&&c!==void 0?c:s,code:(l=(u=v.code)!==null&&u!==void 0?u:m)!==null&&l!==void 0?l:(d=v.error)===null||d===void 0?void 0:d.status}}catch{return{message:s||"Apigee request failed"}}}function y(s){return encodeURIComponent(s)}class ${constructor(e,t,r=fetch){Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"getToken",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"fetchImpl",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"organizationUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.organizationUrl=`${e.apiUrl}/organizations/${encodeURIComponent(e.organizationName)}`}ownerUrl(e){return e.kind==="developer"?`/developers/${y(e.email)}`:`/appgroups/${encodeURIComponent(e.name)}`}request(e){return i(this,arguments,void 0,function*(t,r={}){const n=`${this.organizationUrl}${t}`,o=Object.assign(Object.assign({Accept:"application/json",Authorization:`Bearer ${yield this.getToken()}`},this.settings.auth.type==="OAUTH2"?{"X-Api-Key":this.settings.auth.clientId}:{}),r.headers);let a=r.body;r.json!==void 0&&(o["Content-Type"]="application/json",a=JSON.stringify(r.json));const d=yield this.fetchImpl(n,Object.assign(Object.assign({},r),{headers:o,body:a})),p=yield d.text();if(!d.ok){const{message:c,code:u}=b(p);throw new h(d.status,c,u)}return p?JSON.parse(p):void 0})}listApiProducts(){return i(this,void 0,void 0,function*(){var e;return(e=(yield this.request("/apiproducts?expand=true")).apiProduct)!==null&&e!==void 0?e:[]})}getDeveloper(e){return i(this,void 0,void 0,function*(){try{return yield this.request(`/developers/${y(e)}`)}catch(t){if(t instanceof h&&t.status===404)return null;throw t}})}createDeveloper(e){return i(this,void 0,void 0,function*(){return this.request("/developers",{method:"POST",json:e})})}ensureDeveloper(e){return i(this,void 0,void 0,function*(){if(!(yield this.getDeveloper(e.email)))try{yield this.createDeveloper(e)}catch(t){if(t instanceof h&&t.status===409)return;throw t}})}listApps(e){return i(this,void 0,void 0,function*(){var t,r;try{return e.kind==="appgroup"?(t=(yield this.request(`${this.ownerUrl(e)}/apps`)).appGroupApps)!==null&&t!==void 0?t:[]:(r=(yield this.request(`${this.ownerUrl(e)}/apps?expand=true`)).app)!==null&&r!==void 0?r:[]}catch(n){if(g(n))return[];throw n}})}getApp(e,t){return i(this,void 0,void 0,function*(){try{return yield this.request(`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}`)}catch(r){if(r instanceof h&&r.status===404||g(r))return null;throw r}})}createApp(e,t){return i(this,void 0,void 0,function*(){return this.request(`${this.ownerUrl(e)}/apps`,{method:"POST",json:t})})}updateApp(e,t,r){return i(this,void 0,void 0,function*(){return this.request(`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}`,{method:"PUT",json:Object.assign({name:t},r)})})}deleteApp(e,t){return i(this,void 0,void 0,function*(){yield this.request(`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}`,{method:"DELETE"})})}keyUrl(e,t,r){return`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}/keys/${encodeURIComponent(r)}`}createKey(e,t,r){return i(this,void 0,void 0,function*(){const n=e.kind==="appgroup"?"keys":"keys/create";return this.request(`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}/${n}`,{method:"POST",json:{consumerKey:r.consumerKey,consumerSecret:r.consumerSecret,expiresInSeconds:String(r.expiresInSeconds)}})})}getKey(e,t,r){return i(this,void 0,void 0,function*(){try{return yield this.request(this.keyUrl(e,t,r))}catch(n){if(n instanceof h&&n.status===404)return null;throw n}})}addKeyProducts(e,t,r,n,o){return i(this,void 0,void 0,function*(){return this.request(this.keyUrl(e,t,r),{method:"POST",json:{apiProducts:n,attributes:o}})})}removeKeyProduct(e,t,r,n){return i(this,void 0,void 0,function*(){yield this.request(`${this.keyUrl(e,t,r)}/apiproducts/${encodeURIComponent(n)}`,{method:"DELETE"})})}deleteKey(e,t,r){return i(this,void 0,void 0,function*(){yield this.request(this.keyUrl(e,t,r),{method:"DELETE"})})}setKeyProductStatus(e,t,r,n,o){return i(this,void 0,void 0,function*(){yield this.request(`${this.keyUrl(e,t,r)}/apiproducts/${encodeURIComponent(n)}?action=${o}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"}})})}listAppGroups(){return i(this,void 0,void 0,function*(){var e;const t=[];let r;do{const n=new URLSearchParams({pageSize:String(f)});r&&n.set("pageToken",r);const o=yield this.request(`/appgroups?${n}`);t.push(...(e=o.appGroups)!==null&&e!==void 0?e:[]),r=o.nextPageToken}while(r);return t})}getAppGroup(e){return i(this,void 0,void 0,function*(){try{return yield this.request(`/appgroups/${encodeURIComponent(e)}`)}catch(t){if(t instanceof h&&t.status===404)return null;throw t}})}createAppGroup(e){return i(this,void 0,void 0,function*(){return this.request("/appgroups",{method:"POST",json:e})})}updateAppGroup(e,t){return i(this,void 0,void 0,function*(){return this.request(`/appgroups/${encodeURIComponent(e)}`,{method:"PUT",json:t})})}deleteAppGroup(e){return i(this,void 0,void 0,function*(){yield this.request(`/appgroups/${encodeURIComponent(e)}`,{method:"DELETE"})})}listOrganizationApps(){return i(this,void 0,void 0,function*(){var e;const t=[];let r;do{const n=new URLSearchParams({expand:"true",includeCred:"true",pageSize:String(f)});r&&n.set("pageToken",r);const o=yield this.request(`/apps?${n}`);t.push(...(e=o.app)!==null&&e!==void 0?e:[]),r=o.nextPageToken}while(r);return t})}}function g(s){return s instanceof h&&(s.code===U||s.status===404)}export{h as ApigeeApiError,$ as ApigeeClient};
1
+ var i=function(u,e,t,r){function n(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function d(a){try{l(r.next(a))}catch(c){s(c)}}function p(a){try{l(r.throw(a))}catch(c){s(c)}}function l(a){a.done?o(a.value):n(a.value).then(d,p)}l((r=r.apply(u,e||[])).next())})};class h extends Error{constructor(e,t,r){super(t),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ApigeeApiError"})}}const b="developer.service.DeveloperDoesNotExist",f=1e3;function U(u){var e,t,r,n,o,s,d,p,l,a,c;try{const v=JSON.parse(u),g=(o=(n=(r=(t=(e=v.error)===null||e===void 0?void 0:e.details)===null||t===void 0?void 0:t[0])===null||r===void 0?void 0:r.violations)===null||n===void 0?void 0:n[0])===null||o===void 0?void 0:o.type;return{message:(l=(p=(s=v.error)===null||s===void 0?void 0:s.message)!==null&&p!==void 0?p:v.message)!==null&&l!==void 0?l:u,code:(c=(a=v.code)!==null&&a!==void 0?a:g)!==null&&c!==void 0?c:(d=v.error)===null||d===void 0?void 0:d.status}}catch{return{message:u||"Apigee request failed"}}}function y(u){return encodeURIComponent(u)}class ${constructor(e,t,r=fetch){Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"getToken",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"fetchImpl",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"organizationUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.organizationUrl=`${e.apiUrl}/organizations/${encodeURIComponent(e.organizationName)}`}ownerUrl(e){return e.kind==="developer"?`/developers/${y(e.email)}`:`/appgroups/${encodeURIComponent(e.name)}`}request(e){return i(this,arguments,void 0,function*(t,r={}){const n=`${this.organizationUrl}${t}`,o=Object.assign(Object.assign({Accept:"application/json",Authorization:`Bearer ${yield this.getToken()}`},this.settings.auth.type==="OAUTH2"?{"X-Api-Key":this.settings.auth.clientId}:{}),r.headers);let s=r.body;r.json!==void 0&&(o["Content-Type"]="application/json",s=JSON.stringify(r.json));const d=yield this.fetchImpl(n,Object.assign(Object.assign({},r),{headers:o,body:s})),p=yield d.text();if(!d.ok){const{message:l,code:a}=U(p);throw new h(d.status,l,a)}return p?JSON.parse(p):void 0})}listApiProducts(){return i(this,void 0,void 0,function*(){var e;return(e=(yield this.request("/apiproducts?expand=true")).apiProduct)!==null&&e!==void 0?e:[]})}getDeveloper(e){return i(this,void 0,void 0,function*(){try{return yield this.request(`/developers/${y(e)}`)}catch(t){if(t instanceof h&&t.status===404)return null;throw t}})}createDeveloper(e){return i(this,void 0,void 0,function*(){return this.request("/developers",{method:"POST",json:e})})}ensureDeveloper(e){return i(this,void 0,void 0,function*(){if(!(yield this.getDeveloper(e.email)))try{yield this.createDeveloper(e)}catch(t){if(t instanceof h&&t.status===409)return;throw t}})}listApps(e){return i(this,void 0,void 0,function*(){var t,r;try{return e.kind==="appgroup"?(t=(yield this.request(`${this.ownerUrl(e)}/apps`)).appGroupApps)!==null&&t!==void 0?t:[]:(r=(yield this.request(`${this.ownerUrl(e)}/apps?expand=true`)).app)!==null&&r!==void 0?r:[]}catch(n){if(m(n))return[];throw n}})}getApp(e,t){return i(this,void 0,void 0,function*(){try{return yield this.request(`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}`)}catch(r){if(r instanceof h&&r.status===404||m(r))return null;throw r}})}createApp(e,t){return i(this,void 0,void 0,function*(){return this.request(`${this.ownerUrl(e)}/apps`,{method:"POST",json:t})})}updateApp(e,t,r){return i(this,void 0,void 0,function*(){return this.request(`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}`,{method:"PUT",json:Object.assign({name:t},r)})})}deleteApp(e,t){return i(this,void 0,void 0,function*(){yield this.request(`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}`,{method:"DELETE"})})}keyUrl(e,t,r){return`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}/keys/${encodeURIComponent(r)}`}createKey(e,t,r){return i(this,void 0,void 0,function*(){const n=e.kind==="appgroup"?"keys":"keys/create";return this.request(`${this.ownerUrl(e)}/apps/${encodeURIComponent(t)}/${n}`,{method:"POST",json:{consumerKey:r.consumerKey,consumerSecret:r.consumerSecret,expiresInSeconds:String(r.expiresInSeconds)}})})}getKey(e,t,r){return i(this,void 0,void 0,function*(){try{return yield this.request(this.keyUrl(e,t,r))}catch(n){if(n instanceof h&&n.status===404)return null;throw n}})}addKeyProducts(e,t,r,n,o){return i(this,void 0,void 0,function*(){return this.request(this.keyUrl(e,t,r),{method:"POST",json:{apiProducts:n,attributes:o}})})}removeKeyProduct(e,t,r,n){return i(this,void 0,void 0,function*(){yield this.request(`${this.keyUrl(e,t,r)}/apiproducts/${encodeURIComponent(n)}`,{method:"DELETE"})})}deleteKey(e,t,r){return i(this,void 0,void 0,function*(){yield this.request(this.keyUrl(e,t,r),{method:"DELETE"})})}setKeyProductStatus(e,t,r,n,o){return i(this,void 0,void 0,function*(){yield this.request(`${this.keyUrl(e,t,r)}/apiproducts/${encodeURIComponent(n)}?action=${o}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"}})})}listAppGroups(){return i(this,void 0,void 0,function*(){var e;const t=[];let r;do{const n=new URLSearchParams({pageSize:String(f)});r&&n.set("pageToken",r);const o=yield this.request(`/appgroups?${n}`);t.push(...(e=o.appGroups)!==null&&e!==void 0?e:[]),r=o.nextPageToken}while(r);return t})}getAppGroup(e){return i(this,void 0,void 0,function*(){try{return yield this.request(`/appgroups/${encodeURIComponent(e)}`)}catch(t){if(t instanceof h&&t.status===404)return null;throw t}})}createAppGroup(e){return i(this,void 0,void 0,function*(){return this.request("/appgroups",{method:"POST",json:e})})}updateAppGroup(e,t){return i(this,void 0,void 0,function*(){return this.request(`/appgroups/${encodeURIComponent(e)}`,{method:"PUT",json:t})})}deleteAppGroup(e){return i(this,void 0,void 0,function*(){yield this.request(`/appgroups/${encodeURIComponent(e)}`,{method:"DELETE"})})}listOrganizationApps(){return i(this,void 0,void 0,function*(){var e,t;const r=[];let n;do{const o=new URLSearchParams({expand:"true",includeCred:"true",rows:String(f)});n&&o.set("startKey",n);const s=(t=(yield this.request(`/apps?${o}`)).app)!==null&&t!==void 0?t:[];r.push(...n?s.filter(d=>d.appId!==n):s),n=s.length===f?(e=s.at(-1))===null||e===void 0?void 0:e.appId:void 0}while(n);return r})}}function m(u){return u instanceof h&&(u.code===b||u.status===404)}export{h as ApigeeApiError,$ as ApigeeClient};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/framework-plugin-apigee",
3
- "version": "0.1.0-next.10",
3
+ "version": "0.1.0-next.12",
4
4
  "description": "Experimental Apigee developer onboarding plugin for Redocly",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -21,12 +21,12 @@
21
21
  "apigee"
22
22
  ],
23
23
  "dependencies": {
24
- "@redocly/config": "0.75.0",
24
+ "@redocly/config": "0.76.0",
25
25
  "@tanstack/react-query": "5.62.3",
26
26
  "styled-components": "^6.4.2"
27
27
  },
28
28
  "devDependencies": {
29
- "@redocly/framework": "1.0.0-next.17",
29
+ "@redocly/framework": "1.0.0-next.19",
30
30
  "@types/node": "24.1.0",
31
31
  "@types/react": "^19.2.7",
32
32
  "@types/react-dom": "^19.2.3",
@@ -38,8 +38,8 @@
38
38
  "vitest": "4.1.11"
39
39
  },
40
40
  "peerDependencies": {
41
- "@redocly/framework": "^1.0.0-next.17",
42
- "@redocly/theme": "0.73.0-next.12",
41
+ "@redocly/framework": "^1.0.0-next.19",
42
+ "@redocly/theme": "0.73.0-next.14",
43
43
  "react": "^19.2.7",
44
44
  "react-dom": "^19.2.7",
45
45
  "react-router": "^8.3.0"