@digital-gravy/etch-public-api 0.3.4 → 0.6.0
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.d.cts +69 -1
- package/dist/index.d.ts +69 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1141,6 +1141,59 @@ interface EtchHistoryApi {
|
|
|
1141
1141
|
canRedo(): boolean;
|
|
1142
1142
|
}
|
|
1143
1143
|
|
|
1144
|
+
/**
|
|
1145
|
+
* Live bridge connection — lets an external tool (an IDE, a script runner, an AI
|
|
1146
|
+
* agent) drive this Etch instance from outside the page over a WebSocket.
|
|
1147
|
+
*
|
|
1148
|
+
* Calling `window.etch.connectAs(name)` from the builder console opens a
|
|
1149
|
+
* connection to a local bridge server and registers this instance under `name`.
|
|
1150
|
+
* Because the name travels to the server, one server can hold connections to
|
|
1151
|
+
* several Etch tabs at once and address each by name. The server then pushes JS
|
|
1152
|
+
* to evaluate in the page; the page streams console output and the return value
|
|
1153
|
+
* back.
|
|
1154
|
+
*
|
|
1155
|
+
* This is the inverse of Chrome remote debugging: the browser dials out to the
|
|
1156
|
+
* tool, instead of the tool attaching to the browser's debug port. Console-run
|
|
1157
|
+
* code is exempt from the page's CSP, so the connection works even on
|
|
1158
|
+
* locked-down pages.
|
|
1159
|
+
*/
|
|
1160
|
+
/** Options for {@link Etch.connectAs} / `etch.connectAs`. */
|
|
1161
|
+
interface BridgeConnectOptions {
|
|
1162
|
+
/**
|
|
1163
|
+
* Full WebSocket endpoint of the bridge server. Defaults to
|
|
1164
|
+
* `ws://127.0.0.1:7331`. Set this to target a different host/port or a
|
|
1165
|
+
* `wss://` endpoint.
|
|
1166
|
+
*/
|
|
1167
|
+
url?: string;
|
|
1168
|
+
/**
|
|
1169
|
+
* Shorthand for a localhost endpoint on a custom port
|
|
1170
|
+
* (`ws://127.0.0.1:<port>`). Ignored when {@link url} is provided.
|
|
1171
|
+
*/
|
|
1172
|
+
port?: number;
|
|
1173
|
+
/**
|
|
1174
|
+
* Extra identifying metadata sent to the server alongside the name (e.g. a
|
|
1175
|
+
* project id or environment label), so the tool can group or disambiguate
|
|
1176
|
+
* tabs beyond the name alone.
|
|
1177
|
+
*/
|
|
1178
|
+
meta?: Record<string, unknown>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Reconnect automatically (with backoff) when the socket drops. Default
|
|
1181
|
+
* `true`.
|
|
1182
|
+
*/
|
|
1183
|
+
reconnect?: boolean;
|
|
1184
|
+
}
|
|
1185
|
+
/** Handle to a live bridge connection returned by `etch.connectAs`. */
|
|
1186
|
+
interface EtchBridgeConnection {
|
|
1187
|
+
/** The name this instance registered under — how the tool addresses it. */
|
|
1188
|
+
readonly name: string;
|
|
1189
|
+
/** The resolved WebSocket endpoint the connection targets. */
|
|
1190
|
+
readonly url: string;
|
|
1191
|
+
/** Whether the socket is currently open. */
|
|
1192
|
+
readonly connected: boolean;
|
|
1193
|
+
/** Close the connection and stop reconnecting. */
|
|
1194
|
+
close(): void;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1144
1197
|
/**
|
|
1145
1198
|
* The root {@link Etch} interface exposed on `window.etch`, tying every API
|
|
1146
1199
|
* namespace together, plus connection/versioning options.
|
|
@@ -1189,6 +1242,21 @@ interface Etch {
|
|
|
1189
1242
|
history: EtchHistoryApi;
|
|
1190
1243
|
/** Persist everything (blocks, loops, styles, UI). */
|
|
1191
1244
|
saveAsync(): Promise<void>;
|
|
1245
|
+
/**
|
|
1246
|
+
* Open a live bridge connection to a local tooling server (an IDE, a script
|
|
1247
|
+
* runner, an AI agent) and register this instance under `name`, so one server
|
|
1248
|
+
* can drive several Etch tabs at once and tell them apart by name. Returns a
|
|
1249
|
+
* handle; call again with a different name/endpoint to open more connections.
|
|
1250
|
+
*
|
|
1251
|
+
* @example
|
|
1252
|
+
* ```js
|
|
1253
|
+
* // In the builder console:
|
|
1254
|
+
* const conn = etch.connectAs('homepage');
|
|
1255
|
+
* // …the tool can now evaluate code in this tab; later:
|
|
1256
|
+
* conn.close();
|
|
1257
|
+
* ```
|
|
1258
|
+
*/
|
|
1259
|
+
connectAs(name: string, options?: BridgeConnectOptions): EtchBridgeConnection;
|
|
1192
1260
|
/**
|
|
1193
1261
|
* Negotiate a version-pinned API instance. **Reserved** — not implemented by
|
|
1194
1262
|
* `0.x` runtimes. When present on a future stable runtime, it returns an
|
|
@@ -1267,4 +1335,4 @@ declare function isEtchApiError(value: unknown): value is EtchApiError;
|
|
|
1267
1335
|
*/
|
|
1268
1336
|
declare const ETCH_API_VERSION = "0.x";
|
|
1269
1337
|
|
|
1270
|
-
export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
|
|
1338
|
+
export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type BridgeConnectOptions, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchBridgeConnection, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
|
package/dist/index.d.ts
CHANGED
|
@@ -1141,6 +1141,59 @@ interface EtchHistoryApi {
|
|
|
1141
1141
|
canRedo(): boolean;
|
|
1142
1142
|
}
|
|
1143
1143
|
|
|
1144
|
+
/**
|
|
1145
|
+
* Live bridge connection — lets an external tool (an IDE, a script runner, an AI
|
|
1146
|
+
* agent) drive this Etch instance from outside the page over a WebSocket.
|
|
1147
|
+
*
|
|
1148
|
+
* Calling `window.etch.connectAs(name)` from the builder console opens a
|
|
1149
|
+
* connection to a local bridge server and registers this instance under `name`.
|
|
1150
|
+
* Because the name travels to the server, one server can hold connections to
|
|
1151
|
+
* several Etch tabs at once and address each by name. The server then pushes JS
|
|
1152
|
+
* to evaluate in the page; the page streams console output and the return value
|
|
1153
|
+
* back.
|
|
1154
|
+
*
|
|
1155
|
+
* This is the inverse of Chrome remote debugging: the browser dials out to the
|
|
1156
|
+
* tool, instead of the tool attaching to the browser's debug port. Console-run
|
|
1157
|
+
* code is exempt from the page's CSP, so the connection works even on
|
|
1158
|
+
* locked-down pages.
|
|
1159
|
+
*/
|
|
1160
|
+
/** Options for {@link Etch.connectAs} / `etch.connectAs`. */
|
|
1161
|
+
interface BridgeConnectOptions {
|
|
1162
|
+
/**
|
|
1163
|
+
* Full WebSocket endpoint of the bridge server. Defaults to
|
|
1164
|
+
* `ws://127.0.0.1:7331`. Set this to target a different host/port or a
|
|
1165
|
+
* `wss://` endpoint.
|
|
1166
|
+
*/
|
|
1167
|
+
url?: string;
|
|
1168
|
+
/**
|
|
1169
|
+
* Shorthand for a localhost endpoint on a custom port
|
|
1170
|
+
* (`ws://127.0.0.1:<port>`). Ignored when {@link url} is provided.
|
|
1171
|
+
*/
|
|
1172
|
+
port?: number;
|
|
1173
|
+
/**
|
|
1174
|
+
* Extra identifying metadata sent to the server alongside the name (e.g. a
|
|
1175
|
+
* project id or environment label), so the tool can group or disambiguate
|
|
1176
|
+
* tabs beyond the name alone.
|
|
1177
|
+
*/
|
|
1178
|
+
meta?: Record<string, unknown>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Reconnect automatically (with backoff) when the socket drops. Default
|
|
1181
|
+
* `true`.
|
|
1182
|
+
*/
|
|
1183
|
+
reconnect?: boolean;
|
|
1184
|
+
}
|
|
1185
|
+
/** Handle to a live bridge connection returned by `etch.connectAs`. */
|
|
1186
|
+
interface EtchBridgeConnection {
|
|
1187
|
+
/** The name this instance registered under — how the tool addresses it. */
|
|
1188
|
+
readonly name: string;
|
|
1189
|
+
/** The resolved WebSocket endpoint the connection targets. */
|
|
1190
|
+
readonly url: string;
|
|
1191
|
+
/** Whether the socket is currently open. */
|
|
1192
|
+
readonly connected: boolean;
|
|
1193
|
+
/** Close the connection and stop reconnecting. */
|
|
1194
|
+
close(): void;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1144
1197
|
/**
|
|
1145
1198
|
* The root {@link Etch} interface exposed on `window.etch`, tying every API
|
|
1146
1199
|
* namespace together, plus connection/versioning options.
|
|
@@ -1189,6 +1242,21 @@ interface Etch {
|
|
|
1189
1242
|
history: EtchHistoryApi;
|
|
1190
1243
|
/** Persist everything (blocks, loops, styles, UI). */
|
|
1191
1244
|
saveAsync(): Promise<void>;
|
|
1245
|
+
/**
|
|
1246
|
+
* Open a live bridge connection to a local tooling server (an IDE, a script
|
|
1247
|
+
* runner, an AI agent) and register this instance under `name`, so one server
|
|
1248
|
+
* can drive several Etch tabs at once and tell them apart by name. Returns a
|
|
1249
|
+
* handle; call again with a different name/endpoint to open more connections.
|
|
1250
|
+
*
|
|
1251
|
+
* @example
|
|
1252
|
+
* ```js
|
|
1253
|
+
* // In the builder console:
|
|
1254
|
+
* const conn = etch.connectAs('homepage');
|
|
1255
|
+
* // …the tool can now evaluate code in this tab; later:
|
|
1256
|
+
* conn.close();
|
|
1257
|
+
* ```
|
|
1258
|
+
*/
|
|
1259
|
+
connectAs(name: string, options?: BridgeConnectOptions): EtchBridgeConnection;
|
|
1192
1260
|
/**
|
|
1193
1261
|
* Negotiate a version-pinned API instance. **Reserved** — not implemented by
|
|
1194
1262
|
* `0.x` runtimes. When present on a future stable runtime, it returns an
|
|
@@ -1267,4 +1335,4 @@ declare function isEtchApiError(value: unknown): value is EtchApiError;
|
|
|
1267
1335
|
*/
|
|
1268
1336
|
declare const ETCH_API_VERSION = "0.x";
|
|
1269
1337
|
|
|
1270
|
-
export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
|
|
1338
|
+
export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type BridgeConnectOptions, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchBridgeConnection, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digital-gravy/etch-public-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "MIT-licensed typed client and contract for the Etch builder scripting API (window.etch). Etch itself is a separate proprietary product governed by its own commercial terms.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,4 +43,4 @@
|
|
|
43
43
|
"typescript": "^5.7.2",
|
|
44
44
|
"vitest": "^3.0.5"
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
}
|