deepspace 0.10.0 → 0.10.2

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 (82) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{chunk-DQ4G6VL6.js → chunk-T7V4GUIN.js} +283 -180
  3. package/dist/chunk-T7V4GUIN.js.map +1 -0
  4. package/dist/cli.js +1010 -6123
  5. package/dist/cli.js.map +1 -1
  6. package/dist/documentation-client-core.d.ts +18 -0
  7. package/dist/{docs-client-core.js → documentation-client-core.js} +60 -51
  8. package/dist/documentation-client-core.js.map +1 -0
  9. package/dist/documentation-default-renderer.cjs +124 -0
  10. package/dist/documentation-react.d.ts +2 -0
  11. package/dist/{docs-react.js → documentation-react.js} +8 -8
  12. package/dist/documentation-runtime.js +71 -0
  13. package/dist/documentation-server-core.d.ts +11 -0
  14. package/dist/{docs-server-core.js → documentation-server-core.js} +13 -13
  15. package/dist/documentation-server-core.js.map +1 -0
  16. package/dist/documentation.d.ts +366 -0
  17. package/dist/documentation.js +3953 -0
  18. package/dist/documentation.js.map +1 -0
  19. package/dist/feature-installer.js +145 -0
  20. package/dist/feature-installer.js.map +1 -1
  21. package/dist/index.d.ts +6 -8
  22. package/dist/index.js +5 -15
  23. package/dist/index.js.map +1 -1
  24. package/dist/public-BGRX_Cjd.d.ts +234 -0
  25. package/dist/schema.d.ts +186 -0
  26. package/dist/schema.js +610 -0
  27. package/dist/schema.js.map +1 -0
  28. package/dist/server.d.ts +19 -167
  29. package/dist/server.js +76 -1069
  30. package/dist/server.js.map +1 -1
  31. package/dist/testing.d.ts +5 -8
  32. package/dist/testing.js +48 -14
  33. package/dist/testing.js.map +1 -1
  34. package/dist/worker.d.ts +52 -173
  35. package/dist/worker.js +563 -492
  36. package/dist/worker.js.map +1 -1
  37. package/features/admin-page/src/admin-schema.ts +1 -1
  38. package/features/ai-chat/feature.json +2 -2
  39. package/features/ai-chat/src/ChatPanel.tsx +0 -1
  40. package/features/ai-chat/src/ai-chat-schema.ts +1 -2
  41. package/features/canvas/src/canvas-schema.ts +1 -1
  42. package/features/documentation/content/index.mdx +14 -0
  43. package/features/documentation/content/quickstart.mdx +12 -0
  44. package/features/documentation/documentation.json +18 -0
  45. package/features/documentation/feature.json +68 -0
  46. package/features/{docs → documents}/feature.json +27 -27
  47. package/features/{docs/src/DocsEditorPage.tsx → documents/src/DocumentsEditorPage.tsx} +74 -74
  48. package/features/{docs/src/DocsListPage.tsx → documents/src/DocumentsListPage.tsx} +102 -102
  49. package/features/{docs/src/DocsOutlinePanel.tsx → documents/src/DocumentsOutlinePanel.tsx} +9 -9
  50. package/features/{docs/src/DocsPresence.tsx → documents/src/DocumentsPresence.tsx} +18 -18
  51. package/features/{docs → documents}/src/InviteDialog.tsx +21 -21
  52. package/features/{docs → documents}/src/LibrarySidebar.tsx +25 -25
  53. package/features/documents/src/__tests__/documents-presence-access.test.ts +71 -0
  54. package/features/{docs/src/docs-library-types.ts → documents/src/documents-library-types.ts} +3 -3
  55. package/features/{docs/src/docs-schema.ts → documents/src/documents-schema.ts} +6 -6
  56. package/features/{docs/src/docs-ui.css → documents/src/documents-ui.css} +89 -89
  57. package/features/{docs → documents}/src/editor/DocEditorSurface.tsx +11 -11
  58. package/features/{docs/src/editor/DocsTiptapToolbar.tsx → documents/src/editor/DocumentsTiptapToolbar.tsx} +21 -21
  59. package/features/{docs → documents}/src/editor/useDocEditor.ts +4 -4
  60. package/features/{docs/src/use-docs-presence-access.ts → documents/src/use-documents-presence-access.ts} +51 -51
  61. package/features/file-attachments/src/attachments-schema.ts +1 -1
  62. package/features/items/src/items-schema.ts +1 -1
  63. package/features/leaderboard/src/leaderboard-schema.ts +1 -1
  64. package/features/messaging/src/ChatMultiPage.tsx +1 -1
  65. package/features/messaging/src/ChatPage.tsx +1 -1
  66. package/features/messaging/src/messaging-schema.ts +2 -2
  67. package/features/tasks/src/tasks-schema.ts +1 -1
  68. package/features/testing/src/test-schema.ts +2 -2
  69. package/package.json +12 -7
  70. package/dist/chunk-DQ4G6VL6.js.map +0 -1
  71. package/dist/docs-client-core.d.ts +0 -18
  72. package/dist/docs-client-core.js.map +0 -1
  73. package/dist/docs-react.d.ts +0 -2
  74. package/dist/docs-runtime.js +0 -71
  75. package/dist/docs-server-core.d.ts +0 -11
  76. package/dist/docs-server-core.js.map +0 -1
  77. package/dist/docs.d.ts +0 -350
  78. package/dist/docs.js +0 -5139
  79. package/dist/docs.js.map +0 -1
  80. package/dist/public-Cp1X8ZQ3.d.ts +0 -230
  81. package/features/docs/src/__tests__/docs-presence-access.test.ts +0 -71
  82. /package/dist/{docs-react.js.map → documentation-react.js.map} +0 -0
@@ -0,0 +1,234 @@
1
+ import { ReactNode, ReactElement, ComponentType } from 'react';
2
+
3
+ type DocumentationAssistantAccess = 'disabled' | 'public' | 'authenticated';
4
+ type DocumentationMcpAccess = 'disabled' | 'public';
5
+ declare const DOCUMENTATION_CONTEXTUAL_ACTIONS: readonly ["copy", "view", "assistant", "chatgpt", "claude", "mcp", "add-mcp", "cursor", "vscode"];
6
+ type DocumentationContextualAction = (typeof DOCUMENTATION_CONTEXTUAL_ACTIONS)[number];
7
+ interface DocumentationFontConfig {
8
+ family: string;
9
+ weight?: number | string;
10
+ source?: string;
11
+ format?: string;
12
+ }
13
+ interface DocumentationThemeConfig {
14
+ preset?: string;
15
+ accent?: string;
16
+ background?: string;
17
+ backgroundDark?: string;
18
+ backgroundDecoration?: 'none' | 'gradient' | 'grid';
19
+ bodyFont?: DocumentationFontConfig;
20
+ headingFont?: DocumentationFontConfig;
21
+ monoFont?: DocumentationFontConfig;
22
+ codeBlockMode?: 'dark' | 'system';
23
+ eyebrowStyle?: 'section' | 'breadcrumbs' | 'none';
24
+ logo?: string;
25
+ logoDark?: string;
26
+ logoHref?: string;
27
+ favicon?: string;
28
+ defaultMode?: 'light' | 'dark' | 'system';
29
+ strictMode?: boolean;
30
+ }
31
+ interface DocumentationLinkConfig {
32
+ label: string;
33
+ href: string;
34
+ }
35
+ interface DocumentationNavGroup {
36
+ group: string;
37
+ pages: DocumentationNavigationItem[];
38
+ }
39
+ type DocumentationNavigationItem = string | DocumentationLinkConfig | DocumentationNavGroup;
40
+ declare const DOCUMENTATION_OPENAPI_SAMPLE_LANGUAGES: readonly ["curl", "javascript", "python", "go"];
41
+ type DocumentationOpenApiSampleLanguage = (typeof DOCUMENTATION_OPENAPI_SAMPLE_LANGUAGES)[number];
42
+ type DocumentationOpenApiSampleDefaults = 'required' | 'all';
43
+ interface DocumentationOpenApiExamplesConfig {
44
+ languages: DocumentationOpenApiSampleLanguage[];
45
+ defaults: DocumentationOpenApiSampleDefaults;
46
+ autogenerate: boolean;
47
+ }
48
+ interface DocumentationOpenApiConfig {
49
+ source: string;
50
+ route?: string;
51
+ label?: string;
52
+ playground?: boolean;
53
+ baseUrl?: string;
54
+ examples?: DocumentationOpenApiExamplesConfig;
55
+ }
56
+ interface DocumentationAssistantConfig {
57
+ access: DocumentationAssistantAccess;
58
+ model?: string;
59
+ suggestions?: string[];
60
+ }
61
+ interface DocumentationMcpConfig {
62
+ access: DocumentationMcpAccess;
63
+ }
64
+ interface DocumentationContextualConfig {
65
+ actions: DocumentationContextualAction[];
66
+ }
67
+ interface DocumentationSeoConfig {
68
+ noindex?: boolean;
69
+ ogImage?: string;
70
+ metaTags?: Record<string, string>;
71
+ }
72
+ interface DocumentationConfig {
73
+ $schema?: string;
74
+ name: string;
75
+ description?: string;
76
+ source: string;
77
+ output: string;
78
+ url?: string;
79
+ /** Explicit custom hostnames that mount this documentation at `/`. */
80
+ domains: string[];
81
+ theme: DocumentationThemeConfig;
82
+ navigation?: DocumentationNavigationItem[];
83
+ links: DocumentationLinkConfig[];
84
+ footer: DocumentationLinkConfig[];
85
+ redirects: Record<string, string>;
86
+ openapi: DocumentationOpenApiConfig[];
87
+ assistant: DocumentationAssistantConfig;
88
+ mcp: DocumentationMcpConfig;
89
+ contextual: DocumentationContextualConfig;
90
+ seo: DocumentationSeoConfig;
91
+ }
92
+ interface DocumentationHeading {
93
+ depth: number;
94
+ id: string;
95
+ text: string;
96
+ }
97
+ interface DocumentationPage {
98
+ sourcePath: string;
99
+ relativePath: string;
100
+ route: string;
101
+ title: string;
102
+ description?: string;
103
+ hidden: boolean;
104
+ noindex: boolean;
105
+ markdown: string;
106
+ html: string;
107
+ text: string;
108
+ headings: DocumentationHeading[];
109
+ sourceFormat: 'markdown' | 'mdx' | 'generated';
110
+ kind: 'page' | 'openapi';
111
+ openapi?: DocumentationOpenApiOperation;
112
+ }
113
+ interface DocumentationNavigationPage {
114
+ kind: 'page';
115
+ route: string;
116
+ label: string;
117
+ }
118
+ interface DocumentationNavigationLink {
119
+ kind: 'link';
120
+ href: string;
121
+ label: string;
122
+ }
123
+ interface DocumentationNavigationGroup {
124
+ kind: 'group';
125
+ label: string;
126
+ items: DocumentationNavigationNode[];
127
+ }
128
+ type DocumentationNavigationNode = DocumentationNavigationPage | DocumentationNavigationLink | DocumentationNavigationGroup;
129
+ interface DocumentationOpenApiParameter {
130
+ name: string;
131
+ in: string;
132
+ required: boolean;
133
+ description?: string;
134
+ schema?: unknown;
135
+ example?: unknown;
136
+ }
137
+ interface DocumentationOpenApiResponse {
138
+ status: string;
139
+ description: string;
140
+ schema?: unknown;
141
+ }
142
+ interface DocumentationOpenApiCodeSample {
143
+ language: string;
144
+ label: string;
145
+ syntax: string;
146
+ code: string;
147
+ generated: boolean;
148
+ }
149
+ interface DocumentationOpenApiOperation {
150
+ method: string;
151
+ path: string;
152
+ operationId: string;
153
+ summary: string;
154
+ description?: string;
155
+ tags: string[];
156
+ parameters: DocumentationOpenApiParameter[];
157
+ requestBody?: unknown;
158
+ responses: DocumentationOpenApiResponse[];
159
+ security?: unknown;
160
+ baseUrl?: string;
161
+ playground: boolean;
162
+ codeSamples: DocumentationOpenApiCodeSample[];
163
+ }
164
+ interface DocumentationRuntimePageLink {
165
+ route: string;
166
+ title: string;
167
+ }
168
+ interface DocumentationRuntimePage {
169
+ route: string;
170
+ title: string;
171
+ description?: string;
172
+ html: string;
173
+ headings: DocumentationHeading[];
174
+ kind: DocumentationPage['kind'];
175
+ markdownUrl: string;
176
+ openapi?: DocumentationOpenApiOperation;
177
+ }
178
+ interface DocumentationRuntimeData {
179
+ /** Public mount (`/docs` on an app host, empty on an explicit documentation domain). */
180
+ basePath: string;
181
+ config: Pick<DocumentationConfig, 'name' | 'description' | 'theme' | 'links' | 'footer' | 'assistant' | 'mcp' | 'contextual'>;
182
+ page: DocumentationRuntimePage;
183
+ navigation: DocumentationNavigationNode[];
184
+ breadcrumbs: string[];
185
+ previous?: DocumentationRuntimePageLink;
186
+ next?: DocumentationRuntimePageLink;
187
+ }
188
+
189
+ interface DocumentationAppProps {
190
+ data: DocumentationRuntimeData;
191
+ /** Rendered page body. Omit children to use the compiler's static HTML. */
192
+ children?: ReactNode;
193
+ navigating?: boolean;
194
+ onNavigate?: (href: string) => void;
195
+ onPrefetch?: (href: string) => void;
196
+ }
197
+ declare function DocumentationApp({ data, children, navigating, onNavigate, }: DocumentationAppProps): ReactElement;
198
+
199
+ interface TitledProps {
200
+ children?: ReactNode;
201
+ label?: string;
202
+ title?: string;
203
+ }
204
+ declare function Note(props: TitledProps): ReactElement;
205
+ declare function Tip(props: TitledProps): ReactElement;
206
+ declare function Warning(props: TitledProps): ReactElement;
207
+ declare function Info(props: TitledProps): ReactElement;
208
+ declare function Card({ children, href, label, title }: TitledProps & {
209
+ href?: string;
210
+ }): ReactElement;
211
+ declare function Accordion({ children, label, title }: TitledProps): ReactElement;
212
+ declare function AccordionGroup({ children }: TitledProps): ReactElement;
213
+ declare function Step({ children, label, title }: TitledProps): ReactElement;
214
+ declare function Steps({ children }: TitledProps): ReactElement;
215
+ declare function Tab({ children, label, title }: TitledProps): ReactElement;
216
+ declare function Tabs({ children }: TitledProps): ReactElement;
217
+ declare function CodeGroup({ children, label, title }: TitledProps): ReactElement;
218
+
219
+ type DocumentationPageComponent = ComponentType<{
220
+ components?: Record<string, ComponentType<never>>;
221
+ }>;
222
+ interface DocumentationSiteProps extends DocumentationAppProps {
223
+ /** The current compiled Markdown or MDX page. */
224
+ children: ReactNode;
225
+ }
226
+ type DocumentationSiteComponent = ComponentType<DocumentationSiteProps>;
227
+ /** The polished SDK-owned documentation shell. */
228
+ declare const DefaultDocumentation: typeof DocumentationApp;
229
+ declare function DocumentationContent({ data, Page, }: {
230
+ data: DocumentationRuntimeData;
231
+ Page?: DocumentationPageComponent;
232
+ }): ReactElement;
233
+
234
+ export { Accordion as A, Card as C, type DocumentationRuntimeData as D, Info as I, Note as N, Step as S, Tab as T, Warning as W, type DocumentationPageComponent as a, type DocumentationSiteComponent as b, AccordionGroup as c, CodeGroup as d, DefaultDocumentation as e, DocumentationApp as f, type DocumentationAppProps as g, DocumentationContent as h, type DocumentationSiteProps as i, Steps as j, Tabs as k, Tip as l };
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Shared type definitions for the DeepSpace SDK
3
+ *
4
+ * Types used by both client-side SDK and server-side workers.
5
+ */
6
+ type ColumnInterpretation = {
7
+ kind: 'plain';
8
+ } | {
9
+ kind: 'currency';
10
+ symbol: string;
11
+ decimals: number;
12
+ } | {
13
+ kind: 'date';
14
+ format?: string;
15
+ } | {
16
+ kind: 'datetime';
17
+ format?: string;
18
+ } | {
19
+ kind: 'boolean';
20
+ trueLabel?: string;
21
+ falseLabel?: string;
22
+ } | {
23
+ kind: 'percent';
24
+ decimals?: number;
25
+ } | {
26
+ kind: 'select';
27
+ options: string[];
28
+ } | {
29
+ kind: 'multiselect';
30
+ options: string[];
31
+ } | {
32
+ kind: 'url';
33
+ } | {
34
+ kind: 'email';
35
+ } | {
36
+ kind: 'json';
37
+ } | {
38
+ kind: 'reference';
39
+ targetTable: string;
40
+ displayColumn: string;
41
+ };
42
+ interface ColumnDefinition {
43
+ /** Stable ID override (survives renames). Falls back to `col_{name}`. */
44
+ id?: string;
45
+ name: string;
46
+ storage: 'number' | 'text';
47
+ interpretation: ColumnInterpretation | string;
48
+ expression?: string;
49
+ userBound?: boolean;
50
+ immutable?: boolean;
51
+ required?: boolean;
52
+ default?: unknown;
53
+ timestampTrigger?: {
54
+ field: string;
55
+ value?: unknown;
56
+ };
57
+ }
58
+ type PermissionLevel = boolean | 'own' | 'unclaimed-or-own' | 'collaborator' | 'team' | 'access' | 'published' | 'shared';
59
+ interface RolePermissions {
60
+ read: PermissionLevel;
61
+ /** Create has no existing record to evaluate, so it is an explicit grant. */
62
+ create: boolean;
63
+ update: PermissionLevel;
64
+ delete: PermissionLevel;
65
+ /** If set, only these columns can be updated by this role. */
66
+ writableFields?: string[];
67
+ }
68
+ interface CollectionSchema {
69
+ name: string;
70
+ /** Every collection is stored in typed SQL columns. */
71
+ columns: ColumnDefinition[];
72
+ /** Composite uniqueness constraint (for example `['userId', 'taskId']`). */
73
+ uniqueOn?: string[];
74
+ /** Ownership column; defaults to the row creator. */
75
+ ownerField?: string;
76
+ /** Column containing a JSON array of collaborator user ids. */
77
+ collaboratorsField?: string;
78
+ /** Column containing the team id used by team permission rules. */
79
+ teamField?: string;
80
+ /** A string is public when equal to `public`; an object supplies an exact value. */
81
+ visibilityField?: string | {
82
+ field: string;
83
+ value: unknown;
84
+ };
85
+ /** Permissions per role; `*` is the catch-all role. */
86
+ permissions: Record<string, RolePermissions>;
87
+ /** Default role assigned on the `users` collection. */
88
+ defaultRole?: string;
89
+ }
90
+
91
+ /**
92
+ * Collection Schema Definitions & Validation
93
+ *
94
+ * All collections use typed SQL columns. No document-mode / fields-based storage.
95
+ */
96
+
97
+ /** Standard user columns. Apps spread these into their users schema. */
98
+ declare const USERS_COLUMNS: ColumnDefinition[];
99
+ declare const BASE_USERS_SCHEMA: CollectionSchema;
100
+
101
+ /**
102
+ * AI Chat Schemas
103
+ *
104
+ * Pre-built collection schemas for DO-backed AI chat history.
105
+ * The worker is the only writer; the client reads via `useQuery`.
106
+ */
107
+
108
+ declare const AI_CHATS_SCHEMA: CollectionSchema;
109
+ declare const AI_MESSAGES_SCHEMA: CollectionSchema;
110
+
111
+ /**
112
+ * Messaging Schemas
113
+ *
114
+ * Pre-built collection schemas for messaging functionality.
115
+ * Any app can import these to add channels, messages, reactions, etc.
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * import { CHANNELS_SCHEMA, MESSAGES_SCHEMA, REACTIONS_SCHEMA } from 'deepspace/worker'
120
+ * export const schemas = [usersSchema, CHANNELS_SCHEMA, MESSAGES_SCHEMA, REACTIONS_SCHEMA]
121
+ * ```
122
+ */
123
+
124
+ declare const CHANNELS_SCHEMA: CollectionSchema;
125
+ declare const MESSAGES_SCHEMA: CollectionSchema;
126
+ declare const REACTIONS_SCHEMA: CollectionSchema;
127
+ declare const CHANNEL_MEMBERS_SCHEMA: CollectionSchema;
128
+ declare const CHANNEL_INVITATIONS_SCHEMA: CollectionSchema;
129
+ declare const READ_RECEIPTS_SCHEMA: CollectionSchema;
130
+
131
+ /**
132
+ * Shared conversation schemas for RecordRoom-based conversations.
133
+ *
134
+ * These define the collections inside a per-conversation RecordRoom DO.
135
+ * Used by apps that have messaging/conversation features (slack-clone,
136
+ * helpdesk, mail, reddit-clone, etc.).
137
+ *
138
+ * Each conversation gets its own RecordRoom DO keyed by `conv:{id}`.
139
+ */
140
+
141
+ declare const CONVERSATION_SCHEMAS: CollectionSchema[];
142
+ /**
143
+ * Voting schemas for Reddit-style apps.
144
+ * Add these alongside CONVERSATION_SCHEMAS for apps that need voting.
145
+ */
146
+ declare const VOTING_SCHEMAS: CollectionSchema[];
147
+
148
+ /**
149
+ * Directory DO Schemas
150
+ *
151
+ * Purpose-built collections for the `dir:{appName}` global DO type.
152
+ * This is the cross-app-visible directory layer — any app can subscribe
153
+ * to another app's directory in real-time via SHARED_CONNECTIONS.
154
+ *
155
+ * Five collections covering all standard communication/social patterns:
156
+ * - conversations: channels, DMs, email threads, support chats
157
+ * - conversation_state: per-user metadata (read cursor, stars, labels, folders)
158
+ * - communities: groups, forums, boards, projects
159
+ * - memberships: user membership in communities
160
+ * - posts: feed items, tweets, Q&A questions, announcements
161
+ *
162
+ * Domain-specific data (tickets, CRM, procurement) stays in app DOs.
163
+ * Message content stays in conv:{id} DOs (CONVERSATION_SCHEMAS).
164
+ */
165
+
166
+ /** All directory schemas for the `dir:{appName}` global DO type. */
167
+ declare const DIRECTORY_SCHEMAS: CollectionSchema[];
168
+
169
+ /**
170
+ * Workspace DO Schemas
171
+ *
172
+ * All collections for the workspace:default Durable Object.
173
+ * This DO consolidates shared, cross-app business data:
174
+ *
175
+ * - teams / team_members — workspace-wide team management (replaces built-in teams)
176
+ * - tasks / projects / tags — team-scoped task management
177
+ * - people — shared contacts directory
178
+ * - transactions / accounts — shared financial ledger
179
+ *
180
+ * Team-scoped collections use teamField RBAC: members see only
181
+ * their team's records; admins see everything.
182
+ */
183
+
184
+ declare const WORKSPACE_SCHEMAS: CollectionSchema[];
185
+
186
+ export { AI_CHATS_SCHEMA, AI_MESSAGES_SCHEMA, BASE_USERS_SCHEMA, CHANNELS_SCHEMA, CHANNEL_INVITATIONS_SCHEMA, CHANNEL_MEMBERS_SCHEMA, CONVERSATION_SCHEMAS, type CollectionSchema, type ColumnDefinition, type ColumnInterpretation, DIRECTORY_SCHEMAS, MESSAGES_SCHEMA, type PermissionLevel, REACTIONS_SCHEMA, READ_RECEIPTS_SCHEMA, type RolePermissions, USERS_COLUMNS, VOTING_SCHEMAS, WORKSPACE_SCHEMAS };