@osdk/create-app 0.3.0 → 0.5.0

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.
Files changed (37) hide show
  1. package/README.md +17 -15
  2. package/build/js/index.cjs +38 -15
  3. package/build/js/index.cjs.map +1 -1
  4. package/build/js/index.mjs +38 -15
  5. package/build/js/index.mjs.map +1 -1
  6. package/build/types/generate/generateEnv.d.ts +2 -1
  7. package/build/types/prompts/promptCorsProxy.d.ts +3 -0
  8. package/build/types/prompts/promptCorsProxy.test.d.ts +1 -0
  9. package/build/types/templates.d.ts +2 -0
  10. package/changelog/0.4.0/pr-71.v2.yml +5 -0
  11. package/changelog/0.4.0/pr-76.v2.yml +5 -0
  12. package/changelog/0.4.0/pr-77.v2.yml +5 -0
  13. package/changelog/0.5.0/pr-82.v2.yml +5 -0
  14. package/package.json +1 -1
  15. package/templates/template-next-static-export/README.md.hbs +5 -1
  16. package/templates/template-next-static-export/next.config.js.hbs +17 -0
  17. package/templates/template-next-static-export/src/app/icon.svg +15 -20
  18. package/templates/template-next-static-export/src/app/layout.tsx +2 -12
  19. package/templates/template-next-static-export/src/app/page.tsx.hbs +9 -3
  20. package/templates/template-next-static-export/src/lib/client.ts.hbs +20 -4
  21. package/templates/template-react/README.md.hbs +4 -0
  22. package/templates/template-react/index.html +1 -1
  23. package/templates/template-react/src/Home.tsx.hbs +9 -3
  24. package/templates/template-react/src/Layout.tsx +1 -9
  25. package/templates/template-react/src/client.ts.hbs +20 -4
  26. package/templates/template-react/{vite.config.ts → vite.config.ts.hbs} +9 -0
  27. package/templates/template-vue/README.md.hbs +5 -1
  28. package/templates/template-vue/index.html +1 -1
  29. package/templates/template-vue/src/Home.vue.hbs +6 -6
  30. package/templates/template-vue/src/Layout.vue +1 -4
  31. package/templates/template-vue/src/Login.vue +0 -1
  32. package/templates/template-vue/src/client.ts.hbs +20 -4
  33. package/templates/template-vue/{vite.config.ts → vite.config.ts.hbs} +9 -0
  34. package/templates/template-next-static-export/next.config.js +0 -7
  35. package/templates/template-next-static-export/public/dev-console.svg +0 -25
  36. package/templates/template-react/public/dev-console.svg +0 -25
  37. package/templates/template-vue/public/dev-console.svg +0 -25
@@ -1,13 +1,10 @@
1
1
  <template>
2
2
  <div>
3
- <a href="https://www.palantir.com/" target="_blank">
4
- <img src="/palantir.svg" class="logo" alt="Palantir logo" />
5
- </a>
6
3
  <a
7
4
  href="https://www.palantir.com/docs/foundry/ontology-sdk/overview/"
8
5
  target="_blank"
9
6
  >
10
- <img src="/dev-console.svg" class="logo" alt="Developer Console logo" />
7
+ <img src="/palantir.svg" class="logo" alt="Palantir logo" />
11
8
  </a>
12
9
  <a href="https://vuejs.org/" target="_blank">
13
10
  <img src="/vue.svg" class="logo" alt="Vue logo" />
@@ -20,7 +20,6 @@ const login = async () => {
20
20
  };
21
21
 
22
22
  onUpdated(() => {
23
- console.log(client.auth.token);
24
23
  // If the token exists but a user tries to load /login, redirect to the home page instead
25
24
  if (client.auth.token != null) {
26
25
  router.replace("/");
@@ -1,14 +1,30 @@
1
1
  import { FoundryClient, PublicClientAuth } from "{{osdkPackage}}";
2
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
+
3
19
  /**
4
20
  * Initialize the client to interact with the Ontology SDK
5
21
  */
6
22
  const client = new FoundryClient({
7
- url: import.meta.env.VITE_FOUNDRY_API_URL!,
23
+ url,
8
24
  auth: new PublicClientAuth({
9
- clientId: import.meta.env.VITE_FOUNDRY_CLIENT_ID!,
10
- url: import.meta.env.VITE_FOUNDRY_API_URL!,
11
- redirectUrl: import.meta.env.VITE_FOUNDRY_REDIRECT_URL!,
25
+ clientId,
26
+ url,
27
+ redirectUrl,
12
28
  }),
13
29
  });
14
30
 
@@ -6,6 +6,15 @@ export default defineConfig({
6
6
  plugins: [vue()],
7
7
  server: {
8
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}}
9
18
  },
10
19
  resolve: {
11
20
  alias: {
@@ -1,7 +0,0 @@
1
- /** @type {import('next').NextConfig} */
2
- const nextConfig = {
3
- reactStrictMode: false,
4
- output: "export",
5
- };
6
-
7
- module.exports = nextConfig;
@@ -1,25 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
3
- <title>Developer Console Application</title>
4
- <rect x="1" y="1" width="14" height="12" fill="white"/>
5
- <g opacity="0.5">
6
- <path fill-rule="evenodd" clip-rule="evenodd" d="M1 0H15C15.55 0 16 0.45 16 1V13C16 13.55 15.55 14 15 14H1C0.45 14 0 13.55 0 13V1C0 0.45 0.45 0 1 0ZM15 13V1H1V13H15Z" fill="#10161A"/>
7
- </g>
8
- <rect x="1" y="1" width="14" height="3" fill="#72CA9B"/>
9
- <rect x="1" y="4" width="14" height="1" fill="#32A467"/>
10
- <rect x="2" y="2" width="1" height="1" fill="white"/>
11
- <rect x="4" y="2" width="1" height="1" fill="white"/>
12
- <rect x="6" y="2" width="1" height="1" fill="white"/>
13
- <rect x="12" y="2" width="2" height="1" fill="white"/>
14
- <path fill-rule="evenodd" clip-rule="evenodd" d="M6 8H14C14.5523 8 15 8.44772 15 9V14C15 14.5523 14.5523 15 14 15H6C5.44772 15 5 14.5523 5 14V9C5 8.44772 5.44772 8 6 8Z" fill="white"/>
15
- <path fill-rule="evenodd" clip-rule="evenodd" d="M6 9H14V14H6V9Z" fill="url(#paint0_linear_1221_19327)"/>
16
- <path fill-rule="evenodd" clip-rule="evenodd" d="M8 10H7V11H8V12H7V13H8V12H9V11H8V10ZM13 12H10V13H13V12Z" fill="white"/>
17
- <path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M6 7H14C15.1046 7 16 7.89543 16 9V14C16 15.1046 15.1046 16 14 16H6C4.89543 16 4 15.1046 4 14V9C4 7.89543 4.89543 7 6 7ZM15 9C15 8.44772 14.5523 8 14 8H6C5.44772 8 5 8.44772 5 9V14C5 14.5523 5.44772 15 6 15H14C14.5523 15 15 14.5523 15 14V9Z" fill="#10161A"/>
18
- <defs>
19
- <linearGradient id="paint0_linear_1221_19327" x1="17.4913" y1="13.1561" x2="15.3484" y2="6.02991" gradientUnits="userSpaceOnUse">
20
- <stop stop-color="#394B59"/>
21
- <stop offset="0.827" stop-color="#394B59"/>
22
- <stop offset="1" stop-color="#30404D"/>
23
- </linearGradient>
24
- </defs>
25
- </svg>
@@ -1,25 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
3
- <title>Developer Console Application</title>
4
- <rect x="1" y="1" width="14" height="12" fill="white"/>
5
- <g opacity="0.5">
6
- <path fill-rule="evenodd" clip-rule="evenodd" d="M1 0H15C15.55 0 16 0.45 16 1V13C16 13.55 15.55 14 15 14H1C0.45 14 0 13.55 0 13V1C0 0.45 0.45 0 1 0ZM15 13V1H1V13H15Z" fill="#10161A"/>
7
- </g>
8
- <rect x="1" y="1" width="14" height="3" fill="#72CA9B"/>
9
- <rect x="1" y="4" width="14" height="1" fill="#32A467"/>
10
- <rect x="2" y="2" width="1" height="1" fill="white"/>
11
- <rect x="4" y="2" width="1" height="1" fill="white"/>
12
- <rect x="6" y="2" width="1" height="1" fill="white"/>
13
- <rect x="12" y="2" width="2" height="1" fill="white"/>
14
- <path fill-rule="evenodd" clip-rule="evenodd" d="M6 8H14C14.5523 8 15 8.44772 15 9V14C15 14.5523 14.5523 15 14 15H6C5.44772 15 5 14.5523 5 14V9C5 8.44772 5.44772 8 6 8Z" fill="white"/>
15
- <path fill-rule="evenodd" clip-rule="evenodd" d="M6 9H14V14H6V9Z" fill="url(#paint0_linear_1221_19327)"/>
16
- <path fill-rule="evenodd" clip-rule="evenodd" d="M8 10H7V11H8V12H7V13H8V12H9V11H8V10ZM13 12H10V13H13V12Z" fill="white"/>
17
- <path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M6 7H14C15.1046 7 16 7.89543 16 9V14C16 15.1046 15.1046 16 14 16H6C4.89543 16 4 15.1046 4 14V9C4 7.89543 4.89543 7 6 7ZM15 9C15 8.44772 14.5523 8 14 8H6C5.44772 8 5 8.44772 5 9V14C5 14.5523 5.44772 15 6 15H14C14.5523 15 15 14.5523 15 14V9Z" fill="#10161A"/>
18
- <defs>
19
- <linearGradient id="paint0_linear_1221_19327" x1="17.4913" y1="13.1561" x2="15.3484" y2="6.02991" gradientUnits="userSpaceOnUse">
20
- <stop stop-color="#394B59"/>
21
- <stop offset="0.827" stop-color="#394B59"/>
22
- <stop offset="1" stop-color="#30404D"/>
23
- </linearGradient>
24
- </defs>
25
- </svg>
@@ -1,25 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
3
- <title>Developer Console Application</title>
4
- <rect x="1" y="1" width="14" height="12" fill="white"/>
5
- <g opacity="0.5">
6
- <path fill-rule="evenodd" clip-rule="evenodd" d="M1 0H15C15.55 0 16 0.45 16 1V13C16 13.55 15.55 14 15 14H1C0.45 14 0 13.55 0 13V1C0 0.45 0.45 0 1 0ZM15 13V1H1V13H15Z" fill="#10161A"/>
7
- </g>
8
- <rect x="1" y="1" width="14" height="3" fill="#72CA9B"/>
9
- <rect x="1" y="4" width="14" height="1" fill="#32A467"/>
10
- <rect x="2" y="2" width="1" height="1" fill="white"/>
11
- <rect x="4" y="2" width="1" height="1" fill="white"/>
12
- <rect x="6" y="2" width="1" height="1" fill="white"/>
13
- <rect x="12" y="2" width="2" height="1" fill="white"/>
14
- <path fill-rule="evenodd" clip-rule="evenodd" d="M6 8H14C14.5523 8 15 8.44772 15 9V14C15 14.5523 14.5523 15 14 15H6C5.44772 15 5 14.5523 5 14V9C5 8.44772 5.44772 8 6 8Z" fill="white"/>
15
- <path fill-rule="evenodd" clip-rule="evenodd" d="M6 9H14V14H6V9Z" fill="url(#paint0_linear_1221_19327)"/>
16
- <path fill-rule="evenodd" clip-rule="evenodd" d="M8 10H7V11H8V12H7V13H8V12H9V11H8V10ZM13 12H10V13H13V12Z" fill="white"/>
17
- <path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M6 7H14C15.1046 7 16 7.89543 16 9V14C16 15.1046 15.1046 16 14 16H6C4.89543 16 4 15.1046 4 14V9C4 7.89543 4.89543 7 6 7ZM15 9C15 8.44772 14.5523 8 14 8H6C5.44772 8 5 8.44772 5 9V14C5 14.5523 5.44772 15 6 15H14C14.5523 15 15 14.5523 15 14V9Z" fill="#10161A"/>
18
- <defs>
19
- <linearGradient id="paint0_linear_1221_19327" x1="17.4913" y1="13.1561" x2="15.3484" y2="6.02991" gradientUnits="userSpaceOnUse">
20
- <stop stop-color="#394B59"/>
21
- <stop offset="0.827" stop-color="#394B59"/>
22
- <stop offset="1" stop-color="#30404D"/>
23
- </linearGradient>
24
- </defs>
25
- </svg>