@tomorrowos/sdk 0.9.28 → 0.9.29

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 (29) hide show
  1. package/README.md +6 -1
  2. package/VERCEL_SETUP.md +1 -1
  3. package/dist/cli.js +42 -11
  4. package/package.json +1 -1
  5. package/templates/cms-starter/package.json +2 -2
  6. package/templates/cms-starter/server.ts +2 -2
  7. package/templates/cms-starter-v0/.env.example +19 -0
  8. package/templates/cms-starter-v0/README.md +60 -0
  9. package/templates/cms-starter-v0/assets/logo.svg +4 -0
  10. package/templates/cms-starter-v0/brand.json +23 -0
  11. package/templates/cms-starter-v0/cms-panel/assets/player-download/android.svg +1 -0
  12. package/templates/cms-starter-v0/cms-panel/assets/player-download/brightsign.svg +1 -0
  13. package/templates/cms-starter-v0/cms-panel/assets/player-download/lg-webos.svg +1 -0
  14. package/templates/cms-starter-v0/cms-panel/assets/player-download/samsung.svg +1 -0
  15. package/templates/cms-starter-v0/cms-panel/assets/player-download/toolbox.svg +1 -0
  16. package/templates/cms-starter-v0/cms-panel/index.html +290 -0
  17. package/templates/cms-starter-v0/cms-panel/methods.js +2361 -0
  18. package/templates/cms-starter-v0/cms-panel/panel.css +1127 -0
  19. package/templates/cms-starter-v0/cms-panel/uploads/.gitkeep +1 -0
  20. package/templates/cms-starter-v0/package.json +35 -0
  21. package/templates/cms-starter-v0/policy.example.json +30 -0
  22. package/templates/cms-starter-v0/preview/app/layout.tsx +11 -0
  23. package/templates/cms-starter-v0/preview/app/page.tsx +3 -0
  24. package/templates/cms-starter-v0/preview/next-env.d.ts +2 -0
  25. package/templates/cms-starter-v0/preview/next.config.mjs +18 -0
  26. package/templates/cms-starter-v0/preview/tsconfig.json +20 -0
  27. package/templates/cms-starter-v0/server.ts +75 -0
  28. package/templates/cms-starter-v0/tsconfig.json +13 -0
  29. package/templates/cms-starter-v0/vercel.json +7 -0
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "my-cms",
3
+ "version": "0.9.29",
4
+ "description": "TomorrowOS CMS for Vercel / v0 Publish (Node Fluid + optional Next Preview shell).",
5
+ "private": true,
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=20"
9
+ },
10
+ "scripts": {
11
+ "dev": "tsx watch server.ts",
12
+ "dev:tomorrowos": "cross-env TOMORROWOS_INTERNAL_PORT=3001 tsx watch server.ts",
13
+ "dev:next": "cd preview && next dev -p 3000",
14
+ "dev:preview": "concurrently -k \"npm:dev:tomorrowos\" \"npm:dev:next\"",
15
+ "start": "tsx server.ts",
16
+ "build": "node -e \"process.exit(0)\"",
17
+ "build-player": "tomorrowos build --platform tizen"
18
+ },
19
+ "dependencies": {
20
+ "@tomorrowos/sdk": "^0.9.29",
21
+ "dotenv": "^17.2.3",
22
+ "tsx": "^4.19.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^20.0.0",
26
+ "@types/react": "^19.0.0",
27
+ "@types/react-dom": "^19.0.0",
28
+ "concurrently": "^9.1.2",
29
+ "cross-env": "^7.0.3",
30
+ "next": "^15.1.0",
31
+ "react": "^19.0.0",
32
+ "react-dom": "^19.0.0",
33
+ "typescript": "^5.5.0"
34
+ }
35
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "policy": {
3
+ "playlists": [
4
+ {
5
+ "id": "weekday-promo",
6
+ "name": "Weekday promo",
7
+ "schedule": {
8
+ "startDate": "2026-05-01",
9
+ "endDate": "2026-05-31",
10
+ "daysOfWeek": [1, 2, 3, 4, 5],
11
+ "start": "09:00",
12
+ "end": "17:00"
13
+ },
14
+ "items": [
15
+ {
16
+ "url": "https://example.com/hero.jpg",
17
+ "type": "image",
18
+ "durationMs": 10000
19
+ },
20
+ {
21
+ "url": "https://example.com/spot.mp4",
22
+ "type": "video",
23
+ "durationMs": 30000
24
+ }
25
+ ]
26
+ }
27
+ ],
28
+ "fallback": { "type": "brand" }
29
+ }
30
+ }
@@ -0,0 +1,11 @@
1
+ export default function RootLayout({
2
+ children
3
+ }: {
4
+ children: React.ReactNode;
5
+ }) {
6
+ return (
7
+ <html lang="en">
8
+ <body>{children}</body>
9
+ </html>
10
+ );
11
+ }
@@ -0,0 +1,3 @@
1
+ export default function PreviewShellPage() {
2
+ return null;
3
+ }
@@ -0,0 +1,2 @@
1
+ /// <reference types="next" />
2
+ /// <reference types="next/image-types/global" />
@@ -0,0 +1,18 @@
1
+ const internalUrl =
2
+ process.env.TOMORROWOS_INTERNAL_URL || "http://127.0.0.1:3001";
3
+
4
+ /** @type {import('next').NextConfig} */
5
+ const nextConfig = {
6
+ async rewrites() {
7
+ return {
8
+ fallback: [
9
+ {
10
+ source: "/:path*",
11
+ destination: `${internalUrl}/:path*`
12
+ }
13
+ ]
14
+ };
15
+ }
16
+ };
17
+
18
+ export default nextConfig;
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
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": [{ "name": "next" }]
17
+ },
18
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
19
+ "exclude": ["node_modules"]
20
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * TomorrowOS CMS server — Vercel / v0 starter.
3
+ * Production: root server.ts + Fluid (see vercel.json).
4
+ * Preview: npm run dev:preview (Next in preview/ proxies to this server on :3001).
5
+ */
6
+
7
+ import "dotenv/config";
8
+ import { readFileSync } from "fs";
9
+ import { fileURLToPath } from "url";
10
+ import { dirname, join } from "path";
11
+ import { createTomorrowOSStore, TomorrowOS } from "@tomorrowos/sdk";
12
+
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const brand = JSON.parse(readFileSync(join(__dirname, "brand.json"), "utf8"));
15
+ const store = createTomorrowOSStore({
16
+ databaseUrl:
17
+ process.env.SUPABASE_URL ||
18
+ process.env.NEON_DATABASE_URL ||
19
+ process.env.DATABASE_URL,
20
+ sqlitePath: join(__dirname, "data", "tomorrowos.db")
21
+ });
22
+
23
+ const tomorrowos = new TomorrowOS({ brand, store });
24
+
25
+ const port = Number(
26
+ process.env.TOMORROWOS_INTERNAL_PORT || process.env.PORT || 3000
27
+ );
28
+
29
+ const server = tomorrowos.listen({
30
+ port,
31
+ host: "0.0.0.0",
32
+ staticRoot: join(__dirname, "cms-panel")
33
+ });
34
+
35
+ tomorrowos.on("device.paired", (event) => {
36
+ console.log(`[TomorrowOS] device paired: ${event.deviceId}`);
37
+ void tomorrowos.pushLatestPolicyToDevice(event.deviceId).then((r) => {
38
+ if (r.pushed) {
39
+ console.log(`[TomorrowOS] pushed latest policy to ${event.deviceId} (paired)`);
40
+ }
41
+ }).catch((err) => {
42
+ console.error(`[TomorrowOS] policy push on paired failed for ${event.deviceId}:`, err);
43
+ });
44
+ });
45
+
46
+ tomorrowos.on("device.online", (event) => {
47
+ console.log(`[TomorrowOS] device online: ${event.deviceId}`);
48
+ void tomorrowos.pushLatestPolicyToDevice(event.deviceId).then((r) => {
49
+ if (r.pushed) {
50
+ console.log(`[TomorrowOS] pushed latest policy to ${event.deviceId}`);
51
+ }
52
+ }).catch((err) => {
53
+ console.error(`[TomorrowOS] latest policy push failed for ${event.deviceId}:`, err);
54
+ });
55
+ });
56
+
57
+ tomorrowos.on("device.offline", (event) => {
58
+ console.log(
59
+ `[TomorrowOS] device offline: ${event.deviceId} (lastSeen: ${event.lastSeen})`
60
+ );
61
+ });
62
+
63
+ tomorrowos.on("command.verified", (event) => {
64
+ console.log(
65
+ `[TomorrowOS] command verified: ${event.commandId} (${event.method})`
66
+ );
67
+ });
68
+
69
+ tomorrowos.on("command.failed", (event) => {
70
+ console.error(
71
+ `[TomorrowOS] command failed: ${event.commandId} (${event.method}) — ${event.error.message}`
72
+ );
73
+ });
74
+
75
+ export default server;
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+ "resolveJsonModule": true,
9
+ "noEmit": true,
10
+ "types": ["node"]
11
+ },
12
+ "include": ["server.ts"]
13
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://openapi.vercel.sh/vercel.json",
3
+ "fluid": true,
4
+ "framework": null,
5
+ "installCommand": "npm install",
6
+ "buildCommand": "npm run build"
7
+ }