@osdk/create-app 0.17.0-main-20240530094422 → 0.17.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 +60 -1
- package/build/browser/esm-5B4R5BF5.js +248 -0
- package/build/browser/esm-5B4R5BF5.js.map +1 -0
- package/build/browser/esm-7ZL7DCMH.js +451 -0
- package/build/browser/esm-7ZL7DCMH.js.map +1 -0
- package/build/browser/esm-WPXIOIG2.js +1170 -0
- package/build/browser/esm-WPXIOIG2.js.map +1 -0
- package/build/browser/esm-ZCTE2SEE.js +377 -0
- package/build/browser/esm-ZCTE2SEE.js.map +1 -0
- package/build/browser/esm-ZDRBH2ME.js +901 -0
- package/build/browser/esm-ZDRBH2ME.js.map +1 -0
- package/build/browser/index.js +26 -19
- package/build/browser/index.js.map +1 -1
- package/build/cjs/esm-2ZIGIHPI.cjs +379 -0
- package/build/cjs/esm-2ZIGIHPI.cjs.map +1 -0
- package/build/cjs/esm-JBGUEJ46.cjs +250 -0
- package/build/cjs/esm-JBGUEJ46.cjs.map +1 -0
- package/build/cjs/esm-RRFVZF4X.cjs +1172 -0
- package/build/cjs/esm-RRFVZF4X.cjs.map +1 -0
- package/build/cjs/esm-VSENADXB.cjs +903 -0
- package/build/cjs/esm-VSENADXB.cjs.map +1 -0
- package/build/cjs/esm-YRGJOBTV.cjs +453 -0
- package/build/cjs/esm-YRGJOBTV.cjs.map +1 -0
- package/build/cjs/index.cjs +26 -20
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/esm-5B4R5BF5.js +248 -0
- package/build/esm/esm-5B4R5BF5.js.map +1 -0
- package/build/esm/esm-7ZL7DCMH.js +451 -0
- package/build/esm/esm-7ZL7DCMH.js.map +1 -0
- package/build/esm/esm-WPXIOIG2.js +1170 -0
- package/build/esm/esm-WPXIOIG2.js.map +1 -0
- package/build/esm/esm-ZCTE2SEE.js +377 -0
- package/build/esm/esm-ZCTE2SEE.js.map +1 -0
- package/build/esm/esm-ZDRBH2ME.js +901 -0
- package/build/esm/esm-ZDRBH2ME.js.map +1 -0
- package/build/esm/index.js +26 -19
- package/build/esm/index.js.map +1 -1
- package/build/esm/run.d.ts.map +1 -1
- package/build/esm/templates.d.ts +7 -0
- package/build/esm/templates.d.ts.map +1 -1
- package/package.json +18 -9
- package/templates/template-next-static-export/.eslintrc.json +0 -4
- package/templates/template-next-static-export/README.md.hbs +0 -35
- package/templates/template-next-static-export/_gitignore +0 -36
- package/templates/template-next-static-export/next.config.js.hbs +0 -17
- package/templates/template-next-static-export/package.json.hbs +0 -25
- package/templates/template-next-static-export/public/next.svg +0 -20
- package/templates/template-next-static-export/public/palantir.svg +0 -3
- package/templates/template-next-static-export/src/app/auth/callback/page.tsx +0 -25
- package/templates/template-next-static-export/src/app/globals.css +0 -81
- package/templates/template-next-static-export/src/app/icon.svg +0 -20
- package/templates/template-next-static-export/src/app/layout.module.css +0 -11
- package/templates/template-next-static-export/src/app/layout.tsx +0 -51
- package/templates/template-next-static-export/src/app/login/page.tsx +0 -43
- package/templates/template-next-static-export/src/app/page.module.css +0 -7
- package/templates/template-next-static-export/src/app/page.tsx.hbs +0 -53
- package/templates/template-next-static-export/src/lib/client.ts.hbs +0 -31
- package/templates/template-next-static-export/src/lib/useAuthenticated.ts +0 -25
- package/templates/template-next-static-export/tsconfig.json +0 -27
- package/templates/template-react/.eslintrc.cjs +0 -18
- package/templates/template-react/README.md.hbs +0 -35
- package/templates/template-react/_gitignore +0 -24
- package/templates/template-react/index.html +0 -15
- package/templates/template-react/package.json.hbs +0 -30
- package/templates/template-react/public/palantir.svg +0 -3
- package/templates/template-react/public/react.svg +0 -1
- package/templates/template-react/src/AuthCallback.tsx +0 -24
- package/templates/template-react/src/AuthenticatedRoute.tsx +0 -33
- package/templates/template-react/src/Home.module.css +0 -7
- package/templates/template-react/src/Home.tsx.hbs +0 -47
- package/templates/template-react/src/Layout.module.css +0 -10
- package/templates/template-react/src/Layout.tsx +0 -29
- package/templates/template-react/src/Login.tsx +0 -40
- package/templates/template-react/src/client.ts.hbs +0 -31
- package/templates/template-react/src/index.css +0 -81
- package/templates/template-react/src/main.tsx +0 -33
- package/templates/template-react/src/vite-env.d.ts +0 -1
- package/templates/template-react/tsconfig.json +0 -25
- package/templates/template-react/tsconfig.node.json +0 -10
- package/templates/template-react/vite.config.ts.hbs +0 -19
- package/templates/template-tutorial-todo-app/.eslintrc.cjs +0 -18
- package/templates/template-tutorial-todo-app/README.md.hbs +0 -33
- package/templates/template-tutorial-todo-app/index.html +0 -15
- package/templates/template-tutorial-todo-app/package.json.hbs +0 -31
- package/templates/template-tutorial-todo-app/public/todo-app.svg +0 -4
- package/templates/template-tutorial-todo-app/src/AuthCallback.tsx +0 -24
- package/templates/template-tutorial-todo-app/src/AuthenticatedRoute.tsx +0 -33
- package/templates/template-tutorial-todo-app/src/CreateProjectButton.tsx +0 -33
- package/templates/template-tutorial-todo-app/src/CreateProjectDialog.tsx +0 -56
- package/templates/template-tutorial-todo-app/src/CreateTaskButton.tsx +0 -35
- package/templates/template-tutorial-todo-app/src/CreateTaskDialog.tsx +0 -52
- package/templates/template-tutorial-todo-app/src/DeleteProjectButton.tsx +0 -34
- package/templates/template-tutorial-todo-app/src/DeleteProjectDialog.tsx +0 -46
- package/templates/template-tutorial-todo-app/src/Dialog.module.css +0 -5
- package/templates/template-tutorial-todo-app/src/Dialog.tsx +0 -19
- package/templates/template-tutorial-todo-app/src/Home.module.css +0 -35
- package/templates/template-tutorial-todo-app/src/Home.tsx +0 -62
- package/templates/template-tutorial-todo-app/src/Layout.module.css +0 -16
- package/templates/template-tutorial-todo-app/src/Layout.tsx +0 -21
- package/templates/template-tutorial-todo-app/src/Login.module.css +0 -5
- package/templates/template-tutorial-todo-app/src/Login.tsx +0 -42
- package/templates/template-tutorial-todo-app/src/ProjectSelect.tsx +0 -40
- package/templates/template-tutorial-todo-app/src/TaskList.module.css +0 -6
- package/templates/template-tutorial-todo-app/src/TaskList.tsx +0 -38
- package/templates/template-tutorial-todo-app/src/TaskListItem.module.css +0 -3
- package/templates/template-tutorial-todo-app/src/TaskListItem.tsx +0 -37
- package/templates/template-tutorial-todo-app/src/client.ts.hbs +0 -31
- package/templates/template-tutorial-todo-app/src/index.css +0 -80
- package/templates/template-tutorial-todo-app/src/main.tsx +0 -33
- package/templates/template-tutorial-todo-app/src/mocks.ts +0 -137
- package/templates/template-tutorial-todo-app/src/useProjectTasks.ts +0 -55
- package/templates/template-tutorial-todo-app/src/useProjects.ts +0 -43
- package/templates/template-tutorial-todo-app/src/vite-env.d.ts +0 -1
- package/templates/template-tutorial-todo-app/tsconfig.json +0 -25
- package/templates/template-tutorial-todo-app/tsconfig.node.json +0 -10
- package/templates/template-tutorial-todo-app/vite.config.ts.hbs +0 -19
- package/templates/template-vue/.vscode/extensions.json +0 -3
- package/templates/template-vue/README.md.hbs +0 -35
- package/templates/template-vue/_gitignore +0 -24
- package/templates/template-vue/index.html +0 -15
- package/templates/template-vue/package.json.hbs +0 -22
- package/templates/template-vue/public/palantir.svg +0 -3
- package/templates/template-vue/public/vue.svg +0 -1
- package/templates/template-vue/src/AuthCallback.vue +0 -22
- package/templates/template-vue/src/Home.vue.hbs +0 -38
- package/templates/template-vue/src/Layout.vue +0 -26
- package/templates/template-vue/src/Login.vue +0 -36
- package/templates/template-vue/src/client.ts.hbs +0 -31
- package/templates/template-vue/src/main.ts +0 -35
- package/templates/template-vue/src/style.css +0 -81
- package/templates/template-vue/src/vite-env.d.ts +0 -1
- package/templates/template-vue/tsconfig.json +0 -25
- package/templates/template-vue/tsconfig.node.json +0 -10
- package/templates/template-vue/vite.config.ts.hbs +0 -24
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{project}}",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "next dev -p 8080",
|
|
7
|
-
"build": "next build",
|
|
8
|
-
"start": "next start",
|
|
9
|
-
"lint": "next lint"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"{{osdkPackage}}": "latest",
|
|
13
|
-
"react": "^18",
|
|
14
|
-
"react-dom": "^18",
|
|
15
|
-
"next": "14.2.3"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@types/node": "^20",
|
|
19
|
-
"@types/react": "^18",
|
|
20
|
-
"@types/react-dom": "^18",
|
|
21
|
-
"eslint": "^8.57.0",
|
|
22
|
-
"eslint-config-next": "^14.2.3",
|
|
23
|
-
"typescript": "^5"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<svg width="180" height="180" viewBox="0 0 180 180" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<mask id="mask0_408_134" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="180" height="180">
|
|
3
|
-
<circle cx="90" cy="90" r="90" fill="black"/>
|
|
4
|
-
</mask>
|
|
5
|
-
<g mask="url(#mask0_408_134)">
|
|
6
|
-
<circle cx="90" cy="90" r="90" fill="black"/>
|
|
7
|
-
<path d="M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z" fill="url(#paint0_linear_408_134)"/>
|
|
8
|
-
<rect x="115" y="54" width="12" height="72" fill="url(#paint1_linear_408_134)"/>
|
|
9
|
-
</g>
|
|
10
|
-
<defs>
|
|
11
|
-
<linearGradient id="paint0_linear_408_134" x1="109" y1="116.5" x2="144.5" y2="160.5" gradientUnits="userSpaceOnUse">
|
|
12
|
-
<stop stop-color="white"/>
|
|
13
|
-
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
14
|
-
</linearGradient>
|
|
15
|
-
<linearGradient id="paint1_linear_408_134" x1="121" y1="54" x2="120.799" y2="106.875" gradientUnits="userSpaceOnUse">
|
|
16
|
-
<stop stop-color="white"/>
|
|
17
|
-
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
18
|
-
</linearGradient>
|
|
19
|
-
</defs>
|
|
20
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.10768 6.06401C4.10768 8.3771 5.96702 10.2526 8.26059 10.2526C10.5543 10.2526 12.4138 8.3771 12.4138 6.06401C12.4138 3.7508 10.5543 1.87553 8.26059 1.87553C5.96702 1.87553 4.10768 3.7508 4.10768 6.06401ZM8.26093 13.923L13.6299 11.5848L14.5217 13.3091L8.26093 16L2 13.3091L2.89201 11.5848L8.26093 13.923ZM8.26101 0C4.94367 0 2.25442 2.71228 2.25442 6.05803C2.25442 9.40378 4.94367 12.1159 8.26101 12.1159C11.5782 12.1159 14.2676 9.40378 14.2676 6.05803C14.2676 2.71228 11.5782 0 8.26101 0Z" fill="#111418"/>
|
|
3
|
-
</svg>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import client from "@/lib/client";
|
|
3
|
-
import { useRouter } from "next/navigation";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Component to render at `/auth/callback`
|
|
8
|
-
* This calls signIn() again to save the token, and then navigates the user back to the home page.
|
|
9
|
-
*/
|
|
10
|
-
function AuthCallback() {
|
|
11
|
-
const [error, setError] = useState<string | undefined>(undefined);
|
|
12
|
-
const router = useRouter();
|
|
13
|
-
|
|
14
|
-
// This effect conflicts with React 18 strict mode in development
|
|
15
|
-
// https://react.dev/learn/synchronizing-with-effects#how-to-handle-the-effect-firing-twice-in-development
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
client.auth
|
|
18
|
-
.signIn()
|
|
19
|
-
.then(() => router.replace("/"))
|
|
20
|
-
.catch((e: unknown) => setError((e as Error).message ?? e));
|
|
21
|
-
}, [router]);
|
|
22
|
-
return <div>{error != null ? error : "Authenticating…"}</div>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default AuthCallback;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
-
line-height: 1.5;
|
|
4
|
-
font-weight: 400;
|
|
5
|
-
|
|
6
|
-
color-scheme: light dark;
|
|
7
|
-
color: rgba(255, 255, 255, 0.87);
|
|
8
|
-
background-color: #242424;
|
|
9
|
-
|
|
10
|
-
font-synthesis: none;
|
|
11
|
-
text-rendering: optimizeLegibility;
|
|
12
|
-
-webkit-font-smoothing: antialiased;
|
|
13
|
-
-moz-osx-font-smoothing: grayscale;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
#root-container {
|
|
17
|
-
display: flex;
|
|
18
|
-
flex: 1;
|
|
19
|
-
align-items: center;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
#root {
|
|
23
|
-
max-width: 1280px;
|
|
24
|
-
margin: 0 auto;
|
|
25
|
-
padding: 2rem;
|
|
26
|
-
text-align: center;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
a {
|
|
30
|
-
font-weight: 500;
|
|
31
|
-
color: #646cff;
|
|
32
|
-
text-decoration: inherit;
|
|
33
|
-
}
|
|
34
|
-
a:hover {
|
|
35
|
-
color: #535bf2;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
body {
|
|
39
|
-
margin: 0;
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
min-width: 320px;
|
|
43
|
-
min-height: 100vh;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
h1 {
|
|
47
|
-
font-size: 3.2em;
|
|
48
|
-
line-height: 1.1;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
button {
|
|
52
|
-
border-radius: 8px;
|
|
53
|
-
border: 1px solid transparent;
|
|
54
|
-
padding: 0.6em 1.2em;
|
|
55
|
-
font-size: 1em;
|
|
56
|
-
font-weight: 500;
|
|
57
|
-
font-family: inherit;
|
|
58
|
-
background-color: #1a1a1a;
|
|
59
|
-
cursor: pointer;
|
|
60
|
-
transition: border-color 0.25s;
|
|
61
|
-
}
|
|
62
|
-
button:hover {
|
|
63
|
-
border-color: #646cff;
|
|
64
|
-
}
|
|
65
|
-
button:focus,
|
|
66
|
-
button:focus-visible {
|
|
67
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@media (prefers-color-scheme: light) {
|
|
71
|
-
:root {
|
|
72
|
-
color: #213547;
|
|
73
|
-
background-color: #ffffff;
|
|
74
|
-
}
|
|
75
|
-
a:hover {
|
|
76
|
-
color: #747bff;
|
|
77
|
-
}
|
|
78
|
-
button {
|
|
79
|
-
background-color: #f9f9f9;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<svg width="180" height="180" viewBox="0 0 180 180" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<mask id="mask0_408_134" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="180" height="180">
|
|
3
|
-
<circle cx="90" cy="90" r="90" fill="black"/>
|
|
4
|
-
</mask>
|
|
5
|
-
<g mask="url(#mask0_408_134)">
|
|
6
|
-
<circle cx="90" cy="90" r="90" fill="black"/>
|
|
7
|
-
<path d="M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z" fill="url(#paint0_linear_408_134)"/>
|
|
8
|
-
<rect x="115" y="54" width="12" height="72" fill="url(#paint1_linear_408_134)"/>
|
|
9
|
-
</g>
|
|
10
|
-
<defs>
|
|
11
|
-
<linearGradient id="paint0_linear_408_134" x1="109" y1="116.5" x2="144.5" y2="160.5" gradientUnits="userSpaceOnUse">
|
|
12
|
-
<stop stop-color="white"/>
|
|
13
|
-
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
14
|
-
</linearGradient>
|
|
15
|
-
<linearGradient id="paint1_linear_408_134" x1="121" y1="54" x2="120.799" y2="106.875" gradientUnits="userSpaceOnUse">
|
|
16
|
-
<stop stop-color="white"/>
|
|
17
|
-
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
18
|
-
</linearGradient>
|
|
19
|
-
</defs>
|
|
20
|
-
</svg>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from "next";
|
|
2
|
-
import { Inter } from "next/font/google";
|
|
3
|
-
import Image from "next/image";
|
|
4
|
-
import css from "./layout.module.css";
|
|
5
|
-
import "./globals.css";
|
|
6
|
-
|
|
7
|
-
const inter = Inter({ subsets: ["latin"] });
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
title: "Ontology SDK + Next.js",
|
|
11
|
-
description: "Generated by @osdk/create-app",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
function RootLayout({ children }: { children: React.ReactNode }) {
|
|
15
|
-
return (
|
|
16
|
-
<html lang="en">
|
|
17
|
-
<body className={inter.className}>
|
|
18
|
-
<div id="root-container">
|
|
19
|
-
<div id="root">
|
|
20
|
-
<a
|
|
21
|
-
href="https://www.palantir.com/docs/foundry/ontology-sdk/overview/"
|
|
22
|
-
target="_blank"
|
|
23
|
-
>
|
|
24
|
-
<Image
|
|
25
|
-
src="/palantir.svg"
|
|
26
|
-
alt="Palantir logo"
|
|
27
|
-
className={css.logo}
|
|
28
|
-
width={16}
|
|
29
|
-
height={16}
|
|
30
|
-
priority
|
|
31
|
-
/>
|
|
32
|
-
</a>
|
|
33
|
-
<a href="https://nextjs.org/" target="_blank">
|
|
34
|
-
<Image
|
|
35
|
-
src="/next.svg"
|
|
36
|
-
alt="Next logo"
|
|
37
|
-
className={css.logo}
|
|
38
|
-
width={16}
|
|
39
|
-
height={16}
|
|
40
|
-
priority
|
|
41
|
-
/>
|
|
42
|
-
</a>
|
|
43
|
-
{children}
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</body>
|
|
47
|
-
</html>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default RootLayout;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import client from "@/lib/client";
|
|
3
|
-
import { useRouter } from "next/navigation";
|
|
4
|
-
import { useCallback, useEffect, useState } from "react";
|
|
5
|
-
|
|
6
|
-
function Login() {
|
|
7
|
-
const [isLoggingIn, setIsLoggingIn] = useState(false);
|
|
8
|
-
const [error, setError] = useState<string | undefined>(undefined);
|
|
9
|
-
const router = useRouter();
|
|
10
|
-
const token = client.auth.token;
|
|
11
|
-
|
|
12
|
-
const handleLogin = useCallback(async () => {
|
|
13
|
-
setIsLoggingIn(true);
|
|
14
|
-
try {
|
|
15
|
-
// Initiate the OAuth flow, which will redirect the user to log into Foundry
|
|
16
|
-
// Once the login has completed, the user will be redirected back to the route defined via the
|
|
17
|
-
// FOUNDRY_REDIRECT_URL variable in .env.development
|
|
18
|
-
await client.auth.signIn();
|
|
19
|
-
} catch (e: unknown) {
|
|
20
|
-
console.error(e);
|
|
21
|
-
setError((e as Error).message ?? e);
|
|
22
|
-
}
|
|
23
|
-
}, []);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
// If the token exists but a user tries to load /login, redirect to the home page instead
|
|
27
|
-
if (token != null) {
|
|
28
|
-
router.replace("/");
|
|
29
|
-
}
|
|
30
|
-
}, [token, router]);
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div>
|
|
34
|
-
<h1>Ontology SDK</h1>
|
|
35
|
-
<button onClick={handleLogin}>
|
|
36
|
-
{isLoggingIn ? "Logging in…" : "Log in "}
|
|
37
|
-
</button>
|
|
38
|
-
{error && <div>Unable to log in: {error}</div>}
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default Login;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import client from "@/lib/client";
|
|
3
|
-
import useAuthenticated from "@/lib/useAuthenticated";
|
|
4
|
-
import css from "./page.module.css";
|
|
5
|
-
|
|
6
|
-
function Home() {
|
|
7
|
-
const authenticated = useAuthenticated();
|
|
8
|
-
if (!authenticated) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const objectApiNames = Object.keys(client.ontology.objects);
|
|
13
|
-
const actionApiNames = Object.keys(client.ontology.actions);
|
|
14
|
-
const queryApiNames = Object.keys(client.ontology.queries);
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div>
|
|
18
|
-
<h1>{{osdkPackage}}</h1>
|
|
19
|
-
<p>
|
|
20
|
-
Welcome to your Ontology SDK! Try using any of the following methods
|
|
21
|
-
now.
|
|
22
|
-
</p>
|
|
23
|
-
<div className={css.methods}>
|
|
24
|
-
<div>
|
|
25
|
-
<h2>Objects ({objectApiNames.length})</h2>
|
|
26
|
-
{objectApiNames.map((objectApiName) => (
|
|
27
|
-
<pre key={objectApiName}>
|
|
28
|
-
client.ontology.objects.{objectApiName}
|
|
29
|
-
</pre>
|
|
30
|
-
))}
|
|
31
|
-
</div>
|
|
32
|
-
<div>
|
|
33
|
-
<h2>Actions ({actionApiNames.length})</h2>
|
|
34
|
-
{actionApiNames.map((actionApiName) => (
|
|
35
|
-
<pre key={actionApiName}>
|
|
36
|
-
client.ontology.actions.{actionApiName}
|
|
37
|
-
</pre>
|
|
38
|
-
))}
|
|
39
|
-
</div>
|
|
40
|
-
<div>
|
|
41
|
-
<h2>Queries ({queryApiNames.length})</h2>
|
|
42
|
-
{queryApiNames.map((queryApiName) => (
|
|
43
|
-
<pre key={queryApiName}>
|
|
44
|
-
client.ontology.queries.{queryApiName}
|
|
45
|
-
</pre>
|
|
46
|
-
))}
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export default Home;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { FoundryClient, PublicClientAuth } from "{{osdkPackage}}";
|
|
2
|
-
|
|
3
|
-
const url = process.env.NEXT_PUBLIC_FOUNDRY_API_URL;
|
|
4
|
-
const clientId = process.env.NEXT_PUBLIC_FOUNDRY_CLIENT_ID;
|
|
5
|
-
const redirectUrl = process.env.NEXT_PUBLIC_FOUNDRY_REDIRECT_URL;
|
|
6
|
-
checkEnv(url, "NEXT_PUBLIC_FOUNDRY_API_URL");
|
|
7
|
-
checkEnv(clientId, "NEXT_PUBLIC_FOUNDRY_CLIENT_ID");
|
|
8
|
-
checkEnv(redirectUrl, "NEXT_PUBLIC_FOUNDRY_REDIRECT_URL");
|
|
9
|
-
|
|
10
|
-
function checkEnv(
|
|
11
|
-
value: string | undefined,
|
|
12
|
-
name: string,
|
|
13
|
-
): asserts value is string {
|
|
14
|
-
if (value == null) {
|
|
15
|
-
throw new Error(`Missing environment variable: ${name}`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Initialize the client to interact with the Ontology SDK
|
|
21
|
-
*/
|
|
22
|
-
const client = new FoundryClient({
|
|
23
|
-
url,
|
|
24
|
-
auth: new PublicClientAuth({
|
|
25
|
-
clientId,
|
|
26
|
-
url,
|
|
27
|
-
redirectUrl,
|
|
28
|
-
}),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default client;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useRouter } from "next/navigation";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import client from "./client";
|
|
4
|
-
|
|
5
|
-
function useAuthenticated() {
|
|
6
|
-
const router = useRouter();
|
|
7
|
-
const [token, setToken] = useState(client.auth.token);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
if (client.auth.token == null || client.auth.token.isExpired) {
|
|
10
|
-
client.auth
|
|
11
|
-
.refresh()
|
|
12
|
-
.then(() => {
|
|
13
|
-
setToken(client.auth.token);
|
|
14
|
-
})
|
|
15
|
-
.catch(() => {
|
|
16
|
-
// If we cannot refresh the token (i.e. the user is not logged in) we redirect to the login page
|
|
17
|
-
router.push("/login");
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}, [router]);
|
|
21
|
-
|
|
22
|
-
return token != null && !token.isExpired;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default useAuthenticated;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
-
"allowJs": true,
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"noEmit": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"module": "esnext",
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"isolatedModules": true,
|
|
14
|
-
"jsx": "preserve",
|
|
15
|
-
"incremental": true,
|
|
16
|
-
"plugins": [
|
|
17
|
-
{
|
|
18
|
-
"name": "next"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"paths": {
|
|
22
|
-
"@/*": ["./src/*"]
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
26
|
-
"exclude": ["node_modules"]
|
|
27
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
env: { browser: true, es2020: true },
|
|
4
|
-
extends: [
|
|
5
|
-
"eslint:recommended",
|
|
6
|
-
"plugin:@typescript-eslint/recommended",
|
|
7
|
-
"plugin:react-hooks/recommended",
|
|
8
|
-
],
|
|
9
|
-
ignorePatterns: ["dist", ".eslintrc.cjs"],
|
|
10
|
-
parser: "@typescript-eslint/parser",
|
|
11
|
-
plugins: ["react-refresh"],
|
|
12
|
-
rules: {
|
|
13
|
-
"react-refresh/only-export-components": [
|
|
14
|
-
"warn",
|
|
15
|
-
{ allowConstantExport: true },
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# {{project}}
|
|
2
|
-
|
|
3
|
-
This project was generated with [`@osdk/create-app`](https://www.npmjs.com/package/@osdk/create-app) and demonstrates using the Ontology SDK package `{{osdkPackage}}` with React on top of Vite. Check out the [Vite](https://vitejs.dev/guide/) docs for further configuration.
|
|
4
|
-
|
|
5
|
-
## Developing
|
|
6
|
-
|
|
7
|
-
Run the following command or equivalent with your preferred package manager to start a local development server on `http://localhost:8080`:
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
npm run dev
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Development configuration is stored in `.env.development`.
|
|
14
|
-
|
|
15
|
-
{{#if corsProxy}}
|
|
16
|
-
In order to make API requests to Foundry, a CORS proxy has been set up for local development which may be removed if the stack is configured to allow `http://localhost:8080` to load resources. The configured OAuth client must also allow `http://localhost:8080/auth/callback` as a redirect URL.
|
|
17
|
-
{{else}}
|
|
18
|
-
In order to make API requests to Foundry, CORS must be configured for the stack to allow `http://localhost:8080` to load resources. If this has not been configured and you are unable to request this, you can alternatively generate your project again with `--corsProxy true` to use a proxy for API requests during local development. The configured OAuth client must also allow `http://localhost:8080/auth/callback` as a redirect URL.
|
|
19
|
-
{{/if}}
|
|
20
|
-
|
|
21
|
-
## Deploying
|
|
22
|
-
|
|
23
|
-
Run the following command or equivalent with your preferred package manager to create a production build of your application:
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
npm run build
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Production configuration is stored in `.env.production`.
|
|
30
|
-
|
|
31
|
-
If you did not fill in the URL your production application will be hosted on you will need to fill in the `VITE_FOUNDRY_REDIRECT_URL` in `.env.production`.
|
|
32
|
-
|
|
33
|
-
In order to make API requests to Foundry, CORS must be configured for the stack to allow the production origin to load resources. This will be automatically done for you if you are using Foundry website hosting. The configured OAuth client must also allow the production origin auth callback as a redirect URL.
|
|
34
|
-
|
|
35
|
-
A `foundry.config.json` file is included in the root of this project to make deploying to Foundry website hosting with [`@osdk/cli`](https://www.npmjs.com/package/@osdk/cli) easier. If you are not using Foundry website hosting for your application you may delete this file.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Logs
|
|
2
|
-
logs
|
|
3
|
-
*.log
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
yarn-debug.log*
|
|
6
|
-
yarn-error.log*
|
|
7
|
-
pnpm-debug.log*
|
|
8
|
-
lerna-debug.log*
|
|
9
|
-
|
|
10
|
-
node_modules
|
|
11
|
-
dist
|
|
12
|
-
dist-ssr
|
|
13
|
-
*.local
|
|
14
|
-
|
|
15
|
-
# Editor directories and files
|
|
16
|
-
.vscode/*
|
|
17
|
-
!.vscode/extensions.json
|
|
18
|
-
.idea
|
|
19
|
-
.DS_Store
|
|
20
|
-
*.suo
|
|
21
|
-
*.ntvs*
|
|
22
|
-
*.njsproj
|
|
23
|
-
*.sln
|
|
24
|
-
*.sw?
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/react.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Ontology SDK + React</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root-container">
|
|
11
|
-
<div id="root"></div>
|
|
12
|
-
</div>
|
|
13
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
14
|
-
</body>
|
|
15
|
-
</html>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{project}}",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "tsc && vite build",
|
|
9
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
|
-
"preview": "vite preview"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"{{osdkPackage}}": "latest",
|
|
14
|
-
"react": "^18",
|
|
15
|
-
"react-dom": "^18",
|
|
16
|
-
"react-router-dom": "^6.23.1"
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@types/react": "^18",
|
|
20
|
-
"@types/react-dom": "^18",
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
22
|
-
"@typescript-eslint/parser": "^7.8.0",
|
|
23
|
-
"@vitejs/plugin-react": "^4.2.0",
|
|
24
|
-
"eslint": "^8.57.0",
|
|
25
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
|
26
|
-
"eslint-plugin-react-refresh": "^0.4.6",
|
|
27
|
-
"typescript": "^5.2.2",
|
|
28
|
-
"vite": "^5.2.11"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.10768 6.06401C4.10768 8.3771 5.96702 10.2526 8.26059 10.2526C10.5543 10.2526 12.4138 8.3771 12.4138 6.06401C12.4138 3.7508 10.5543 1.87553 8.26059 1.87553C5.96702 1.87553 4.10768 3.7508 4.10768 6.06401ZM8.26093 13.923L13.6299 11.5848L14.5217 13.3091L8.26093 16L2 13.3091L2.89201 11.5848L8.26093 13.923ZM8.26101 0C4.94367 0 2.25442 2.71228 2.25442 6.05803C2.25442 9.40378 4.94367 12.1159 8.26101 12.1159C11.5782 12.1159 14.2676 9.40378 14.2676 6.05803C14.2676 2.71228 11.5782 0 8.26101 0Z" fill="#111418"/>
|
|
3
|
-
</svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { useNavigate } from "react-router-dom";
|
|
3
|
-
import client from "./client";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Component to render at `/auth/callback`
|
|
7
|
-
* This calls signIn() again to save the token, and then navigates the user back to the home page.
|
|
8
|
-
*/
|
|
9
|
-
function AuthCallback() {
|
|
10
|
-
const [error, setError] = useState<string | undefined>(undefined);
|
|
11
|
-
const navigate = useNavigate();
|
|
12
|
-
|
|
13
|
-
// This effect conflicts with React 18 strict mode in development
|
|
14
|
-
// https://react.dev/learn/synchronizing-with-effects#how-to-handle-the-effect-firing-twice-in-development
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
client.auth
|
|
17
|
-
.signIn()
|
|
18
|
-
.then(() => navigate("/", { replace: true }))
|
|
19
|
-
.catch((e: unknown) => setError((e as Error).message ?? e));
|
|
20
|
-
}, [navigate]);
|
|
21
|
-
return <div>{error != null ? error : "Authenticating…"}</div>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default AuthCallback;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { Outlet, useNavigate } from "react-router-dom";
|
|
3
|
-
import client from "./client";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A component that can be used to wrap routes that require authentication.
|
|
7
|
-
* Nested routes may assume that a valid token is present.
|
|
8
|
-
*/
|
|
9
|
-
function AuthenticatedRoute() {
|
|
10
|
-
const navigate = useNavigate();
|
|
11
|
-
const [token, setToken] = useState(client.auth.token);
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (client.auth.token == null || client.auth.token.isExpired) {
|
|
14
|
-
client.auth
|
|
15
|
-
.refresh()
|
|
16
|
-
.then(() => {
|
|
17
|
-
setToken(client.auth.token);
|
|
18
|
-
})
|
|
19
|
-
.catch(() => {
|
|
20
|
-
// If we cannot refresh the token (i.e. the user is not logged in) we redirect to the login page
|
|
21
|
-
navigate("/login");
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}, [navigate]);
|
|
25
|
-
|
|
26
|
-
if (token == null || token.isExpired) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return <Outlet />;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default AuthenticatedRoute;
|