@osdk/create-app 0.17.0-beta.3 → 0.17.0-beta.4
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 +6 -0
- package/build/browser/index.js +9 -13
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +9 -14
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/index.js +9 -13
- package/build/esm/index.js.map +1 -1
- package/build/esm/run.d.ts.map +1 -1
- package/package.json +15 -6
- 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 -45
- 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 -42
- 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 -36
- 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-aip-app/.eslintrc.cjs +0 -18
- package/templates/template-tutorial-todo-aip-app/README.md.hbs +0 -34
- package/templates/template-tutorial-todo-aip-app/index.html +0 -15
- package/templates/template-tutorial-todo-aip-app/package.json.hbs +0 -31
- package/templates/template-tutorial-todo-aip-app/public/aip-icon.svg +0 -3
- package/templates/template-tutorial-todo-aip-app/public/todo-aip-app.svg +0 -19
- package/templates/template-tutorial-todo-aip-app/src/AuthCallback.tsx +0 -24
- package/templates/template-tutorial-todo-aip-app/src/AuthenticatedRoute.tsx +0 -33
- package/templates/template-tutorial-todo-aip-app/src/CreateProjectButton.module.css +0 -3
- package/templates/template-tutorial-todo-aip-app/src/CreateProjectButton.tsx +0 -36
- package/templates/template-tutorial-todo-aip-app/src/CreateProjectDialog.module.css +0 -15
- package/templates/template-tutorial-todo-aip-app/src/CreateProjectDialog.tsx +0 -74
- package/templates/template-tutorial-todo-aip-app/src/CreateTaskButton.module.css +0 -3
- package/templates/template-tutorial-todo-aip-app/src/CreateTaskButton.tsx +0 -38
- package/templates/template-tutorial-todo-aip-app/src/CreateTaskDialog.module.css +0 -66
- package/templates/template-tutorial-todo-aip-app/src/CreateTaskDialog.tsx +0 -140
- package/templates/template-tutorial-todo-aip-app/src/DeleteProjectButton.module.css +0 -3
- package/templates/template-tutorial-todo-aip-app/src/DeleteProjectButton.tsx +0 -37
- package/templates/template-tutorial-todo-aip-app/src/DeleteProjectDialog.module.css +0 -3
- package/templates/template-tutorial-todo-aip-app/src/DeleteProjectDialog.tsx +0 -57
- package/templates/template-tutorial-todo-aip-app/src/Dialog.module.css +0 -11
- package/templates/template-tutorial-todo-aip-app/src/Dialog.tsx +0 -19
- package/templates/template-tutorial-todo-aip-app/src/Home.module.css +0 -28
- package/templates/template-tutorial-todo-aip-app/src/Home.tsx +0 -64
- package/templates/template-tutorial-todo-aip-app/src/Layout.module.css +0 -16
- package/templates/template-tutorial-todo-aip-app/src/Layout.tsx +0 -23
- package/templates/template-tutorial-todo-aip-app/src/Login.module.css +0 -5
- package/templates/template-tutorial-todo-aip-app/src/Login.tsx +0 -44
- package/templates/template-tutorial-todo-aip-app/src/ProjectDetails.module.css +0 -53
- package/templates/template-tutorial-todo-aip-app/src/ProjectDetails.tsx +0 -88
- package/templates/template-tutorial-todo-aip-app/src/ProjectSelect.tsx +0 -40
- package/templates/template-tutorial-todo-aip-app/src/TaskList.module.css +0 -7
- package/templates/template-tutorial-todo-aip-app/src/TaskList.tsx +0 -44
- package/templates/template-tutorial-todo-aip-app/src/TaskListItem.module.css +0 -35
- package/templates/template-tutorial-todo-aip-app/src/TaskListItem.tsx +0 -58
- package/templates/template-tutorial-todo-aip-app/src/client.ts.hbs +0 -31
- package/templates/template-tutorial-todo-aip-app/src/index.css +0 -75
- package/templates/template-tutorial-todo-aip-app/src/main.tsx +0 -36
- package/templates/template-tutorial-todo-aip-app/src/mocks.ts +0 -186
- package/templates/template-tutorial-todo-aip-app/src/useProjectTasks.ts +0 -75
- package/templates/template-tutorial-todo-aip-app/src/useProjects.ts +0 -57
- package/templates/template-tutorial-todo-aip-app/src/vite-env.d.ts +0 -1
- package/templates/template-tutorial-todo-aip-app/tsconfig.json +0 -25
- package/templates/template-tutorial-todo-aip-app/tsconfig.node.json +0 -10
- package/templates/template-tutorial-todo-aip-app/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 -10
- package/templates/template-tutorial-todo-app/src/Dialog.tsx +0 -19
- package/templates/template-tutorial-todo-app/src/Home.module.css +0 -34
- package/templates/template-tutorial-todo-app/src/Home.tsx +0 -63
- 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 -44
- 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 -13
- package/templates/template-tutorial-todo-app/src/TaskListItem.tsx +0 -40
- package/templates/template-tutorial-todo-app/src/client.ts.hbs +0 -31
- package/templates/template-tutorial-todo-app/src/index.css +0 -75
- package/templates/template-tutorial-todo-app/src/main.tsx +0 -36
- package/templates/template-tutorial-todo-app/src/mocks.ts +0 -137
- package/templates/template-tutorial-todo-app/src/useProjectTasks.ts +0 -60
- 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,75 +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
|
-
font-synthesis: none;
|
|
7
|
-
text-rendering: optimizeLegibility;
|
|
8
|
-
-webkit-font-smoothing: antialiased;
|
|
9
|
-
-moz-osx-font-smoothing: grayscale;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
#root-container {
|
|
13
|
-
display: flex;
|
|
14
|
-
flex: 1;
|
|
15
|
-
align-items: center;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
#root {
|
|
19
|
-
max-width: 1280px;
|
|
20
|
-
margin: 2rem auto;
|
|
21
|
-
padding: 2rem;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
a {
|
|
25
|
-
font-weight: 500;
|
|
26
|
-
color: #646cff;
|
|
27
|
-
text-decoration: inherit;
|
|
28
|
-
}
|
|
29
|
-
a:hover {
|
|
30
|
-
color: #535bf2;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
body {
|
|
34
|
-
margin: 0;
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-direction: column;
|
|
37
|
-
min-width: 320px;
|
|
38
|
-
min-height: 100vh;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
h1 {
|
|
42
|
-
font-size: 3.2em;
|
|
43
|
-
line-height: 1.1;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
button {
|
|
47
|
-
border-radius: 8px;
|
|
48
|
-
border: 1px solid transparent;
|
|
49
|
-
padding: 0.6em 1.2em;
|
|
50
|
-
font-size: 1em;
|
|
51
|
-
font-weight: 500;
|
|
52
|
-
font-family: inherit;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
transition: border-color 0.25s;
|
|
55
|
-
}
|
|
56
|
-
button:hover {
|
|
57
|
-
border-color: #646cff;
|
|
58
|
-
}
|
|
59
|
-
button:focus,
|
|
60
|
-
button:focus-visible {
|
|
61
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@media (prefers-color-scheme: light) {
|
|
65
|
-
:root {
|
|
66
|
-
color: #213547;
|
|
67
|
-
background-color: #ffffff;
|
|
68
|
-
}
|
|
69
|
-
a:hover {
|
|
70
|
-
color: #747bff;
|
|
71
|
-
}
|
|
72
|
-
button {
|
|
73
|
-
background-color: #f9f9f9;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import ReactDOM from "react-dom/client";
|
|
2
|
-
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
3
|
-
import AuthCallback from "./AuthCallback";
|
|
4
|
-
import AuthenticatedRoute from "./AuthenticatedRoute";
|
|
5
|
-
import Home from "./Home";
|
|
6
|
-
import Login from "./Login";
|
|
7
|
-
import "./index.css";
|
|
8
|
-
|
|
9
|
-
const router = createBrowserRouter(
|
|
10
|
-
[
|
|
11
|
-
{
|
|
12
|
-
path: "/",
|
|
13
|
-
element: <AuthenticatedRoute />,
|
|
14
|
-
children: [
|
|
15
|
-
{
|
|
16
|
-
path: "/",
|
|
17
|
-
element: <Home />,
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
path: "/login",
|
|
23
|
-
element: <Login />,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
// This is the route defined in your application's redirect URL
|
|
27
|
-
path: "/auth/callback",
|
|
28
|
-
element: <AuthCallback />,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
{ basename: import.meta.env.BASE_URL },
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
35
|
-
<RouterProvider router={router} />,
|
|
36
|
-
);
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
export interface MockProject {
|
|
2
|
-
$apiName: string;
|
|
3
|
-
$primaryKey: string;
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
tasks: MockTask[];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface MockTask {
|
|
10
|
-
$apiName: string;
|
|
11
|
-
$primaryKey: string;
|
|
12
|
-
id: string;
|
|
13
|
-
title: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const projects: MockProject[] = [
|
|
17
|
-
{
|
|
18
|
-
$apiName: "MockProject",
|
|
19
|
-
$primaryKey: "1",
|
|
20
|
-
id: "1",
|
|
21
|
-
name: "Mock project",
|
|
22
|
-
tasks: [
|
|
23
|
-
{
|
|
24
|
-
$apiName: "MockTask",
|
|
25
|
-
$primaryKey: "1",
|
|
26
|
-
id: "1",
|
|
27
|
-
title: "Try to",
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
$apiName: "MockTask",
|
|
31
|
-
$primaryKey: "2",
|
|
32
|
-
id: "2",
|
|
33
|
-
title: "Implement this",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
$apiName: "MockTask",
|
|
37
|
-
$primaryKey: "3",
|
|
38
|
-
id: "3",
|
|
39
|
-
title: "With the Ontology SDK!",
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
$apiName: "MockProject",
|
|
45
|
-
$primaryKey: "2",
|
|
46
|
-
id: "2",
|
|
47
|
-
name: "Yet another mock project",
|
|
48
|
-
tasks: [
|
|
49
|
-
{
|
|
50
|
-
$apiName: "MockTask",
|
|
51
|
-
$primaryKey: "4",
|
|
52
|
-
id: "4",
|
|
53
|
-
title: "More tasks here",
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
async function delay(): Promise<void> {
|
|
60
|
-
return new Promise((resolve) =>
|
|
61
|
-
setTimeout(() => resolve(), 500 + Math.random() * 1000)
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Good enough random id for mocks
|
|
66
|
-
function randomId(): string {
|
|
67
|
-
return `${Math.floor(Math.random() * 2 ** 31)}`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async function getProjects(): Promise<MockProject[]> {
|
|
71
|
-
await delay();
|
|
72
|
-
const result = [...projects];
|
|
73
|
-
result.sort((p1, p2) => p1.name.localeCompare(p2.name));
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
async function createProject({
|
|
78
|
-
name,
|
|
79
|
-
}: {
|
|
80
|
-
name: string;
|
|
81
|
-
}): Promise<MockProject["$primaryKey"]> {
|
|
82
|
-
await delay();
|
|
83
|
-
const id = randomId();
|
|
84
|
-
projects.push({
|
|
85
|
-
$apiName: "MockProject",
|
|
86
|
-
$primaryKey: id,
|
|
87
|
-
id,
|
|
88
|
-
name,
|
|
89
|
-
tasks: [],
|
|
90
|
-
});
|
|
91
|
-
return id;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async function deleteProject(id: string): Promise<void> {
|
|
95
|
-
await delay();
|
|
96
|
-
const idx = projects.findIndex((p) => p.id === id);
|
|
97
|
-
if (idx !== -1) {
|
|
98
|
-
projects.splice(idx, 1);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
async function createTask({
|
|
103
|
-
title,
|
|
104
|
-
projectId,
|
|
105
|
-
}: {
|
|
106
|
-
title: string;
|
|
107
|
-
projectId: string;
|
|
108
|
-
}): Promise<MockTask["$primaryKey"]> {
|
|
109
|
-
await delay();
|
|
110
|
-
const project = projects.find((p) => p.id === projectId);
|
|
111
|
-
if (project == null) {
|
|
112
|
-
throw new Error(`Project ${projectId} not found!`);
|
|
113
|
-
}
|
|
114
|
-
const id = randomId();
|
|
115
|
-
project.tasks.unshift({ $apiName: "MockTask", $primaryKey: id, id, title });
|
|
116
|
-
return id;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
async function deleteTask(id: string): Promise<void> {
|
|
120
|
-
await delay();
|
|
121
|
-
for (const project of projects) {
|
|
122
|
-
const idx = project.tasks.findIndex((t) => t.id === id);
|
|
123
|
-
if (idx !== -1) {
|
|
124
|
-
project.tasks.splice(idx, 1);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const Mocks = {
|
|
130
|
-
getProjects,
|
|
131
|
-
createProject,
|
|
132
|
-
deleteProject,
|
|
133
|
-
createTask,
|
|
134
|
-
deleteTask,
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export default Mocks;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import useSWR from "swr";
|
|
3
|
-
import Mocks, { MockProject, MockTask } from "./mocks";
|
|
4
|
-
|
|
5
|
-
export function useProjectTasks(project: MockProject | undefined) {
|
|
6
|
-
const { data, isLoading, isValidating, error, mutate } = useSWR<MockTask[]>(
|
|
7
|
-
project != null ? `projects/${project.id}/tasks` : null,
|
|
8
|
-
// Try to implement this with the Ontology SDK!
|
|
9
|
-
async () => {
|
|
10
|
-
if (project == null) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
return project.tasks;
|
|
14
|
-
},
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
const createTask: (
|
|
18
|
-
title: string,
|
|
19
|
-
) => Promise<MockTask["$primaryKey"] | undefined> = useCallback(
|
|
20
|
-
async (title) => {
|
|
21
|
-
if (project == null) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
// Try to implement this with the Ontology SDK!
|
|
25
|
-
const id = await Mocks.createTask({
|
|
26
|
-
title,
|
|
27
|
-
projectId: project.$primaryKey,
|
|
28
|
-
});
|
|
29
|
-
await mutate();
|
|
30
|
-
return id;
|
|
31
|
-
},
|
|
32
|
-
[project, mutate],
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const deleteTask: (task: MockTask) => Promise<void> = useCallback(
|
|
36
|
-
async (task) => {
|
|
37
|
-
if (project == null) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
await sleep(1000);
|
|
41
|
-
// Try to implement this with the Ontology SDK!
|
|
42
|
-
await Mocks.deleteTask(task.$primaryKey);
|
|
43
|
-
await mutate();
|
|
44
|
-
},
|
|
45
|
-
[project, mutate],
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
tasks: data,
|
|
50
|
-
isLoading,
|
|
51
|
-
isValidating,
|
|
52
|
-
isError: error,
|
|
53
|
-
createTask,
|
|
54
|
-
deleteTask,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function sleep(ms: number) {
|
|
59
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
60
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import useSWR from "swr";
|
|
3
|
-
import Mocks, { MockProject } from "./mocks";
|
|
4
|
-
|
|
5
|
-
function useProjects() {
|
|
6
|
-
const { data, isLoading, isValidating, error, mutate } = useSWR<
|
|
7
|
-
MockProject[]
|
|
8
|
-
>("projects", async () => {
|
|
9
|
-
// Try to implement this with the Ontology SDK!
|
|
10
|
-
return Mocks.getProjects();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const createProject: (name: string) => Promise<MockProject["$primaryKey"]> =
|
|
14
|
-
useCallback(
|
|
15
|
-
async (name) => {
|
|
16
|
-
// Try to implement this with the Ontology SDK!
|
|
17
|
-
const id = await Mocks.createProject({ name });
|
|
18
|
-
await mutate();
|
|
19
|
-
return id;
|
|
20
|
-
},
|
|
21
|
-
[mutate],
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const deleteProject: (project: MockProject) => Promise<void> = useCallback(
|
|
25
|
-
async (project) => {
|
|
26
|
-
// Try to implement this with the Ontology SDK!
|
|
27
|
-
await Mocks.deleteProject(project.$primaryKey);
|
|
28
|
-
await mutate();
|
|
29
|
-
},
|
|
30
|
-
[mutate],
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
projects: data,
|
|
35
|
-
isLoading,
|
|
36
|
-
isValidating,
|
|
37
|
-
isError: error,
|
|
38
|
-
createProject,
|
|
39
|
-
deleteProject,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default useProjects;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
|
|
9
|
-
/* Bundler mode */
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"allowImportingTsExtensions": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"isolatedModules": true,
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
"jsx": "react-jsx",
|
|
16
|
-
|
|
17
|
-
/* Linting */
|
|
18
|
-
"strict": true,
|
|
19
|
-
"noUnusedLocals": true,
|
|
20
|
-
"noUnusedParameters": true,
|
|
21
|
-
"noFallthroughCasesInSwitch": true
|
|
22
|
-
},
|
|
23
|
-
"include": ["src"],
|
|
24
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
|
25
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import react from "@vitejs/plugin-react";
|
|
2
|
-
import { defineConfig } from "vite";
|
|
3
|
-
|
|
4
|
-
// https://vitejs.dev/config/
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
plugins: [react()],
|
|
7
|
-
server: {
|
|
8
|
-
port: 8080,
|
|
9
|
-
{{#if corsProxy}}
|
|
10
|
-
proxy: {
|
|
11
|
-
"^(/multipass/api|/api)": {
|
|
12
|
-
target: "{{foundryUrl}}",
|
|
13
|
-
changeOrigin: true,
|
|
14
|
-
secure: true,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
{{/if}}
|
|
18
|
-
},
|
|
19
|
-
});
|
|
@@ -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 Vue 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="/vue.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Ontology SDK + Vue</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app-container">
|
|
11
|
-
<div id="app"></div>
|
|
12
|
-
</div>
|
|
13
|
-
<script type="module" src="/src/main.ts"></script>
|
|
14
|
-
</body>
|
|
15
|
-
</html>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{project}}",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "vue-tsc && vite build",
|
|
9
|
-
"preview": "vite preview"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"{{osdkPackage}}": "latest",
|
|
13
|
-
"vue": "^3.4.27",
|
|
14
|
-
"vue-router": "^4.2.5"
|
|
15
|
-
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@vitejs/plugin-vue": "^4.5.0",
|
|
18
|
-
"typescript": "^5.2.2",
|
|
19
|
-
"vite": "^5.2.11",
|
|
20
|
-
"vue-tsc": "^1.8.22"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -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="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { onMounted, ref } from "vue";
|
|
3
|
-
import client from "./client";
|
|
4
|
-
import { useRouter } from "vue-router";
|
|
5
|
-
|
|
6
|
-
const router = useRouter();
|
|
7
|
-
|
|
8
|
-
const error = ref<string>();
|
|
9
|
-
|
|
10
|
-
onMounted(() => {
|
|
11
|
-
client.auth
|
|
12
|
-
.signIn()
|
|
13
|
-
.then(() => router.replace("/"))
|
|
14
|
-
.catch((e: unknown) => {
|
|
15
|
-
error.value = (e as Error).message;
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<div>{{ error != null ? error : "Authenticating…" }}</div>
|
|
22
|
-
</template>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import client from "./client";
|
|
3
|
-
|
|
4
|
-
const objectApiNames = Object.keys(client.ontology.objects);
|
|
5
|
-
const actionApiNames = Object.keys(client.ontology.actions);
|
|
6
|
-
const queryApiNames = Object.keys(client.ontology.queries);
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<h1>{{osdkPackage}}</h1>
|
|
11
|
-
<p>
|
|
12
|
-
Welcome to your Ontology SDK! Try using any of the following methods now.
|
|
13
|
-
</p>
|
|
14
|
-
<div class="methods">
|
|
15
|
-
<div>
|
|
16
|
-
<h2>Objects (\{{ objectApiNames.length }})</h2>
|
|
17
|
-
<pre v-for="objectApiName in objectApiNames" key="objectApiName">client.ontology.objects.\{{ objectApiName }}</pre>
|
|
18
|
-
</div>
|
|
19
|
-
<div>
|
|
20
|
-
<h2>Actions (\{{ actionApiNames.length }})</h2>
|
|
21
|
-
<pre v-for="actionApiName in actionApiNames" key="actionApiName">client.ontology.actions.\{{ actionApiName }}</pre>
|
|
22
|
-
</div>
|
|
23
|
-
<div>
|
|
24
|
-
<h2>Queries (\{{ queryApiNames.length }})</h2>
|
|
25
|
-
<pre v-for="queryApiName in queryApiNames" key="queryApiName">client.ontology.queries.\{{ queryApiName }}</pre>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
|
-
<style scoped>
|
|
31
|
-
.methods {
|
|
32
|
-
padding: 2em;
|
|
33
|
-
gap: 2em;
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-direction: row;
|
|
36
|
-
flex-wrap: wrap;
|
|
37
|
-
}
|
|
38
|
-
</style>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<a
|
|
4
|
-
href="https://www.palantir.com/docs/foundry/ontology-sdk/overview/"
|
|
5
|
-
target="_blank"
|
|
6
|
-
>
|
|
7
|
-
<img src="/palantir.svg" class="logo" alt="Palantir logo" />
|
|
8
|
-
</a>
|
|
9
|
-
<a href="https://vuejs.org/" target="_blank">
|
|
10
|
-
<img src="/vue.svg" class="logo" alt="Vue logo" />
|
|
11
|
-
</a>
|
|
12
|
-
</div>
|
|
13
|
-
<router-view />
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<style scoped>
|
|
17
|
-
.logo {
|
|
18
|
-
height: 6em;
|
|
19
|
-
padding: 1.5em;
|
|
20
|
-
will-change: filter;
|
|
21
|
-
transition: filter 300ms;
|
|
22
|
-
}
|
|
23
|
-
.logo:hover {
|
|
24
|
-
filter: drop-shadow(0 0 2em #646cffaa);
|
|
25
|
-
}
|
|
26
|
-
</style>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { onUpdated, ref } from "vue";
|
|
3
|
-
import client from "./client";
|
|
4
|
-
import { useRouter } from "vue-router";
|
|
5
|
-
|
|
6
|
-
const router = useRouter();
|
|
7
|
-
|
|
8
|
-
const isLoggingIn = ref(false);
|
|
9
|
-
const error = ref<string>();
|
|
10
|
-
|
|
11
|
-
const login = async () => {
|
|
12
|
-
isLoggingIn.value = true;
|
|
13
|
-
try {
|
|
14
|
-
await client.auth.signIn();
|
|
15
|
-
} catch (e: unknown) {
|
|
16
|
-
error.value = (e as Error).message;
|
|
17
|
-
} finally {
|
|
18
|
-
isLoggingIn.value = false;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
onUpdated(() => {
|
|
23
|
-
// If the token exists but a user tries to load /login, redirect to the home page instead
|
|
24
|
-
if (client.auth.token != null) {
|
|
25
|
-
router.replace("/");
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<template>
|
|
31
|
-
<h1>Ontology SDK</h1>
|
|
32
|
-
<button @click="login">
|
|
33
|
-
{{ isLoggingIn ? "Logging in…" : "Log in " }}
|
|
34
|
-
</button>
|
|
35
|
-
<div v-if="error">Unable to log in: {{ error }}</div>
|
|
36
|
-
</template>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { FoundryClient, PublicClientAuth } from "{{osdkPackage}}";
|
|
2
|
-
|
|
3
|
-
const url = import.meta.env.VITE_FOUNDRY_API_URL;
|
|
4
|
-
const clientId = import.meta.env.VITE_FOUNDRY_CLIENT_ID;
|
|
5
|
-
const redirectUrl = import.meta.env.VITE_FOUNDRY_REDIRECT_URL;
|
|
6
|
-
checkEnv(url, "VITE_FOUNDRY_API_URL");
|
|
7
|
-
checkEnv(clientId, "VITE_FOUNDRY_CLIENT_ID");
|
|
8
|
-
checkEnv(redirectUrl, "VITE_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;
|