Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Subscribe Sandbox App #882

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thick-spies-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"e2e.sandbox.subscribeapp": patch
---

Created initial sandbox app for subscribe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"/Volumes/git/osdk-ts/examples/example-next-static-export/src/app/auth/callback/page.tsx":"1","/Volumes/git/osdk-ts/examples/example-next-static-export/src/app/layout.tsx":"2","/Volumes/git/osdk-ts/examples/example-next-static-export/src/app/login/page.tsx":"3","/Volumes/git/osdk-ts/examples/example-next-static-export/src/app/page.tsx":"4","/Volumes/git/osdk-ts/examples/example-next-static-export/src/env.test.ts":"5","/Volumes/git/osdk-ts/examples/example-next-static-export/src/lib/client.ts":"6","/Volumes/git/osdk-ts/examples/example-next-static-export/src/lib/useAuthenticated.ts":"7"},{"size":866,"mtime":1729085729143,"results":"8","hashOfConfig":"9"},{"size":1341,"mtime":1729085729144,"results":"10","hashOfConfig":"9"},{"size":1326,"mtime":1729085729144,"results":"11","hashOfConfig":"9"},{"size":1470,"mtime":1729085729144,"results":"12","hashOfConfig":"9"},{"size":806,"mtime":1729085729144,"results":"13","hashOfConfig":"9"},{"size":815,"mtime":1729085729144,"results":"14","hashOfConfig":"9"},{"size":714,"mtime":1729085729145,"results":"15","hashOfConfig":"9"},{"filePath":"16","messages":"17","suppressedMessages":"18","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1bx05na",{"filePath":"19","messages":"20","suppressedMessages":"21","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"22","messages":"23","suppressedMessages":"24","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"25","messages":"26","suppressedMessages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","suppressedMessages":"30","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","suppressedMessages":"33","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"34","messages":"35","suppressedMessages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Volumes/git/osdk-ts/examples/example-next-static-export/src/app/auth/callback/page.tsx",[],[],"/Volumes/git/osdk-ts/examples/example-next-static-export/src/app/layout.tsx",[],[],"/Volumes/git/osdk-ts/examples/example-next-static-export/src/app/login/page.tsx",[],[],"/Volumes/git/osdk-ts/examples/example-next-static-export/src/app/page.tsx",[],[],"/Volumes/git/osdk-ts/examples/example-next-static-export/src/env.test.ts",[],[],"/Volumes/git/osdk-ts/examples/example-next-static-export/src/lib/client.ts",[],[],"/Volumes/git/osdk-ts/examples/example-next-static-export/src/lib/useAuthenticated.ts",[],[]]
5 changes: 5 additions & 0 deletions examples/example-next-static-export/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ export function createOsdkObject<
target[RawObject][objectDef.primaryKeyApiName as string],
p as string,
rawValue.type === "geotimeSeriesValue"
? { time: rawValue.timestamp, value: rawValue.position }
? {
time: rawValue.timestamp,
value: { coordinates: rawValue.position, type: "Point" },
}
: undefined,
);
target[CachedPropertiesRef].set(p, geotimeProp);
Expand Down
21 changes: 21 additions & 0 deletions packages/e2e.sandbox.subscribeapp/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
ignorePatterns: ["dist", "build", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "warn",
},
};
24 changes: 24 additions & 0 deletions packages/e2e.sandbox.subscribeapp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do I need to configure this?

Empty file.
Empty file.
13 changes: 13 additions & 0 deletions packages/e2e.sandbox.subscribeapp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
56 changes: 56 additions & 0 deletions packages/e2e.sandbox.subscribeapp/ontology.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"ontology": {
"apiName": "default",
"rid": "ri.ontology.main.ontology.a35bb7f9-2c57-4199-a1cd-af461d88bd6e",
"displayName": "",
"description": ""
},
"actionTypes": {
},
"objectTypes": {
"MtaBus": {
"objectType": {
"apiName": "MtaBus",
"primaryKey": "vehicleId",
"displayName": "MtaBus",
"description": "MtaBus",
"properties": {
"vehicleId": {
"dataType": {
"type": "string"
}
},
"nextStopId": {
"dataType": {
"type": "string"
}
},
"routeId": {
"dataType": {
"type": "string"
}
},
"positionId": {
"dataType": {
"type": "geotimeSeriesReference"
}
}
},
"status": "ACTIVE",
"rid": "ri.a.b.c.d",
"icon": {
"type": "blueprint",
"name": "traffic",
"color": "color"
},
"titleProperty": "name",
"pluralDisplayName": "Fintraffic AIS"
},
"linkTypes": []
}
},
"queryTypes": {
},
"interfaceTypes": {
}
}
77 changes: 77 additions & 0 deletions packages/e2e.sandbox.subscribeapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"name": "e2e.sandbox.subscribeapp",
"version": "0.0.0",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/palantir/osdk-ts.git"
},
"exports": {
".": {
"browser": "./build/browser/index.js",
"import": "./build/esm/index.js"
},
"./*": {
"browser": "./build/browser/public/*.js",
"import": "./build/esm/public/*.js"
}
},
"scripts": {
"build": "tsc -b && vite build",
"check-attw": "monorepo.tool.attw esm",
"check-spelling": "cspell --quiet .",
"clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
"codegen": "rm -rf src/generatedNoCheck2/* && osdk-unstable-typescript generate --outDir src/generatedNoCheck2 --beta --ontologyPath ontology.json --version dev --internal",
"dev": "vite",
"fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
"lint": "eslint . && dprint check --config $(find-up dprint.json)",
"preview": "vite preview",
"transpile": "monorepo.tool.transpile"
},
"dependencies": {
"@types/leaflet": "^1.9.12",
"leaflet": "^1.9.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-leaflet": "^4.2.1"
},
"peerDependencies": {
"@osdk/api": "workspace:~",
"@osdk/client": "workspace:~"
},
"devDependencies": {
"@eslint/js": "^9.11.1",
"@osdk/api": "workspace:~",
"@osdk/cli.cmd.typescript": "workspace:~",
"@osdk/client": "workspace:~",
"@osdk/monorepo.api-extractor": "workspace:~",
"@osdk/monorepo.tsconfig": "workspace:~",
"@osdk/monorepo.tsup": "workspace:~",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.2",
"eslint": "^9.11.1",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.12",
"globals": "^15.9.0",
"tiny-invariant": "1.3.3",
"typescript": "^5.5.4",
"typescript-eslint": "^8.7.0",
"vite": "^5.4.8"
},
"publishConfig": {
"access": "public"
},
"files": [
"build/cjs",
"build/esm",
"build/browser",
"CHANGELOG.md",
"package.json",
"templates",
"*.d.ts"
],
"module": "./build/esm/index.js",
"types": "./build/esm/index.d.ts",
"type": "module"
}
41 changes: 41 additions & 0 deletions packages/e2e.sandbox.subscribeapp/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#root {
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
}
20 changes: 20 additions & 0 deletions packages/e2e.sandbox.subscribeapp/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import viteLogo from "/vite.svg";
import React from "react";
import "./App.css";
import MapComponent from "./MapComponent.js";
import { useSubscribe } from "./useSubscribe.tsx";

interface Coordinates {
lat: number;
lng: number;
}

function App() {
return (
<div>
<MapComponent />
</div>
);
}

export default App;
21 changes: 21 additions & 0 deletions packages/e2e.sandbox.subscribeapp/src/EntityPopup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from "react";

interface EntityPopupProps {
id: string;
routeId: string;
nextStopId: string;
}

const EntityPopup: React.FC<EntityPopupProps> = (
{ id, routeId, nextStopId },
) => {
return (
<div>
<h1>{id}</h1>
<p>Route ID: {routeId}</p>
<p>Next Stop ID: {nextStopId}</p>
</div>
);
};

export default EntityPopup;
Loading