@notis_ai/cli 0.2.7 → 0.2.9
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/README.md +56 -2
- package/dist/scaffolds/notis-database/app/page.tsx +38 -41
- package/dist/scaffolds/notis-database/lib/types.ts +5 -7
- package/dist/scaffolds/notis-database/metadata/screenshot-1.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-2.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-3.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-4.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-5.png +0 -0
- package/dist/scaffolds/notis-database/metadata/screenshot-fixtures.json +1839 -0
- package/dist/scaffolds/notis-database/notis.config.ts +48 -1
- package/dist/scaffolds/notis-database/package-lock.json +3935 -0
- package/dist/scaffolds/notis-database/package.json +2 -1
- package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/package.json +4 -0
- package/dist/scaffolds/notis-database/packages/sdk/src/components/DocumentEditor.tsx +93 -0
- package/dist/scaffolds/notis-database/packages/sdk/src/components/Markdown.tsx +60 -0
- package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/components/MultiSelectActionBar.tsx +7 -2
- package/dist/scaffolds/notis-database/packages/sdk/src/config.ts +196 -0
- package/dist/scaffolds/notis-database/packages/sdk/src/documents.ts +229 -0
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useDatabaseSchema.ts +85 -0
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useDocument.ts +78 -0
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useDocuments.ts +121 -0
- package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/hooks/useMultiSelect.ts +38 -2
- package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useUpsertDocument.ts +95 -0
- package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/index.ts +30 -1
- package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/runtime.ts +76 -17
- package/dist/scaffolds/notis-database/packages/sdk/src/styles.css +186 -0
- package/dist/scaffolds/notis-database/src/mock-runtime.ts +4 -1
- package/dist/scaffolds/notis-journal/CHANGELOG.md +4 -0
- package/dist/scaffolds/notis-journal/app/page.tsx +1 -0
- package/dist/scaffolds/notis-journal/package-lock.json +4615 -0
- package/dist/scaffolds/notis-journal/package.json +2 -2
- package/dist/scaffolds/notis-journal/packages/sdk/src/config.ts +52 -1
- package/dist/scaffolds/notis-notes/app/page.tsx +39 -46
- package/dist/scaffolds/notis-notes/app/phosphor-icons.ts +596 -0
- package/dist/scaffolds/notis-notes/lib/visible-properties.ts +144 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-1.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-2.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-3.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-4.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-5.png +0 -0
- package/dist/scaffolds/notis-notes/metadata/screenshot-fixtures.json +752 -0
- package/dist/scaffolds/notis-notes/notis.config.ts +48 -3
- package/dist/scaffolds/notis-notes/package-lock.json +4636 -0
- package/dist/scaffolds/notis-notes/package.json +7 -3
- package/dist/scaffolds/notis-notes/packages/sdk/package.json +36 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/DocumentEditor.tsx +93 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/Markdown.tsx +60 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/MultiSelectActionBar.tsx +278 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/MultiSelectCheckbox.tsx +91 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/components/MultiSelectDragOverlay.tsx +39 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/config.ts +196 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/documents.ts +229 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useBackend.ts +41 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useDatabaseSchema.ts +85 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useDocument.ts +78 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useDocuments.ts +121 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useMultiSelect.ts +539 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useNotis.ts +34 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useNotisNavigation.ts +49 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useTool.ts +64 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useTools.ts +56 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useTopBarSearch.ts +73 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useUpsertDocument.ts +95 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/index.ts +83 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/provider.tsx +43 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/runtime.ts +220 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/styles.css +186 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/ui.ts +15 -0
- package/dist/scaffolds/notis-notes/packages/sdk/src/vite.ts +56 -0
- package/dist/scaffolds/notis-notes/packages/sdk/tsconfig.json +15 -0
- package/dist/scaffolds/notis-random/CHANGELOG.md +12 -2
- package/dist/scaffolds/notis-random/app/history/page.tsx +5 -4
- package/dist/scaffolds/notis-random/app/page.tsx +141 -74
- package/dist/scaffolds/notis-random/components/ui/button.tsx +50 -0
- package/dist/scaffolds/notis-random/components/ui/card.tsx +16 -0
- package/dist/scaffolds/notis-random/components/ui/input.tsx +23 -0
- package/dist/scaffolds/notis-random/lib/notis-tools.ts +26 -7
- package/dist/scaffolds/notis-random/lib/rng.ts +179 -19
- package/dist/scaffolds/notis-random/lib/roll-record.ts +103 -16
- package/dist/scaffolds/notis-random/metadata/screenshot-1.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-2.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-3.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-4.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-5.png +0 -0
- package/dist/scaffolds/notis-random/metadata/screenshot-fixtures.json +753 -0
- package/dist/scaffolds/notis-random/notis.config.ts +47 -3
- package/dist/scaffolds/notis-random/package-lock.json +4513 -0
- package/dist/scaffolds/notis-random/package.json +6 -2
- package/dist/scaffolds/notis-random/packages/sdk/package.json +36 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/components/DocumentEditor.tsx +93 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/components/Markdown.tsx +60 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/components/MultiSelectActionBar.tsx +278 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/components/MultiSelectCheckbox.tsx +91 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/components/MultiSelectDragOverlay.tsx +39 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/config.ts +196 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/documents.ts +229 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useBackend.ts +41 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useDatabaseSchema.ts +85 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useDocument.ts +78 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useDocuments.ts +121 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useMultiSelect.ts +539 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useNotis.ts +34 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useNotisNavigation.ts +49 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useTool.ts +64 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useTools.ts +56 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useTopBarSearch.ts +73 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useUpsertDocument.ts +95 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/index.ts +83 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/provider.tsx +43 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/runtime.ts +220 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/styles.css +186 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/ui.ts +15 -0
- package/dist/scaffolds/notis-random/packages/sdk/src/vite.ts +56 -0
- package/dist/scaffolds/notis-random/packages/sdk/tsconfig.json +15 -0
- package/dist/scaffolds/notis-random/tailwind.config.ts +8 -1
- package/dist/scaffolds.json +8 -17
- package/package.json +2 -1
- package/skills/notis-apps/SKILL.md +438 -144
- package/skills/notis-apps/cli.md +16 -1
- package/skills/notis-cli/SKILL.md +11 -4
- package/skills/notis-onboarding/BRIEF.md +93 -0
- package/skills/notis-query/cli.md +1 -1
- package/src/cli.js +50 -12
- package/src/command-specs/apps.js +309 -41
- package/src/command-specs/auth.js +107 -0
- package/src/command-specs/index.js +4 -0
- package/src/command-specs/meta.js +68 -6
- package/src/command-specs/onboarding.js +304 -0
- package/src/command-specs/tools.js +8 -4
- package/src/runtime/app-dev-server.js +3 -2
- package/src/runtime/app-dev-sessions.js +14 -40
- package/src/runtime/app-platform.js +65 -4
- package/src/runtime/desktop-auth.js +86 -17
- package/src/runtime/errors.js +1 -0
- package/src/runtime/oauth.js +1105 -0
- package/src/runtime/output.js +16 -2
- package/src/runtime/profiles.js +542 -18
- package/src/runtime/telemetry.js +92 -0
- package/src/runtime/transport.js +66 -11
- package/template/.harness/index.html.tmpl +30 -2
- package/template/packages/sdk/src/config.ts +38 -1
- package/dist/scaffolds/notis-affiliate-prospects/CHANGELOG.md +0 -7
- package/dist/scaffolds/notis-affiliate-prospects/README.md +0 -20
- package/dist/scaffolds/notis-affiliate-prospects/app/globals.css +0 -42
- package/dist/scaffolds/notis-affiliate-prospects/app/layout.tsx +0 -7
- package/dist/scaffolds/notis-affiliate-prospects/app/page.tsx +0 -248
- package/dist/scaffolds/notis-affiliate-prospects/app/prospects/page.tsx +0 -134
- package/dist/scaffolds/notis-affiliate-prospects/app/segments/page.tsx +0 -108
- package/dist/scaffolds/notis-affiliate-prospects/components/ui/card.tsx +0 -35
- package/dist/scaffolds/notis-affiliate-prospects/index.html +0 -12
- package/dist/scaffolds/notis-affiliate-prospects/lib/affiliate-data.ts +0 -218
- package/dist/scaffolds/notis-affiliate-prospects/lib/demo-prospects.ts +0 -52
- package/dist/scaffolds/notis-affiliate-prospects/lib/notis-tools.ts +0 -100
- package/dist/scaffolds/notis-affiliate-prospects/lib/utils.ts +0 -25
- package/dist/scaffolds/notis-affiliate-prospects/metadata/screenshot-1.png +0 -0
- package/dist/scaffolds/notis-affiliate-prospects/metadata/screenshot-2.png +0 -0
- package/dist/scaffolds/notis-affiliate-prospects/metadata/screenshot-3.png +0 -0
- package/dist/scaffolds/notis-affiliate-prospects/metadata/screenshot-fixtures.json +0 -187
- package/dist/scaffolds/notis-affiliate-prospects/notis.config.ts +0 -65
- package/dist/scaffolds/notis-affiliate-prospects/package.json +0 -32
- package/dist/scaffolds/notis-affiliate-prospects/packages/sdk/src/config.ts +0 -90
- package/dist/scaffolds/notis-affiliate-prospects/packages/sdk/src/hooks/useDatabase.ts +0 -76
- package/dist/scaffolds/notis-affiliate-prospects/packages/sdk/src/hooks/useUpsertDocument.ts +0 -50
- package/dist/scaffolds/notis-affiliate-prospects/packages/sdk/src/styles.css +0 -38
- package/dist/scaffolds/notis-affiliate-prospects/postcss.config.mjs +0 -6
- package/dist/scaffolds/notis-affiliate-prospects/src/dev-main.tsx +0 -72
- package/dist/scaffolds/notis-affiliate-prospects/src/mock-runtime.ts +0 -242
- package/dist/scaffolds/notis-affiliate-prospects/tailwind.config.ts +0 -51
- package/dist/scaffolds/notis-affiliate-prospects/tsconfig.json +0 -23
- package/dist/scaffolds/notis-affiliate-prospects/vite.config.ts +0 -11
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/components/MultiSelectCheckbox.tsx +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/components/MultiSelectDragOverlay.tsx +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/hooks/useBackend.ts +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/hooks/useNotis.ts +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/hooks/useNotisNavigation.ts +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/hooks/useTool.ts +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/hooks/useTools.ts +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/hooks/useTopBarSearch.ts +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/provider.tsx +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/ui.ts +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/src/vite.ts +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-database}/packages/sdk/tsconfig.json +0 -0
- /package/dist/scaffolds/{notis-affiliate-prospects → notis-random}/components.json +0 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Agent-first Notis CLI for apps and generic tool execution.
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
Use the Notis CLI through NPX
|
|
7
|
+
Use the Notis CLI through NPX; do not rely on an installed `notis` command. When Notis Desktop is signed in, its local credential remains the fastest path. On a server, container, or machine without Desktop, run `notis login` to authorize a scoped, revocable OAuth credential in the browser.
|
|
8
8
|
|
|
9
9
|
For CI, hosted agents, or internal scripts, pass a non-persisted token with `NOTIS_JWT=<token>`.
|
|
10
10
|
|
|
@@ -12,12 +12,13 @@ For CI, hosted agents, or internal scripts, pass a non-persisted token with `NOT
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npx --package @notis_ai/cli@latest -- notis --help
|
|
15
|
+
npx --package @notis_ai/cli@latest -- notis login
|
|
15
16
|
npx --package @notis_ai/cli@latest -- notis doctor
|
|
16
17
|
npx --package @notis_ai/cli@latest -- notis apps list
|
|
17
18
|
npx --package @notis_ai/cli@latest -- notis tools search "list Notis databases"
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
Credential precedence is worktree runtime, `NOTIS_JWT`, a valid Desktop credential, then OAuth. `notis logout` revokes and removes OAuth without signing Desktop out. Use `notis login --paste-code` for the HTTPS copy-paste fallback on a remote machine.
|
|
21
22
|
|
|
22
23
|
The CLI defaults to `json` output in agent or non-TTY contexts and `table` output in interactive terminals.
|
|
23
24
|
|
|
@@ -31,6 +32,44 @@ The CLI defaults to `json` output in agent or non-TTY contexts and `table` outpu
|
|
|
31
32
|
- `--timeout-ms <n>` — HTTP timeout in milliseconds
|
|
32
33
|
- `--idempotency-key <key>` — Override the generated idempotency key for mutating commands
|
|
33
34
|
|
|
35
|
+
## Authentication
|
|
36
|
+
|
|
37
|
+
### `npx --package @notis_ai/cli@latest -- notis login`
|
|
38
|
+
|
|
39
|
+
Authorize the Notis CLI in a browser with scoped OAuth access.
|
|
40
|
+
|
|
41
|
+
When to use: Use this on a machine where Notis Desktop is unavailable, signed out, or should not own CLI authentication.
|
|
42
|
+
|
|
43
|
+
Options:
|
|
44
|
+
- `--no-browser` — Print the authorization URL without opening a browser.
|
|
45
|
+
- `--print-url` — Print the authorization URL even when opening a browser.
|
|
46
|
+
- `--paste-code` — Use the copy-paste callback for SSH and headless machines.
|
|
47
|
+
- `--force` — Create an independent OAuth grant even when Desktop is signed in.
|
|
48
|
+
- `--timeout-seconds <n>` — How long to wait for authorization (default 300).
|
|
49
|
+
- `--scope <scope>` — OAuth permission to request (repeatable).
|
|
50
|
+
- `--code <code>` — Redeem the code shown in the browser after a non-interactive login.
|
|
51
|
+
|
|
52
|
+
Examples:
|
|
53
|
+
- `npx --package @notis_ai/cli@latest -- notis login`
|
|
54
|
+
- `npx --package @notis_ai/cli@latest -- notis login --no-browser --print-url`
|
|
55
|
+
- `npx --package @notis_ai/cli@latest -- notis login --paste-code`
|
|
56
|
+
- `npx --package @notis_ai/cli@latest -- notis login --code 4f3c2b1a`
|
|
57
|
+
- `npx --package @notis_ai/cli@latest -- notis login --force`
|
|
58
|
+
|
|
59
|
+
### `npx --package @notis_ai/cli@latest -- notis logout`
|
|
60
|
+
|
|
61
|
+
Revoke and remove the scoped OAuth credential for the active CLI profile.
|
|
62
|
+
|
|
63
|
+
When to use: Use this to disconnect the command line without signing Notis Desktop out.
|
|
64
|
+
|
|
65
|
+
Options:
|
|
66
|
+
- `--all-profiles` — Remove OAuth credentials from every CLI profile.
|
|
67
|
+
|
|
68
|
+
Examples:
|
|
69
|
+
- `npx --package @notis_ai/cli@latest -- notis logout`
|
|
70
|
+
- `npx --package @notis_ai/cli@latest -- notis logout --all-profiles`
|
|
71
|
+
|
|
72
|
+
|
|
34
73
|
## Apps
|
|
35
74
|
|
|
36
75
|
### `npx --package @notis_ai/cli@latest -- notis apps list`
|
|
@@ -200,6 +239,21 @@ Examples:
|
|
|
200
239
|
- `npx --package @notis_ai/cli@latest -- notis apps publish --confirm-ready`
|
|
201
240
|
- `npx --package @notis_ai/cli@latest -- notis apps publish ./my-app --confirm-ready`
|
|
202
241
|
|
|
242
|
+
### `npx --package @notis_ai/cli@latest -- notis apps duplicate [dir]`
|
|
243
|
+
|
|
244
|
+
Duplicate an app into an independent copy with its own databases.
|
|
245
|
+
|
|
246
|
+
When to use: When the same app should run for a second purpose - a notes app for blog drafts alongside one for bookmarks. The copy shares no data with the source.
|
|
247
|
+
|
|
248
|
+
Options:
|
|
249
|
+
- `--app-id <id>` — App to duplicate. Defaults to the app this project is linked to.
|
|
250
|
+
- `--name <name>` — Name for the duplicate (default: the source name followed by "copy").
|
|
251
|
+
- `--copy-documents <mode>` — Which rows to copy: 'declared' (default, the starter content a fresh install would have), 'all', or 'none'.
|
|
252
|
+
|
|
253
|
+
Examples:
|
|
254
|
+
- `npx --package @notis_ai/cli@latest -- notis apps duplicate --name "Blog"`
|
|
255
|
+
- `npx --package @notis_ai/cli@latest -- notis apps duplicate --app-id abc123 --name "Bookmarks" --copy-documents none`
|
|
256
|
+
|
|
203
257
|
### `npx --package @notis_ai/cli@latest -- notis apps doctor [dir]`
|
|
204
258
|
|
|
205
259
|
Check project health and readiness.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { useTool, useTopBarSearch } from '@notis/sdk';
|
|
4
|
+
import { normalizeDocumentRecord, useTool, useTopBarSearch } from '@notis/sdk';
|
|
5
5
|
import { WarningCircleIcon as AlertCircle, AtIcon as AtSign, CalendarIcon as Calendar, CheckSquareIcon as CheckSquare, CaretDownIcon as ChevronDown, CircleIcon as Circle, CircleIcon as CircleDot, DatabaseIcon as Database, FileTextIcon as FileText, HashIcon as Hash, LinkIcon as Link2, ListChecksIcon as ListChecks, CircleNotchIcon as Loader2, EnvelopeIcon as Mail, PaperclipIcon as Paperclip, PhoneIcon as Phone, SigmaIcon as Sigma, TagIcon as Tag, TextTIcon as Type, UserIcon as User } from '@phosphor-icons/react';
|
|
6
6
|
|
|
7
7
|
import { Badge } from '@/components/ui/badge';
|
|
@@ -326,10 +326,10 @@ export default function CatalogPage() {
|
|
|
326
326
|
if (activeTab !== 'documents') return;
|
|
327
327
|
if (!detail) return;
|
|
328
328
|
|
|
329
|
-
const
|
|
330
|
-
if (!
|
|
329
|
+
const databaseId = detail.id;
|
|
330
|
+
if (!databaseId) {
|
|
331
331
|
setDocuments([]);
|
|
332
|
-
setDocumentsError('This database does not have a
|
|
332
|
+
setDocumentsError('This database does not have a stable ID.');
|
|
333
333
|
setDocumentsLoading(false);
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
@@ -347,7 +347,7 @@ export default function CatalogPage() {
|
|
|
347
347
|
|
|
348
348
|
for (let page = 0; page < maxPages; page += 1) {
|
|
349
349
|
const result = await queryCall({
|
|
350
|
-
|
|
350
|
+
database_id: databaseId,
|
|
351
351
|
query: { page_size: pageSize },
|
|
352
352
|
offset,
|
|
353
353
|
});
|
|
@@ -357,7 +357,10 @@ export default function CatalogPage() {
|
|
|
357
357
|
throw new Error(result?.message || 'Failed to load documents.');
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
|
|
360
|
+
collected = [
|
|
361
|
+
...collected,
|
|
362
|
+
...(result.documents ?? []).map((document) => normalizeDocumentRecord(document)),
|
|
363
|
+
];
|
|
361
364
|
setDocuments(collected);
|
|
362
365
|
|
|
363
366
|
if (!result.has_more) return;
|
|
@@ -411,7 +414,10 @@ export default function CatalogPage() {
|
|
|
411
414
|
const propCount = nonRelationProps(detail).length;
|
|
412
415
|
|
|
413
416
|
return (
|
|
414
|
-
<div
|
|
417
|
+
<div
|
|
418
|
+
data-store-screenshot="catalog"
|
|
419
|
+
className="flex h-screen w-full overflow-hidden bg-background text-foreground antialiased"
|
|
420
|
+
>
|
|
415
421
|
<aside className="flex h-full w-[288px] flex-shrink-0 flex-col border-r border-border bg-background">
|
|
416
422
|
<div className="flex items-baseline justify-between gap-2 px-4 pb-3 pt-4">
|
|
417
423
|
<h1 className="text-lg font-semibold tracking-tight">Databases</h1>
|
|
@@ -691,6 +697,7 @@ function DetailHeader({
|
|
|
691
697
|
label="Properties"
|
|
692
698
|
count={propCount}
|
|
693
699
|
active={activeTab === 'properties'}
|
|
700
|
+
tab="properties"
|
|
694
701
|
onClick={() => onTabChange('properties')}
|
|
695
702
|
/>
|
|
696
703
|
<TabButton
|
|
@@ -698,6 +705,7 @@ function DetailHeader({
|
|
|
698
705
|
label="Relations"
|
|
699
706
|
count={relCount}
|
|
700
707
|
active={activeTab === 'relations'}
|
|
708
|
+
tab="relations"
|
|
701
709
|
onClick={() => onTabChange('relations')}
|
|
702
710
|
/>
|
|
703
711
|
<TabButton
|
|
@@ -705,6 +713,7 @@ function DetailHeader({
|
|
|
705
713
|
label="Documents"
|
|
706
714
|
count={docCount}
|
|
707
715
|
active={activeTab === 'documents'}
|
|
716
|
+
tab="documents"
|
|
708
717
|
onClick={() => onTabChange('documents')}
|
|
709
718
|
/>
|
|
710
719
|
</div>
|
|
@@ -717,17 +726,20 @@ function TabButton({
|
|
|
717
726
|
label,
|
|
718
727
|
count,
|
|
719
728
|
active,
|
|
729
|
+
tab,
|
|
720
730
|
onClick,
|
|
721
731
|
}: {
|
|
722
732
|
icon: React.ReactNode;
|
|
723
733
|
label: string;
|
|
724
734
|
count: number;
|
|
725
735
|
active: boolean;
|
|
736
|
+
tab: ActiveTab;
|
|
726
737
|
onClick: () => void;
|
|
727
738
|
}) {
|
|
728
739
|
return (
|
|
729
740
|
<button
|
|
730
741
|
type="button"
|
|
742
|
+
data-tab={tab}
|
|
731
743
|
onClick={onClick}
|
|
732
744
|
className={cn(
|
|
733
745
|
'flex items-center gap-1.5 px-3.5 py-1.5 text-[12.5px] transition-colors',
|
|
@@ -953,10 +965,10 @@ function DocumentsTable({
|
|
|
953
965
|
</div>
|
|
954
966
|
</TableCell>
|
|
955
967
|
<TableCell className="whitespace-nowrap text-muted-foreground">
|
|
956
|
-
{formatDateTime(document.
|
|
968
|
+
{formatDateTime(document.createdAt)}
|
|
957
969
|
</TableCell>
|
|
958
970
|
<TableCell className="whitespace-nowrap text-muted-foreground">
|
|
959
|
-
{formatDateTime(document.
|
|
971
|
+
{formatDateTime(document.lastEditedTime)}
|
|
960
972
|
</TableCell>
|
|
961
973
|
{properties.map((property) => {
|
|
962
974
|
const propertyName = property.name ?? property.id;
|
|
@@ -994,43 +1006,36 @@ function PropertyValue({
|
|
|
994
1006
|
property: DatabaseProperty;
|
|
995
1007
|
value: DocumentPropertyValue | undefined;
|
|
996
1008
|
}) {
|
|
997
|
-
if (
|
|
1009
|
+
if (value == null || value === '') return <MutedDash />;
|
|
998
1010
|
|
|
999
1011
|
switch (property.type) {
|
|
1000
1012
|
case 'title':
|
|
1001
|
-
return <TextValue value={textFromRichText(value.title)} />;
|
|
1002
1013
|
case 'rich_text':
|
|
1003
|
-
return <TextValue value={
|
|
1014
|
+
return <TextValue value={typeof value === 'string' ? value : stringifyFallback(value)} />;
|
|
1004
1015
|
case 'number':
|
|
1005
|
-
return <TextValue value={typeof value
|
|
1016
|
+
return <TextValue value={typeof value === 'number' ? compactNumber(value) : ''} />;
|
|
1006
1017
|
case 'select':
|
|
1007
|
-
case 'status':
|
|
1008
|
-
|
|
1009
|
-
if (!selected || typeof selected !== 'object') return <MutedDash />;
|
|
1010
|
-
const option = selected as { name?: string | null; color?: string | null };
|
|
1011
|
-
if (!option.name) return <MutedDash />;
|
|
1018
|
+
case 'status':
|
|
1019
|
+
if (typeof value !== 'string') return <MutedDash />;
|
|
1012
1020
|
return (
|
|
1013
|
-
<Badge variant="secondary" className=
|
|
1014
|
-
{
|
|
1021
|
+
<Badge variant="secondary" className="rounded-sm px-1.5 py-px">
|
|
1022
|
+
{value}
|
|
1015
1023
|
</Badge>
|
|
1016
1024
|
);
|
|
1017
|
-
}
|
|
1018
1025
|
case 'multi_select': {
|
|
1019
|
-
const options = Array.isArray(value
|
|
1026
|
+
const options = Array.isArray(value) ? value : [];
|
|
1020
1027
|
if (options.length === 0) return <MutedDash />;
|
|
1021
1028
|
return (
|
|
1022
1029
|
<div className="flex max-w-[240px] flex-wrap gap-1">
|
|
1023
1030
|
{options.map((option, index) => {
|
|
1024
|
-
const
|
|
1025
|
-
? option as { id?: string | null; name?: string | null; color?: string | null }
|
|
1026
|
-
: null;
|
|
1031
|
+
const label = typeof option === 'string' ? option : stringifyFallback(option);
|
|
1027
1032
|
return (
|
|
1028
1033
|
<Badge
|
|
1029
|
-
key={
|
|
1034
|
+
key={`${label}-${index}`}
|
|
1030
1035
|
variant="secondary"
|
|
1031
|
-
className=
|
|
1036
|
+
className="rounded-sm px-1.5 py-px"
|
|
1032
1037
|
>
|
|
1033
|
-
{
|
|
1038
|
+
{label || 'Untitled'}
|
|
1034
1039
|
</Badge>
|
|
1035
1040
|
);
|
|
1036
1041
|
})}
|
|
@@ -1038,25 +1043,17 @@ function PropertyValue({
|
|
|
1038
1043
|
);
|
|
1039
1044
|
}
|
|
1040
1045
|
case 'checkbox':
|
|
1041
|
-
return <TextValue value={value
|
|
1042
|
-
case 'date':
|
|
1043
|
-
|
|
1044
|
-
if (!date || typeof date !== 'object') return <MutedDash />;
|
|
1045
|
-
const range = date as { start?: string | null; end?: string | null };
|
|
1046
|
-
const start = formatDate(range.start);
|
|
1047
|
-
const end = range.end ? formatDate(range.end) : null;
|
|
1048
|
-
return <TextValue value={end ? `${start} – ${end}` : start} />;
|
|
1049
|
-
}
|
|
1046
|
+
return <TextValue value={value === true ? 'Yes' : 'No'} />;
|
|
1047
|
+
case 'date':
|
|
1048
|
+
return <TextValue value={typeof value === 'string' ? formatDate(value) : ''} />;
|
|
1050
1049
|
case 'url':
|
|
1051
1050
|
case 'email':
|
|
1052
1051
|
case 'phone_number':
|
|
1053
|
-
return <TextValue value={typeof value
|
|
1052
|
+
return <TextValue value={typeof value === 'string' ? value : ''} />;
|
|
1054
1053
|
case 'relation':
|
|
1055
|
-
return <TextValue value={relationLabel(value.relation, 'linked record')} />;
|
|
1056
1054
|
case 'people':
|
|
1057
|
-
return <TextValue value={relationLabel(value.people, 'person')} />;
|
|
1058
1055
|
case 'files':
|
|
1059
|
-
return <TextValue value={relationLabel(value.files
|
|
1056
|
+
return <TextValue value={relationLabel(value, property.type === 'people' ? 'person' : property.type === 'files' ? 'file' : 'linked record')} />;
|
|
1060
1057
|
default:
|
|
1061
1058
|
return <TextValue value={stringifyFallback(value)} />;
|
|
1062
1059
|
}
|
|
@@ -25,7 +25,8 @@ export type GetDatabaseArgs = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export type QueryDatabaseArgs = {
|
|
28
|
-
|
|
28
|
+
database_id?: string;
|
|
29
|
+
database_slug?: string;
|
|
29
30
|
query: {
|
|
30
31
|
page_size?: number;
|
|
31
32
|
};
|
|
@@ -105,10 +106,7 @@ export type GetDatabaseResult =
|
|
|
105
106
|
| { database: DatabaseDetail }
|
|
106
107
|
| { status: 'error'; message: string };
|
|
107
108
|
|
|
108
|
-
export type DocumentPropertyValue =
|
|
109
|
-
type?: string;
|
|
110
|
-
[key: string]: unknown;
|
|
111
|
-
};
|
|
109
|
+
export type DocumentPropertyValue = unknown;
|
|
112
110
|
|
|
113
111
|
export type DatabaseDocument = {
|
|
114
112
|
id: string;
|
|
@@ -116,8 +114,8 @@ export type DatabaseDocument = {
|
|
|
116
114
|
properties?: Record<string, DocumentPropertyValue>;
|
|
117
115
|
property_states?: Record<string, string>;
|
|
118
116
|
url?: string | null;
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
createdAt?: string | null;
|
|
118
|
+
lastEditedTime?: string | null;
|
|
121
119
|
icon?: string | null;
|
|
122
120
|
cover?: string | null;
|
|
123
121
|
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|