@redocly/framework-plugin-apigee 0.0.1 → 0.1.0-next.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/CHANGELOG.md +64 -0
- package/README.md +103 -0
- package/lib/.tsbuildinfo +1 -0
- package/lib/client/ApigeeTemplate.d.ts +24 -0
- package/lib/client/ApigeeTemplate.js +1 -0
- package/lib/client/Primitives.d.ts +81 -0
- package/lib/client/Primitives.js +420 -0
- package/lib/client/api.d.ts +28 -0
- package/lib/client/api.js +1 -0
- package/lib/client/context.d.ts +12 -0
- package/lib/client/context.js +1 -0
- package/lib/client/hooks.d.ts +21 -0
- package/lib/client/hooks.js +1 -0
- package/lib/client/views/AdminView.d.ts +2 -0
- package/lib/client/views/AdminView.js +20 -0
- package/lib/client/views/AppsView.d.ts +15 -0
- package/lib/client/views/AppsView.js +5 -0
- package/lib/client/views/Dialogs.d.ts +58 -0
- package/lib/client/views/Dialogs.js +9 -0
- package/lib/client/views/TeamsView.d.ts +10 -0
- package/lib/client/views/TeamsView.js +1 -0
- package/lib/config.d.ts +31 -0
- package/lib/config.js +1 -0
- package/lib/constants.d.ts +37 -0
- package/lib/constants.js +1 -0
- package/lib/contract.d.ts +195 -0
- package/lib/contract.js +1 -0
- package/lib/plugin.d.ts +10 -0
- package/lib/plugin.js +1 -0
- package/lib/server/apigee-types.d.ts +72 -0
- package/lib/server/apigee-types.js +0 -0
- package/lib/server/client.d.ts +60 -0
- package/lib/server/client.js +1 -0
- package/lib/server/mappers.d.ts +10 -0
- package/lib/server/mappers.js +1 -0
- package/lib/server/routes.d.ts +25 -0
- package/lib/server/routes.js +1 -0
- package/lib/server/service.d.ts +98 -0
- package/lib/server/service.js +1 -0
- package/lib/server/store.d.ts +38 -0
- package/lib/server/store.js +1 -0
- package/lib/server/token.d.ts +13 -0
- package/lib/server/token.js +2 -0
- package/package.json +57 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { type AppSelection } from './views/AppsView.js';
|
|
3
|
+
type Route = {
|
|
4
|
+
view: 'apps';
|
|
5
|
+
selection: AppSelection;
|
|
6
|
+
} | {
|
|
7
|
+
view: 'teams';
|
|
8
|
+
} | {
|
|
9
|
+
view: 'team';
|
|
10
|
+
teamId: string;
|
|
11
|
+
} | {
|
|
12
|
+
view: 'admin';
|
|
13
|
+
};
|
|
14
|
+
/** The sub-route under the apps page: the path after `basePath`, without the site prefix. */
|
|
15
|
+
export declare function parseRoute(pathname: string, search: string, basePath: string): Route;
|
|
16
|
+
/** What Realm Plus passes a runtime template: the route that matched and its metadata. */
|
|
17
|
+
type TemplateProps = {
|
|
18
|
+
page: {
|
|
19
|
+
slug: string;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default function ApigeeTemplate({ page }: TemplateProps): ReactElement;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as j}from"react/jsx-runtime";import{useCallback as C,useMemo as S}from"react";import{useLocation as U}from"react-router";import{Button as V}from"@redocly/theme/components/Button/Button";import{useThemeHooks as D}from"@redocly/theme/core/hooks";import{APIGEE_DEFAULT_TITLE as R}from"../constants.js";import{apigeeApi as T}from"./api.js";import{ApigeeContext as $}from"./context.js";import{useAsync as y}from"./hooks.js";import{EmptyState as O,Loading as B,Notice as v,Page as f,Tabs as M}from"./Primitives.js";import{AdminView as W}from"./views/AdminView.js";import{AppsView as F}from"./views/AppsView.js";import{TeamDetailView as G,TeamsView as H}from"./views/TeamsView.js";function N(n,m,l){var s;const r=l==="/"?"":l,i=(n.startsWith(r)?n.slice(r.length):n).split("/").filter(Boolean).map(decodeURIComponent);if(i[0]==="teams")return i[1]?{view:"team",teamId:i[1]}:{view:"teams"};if(i[0]==="admin")return{view:"admin"};if(i[0]){const o=(s=new URLSearchParams(m).get("team"))!==null&&s!==void 0?s:void 0;return{view:"apps",selection:Object.assign({appId:i[0]},o?{teamId:o}:{})}}return{view:"apps",selection:null}}function Y({page:n}){var m,l,s;const r=U(),{userData:d,loginUrl:i}=D().useUserMenu(),o=n.slug.length>1&&n.slug.endsWith("/")?n.slug.slice(0,-1):n.slug,h=typeof((m=n.metadata)===null||m===void 0?void 0:m.title)=="string"?n.metadata.title:R,t=S(()=>N(r.pathname,r.search,o),[r.pathname,r.search,o]),p=d?.isAuthenticated===!0,a=y(()=>T.meta(),p?"meta":"meta:anonymous"),c=y(()=>p?T.listTeams():Promise.resolve([]),p?"teams":"teams:anonymous"),u=C((L="",g)=>{const _=o==="/"?"":o,b=new URLSearchParams;for(const[E,k]of Object.entries(g??{}))k!==void 0&&b.set(E,k);const A=b.toString();return`${_}${L}${A?`?${A}`:""}`||"/"},[o]);if(!p)return e(f,{children:e(O,{icon:"lock",title:"Sign in to manage your apps",text:"Your apps and their API keys are tied to your portal account.",action:i?e(V,{variant:"primary",onClick:()=>window.location.assign(i),children:"Sign in"}):void 0})});if(a.loading&&!a.data)return e(f,{children:e(B,{label:"Loading\u2026"})});if(a.error||!a.data)return e(f,{children:e(v,{tone:"danger",children:(l=a.error)!==null&&l!==void 0?l:"Apigee is not available"})});const P={meta:a.data,basePath:o,title:h,link:u},w=(s=c.data)!==null&&s!==void 0?s:[],x=[{type:"link",label:h,link:u(),icon:"key",active:t.view==="apps"},...a.data.teamsEnabled?[{type:"link",label:"Teams",link:u("/teams"),icon:"user-group",active:t.view==="teams"}]:[],...a.data.approvals.canView?[{type:"link",label:"Approvals",link:u("/admin"),icon:"shield-check",active:t.view==="admin"}]:[]],I=t.view==="team"||t.view==="apps"&&t.selection!==null;return e($.Provider,{value:P,children:j(f,{"data-component-name":"Apigee/AppsPage","data-testid":"apigee-page",children:[I?null:e(M,{items:x}),c.error?e(v,{tone:"danger",children:c.error}):null,t.view==="apps"?e(F,{selection:t.selection,teams:w,products:a.data.apiProducts}):t.view==="teams"?a.data.teamsEnabled?e(H,{teams:w,onTeamsChanged:c.reload}):e(v,{tone:"warning",children:"Teams are disabled on this portal."}):t.view==="team"?e(G,{teamId:t.teamId,onTeamsChanged:c.reload}):a.data.approvals.canView?e(W,{}):e(v,{tone:"warning",children:"Only reviewers of an API product can open this page."})]})})}export{Y as default,N as parseRoute};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { Breadcrumbs } from '@redocly/theme/components/Breadcrumbs/Breadcrumbs';
|
|
3
|
+
import type { NavigationTabItem } from '@redocly/theme/core/types';
|
|
4
|
+
import type { ApprovalStatus } from '../contract.js';
|
|
5
|
+
export declare const Page: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
6
|
+
export declare function PageHeader({ title, description, actions, }: {
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
}): ReactElement;
|
|
11
|
+
export declare const SectionTitle: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>>> & string;
|
|
12
|
+
export declare const Section: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>>> & string;
|
|
13
|
+
export declare const SectionHeader: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
14
|
+
export declare function Tabs({ items }: {
|
|
15
|
+
items: NavigationTabItem[];
|
|
16
|
+
}): ReactElement;
|
|
17
|
+
export declare const TableWrap: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
18
|
+
export declare const Table: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never>>> & string;
|
|
19
|
+
export declare const Muted: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
20
|
+
export declare const Mono: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>>> & string;
|
|
21
|
+
export declare const Row: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
22
|
+
export declare function EmptyState({ icon, title, text, action, }: {
|
|
23
|
+
icon: string;
|
|
24
|
+
title: ReactNode;
|
|
25
|
+
text?: ReactNode;
|
|
26
|
+
action?: ReactNode;
|
|
27
|
+
}): ReactElement;
|
|
28
|
+
export declare const Field: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>>> & string;
|
|
29
|
+
export declare const FieldLabel: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
30
|
+
/** The label of a field the form cannot be sent without; the input itself needs `required`. */
|
|
31
|
+
export declare function RequiredLabel({ children }: {
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
}): ReactElement;
|
|
34
|
+
export declare const Input: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>>> & string;
|
|
35
|
+
export declare const Textarea: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, never>>> & string;
|
|
36
|
+
export declare const CheckList: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
37
|
+
export declare const CheckItem: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "$checked"> & {
|
|
38
|
+
$checked?: boolean;
|
|
39
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "$checked"> & {
|
|
40
|
+
$checked?: boolean;
|
|
41
|
+
}, never>>> & string;
|
|
42
|
+
export declare const CheckItemTitle: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
43
|
+
export declare function Dialog({ title, open, onClose, children, footer, wide, testId, }: {
|
|
44
|
+
title: ReactNode;
|
|
45
|
+
open: boolean;
|
|
46
|
+
onClose: () => void;
|
|
47
|
+
children: ReactNode;
|
|
48
|
+
footer?: ReactNode;
|
|
49
|
+
wide?: boolean;
|
|
50
|
+
testId?: string;
|
|
51
|
+
}): ReactElement | null;
|
|
52
|
+
export declare function Notice({ tone, children, }: {
|
|
53
|
+
tone?: 'info' | 'success' | 'warning' | 'danger';
|
|
54
|
+
children: ReactNode;
|
|
55
|
+
}): ReactElement;
|
|
56
|
+
export declare function StatusTag({ status, label, }: {
|
|
57
|
+
status: ApprovalStatus;
|
|
58
|
+
label?: string;
|
|
59
|
+
}): ReactElement;
|
|
60
|
+
export declare const Overview: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDListElement>, HTMLDListElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDListElement>, HTMLDListElement>, never>>> & string;
|
|
61
|
+
export declare const Stats: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
62
|
+
export declare const Stat: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
63
|
+
export declare function Loading({ label }: {
|
|
64
|
+
label: string;
|
|
65
|
+
}): ReactElement;
|
|
66
|
+
export declare const ListTitle: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
67
|
+
export declare const PageBreadcrumbs: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<{
|
|
68
|
+
className?: string;
|
|
69
|
+
additionalBreadcrumbs?: import("@redocly/theme").BreadcrumbItem[];
|
|
70
|
+
}, never> & Partial<Pick<{
|
|
71
|
+
className?: string;
|
|
72
|
+
additionalBreadcrumbs?: import("@redocly/theme").BreadcrumbItem[];
|
|
73
|
+
}, never>>> & string & Omit<typeof Breadcrumbs, keyof import("react").Component<any, {}, any>>;
|
|
74
|
+
export declare const LinkList: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
75
|
+
export declare function LinkRow({ to, title, subtitle, tag, testId, }: {
|
|
76
|
+
to: string;
|
|
77
|
+
title: ReactNode;
|
|
78
|
+
subtitle?: ReactNode;
|
|
79
|
+
tag?: ReactNode;
|
|
80
|
+
testId?: string;
|
|
81
|
+
}): ReactElement;
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import{jsx as o,jsxs as t}from"react/jsx-runtime";import{useEffect as m}from"react";import r from"styled-components";import{Admonition as h}from"@redocly/theme/components/Admonition/Admonition";import{Breadcrumbs as b}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{Button as f}from"@redocly/theme/components/Button/Button";import{Link as u}from"@redocly/theme/components/Link/Link";import{SpinnerLoader as y}from"@redocly/theme/components/Loaders/SpinnerLoader";import{NavigationTab as w}from"@redocly/theme/components/NavigationTabs/NavigationTab";import{Portal as k}from"@redocly/theme/components/Portal/Portal";import{Tag as z}from"@redocly/theme/components/Tag/Tag";import{breakpoints as T}from"@redocly/theme/core/utils/media-css";import{CDNIcon as l}from"@redocly/theme/icons/CDNIcon/CDNIcon";const lr=r.div`
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 1200px;
|
|
4
|
+
margin: 0 auto;
|
|
5
|
+
padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-xxl);
|
|
6
|
+
font-size: var(--font-size-base);
|
|
7
|
+
line-height: var(--line-height-base);
|
|
8
|
+
color: var(--text-color-primary);
|
|
9
|
+
`,L=r.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
flex-wrap: wrap;
|
|
14
|
+
gap: var(--spacing-base);
|
|
15
|
+
margin-bottom: var(--spacing-lg);
|
|
16
|
+
`,S=r.h1`
|
|
17
|
+
margin: 0;
|
|
18
|
+
font-size: var(--font-size-xl);
|
|
19
|
+
line-height: var(--line-height-xl);
|
|
20
|
+
font-weight: var(--font-weight-semibold);
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: var(--spacing-sm);
|
|
24
|
+
`,j=r.p`
|
|
25
|
+
margin: var(--spacing-xxs) 0 0;
|
|
26
|
+
color: var(--text-color-description);
|
|
27
|
+
max-width: 720px;
|
|
28
|
+
`,D=r.div`
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: var(--spacing-xs);
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
`;function cr({title:e,description:a,actions:i}){return t(L,{children:[t("div",{children:[o(S,{children:e}),a?o(j,{children:a}):null]}),i?o(D,{children:i}):null]})}const E=r.h2`
|
|
34
|
+
margin: 0 0 var(--spacing-sm);
|
|
35
|
+
font-size: var(--font-size-lg);
|
|
36
|
+
line-height: var(--line-height-lg);
|
|
37
|
+
font-weight: var(--font-weight-semibold);
|
|
38
|
+
`,pr=r.section`
|
|
39
|
+
margin-top: var(--spacing-xl);
|
|
40
|
+
`,gr=r.div`
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
gap: var(--spacing-sm);
|
|
45
|
+
margin-bottom: var(--spacing-sm);
|
|
46
|
+
|
|
47
|
+
${E} {
|
|
48
|
+
margin: 0;
|
|
49
|
+
}
|
|
50
|
+
`,R=r.nav`
|
|
51
|
+
border-bottom: var(--navigation-tabs-bottom-border);
|
|
52
|
+
margin-bottom: var(--spacing-lg);
|
|
53
|
+
`,$=r.ul`
|
|
54
|
+
display: flex;
|
|
55
|
+
gap: var(--navigation-tabs-gap);
|
|
56
|
+
height: var(--navigation-tabs-height);
|
|
57
|
+
margin: 0 0 calc(-1 * var(--navigation-tabs-border-width));
|
|
58
|
+
padding: 0;
|
|
59
|
+
overflow-x: auto;
|
|
60
|
+
scrollbar-width: none;
|
|
61
|
+
`;function vr({items:e}){return o(R,{"aria-label":"Sections",children:o($,{children:e.map(a=>o(w,{tab:a},a.link))})})}const xr=r.div`
|
|
62
|
+
border: 1px solid var(--border-color-secondary);
|
|
63
|
+
border-radius: var(--border-radius-xl);
|
|
64
|
+
overflow-x: auto;
|
|
65
|
+
`,mr=r.table`
|
|
66
|
+
width: 100%;
|
|
67
|
+
border-collapse: collapse;
|
|
68
|
+
font-size: var(--font-size-base);
|
|
69
|
+
|
|
70
|
+
th,
|
|
71
|
+
td {
|
|
72
|
+
text-align: left;
|
|
73
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
74
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
75
|
+
vertical-align: top;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
th {
|
|
79
|
+
font-weight: var(--font-weight-medium);
|
|
80
|
+
color: var(--text-color-secondary);
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
tbody tr:last-child td {
|
|
85
|
+
border-bottom: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
tbody tr:hover td {
|
|
89
|
+
background: var(--layer-color-hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
td.actions,
|
|
93
|
+
th.actions {
|
|
94
|
+
position: sticky;
|
|
95
|
+
right: 0;
|
|
96
|
+
text-align: right;
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
width: 1%;
|
|
99
|
+
background: var(--bg-color);
|
|
100
|
+
box-shadow: inset 1px 0 0 var(--border-color-secondary);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
tbody tr:hover td.actions {
|
|
104
|
+
background: linear-gradient(var(--layer-color-hover), var(--layer-color-hover)), var(--bg-color);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
td.key {
|
|
108
|
+
min-width: 260px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@media (max-width: ${T.small}) {
|
|
112
|
+
thead {
|
|
113
|
+
display: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
tbody,
|
|
117
|
+
tr,
|
|
118
|
+
td {
|
|
119
|
+
display: block;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
tr {
|
|
123
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
124
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
tbody tr:last-child {
|
|
128
|
+
border-bottom: none;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
td,
|
|
132
|
+
td.actions,
|
|
133
|
+
td.key {
|
|
134
|
+
position: static;
|
|
135
|
+
width: auto;
|
|
136
|
+
min-width: 0;
|
|
137
|
+
padding: var(--spacing-xxs) 0;
|
|
138
|
+
border-bottom: none;
|
|
139
|
+
text-align: left;
|
|
140
|
+
white-space: normal;
|
|
141
|
+
background: none;
|
|
142
|
+
box-shadow: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
td[data-label]::before {
|
|
146
|
+
content: attr(data-label);
|
|
147
|
+
display: block;
|
|
148
|
+
font-size: var(--font-size-sm);
|
|
149
|
+
line-height: var(--line-height-sm);
|
|
150
|
+
color: var(--text-color-description);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
tbody tr:hover td,
|
|
154
|
+
tbody tr:hover td.actions {
|
|
155
|
+
background: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
td.actions:not(:empty) {
|
|
159
|
+
padding-top: var(--spacing-xs);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
tr {
|
|
163
|
+
position: relative;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
td.actions.menu {
|
|
167
|
+
position: absolute;
|
|
168
|
+
top: var(--spacing-xs);
|
|
169
|
+
right: var(--spacing-xs);
|
|
170
|
+
padding: 0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`,c=r.span`
|
|
174
|
+
color: var(--text-color-description);
|
|
175
|
+
font-size: var(--font-size-sm);
|
|
176
|
+
line-height: var(--line-height-sm);
|
|
177
|
+
`,hr=r.code`
|
|
178
|
+
font-family: var(--font-family-monospaced);
|
|
179
|
+
font-size: var(--font-size-sm);
|
|
180
|
+
white-space: nowrap;
|
|
181
|
+
`,br=r.div`
|
|
182
|
+
display: flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
gap: var(--spacing-xs);
|
|
185
|
+
flex-wrap: wrap;
|
|
186
|
+
`,P=r.div`
|
|
187
|
+
display: flex;
|
|
188
|
+
flex-direction: column;
|
|
189
|
+
align-items: center;
|
|
190
|
+
gap: var(--spacing-sm);
|
|
191
|
+
padding: var(--spacing-xxl) var(--spacing-lg);
|
|
192
|
+
border: 1px dashed var(--border-color-primary);
|
|
193
|
+
border-radius: var(--border-radius-xl);
|
|
194
|
+
text-align: center;
|
|
195
|
+
`,W=r.div`
|
|
196
|
+
width: 48px;
|
|
197
|
+
height: 48px;
|
|
198
|
+
display: grid;
|
|
199
|
+
place-items: center;
|
|
200
|
+
border: 1px solid var(--border-color-secondary);
|
|
201
|
+
border-radius: var(--border-radius-lg);
|
|
202
|
+
background: var(--layer-color);
|
|
203
|
+
`,A=r.div`
|
|
204
|
+
font-weight: var(--font-weight-semibold);
|
|
205
|
+
`;function fr({icon:e,title:a,text:i,action:n}){return t(P,{"data-testid":"apigee-empty",children:[o(W,{children:o(l,{name:e,size:"24px"})}),o(A,{children:a}),i?o(c,{style:{maxWidth:420},children:i}):null,n]})}const ur=r.label`
|
|
206
|
+
display: flex;
|
|
207
|
+
flex-direction: column;
|
|
208
|
+
gap: var(--spacing-xxs);
|
|
209
|
+
font-size: var(--font-size-base);
|
|
210
|
+
`,B=r.span`
|
|
211
|
+
font-weight: var(--font-weight-medium);
|
|
212
|
+
color: var(--text-color-secondary);
|
|
213
|
+
font-size: var(--font-size-sm);
|
|
214
|
+
`,I=r.span`
|
|
215
|
+
margin-left: var(--spacing-xxs);
|
|
216
|
+
color: var(--schema-required-color);
|
|
217
|
+
`;function yr({children:e}){return t(B,{children:[e,o(I,{"aria-hidden":"true",children:"*"})]})}const p=`
|
|
218
|
+
width: 100%;
|
|
219
|
+
box-sizing: border-box;
|
|
220
|
+
padding: 5px var(--spacing-sm);
|
|
221
|
+
border: var(--input-border);
|
|
222
|
+
border-radius: var(--input-border-radius);
|
|
223
|
+
background: var(--bg-color);
|
|
224
|
+
color: var(--text-color-primary);
|
|
225
|
+
font: inherit;
|
|
226
|
+
font-size: var(--font-size-base);
|
|
227
|
+
line-height: var(--line-height-base);
|
|
228
|
+
|
|
229
|
+
&:hover {
|
|
230
|
+
border: var(--input-border-hover);
|
|
231
|
+
}
|
|
232
|
+
&:focus {
|
|
233
|
+
outline: none;
|
|
234
|
+
border: var(--input-border-focus);
|
|
235
|
+
box-shadow: 0 0 0 2px var(--border-color-secondary);
|
|
236
|
+
}
|
|
237
|
+
&::placeholder {
|
|
238
|
+
color: var(--text-color-disabled);
|
|
239
|
+
}
|
|
240
|
+
`,wr=r.input`
|
|
241
|
+
${p}
|
|
242
|
+
`,kr=r.textarea`
|
|
243
|
+
${p}
|
|
244
|
+
min-height: 72px;
|
|
245
|
+
resize: vertical;
|
|
246
|
+
`,zr=r.div`
|
|
247
|
+
display: flex;
|
|
248
|
+
flex-direction: column;
|
|
249
|
+
gap: var(--spacing-xs);
|
|
250
|
+
`,Tr=r.label`
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: flex-start;
|
|
253
|
+
gap: var(--spacing-sm);
|
|
254
|
+
padding: var(--spacing-xs) var(--spacing-sm);
|
|
255
|
+
border: 1px solid ${({$checked:e})=>e?"var(--input-border-color-hover)":"var(--border-color-secondary)"};
|
|
256
|
+
border-radius: var(--border-radius-lg);
|
|
257
|
+
background: ${({$checked:e})=>e?"var(--layer-color)":"transparent"};
|
|
258
|
+
cursor: pointer;
|
|
259
|
+
|
|
260
|
+
input {
|
|
261
|
+
margin-top: 4px;
|
|
262
|
+
accent-color: var(--text-color-primary);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
&:hover {
|
|
266
|
+
border-color: var(--input-border-color-hover);
|
|
267
|
+
background: var(--layer-color);
|
|
268
|
+
}
|
|
269
|
+
`,Lr=r.span`
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
gap: var(--spacing-xs);
|
|
273
|
+
font-weight: var(--font-weight-medium);
|
|
274
|
+
`,C=r.div`
|
|
275
|
+
position: fixed;
|
|
276
|
+
inset: 0;
|
|
277
|
+
background: var(--bg-color-modal-overlay);
|
|
278
|
+
z-index: var(--z-index-overlay);
|
|
279
|
+
display: flex;
|
|
280
|
+
align-items: center;
|
|
281
|
+
justify-content: center;
|
|
282
|
+
padding: var(--spacing-base);
|
|
283
|
+
`,H=r.div`
|
|
284
|
+
width: 100%;
|
|
285
|
+
max-width: ${({$wide:e})=>e?"640px":"480px"};
|
|
286
|
+
max-height: calc(100vh - 64px);
|
|
287
|
+
display: flex;
|
|
288
|
+
flex-direction: column;
|
|
289
|
+
background: var(--bg-color-raised);
|
|
290
|
+
border: 1px solid var(--border-color-secondary);
|
|
291
|
+
border-radius: var(--border-radius-xl);
|
|
292
|
+
box-shadow: var(--modal-box-shadow);
|
|
293
|
+
overflow: hidden;
|
|
294
|
+
font-family: var(--font-family-base);
|
|
295
|
+
`,M=r.div`
|
|
296
|
+
display: flex;
|
|
297
|
+
align-items: center;
|
|
298
|
+
justify-content: space-between;
|
|
299
|
+
gap: var(--spacing-sm);
|
|
300
|
+
padding: var(--spacing-md) var(--spacing-lg) var(--spacing-sm);
|
|
301
|
+
`,N=r.h2`
|
|
302
|
+
margin: 0;
|
|
303
|
+
font-size: var(--font-size-lg);
|
|
304
|
+
line-height: var(--line-height-lg);
|
|
305
|
+
font-weight: var(--font-weight-semibold);
|
|
306
|
+
`,O=r.div`
|
|
307
|
+
display: flex;
|
|
308
|
+
flex-direction: column;
|
|
309
|
+
gap: var(--spacing-base);
|
|
310
|
+
padding: 0 var(--spacing-lg) var(--spacing-md);
|
|
311
|
+
overflow-y: auto;
|
|
312
|
+
`,_=r.div`
|
|
313
|
+
display: flex;
|
|
314
|
+
justify-content: flex-end;
|
|
315
|
+
gap: var(--spacing-xs);
|
|
316
|
+
padding: var(--spacing-base) var(--spacing-lg);
|
|
317
|
+
border-top: 1px solid var(--border-color-secondary);
|
|
318
|
+
`;function Sr({title:e,open:a,onClose:i,children:n,footer:d,wide:g,testId:v}){return m(()=>{if(!a)return;const s=x=>{x.key==="Escape"&&i()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[a,i]),a?o(k,{children:o(C,{onMouseDown:s=>s.target===s.currentTarget&&i(),children:t(H,{role:"dialog","aria-modal":"true",$wide:g,"data-testid":v,children:[t(M,{children:[o(N,{children:e}),o(f,{variant:"text",size:"small",onClick:i,"aria-label":"Close",icon:o(l,{name:"xmark",size:"16px"})})]}),o(O,{children:n}),d?o(_,{children:d}):null]})})}):null}const q=r.div`
|
|
319
|
+
--admonition-margin: 0;
|
|
320
|
+
`;function jr({tone:e="info",children:a}){return o(q,{role:e==="danger"?"alert":"status","data-testid":`apigee-notice-${e}`,children:o(h,{type:e,children:a})})}const F={approved:"green",pending:"orange",revoked:"red"},U={approved:"Approved",pending:"Pending approval",revoked:"Revoked"};function Dr({status:e,label:a}){return o(z,{color:F[e],children:a??U[e]})}const Er=r.dl`
|
|
321
|
+
display: grid;
|
|
322
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
323
|
+
gap: var(--spacing-base);
|
|
324
|
+
margin: 0;
|
|
325
|
+
padding: var(--spacing-base) var(--spacing-md);
|
|
326
|
+
border: 1px solid var(--border-color-secondary);
|
|
327
|
+
border-radius: var(--border-radius-xl);
|
|
328
|
+
background: var(--layer-color);
|
|
329
|
+
|
|
330
|
+
dt {
|
|
331
|
+
font-size: var(--font-size-sm);
|
|
332
|
+
line-height: var(--line-height-sm);
|
|
333
|
+
color: var(--text-color-description);
|
|
334
|
+
margin-bottom: var(--spacing-xxs);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
> div {
|
|
338
|
+
min-width: 0;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
> .wide {
|
|
342
|
+
grid-column: 1 / -1;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
dd {
|
|
346
|
+
margin: 0;
|
|
347
|
+
display: flex;
|
|
348
|
+
align-items: center;
|
|
349
|
+
gap: var(--spacing-xs);
|
|
350
|
+
flex-wrap: wrap;
|
|
351
|
+
overflow-wrap: anywhere;
|
|
352
|
+
}
|
|
353
|
+
`,Rr=r.div`
|
|
354
|
+
display: flex;
|
|
355
|
+
gap: var(--spacing-base);
|
|
356
|
+
flex-wrap: wrap;
|
|
357
|
+
margin-bottom: var(--spacing-lg);
|
|
358
|
+
`,$r=r.div`
|
|
359
|
+
flex: 1 1 160px;
|
|
360
|
+
padding: var(--spacing-base) var(--spacing-md);
|
|
361
|
+
border: 1px solid var(--border-color-secondary);
|
|
362
|
+
border-radius: var(--border-radius-xl);
|
|
363
|
+
display: grid;
|
|
364
|
+
gap: var(--spacing-xxs);
|
|
365
|
+
|
|
366
|
+
strong {
|
|
367
|
+
font-size: var(--font-size-xl);
|
|
368
|
+
line-height: var(--line-height-xl);
|
|
369
|
+
font-weight: var(--font-weight-semibold);
|
|
370
|
+
}
|
|
371
|
+
`,K=r.div`
|
|
372
|
+
display: flex;
|
|
373
|
+
justify-content: center;
|
|
374
|
+
padding: var(--spacing-xl);
|
|
375
|
+
`;function Pr({label:e}){return o(K,{role:"status","aria-label":e,children:o(y,{color:"var(--text-color-description)",size:"24px"})})}const Wr=r.div`
|
|
376
|
+
display: flex;
|
|
377
|
+
align-items: center;
|
|
378
|
+
justify-content: space-between;
|
|
379
|
+
padding: 0 var(--spacing-sm) var(--spacing-xs);
|
|
380
|
+
font-size: var(--font-size-sm);
|
|
381
|
+
font-weight: var(--font-weight-medium);
|
|
382
|
+
color: var(--text-color-secondary);
|
|
383
|
+
`,Ar=r(b)`
|
|
384
|
+
margin-bottom: var(--spacing-sm);
|
|
385
|
+
`,Br=r.div`
|
|
386
|
+
border: 1px solid var(--border-color-secondary);
|
|
387
|
+
border-radius: var(--border-radius-xl);
|
|
388
|
+
overflow: hidden;
|
|
389
|
+
`,G=r(u)`
|
|
390
|
+
display: flex;
|
|
391
|
+
align-items: center;
|
|
392
|
+
gap: var(--spacing-sm);
|
|
393
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
394
|
+
border-bottom: 1px solid var(--border-color-secondary);
|
|
395
|
+
color: var(--text-color-primary);
|
|
396
|
+
text-decoration: none;
|
|
397
|
+
|
|
398
|
+
&:last-child {
|
|
399
|
+
border-bottom: none;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
&:hover {
|
|
403
|
+
background: var(--layer-color-hover);
|
|
404
|
+
color: var(--text-color-primary);
|
|
405
|
+
text-decoration: none;
|
|
406
|
+
}
|
|
407
|
+
`,J=r.span`
|
|
408
|
+
display: flex;
|
|
409
|
+
flex-direction: column;
|
|
410
|
+
flex: 1;
|
|
411
|
+
min-width: 0;
|
|
412
|
+
|
|
413
|
+
> * {
|
|
414
|
+
overflow: hidden;
|
|
415
|
+
text-overflow: ellipsis;
|
|
416
|
+
white-space: nowrap;
|
|
417
|
+
}
|
|
418
|
+
`,Q=r.span`
|
|
419
|
+
font-weight: var(--font-weight-medium);
|
|
420
|
+
`;function Ir({to:e,title:a,subtitle:i,tag:n,testId:d}){return t(G,{to:e,"data-testid":d,children:[t(J,{children:[o(Q,{children:a}),i?o(c,{children:i}):null]}),n,o(l,{name:"chevron-right",size:"14px"})]})}export{Tr as CheckItem,Lr as CheckItemTitle,zr as CheckList,Sr as Dialog,fr as EmptyState,ur as Field,B as FieldLabel,wr as Input,Br as LinkList,Ir as LinkRow,Wr as ListTitle,Pr as Loading,hr as Mono,c as Muted,jr as Notice,Er as Overview,lr as Page,Ar as PageBreadcrumbs,cr as PageHeader,yr as RequiredLabel,br as Row,pr as Section,gr as SectionHeader,E as SectionTitle,$r as Stat,Rr as Stats,Dr as StatusTag,mr as Table,xr as TableWrap,vr as Tabs,kr as Textarea};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AccessRequest, AdminApp, ApigeeMeta, App, AppInput, AppUpdateInput, AuditEntry, Credential, KeyInput, Team, TeamInput, TeamMemberInput, TeamRole } from '../contract.js';
|
|
2
|
+
export declare class ApiRequestError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
name: string;
|
|
5
|
+
constructor(status: number, message: string);
|
|
6
|
+
}
|
|
7
|
+
export declare const apigeeApi: {
|
|
8
|
+
meta: () => Promise<ApigeeMeta>;
|
|
9
|
+
listApps: () => Promise<App[]>;
|
|
10
|
+
createApp: (input: AppInput) => Promise<App>;
|
|
11
|
+
updateApp: (appId: string, input: AppUpdateInput, teamId?: string) => Promise<App>;
|
|
12
|
+
deleteApp: (appId: string, teamId?: string) => Promise<void>;
|
|
13
|
+
createKey: (appId: string, input: KeyInput, teamId?: string) => Promise<Credential>;
|
|
14
|
+
updateKey: (appId: string, consumerKey: string, input: KeyInput, teamId?: string) => Promise<Credential>;
|
|
15
|
+
deleteKey: (appId: string, consumerKey: string, teamId?: string) => Promise<void>;
|
|
16
|
+
listTeams: () => Promise<Team[]>;
|
|
17
|
+
createTeam: (input: TeamInput) => Promise<Team>;
|
|
18
|
+
getTeam: (teamId: string) => Promise<Team>;
|
|
19
|
+
updateTeam: (teamId: string, input: TeamInput) => Promise<Team>;
|
|
20
|
+
deleteTeam: (teamId: string) => Promise<void>;
|
|
21
|
+
addMember: (teamId: string, input: TeamMemberInput) => Promise<Team>;
|
|
22
|
+
setMemberRole: (teamId: string, email: string, role: TeamRole) => Promise<Team>;
|
|
23
|
+
removeMember: (teamId: string, email: string) => Promise<Team>;
|
|
24
|
+
adminRequests: () => Promise<AccessRequest[]>;
|
|
25
|
+
adminDecide: (requestId: string, action: 'approve' | 'revoke', note?: string) => Promise<AuditEntry>;
|
|
26
|
+
adminApps: () => Promise<AdminApp[]>;
|
|
27
|
+
adminAudit: () => Promise<AuditEntry[]>;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=function(e,n,t,i){function m(d){return d instanceof t?d:new t(function(r){r(d)})}return new(t||(t=Promise))(function(d,r){function p(u){try{l(i.next(u))}catch(f){r(f)}}function h(u){try{l(i.throw(u))}catch(f){r(f)}}function l(u){u.done?d(u.value):m(u.value).then(p,h)}l((i=i.apply(e,n||[])).next())})};import{withPathPrefix as j}from"@redocly/theme/core/utils";import{APIGEE_ROUTES as o}from"../constants.js";class T extends Error{constructor(n,t){super(t),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ApiRequestError"})}}function a(e,n,t){let i=e;for(const[r,p]of Object.entries(n))i=i.replace(`:${r}`,encodeURIComponent(p));const m=new URLSearchParams;for(const[r,p]of Object.entries(t??{}))p!==void 0&&p!==""&&m.set(r,p);const d=m.toString();return j(d?`${i}?${d}`:i)}function s(e){return b(this,arguments,void 0,function*(n,t={}){var i;const m=yield fetch(n,Object.assign(Object.assign({},t),{headers:Object.assign(Object.assign({Accept:"application/json"},t.json!==void 0?{"Content-Type":"application/json"}:{}),(i=t.headers)!==null&&i!==void 0?i:{}),body:t.json!==void 0?JSON.stringify(t.json):t.body}));if(m.status===204)return;const d=yield m.text();let r=null;try{r=d?JSON.parse(d):null}catch{r=null}if(!m.ok){const p=r&&typeof r=="object"&&typeof r.error=="string"?r.error:`Request failed with ${m.status}`;throw new T(m.status,p)}return r})}const c=e=>({team:e}),O={meta:()=>s(a(o.meta,{})),listApps:()=>s(a(o.apps,{})),createApp:e=>s(a(o.apps,{}),{method:"POST",json:e}),updateApp:(e,n,t)=>s(a(o.app,{appId:e},c(t)),{method:"PUT",json:n}),deleteApp:(e,n)=>s(a(o.app,{appId:e},c(n)),{method:"DELETE"}),createKey:(e,n,t)=>s(a(o.appKeys,{appId:e},c(t)),{method:"POST",json:n}),updateKey:(e,n,t,i)=>s(a(o.appKey,{appId:e,consumerKey:n},c(i)),{method:"PUT",json:t}),deleteKey:(e,n,t)=>s(a(o.appKey,{appId:e,consumerKey:n},c(t)),{method:"DELETE"}),listTeams:()=>s(a(o.teams,{})),createTeam:e=>s(a(o.teams,{}),{method:"POST",json:e}),getTeam:e=>s(a(o.team,{teamId:e})),updateTeam:(e,n)=>s(a(o.team,{teamId:e}),{method:"PUT",json:n}),deleteTeam:e=>s(a(o.team,{teamId:e}),{method:"DELETE"}),addMember:(e,n)=>s(a(o.teamMembers,{teamId:e}),{method:"POST",json:n}),setMemberRole:(e,n,t)=>s(a(o.teamMember,{teamId:e,email:n}),{method:"PUT",json:{role:t}}),removeMember:(e,n)=>s(a(o.teamMember,{teamId:e,email:n}),{method:"DELETE"}),adminRequests:()=>s(a(o.adminRequests,{})),adminDecide:(e,n,t)=>s(a(n==="approve"?o.adminRequestApprove:o.adminRequestRevoke,{requestId:e}),{method:"POST",json:t?{note:t}:{}}),adminApps:()=>s(a(o.adminApps,{})),adminAudit:()=>s(a(o.adminAudit,{}))};export{T as ApiRequestError,O as apigeeApi};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ApigeeMeta } from '../contract.js';
|
|
2
|
+
export type ApigeeContextValue = {
|
|
3
|
+
meta: ApigeeMeta;
|
|
4
|
+
/** The apps page slug, without the site path prefix: router links add it. */
|
|
5
|
+
basePath: string;
|
|
6
|
+
/** The page title from the route, `apigee.title` in the config. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** A site-relative link under the apps page. */
|
|
9
|
+
link: (path?: string, query?: Record<string, string | undefined>) => string;
|
|
10
|
+
};
|
|
11
|
+
export declare const ApigeeContext: import("react").Context<ApigeeContextValue | null>;
|
|
12
|
+
export declare function useApigee(): ApigeeContextValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as t,useContext as o}from"react";const n=t(null);function i(){const e=o(n);if(!e)throw new Error("useApigee needs an ApigeeContext provider");return e}export{n as ApigeeContext,i as useApigee};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type AsyncState<T> = {
|
|
2
|
+
data: T | null;
|
|
3
|
+
error: string | null;
|
|
4
|
+
loading: boolean;
|
|
5
|
+
reload: () => void;
|
|
6
|
+
/** Replaces the loaded value without a round trip, after a mutation returned the new state. */
|
|
7
|
+
setData: (value: T | null) => void;
|
|
8
|
+
};
|
|
9
|
+
/** Loads `load()` on mount and whenever `key` changes; the last request wins. */
|
|
10
|
+
export declare function useAsync<T>(load: () => Promise<T>, key: string): AsyncState<T>;
|
|
11
|
+
export type MutationState = {
|
|
12
|
+
pending: boolean;
|
|
13
|
+
error: string | null;
|
|
14
|
+
clearError: () => void;
|
|
15
|
+
run: <T>(action: () => Promise<T>) => Promise<T | undefined>;
|
|
16
|
+
};
|
|
17
|
+
/** Runs one mutation at a time and keeps its error for the form that started it. */
|
|
18
|
+
export declare function useMutation(): MutationState;
|
|
19
|
+
export declare function formatDate(value: number | null | undefined): string;
|
|
20
|
+
export declare function formatDateTime(value: number | null | undefined): string;
|
|
21
|
+
export declare function copyText(text: string): Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=function(t,u,a,n){function c(i){return i instanceof a?i:new a(function(o){o(i)})}return new(a||(a=Promise))(function(i,o){function s(e){try{r(n.next(e))}catch(m){o(m)}}function d(e){try{r(n.throw(e))}catch(m){o(m)}}function r(e){e.done?i(e.value):c(e.value).then(s,d)}r((n=n.apply(t,u||[])).next())})};import{useCallback as f,useEffect as p,useRef as y,useState as l}from"react";import{ApiRequestError as x}from"./api.js";function D(t,u){const[a,n]=l({data:null,error:null,loading:!0}),[c,i]=l(0),o=y(t);o.current=t,p(()=>{let r=!1;return n(e=>Object.assign(Object.assign({},e),{loading:!0,error:null})),o.current().then(e=>{r||n({data:e,error:null,loading:!1})}).catch(e=>{r||n({data:null,error:h(e),loading:!1})}),()=>{r=!0}},[u,c]);const s=f(()=>i(r=>r+1),[]),d=f(r=>n({data:r,error:null,loading:!1}),[]);return Object.assign(Object.assign({},a),{reload:s,setData:d})}function E(){const[t,u]=l(!1),[a,n]=l(null),c=f(o=>g(this,void 0,void 0,function*(){u(!0),n(null);try{return yield o()}catch(s){n(h(s));return}finally{u(!1)}}),[]),i=f(()=>n(null),[]);return{pending:t,error:a,clearError:i,run:c}}function h(t){return t instanceof x||t instanceof Error?t.message:String(t)}function S(t){return t?new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):"\u2014"}function _(t){return t?new Date(t).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}function j(t){return g(this,void 0,void 0,function*(){try{return yield navigator.clipboard.writeText(t),!0}catch{return!1}})}export{j as copyText,S as formatDate,_ as formatDateTime,D as useAsync,E as useMutation};
|