@notionhq/custom-blocks-dev-shell 0.1.113 → 0.1.115
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 +27 -14
- package/bin/cli.js +3 -1
- package/dist/assets/index-DXzPwq_J.js +11 -0
- package/dist/index.html +1 -1
- package/dist-cli/cli/binding-cli-flags.js +33 -0
- package/dist-cli/cli/binding-errors.js +15 -0
- package/dist-cli/{build-block-registry.js → cli/build-block-registry.js} +2 -0
- package/dist-cli/{convert-values.js → cli/convert-values.js} +5 -5
- package/dist-cli/{convert.js → cli/convert.js} +3 -3
- package/dist-cli/cli/data-source-files.js +6 -0
- package/dist-cli/{data-sources.js → cli/data-sources.js} +12 -65
- package/dist-cli/{dev-shell-launcher.js → cli/dev-shell-launcher.js} +23 -10
- package/dist-cli/{errors.js → cli/errors.js} +5 -1
- package/dist-cli/cli/launcher-bindings.js +144 -0
- package/dist-cli/{published-cli.js → cli/published-cli.js} +2 -2
- package/dist-cli/{worker-manifest.js → cli/worker-manifest.js} +18 -1
- package/dist-cli/protocol/contrast.d.ts +4 -0
- package/dist-cli/protocol/contrast.js +3 -0
- package/dist-cli/protocol/dataSources/dataSource.d.ts +786 -0
- package/dist-cli/protocol/dataSources/dataSource.js +66 -0
- package/dist-cli/protocol/dataSources/dataSourcePage.d.ts +74 -0
- package/dist-cli/protocol/dataSources/dataSourcePage.js +15 -0
- package/dist-cli/protocol/dataSources/dataSourceValue.d.ts +66 -0
- package/dist-cli/protocol/dataSources/dataSourceValue.js +14 -0
- package/dist-cli/protocol/dataSources/dateValue.d.ts +157 -0
- package/dist-cli/protocol/dataSources/dateValue.js +61 -0
- package/dist-cli/protocol/dataSources/errors.d.ts +8 -0
- package/dist-cli/protocol/dataSources/errors.js +7 -0
- package/dist-cli/protocol/dataSources/propertySchema.d.ts +200 -0
- package/dist-cli/protocol/dataSources/propertySchema.js +174 -0
- package/dist-cli/protocol/dataSources/recordPointer.d.ts +9 -0
- package/dist-cli/protocol/dataSources/recordPointer.js +8 -0
- package/dist-cli/protocol/dataSources/sortDirection.d.ts +3 -0
- package/dist-cli/protocol/dataSources/sortDirection.js +2 -0
- package/dist-cli/protocol/errors.d.ts +12 -0
- package/dist-cli/protocol/errors.js +6 -0
- package/dist-cli/protocol/ids.d.ts +31 -0
- package/dist-cli/protocol/ids.js +26 -0
- package/dist-cli/protocol/index.d.ts +53 -0
- package/dist-cli/protocol/index.js +53 -0
- package/dist-cli/protocol/manifest.d.ts +67 -0
- package/dist-cli/protocol/manifest.js +36 -0
- package/dist-cli/protocol/messages/connect.d.ts +54 -0
- package/dist-cli/protocol/messages/connect.js +39 -0
- package/dist-cli/protocol/messages/contrastModeChanged.d.ts +7 -0
- package/dist-cli/protocol/messages/contrastModeChanged.js +7 -0
- package/dist-cli/protocol/messages/createPage.d.ts +290 -0
- package/dist-cli/protocol/messages/createPage.js +51 -0
- package/dist-cli/protocol/messages/createPageResult.d.ts +897 -0
- package/dist-cli/protocol/messages/createPageResult.js +43 -0
- package/dist-cli/protocol/messages/currentUserChanged.d.ts +18 -0
- package/dist-cli/protocol/messages/currentUserChanged.js +9 -0
- package/dist-cli/protocol/messages/dataSourcesChanged.d.ts +157 -0
- package/dist-cli/protocol/messages/dataSourcesChanged.js +13 -0
- package/dist-cli/protocol/messages/getPage.d.ts +902 -0
- package/dist-cli/protocol/messages/getPage.js +48 -0
- package/dist-cli/protocol/messages/getUser.d.ts +44 -0
- package/dist-cli/protocol/messages/getUser.js +32 -0
- package/dist-cli/protocol/messages/hostToSandbox.d.ts +4385 -0
- package/dist-cli/protocol/messages/hostToSandbox.js +48 -0
- package/dist-cli/protocol/messages/incomingType.d.ts +9 -0
- package/dist-cli/protocol/messages/incomingType.js +17 -0
- package/dist-cli/protocol/messages/init.d.ts +273 -0
- package/dist-cli/protocol/messages/init.js +57 -0
- package/dist-cli/protocol/messages/initResult.d.ts +37 -0
- package/dist-cli/protocol/messages/initResult.js +29 -0
- package/dist-cli/protocol/messages/invalidHostMessage.d.ts +14 -0
- package/dist-cli/protocol/messages/invalidHostMessage.js +13 -0
- package/dist-cli/protocol/messages/invalidSandboxMessage.d.ts +14 -0
- package/dist-cli/protocol/messages/invalidSandboxMessage.js +13 -0
- package/dist-cli/protocol/messages/isInitHandshakeMessage.d.ts +4 -0
- package/dist-cli/protocol/messages/isInitHandshakeMessage.js +11 -0
- package/dist-cli/protocol/messages/listUsers.d.ts +52 -0
- package/dist-cli/protocol/messages/listUsers.js +33 -0
- package/dist-cli/protocol/messages/messagePayload.d.ts +19 -0
- package/dist-cli/protocol/messages/messagePayload.js +1 -0
- package/dist-cli/protocol/messages/openExternalUrl.d.ts +32 -0
- package/dist-cli/protocol/messages/openExternalUrl.js +26 -0
- package/dist-cli/protocol/messages/openPage.d.ts +38 -0
- package/dist-cli/protocol/messages/openPage.js +34 -0
- package/dist-cli/protocol/messages/pageChanged.d.ts +32 -0
- package/dist-cli/protocol/messages/pageChanged.js +9 -0
- package/dist-cli/protocol/messages/parentChanged.d.ts +26 -0
- package/dist-cli/protocol/messages/parentChanged.js +9 -0
- package/dist-cli/protocol/messages/queryDataSource.d.ts +1446 -0
- package/dist-cli/protocol/messages/queryDataSource.js +252 -0
- package/dist-cli/protocol/messages/queryDataSourceResult.d.ts +686 -0
- package/dist-cli/protocol/messages/queryDataSourceResult.js +44 -0
- package/dist-cli/protocol/messages/resize.d.ts +11 -0
- package/dist-cli/protocol/messages/resize.js +10 -0
- package/dist-cli/protocol/messages/sandboxToHost.d.ts +1091 -0
- package/dist-cli/protocol/messages/sandboxToHost.js +33 -0
- package/dist-cli/protocol/messages/themeChanged.d.ts +10 -0
- package/dist-cli/protocol/messages/themeChanged.js +10 -0
- package/dist-cli/protocol/messages/unsubscribeDataSourceQuery.d.ts +10 -0
- package/dist-cli/protocol/messages/unsubscribeDataSourceQuery.js +9 -0
- package/dist-cli/protocol/messages/updatePage.d.ts +271 -0
- package/dist-cli/protocol/messages/updatePage.js +23 -0
- package/dist-cli/protocol/messages/updatePageResult.d.ts +895 -0
- package/dist-cli/protocol/messages/updatePageResult.js +41 -0
- package/dist-cli/protocol/pages/page.d.ts +1422 -0
- package/dist-cli/protocol/pages/page.js +318 -0
- package/dist-cli/protocol/parent.d.ts +32 -0
- package/dist-cli/protocol/parent.js +13 -0
- package/dist-cli/protocol/protocolVersion.d.ts +8 -0
- package/dist-cli/protocol/protocolVersion.js +11 -0
- package/dist-cli/protocol/theme.d.ts +3 -0
- package/dist-cli/protocol/theme.js +2 -0
- package/dist-cli/protocol/users/user.d.ts +32 -0
- package/dist-cli/protocol/users/user.js +20 -0
- package/dist-cli/shared/block-registry.js +28 -0
- package/dist-cli/shared/data-source.js +22 -0
- package/dist-cli/shared/runtime-config.js +10 -0
- package/dist-cli/shared/sample-data-source.js +12 -0
- package/docs/bindings.md +79 -27
- package/package.json +5 -26
- package/dist/assets/index-DgQZ0zg6.js +0 -11
- package/dist-cli/date-value.js +0 -46
- package/dist-cli/resolve-bindings.js +0 -39
- package/dist-cli/source-bindings.js +0 -17
- /package/dist-cli/{block-csp.js → cli/block-csp.js} +0 -0
- /package/dist-cli/{dev-shell-run.js → cli/dev-shell-run.js} +0 -0
- /package/dist-cli/{materialize.js → cli/materialize.js} +0 -0
- /package/dist-cli/{ports.js → cli/ports.js} +0 -0
- /package/dist-cli/{prebuilt.js → cli/prebuilt.js} +0 -0
- /package/dist-cli/{runtime-error-client.js → cli/runtime-error-client.js} +0 -0
- /package/dist-cli/{serve-ui.js → cli/serve-ui.js} +0 -0
- /package/dist-cli/{shared-server.js → cli/shared-server.js} +0 -0
- /package/dist-cli/{utils.js → cli/utils.js} +0 -0
- /package/dist-cli/{vite-block-server.js → cli/vite-block-server.js} +0 -0
- /package/dist-cli/{vite-middleware.js → cli/vite-middleware.js} +0 -0
package/dist-cli/date-value.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
]);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** Validate explicit file selections before servers start. */
|
|
2
|
-
export function resolveLaunchBindings(blocks, sources, overrides) {
|
|
3
|
-
const targets = blocks.flatMap(block => Object.entries(block.config.manifest.dataSources).map(([slotKey]) => ({
|
|
4
|
-
blockKey: block.key,
|
|
5
|
-
slotKey,
|
|
6
|
-
target: `${block.key}.${slotKey}`,
|
|
7
|
-
})));
|
|
8
|
-
const explicit = validateOverrides(targets.map(candidate => candidate.target), sources, overrides);
|
|
9
|
-
const registryBindings = new Map();
|
|
10
|
-
for (const { blockKey, slotKey, target } of targets) {
|
|
11
|
-
const source = explicit.get(target);
|
|
12
|
-
if (source === undefined) {
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
const bindings = registryBindings.get(blockKey) ??
|
|
16
|
-
Object.create(null);
|
|
17
|
-
bindings[slotKey] = `${source.filename}.json`;
|
|
18
|
-
registryBindings.set(blockKey, bindings);
|
|
19
|
-
}
|
|
20
|
-
return { registryBindings };
|
|
21
|
-
}
|
|
22
|
-
function validateOverrides(targets, sources, overrides) {
|
|
23
|
-
const explicit = new Map();
|
|
24
|
-
for (const { target, filename } of overrides) {
|
|
25
|
-
const matches = targets.filter(candidate => candidate === target);
|
|
26
|
-
if (matches.length !== 1) {
|
|
27
|
-
throw new Error(`${matches.length === 0 ? "Unknown" : "Ambiguous"} binding target "${target}". Available targets: ${targets.join(", ") || "(none)"}.`);
|
|
28
|
-
}
|
|
29
|
-
if (explicit.has(target)) {
|
|
30
|
-
throw new Error(`Duplicate --bind target "${target}". Specify each target once.`);
|
|
31
|
-
}
|
|
32
|
-
const source = sources.find(candidate => `${candidate.filename}.json` === filename);
|
|
33
|
-
if (source === undefined) {
|
|
34
|
-
throw new Error(`Cannot bind ${target}: data/${filename} does not exist. Available files: ${sources.map(candidate => `${candidate.filename}.json`).join(", ") || "(none)"}.`);
|
|
35
|
-
}
|
|
36
|
-
explicit.set(target, source);
|
|
37
|
-
}
|
|
38
|
-
return explicit;
|
|
39
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function parseBindingOverride(value) {
|
|
2
|
-
const separator = value.indexOf("=");
|
|
3
|
-
const target = value.slice(0, separator);
|
|
4
|
-
const filename = value.slice(separator + 1);
|
|
5
|
-
const dot = target.indexOf(".");
|
|
6
|
-
if (separator < 0 ||
|
|
7
|
-
dot <= 0 ||
|
|
8
|
-
dot === target.length - 1 ||
|
|
9
|
-
target !== target.trim() ||
|
|
10
|
-
filename !== filename.trim() ||
|
|
11
|
-
!filename.endsWith(".json") ||
|
|
12
|
-
filename === ".json" ||
|
|
13
|
-
/[\\/\0]/.test(filename)) {
|
|
14
|
-
throw new Error("--bind requires <capabilityKey>.<dataSourceKey>=<sampleDataFileName.json>. Use a filename in data/.");
|
|
15
|
-
}
|
|
16
|
-
return { target, filename };
|
|
17
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|