@notionhq/custom-blocks-dev-shell 0.1.94 → 0.1.96
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/dist/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Workers local shell</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-CwNXVO6h.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-B6v5FUFk.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
+
import { localDateValueSchema } from "./date-value.js";
|
|
2
3
|
import { unreachable } from "./utils.js";
|
|
3
4
|
/**
|
|
4
5
|
* Convert one public API property value object to a local data source value.
|
|
@@ -170,31 +171,11 @@ const numberValue = v.pipe(v.number(), v.finite());
|
|
|
170
171
|
const booleanValue = v.boolean();
|
|
171
172
|
const stringArrayValue = v.array(v.string());
|
|
172
173
|
const pointerArrayValue = v.array(v.object({ id: v.string(), table: v.string() }));
|
|
173
|
-
const dateValue = v.variant("type", [
|
|
174
|
-
v.object({ type: v.literal("date"), start_date: v.string() }),
|
|
175
|
-
v.object({
|
|
176
|
-
type: v.literal("daterange"),
|
|
177
|
-
start_date: v.string(),
|
|
178
|
-
end_date: v.string(),
|
|
179
|
-
}),
|
|
180
|
-
v.object({
|
|
181
|
-
type: v.literal("datetime"),
|
|
182
|
-
start_date: v.string(),
|
|
183
|
-
start_time: v.string(),
|
|
184
|
-
}),
|
|
185
|
-
v.object({
|
|
186
|
-
type: v.literal("datetimerange"),
|
|
187
|
-
start_date: v.string(),
|
|
188
|
-
start_time: v.string(),
|
|
189
|
-
end_date: v.string(),
|
|
190
|
-
end_time: v.string(),
|
|
191
|
-
}),
|
|
192
|
-
]);
|
|
193
174
|
const anyLocalValue = v.union([
|
|
194
175
|
stringValue,
|
|
195
176
|
numberValue,
|
|
196
177
|
booleanValue,
|
|
197
|
-
|
|
178
|
+
localDateValueSchema,
|
|
198
179
|
stringArrayValue,
|
|
199
180
|
pointerArrayValue,
|
|
200
181
|
]);
|
|
@@ -217,9 +198,9 @@ const VALUE_SCHEMAS = {
|
|
|
217
198
|
number: numberValue,
|
|
218
199
|
checkbox: booleanValue,
|
|
219
200
|
multi_select: stringArrayValue,
|
|
220
|
-
date:
|
|
221
|
-
created_time:
|
|
222
|
-
last_edited_time:
|
|
201
|
+
date: localDateValueSchema,
|
|
202
|
+
created_time: localDateValueSchema,
|
|
203
|
+
last_edited_time: localDateValueSchema,
|
|
223
204
|
people: pointerArrayValue,
|
|
224
205
|
relation: pointerArrayValue,
|
|
225
206
|
created_by: pointerArrayValue,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
// The published CLI cannot import the private protocol package at runtime.
|
|
3
|
+
// Keep this schema aligned with protocol/src/dataSources/dateValue.ts.
|
|
4
|
+
const dateReminder = v.object({
|
|
5
|
+
unit: v.picklist(["year", "month", "week", "day"]),
|
|
6
|
+
value: v.number(),
|
|
7
|
+
time: v.string(),
|
|
8
|
+
defaultTimeZone: v.optional(v.string()),
|
|
9
|
+
});
|
|
10
|
+
const timeReminder = v.object({
|
|
11
|
+
unit: v.picklist(["hour", "minute"]),
|
|
12
|
+
value: v.number(),
|
|
13
|
+
});
|
|
14
|
+
const noReminder = v.object({ unit: v.literal("none") });
|
|
15
|
+
const dateOrNoReminder = v.optional(v.union([dateReminder, noReminder]));
|
|
16
|
+
const dateTimeOrNoReminder = v.optional(v.union([dateReminder, timeReminder, noReminder]));
|
|
17
|
+
/** Date values used by both the dev shell CLI and its browser binding editor. */
|
|
18
|
+
export const localDateValueSchema = v.variant("type", [
|
|
19
|
+
v.object({
|
|
20
|
+
type: v.literal("date"),
|
|
21
|
+
start_date: v.string(),
|
|
22
|
+
reminder: dateOrNoReminder,
|
|
23
|
+
}),
|
|
24
|
+
v.object({
|
|
25
|
+
type: v.literal("daterange"),
|
|
26
|
+
start_date: v.string(),
|
|
27
|
+
end_date: v.string(),
|
|
28
|
+
reminder: dateOrNoReminder,
|
|
29
|
+
}),
|
|
30
|
+
v.object({
|
|
31
|
+
type: v.literal("datetime"),
|
|
32
|
+
start_date: v.string(),
|
|
33
|
+
start_time: v.string(),
|
|
34
|
+
time_zone: v.optional(v.string()),
|
|
35
|
+
reminder: dateTimeOrNoReminder,
|
|
36
|
+
}),
|
|
37
|
+
v.object({
|
|
38
|
+
type: v.literal("datetimerange"),
|
|
39
|
+
start_date: v.string(),
|
|
40
|
+
start_time: v.string(),
|
|
41
|
+
end_date: v.string(),
|
|
42
|
+
end_time: v.string(),
|
|
43
|
+
time_zone: v.optional(v.string()),
|
|
44
|
+
reminder: dateTimeOrNoReminder,
|
|
45
|
+
}),
|
|
46
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notionhq/custom-blocks-dev-shell",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.96",
|
|
4
4
|
"description": "Local preview shell for Notion custom block workers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"typescript": "^7.0.2",
|
|
36
36
|
"vite": "^8.2.2",
|
|
37
37
|
"vitest": "^5.0.0",
|
|
38
|
-
"@notionhq/custom-blocks-host": "0.2.
|
|
38
|
+
"@notionhq/custom-blocks-host": "0.2.10",
|
|
39
39
|
"@notionhq/custom-blocks-protocol": "0.1.0"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|