deepspace 0.19.1 → 0.19.3
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/CHANGELOG.md +15 -0
- package/dist/cli.js +86 -21
- package/dist/cli.js.map +1 -1
- package/dist/feature-installer.js +14 -5
- package/dist/feature-installer.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -11
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/worker.d.ts +1 -1
- package/features/admin-page/feature.json +3 -4
- package/features/cron/feature.json +8 -5
- package/features/tasks/src/TasksPage.tsx +1 -1
- package/features/tasks/src/tasks-schema.ts +1 -1
- package/package.json +1 -1
- package/features/cron/src/cron.ts +0 -25
package/dist/schema.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ interface RolePermissions {
|
|
|
62
62
|
create: boolean;
|
|
63
63
|
update: PermissionLevel;
|
|
64
64
|
delete: PermissionLevel;
|
|
65
|
-
/** If set, only these columns can be updated by this role. */
|
|
65
|
+
/** If set, only these caller-supplied columns can be created or updated by this role. */
|
|
66
66
|
writableFields?: string[];
|
|
67
67
|
}
|
|
68
68
|
interface CollectionSchema {
|
package/dist/server.d.ts
CHANGED
|
@@ -423,7 +423,7 @@ interface RolePermissions {
|
|
|
423
423
|
create: boolean;
|
|
424
424
|
update: PermissionLevel;
|
|
425
425
|
delete: PermissionLevel;
|
|
426
|
-
/** If set, only these columns can be updated by this role. */
|
|
426
|
+
/** If set, only these caller-supplied columns can be created or updated by this role. */
|
|
427
427
|
writableFields?: string[];
|
|
428
428
|
}
|
|
429
429
|
interface CollectionSchema {
|
package/dist/worker.d.ts
CHANGED
|
@@ -1000,7 +1000,7 @@ interface RolePermissions {
|
|
|
1000
1000
|
create: boolean;
|
|
1001
1001
|
update: PermissionLevel;
|
|
1002
1002
|
delete: PermissionLevel;
|
|
1003
|
-
/** If set, only these columns can be updated by this role. */
|
|
1003
|
+
/** If set, only these caller-supplied columns can be created or updated by this role. */
|
|
1004
1004
|
writableFields?: string[];
|
|
1005
1005
|
}
|
|
1006
1006
|
interface CollectionSchema {
|
|
@@ -21,11 +21,10 @@
|
|
|
21
21
|
},
|
|
22
22
|
"route": {
|
|
23
23
|
"path": "/admin",
|
|
24
|
-
"protected": true
|
|
24
|
+
"protected": true,
|
|
25
|
+
"roles": ["admin"]
|
|
25
26
|
},
|
|
26
27
|
"requires": [],
|
|
27
|
-
"instructions": [
|
|
28
|
-
"This layers an admin-only /admin panel on top of the /settings page that every scaffold already ships (that shared src/schemas/admin-schema.ts is why it reports \"Exists (skipped)\" here). Add a nav entry for /admin; keep /settings for per-user settings."
|
|
29
|
-
],
|
|
28
|
+
"instructions": [],
|
|
30
29
|
"patterns": []
|
|
31
30
|
}
|
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
"description": "Scheduled background tasks via the per-app CronRoom DO",
|
|
6
6
|
"details": "Reference implementation of a working cron job. Registers a 1-minute 'heartbeat' task in src/cron.ts (consumed by AppCronRoom at construction time). Each fire is logged to the DO's cron_history table; /cron-log subscribes via useCronMonitor and renders live history. Useful both as a working example and as the basis for the cron e2e spec.",
|
|
7
7
|
"files": [
|
|
8
|
-
{
|
|
9
|
-
"src": "src/cron.ts",
|
|
10
|
-
"dest": "src/cron.ts"
|
|
11
|
-
},
|
|
12
8
|
{
|
|
13
9
|
"src": "src/CronLogPage.tsx",
|
|
14
10
|
"dest": "src/pages/cron-log.tsx"
|
|
@@ -19,10 +15,17 @@
|
|
|
19
15
|
"protected": false
|
|
20
16
|
},
|
|
21
17
|
"requires": [],
|
|
18
|
+
"code": [
|
|
19
|
+
{
|
|
20
|
+
"file": "src/cron.ts",
|
|
21
|
+
"marker": "export const tasks: CronTask[] = []",
|
|
22
|
+
"insert": "tasks.push({ name: 'heartbeat', intervalMinutes: 1 })"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
22
25
|
"instructions": [
|
|
23
26
|
"Deploy the app: npm run deploy",
|
|
24
27
|
"Within ~90s, visit /cron-log on the deployed app — you should see one new row per minute as the AppCronRoom alarm fires the heartbeat task.",
|
|
25
|
-
"Open the page on a desktop browser and
|
|
28
|
+
"Open the page on a desktop browser and inspect /ws/cron/<SCOPE_ID>, where SCOPE_ID is app:<APP_ID> from src/constants.ts; APP_ID is immutable, while APP_NAME is only the mutable URL label."
|
|
26
29
|
],
|
|
27
30
|
"patterns": [
|
|
28
31
|
"Task config lives in code (src/cron.ts), not JSON. AppCronRoom validates at construction time.",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Demonstrates:
|
|
5
5
|
* - 'unclaimed-or-own' permission for claimable tasks
|
|
6
|
-
* - writableFields for restricting which fields can be updated
|
|
6
|
+
* - writableFields for restricting which fields can be created or updated
|
|
7
7
|
* - timestampTrigger for automatic timestamps
|
|
8
8
|
* - Admin grading workflow
|
|
9
9
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A claimable task system demonstrating:
|
|
5
5
|
* - 'unclaimed-or-own' permission for claiming unclaimed items
|
|
6
|
-
* - writableFields for restricting which fields users can update
|
|
6
|
+
* - writableFields for restricting which fields users can create or update
|
|
7
7
|
* - timestampTrigger for automatic timestamp fields
|
|
8
8
|
* - Admin-only grading workflow
|
|
9
9
|
*/
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cron task definitions for the heartbeat reference feature.
|
|
3
|
-
*
|
|
4
|
-
* AppCronRoom (declared in worker.ts) reads `tasks` at construction time
|
|
5
|
-
* and validates them. The DO alarm fires `runTask(name, env)` on the
|
|
6
|
-
* configured schedule; each fire is recorded in the DO's `cron_history`
|
|
7
|
-
* table and pushed to subscribers over `/ws/cron/:roomId`.
|
|
8
|
-
*
|
|
9
|
-
* The heartbeat task here is the low-cost liveness probe used by both
|
|
10
|
-
* the cron e2e spec and as a quick sanity check after a deploy. To add
|
|
11
|
-
* your own task, append a {name, intervalMinutes} or {name, schedule,
|
|
12
|
-
* timezone} entry to `tasks` and dispatch on `name` inside `runTask`.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import type { CronTask } from 'deepspace/worker'
|
|
16
|
-
|
|
17
|
-
export const tasks: CronTask[] = [
|
|
18
|
-
{ name: 'heartbeat', intervalMinutes: 1 },
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
export async function runTask(_name: string, _env: unknown): Promise<void> {
|
|
22
|
-
// No-op work — the DO records every invocation in cron_history regardless,
|
|
23
|
-
// which is what the e2e spec asserts against. Real apps would dispatch on
|
|
24
|
-
// `_name` here and call into integrations / records via buildCronContext.
|
|
25
|
-
}
|