@hostwebhook/node-types 1.69.0 → 1.71.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.
Files changed (101) hide show
  1. package/dist/bucket-operations.d.ts +88 -0
  2. package/dist/bucket-operations.js +140 -0
  3. package/dist/calendar-toolkit.d.ts +1 -1
  4. package/dist/connections.d.ts +1 -1
  5. package/dist/connections.js +1 -0
  6. package/dist/discord-operations.d.ts +1 -1
  7. package/dist/discord-operations.js +4 -4
  8. package/dist/discord-toolkit.d.ts +1 -1
  9. package/dist/discord-toolkit.js +3 -3
  10. package/dist/dispatch.d.ts +1 -1
  11. package/dist/dispatch.js +1 -0
  12. package/dist/docs-toolkit.d.ts +1 -1
  13. package/dist/drive-toolkit.d.ts +1 -1
  14. package/dist/esm/bucket-operations.d.ts +88 -0
  15. package/dist/esm/bucket-operations.js +136 -0
  16. package/dist/esm/calendar-operations.d.ts +67 -0
  17. package/dist/esm/calendar-operations.js +176 -0
  18. package/dist/esm/calendar-toolkit.d.ts +50 -0
  19. package/dist/esm/calendar-toolkit.js +152 -0
  20. package/dist/esm/capacidad-de-credencial.d.ts +75 -0
  21. package/dist/esm/capacidad-de-credencial.js +68 -0
  22. package/dist/esm/connections.d.ts +17 -0
  23. package/dist/esm/connections.js +107 -0
  24. package/dist/esm/credentials.d.ts +144 -0
  25. package/dist/esm/credentials.js +199 -0
  26. package/dist/esm/discord-operations.d.ts +104 -0
  27. package/dist/esm/discord-operations.js +407 -0
  28. package/dist/esm/discord-toolkit.d.ts +64 -0
  29. package/dist/esm/discord-toolkit.js +260 -0
  30. package/dist/esm/dispatch.d.ts +16 -0
  31. package/dist/esm/dispatch.js +77 -0
  32. package/dist/esm/docs-operations.d.ts +99 -0
  33. package/dist/esm/docs-operations.js +127 -0
  34. package/dist/esm/docs-toolkit.d.ts +42 -0
  35. package/dist/esm/docs-toolkit.js +97 -0
  36. package/dist/esm/drive-operations.d.ts +103 -0
  37. package/dist/esm/drive-operations.js +319 -0
  38. package/dist/esm/drive-toolkit.d.ts +54 -0
  39. package/dist/esm/drive-toolkit.js +177 -0
  40. package/dist/esm/github-operations.d.ts +147 -0
  41. package/dist/esm/github-operations.js +551 -0
  42. package/dist/esm/gmail-operations.d.ts +190 -0
  43. package/dist/esm/gmail-operations.js +560 -0
  44. package/dist/esm/google-analytics-operations.d.ts +99 -0
  45. package/dist/esm/google-analytics-operations.js +222 -0
  46. package/dist/esm/google-contacts-operations.d.ts +93 -0
  47. package/dist/esm/google-contacts-operations.js +363 -0
  48. package/dist/esm/index.d.ts +68 -0
  49. package/dist/esm/index.js +51 -0
  50. package/dist/esm/jira-operations.d.ts +164 -0
  51. package/dist/esm/jira-operations.js +470 -0
  52. package/dist/esm/llm-models.d.ts +101 -0
  53. package/dist/esm/llm-models.js +230 -0
  54. package/dist/esm/mailchimp-operations.d.ts +56 -0
  55. package/dist/esm/mailchimp-operations.js +155 -0
  56. package/dist/esm/mongo-operations.d.ts +61 -0
  57. package/dist/esm/mongo-operations.js +120 -0
  58. package/dist/esm/notion-operations.d.ts +125 -0
  59. package/dist/esm/notion-operations.js +511 -0
  60. package/dist/esm/openrouter.d.ts +142 -0
  61. package/dist/esm/openrouter.js +99 -0
  62. package/dist/esm/package.json +4 -0
  63. package/dist/esm/postgres-operations.d.ts +60 -0
  64. package/dist/esm/postgres-operations.js +75 -0
  65. package/dist/esm/registry.d.ts +160 -0
  66. package/dist/esm/registry.js +885 -0
  67. package/dist/esm/sheets-operations.d.ts +78 -0
  68. package/dist/esm/sheets-operations.js +150 -0
  69. package/dist/esm/sheets-toolkit.d.ts +49 -0
  70. package/dist/esm/sheets-toolkit.js +127 -0
  71. package/dist/esm/shopify-operations.d.ts +95 -0
  72. package/dist/esm/shopify-operations.js +259 -0
  73. package/dist/esm/slack-operations.d.ts +81 -0
  74. package/dist/esm/slack-operations.js +244 -0
  75. package/dist/esm/slack-toolkit.d.ts +60 -0
  76. package/dist/esm/slack-toolkit.js +235 -0
  77. package/dist/esm/telegram-operations.d.ts +104 -0
  78. package/dist/esm/telegram-operations.js +351 -0
  79. package/dist/esm/telegram-toolkit.d.ts +52 -0
  80. package/dist/esm/telegram-toolkit.js +183 -0
  81. package/dist/esm/types.d.ts +149 -0
  82. package/dist/esm/types.js +8 -0
  83. package/dist/esm/ui.d.ts +13 -0
  84. package/dist/esm/ui.js +152 -0
  85. package/dist/esm/whatsapp-operations.d.ts +23 -0
  86. package/dist/esm/whatsapp-operations.js +36 -0
  87. package/dist/index.d.ts +68 -66
  88. package/dist/index.js +193 -187
  89. package/dist/openrouter.d.ts +1 -1
  90. package/dist/registry.d.ts +4 -4
  91. package/dist/registry.js +540 -210
  92. package/dist/sheets-toolkit.d.ts +1 -1
  93. package/dist/slack-operations.d.ts +1 -1
  94. package/dist/slack-operations.js +4 -4
  95. package/dist/slack-toolkit.d.ts +1 -1
  96. package/dist/slack-toolkit.js +3 -3
  97. package/dist/telegram-toolkit.d.ts +1 -1
  98. package/dist/types.d.ts +1 -1
  99. package/dist/ui.d.ts +1 -1
  100. package/dist/ui.js +2 -0
  101. package/package.json +21 -3
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Notion operation enum — single source of truth across the API, Dashboard y
3
+ * Message Broker. Lo usan:
4
+ * - notionAction entity / DTO (api): campo `operation` + validación
5
+ * - la página de detalle del dashboard
6
+ * - specs de toolkit MCP, si algún día el nodo gana modo herramienta
7
+ *
8
+ * Mismo patrón que `google-analytics-operations.ts` y `drive-operations.ts`.
9
+ *
10
+ * ── Contra qué versión está escrito ──
11
+ *
12
+ * `Notion-Version: 2026-03-11`. Importa más de lo normal porque Notion movió
13
+ * cosas de sitio dos veces seguidas y los ejemplos que hay por internet están
14
+ * casi todos contra la API anterior:
15
+ *
16
+ * - 2025-09-03 partió `database` en database + **data source**. El query
17
+ * dejó de vivir en `databases/{id}/query` y pasó a
18
+ * `data_sources/{id}/query`. Una database contiene N data sources.
19
+ * - 2026-03-11 quitó el alias `archived` (ahora es **`in_trash`**), cambió
20
+ * el `after` de append blocks por un objeto **`position`**, y renombró el
21
+ * bloque `transcription` a `meeting_notes`.
22
+ *
23
+ * ── Por qué hay operaciones de markdown ──
24
+ *
25
+ * Escribir contenido en Notion era construir un árbol de bloques a mano, que
26
+ * es con diferencia lo más pesado de su API. Desde 2026-03-11 hay
27
+ * `GET/PATCH /v1/pages/{id}/markdown`, disponible —lo dicen los docs con esas
28
+ * palabras— para "all connection types (public, internal, and personal access
29
+ * tokens)". Con eso, escribir una página es mandar texto.
30
+ *
31
+ * Y el markdown cubre también el añadir-sin-pisar, vía el comando
32
+ * `insert_content` con `position: end`. `PATCH /v1/blocks/{id}/children` NO
33
+ * acepta markdown —sólo objetos de bloque—, así que la única op de bloques que
34
+ * queda es la de LEER la estructura cruda, que es lo que markdown no da.
35
+ *
36
+ * ── Lo que NO es una operación ──
37
+ *
38
+ * Listar las databases/data sources a las que la credencial tiene acceso, y
39
+ * leer el esquema para pintar un selector, NO son ops del nodo: son endpoints
40
+ * del controlador, como Drive alimenta su `DriveFilePicker`. Una op existe
41
+ * para producir payload en una corrida; esto otro es para rellenar el
42
+ * formulario.
43
+ *
44
+ * ── Decisiones propias de Notion (anti-n8n) ──
45
+ *
46
+ * - La database/data source y la página se ELIGEN de una lista viva, no se
47
+ * teclean. Un id de Notion es un UUID sin guiones dentro de una URL larga;
48
+ * pedirle eso al usuario es pedirle que se equivoque.
49
+ * - Las propiedades de una página van en JSON crudo salvo el título, que es
50
+ * el 90% de los casos y tiene campo propio. Cada tipo de propiedad de
51
+ * Notion tiene una forma distinta (`rich_text`, `select`, `date`,
52
+ * `relation`…) y fingir que caben en tres campos genéricos produce un 400
53
+ * que no explica nada.
54
+ * - Ninguna op declarada sin implementar. El enum ES el contrato de la
55
+ * pantalla: una op declarada se pinta en el desplegable y falla al
56
+ * ejecutarse. Entran cuando entre su código.
57
+ */
58
+ export declare const NOTION_OPERATIONS: readonly ["createPage", "getPage", "getPageMarkdown", "updatePageProperties", "updatePageMarkdown", "archivePage", "queryDataSource", "getDataSource", "appendToPage", "getBlockChildren", "search", "createComment"];
59
+ export type NotionOperation = (typeof NOTION_OPERATIONS)[number];
60
+ /** Type guard — para validar entrada no fiable (DTOs, tool calls). */
61
+ export declare function isNotionOperation(value: unknown): value is NotionOperation;
62
+ export type NotionParamType =
63
+ /** Selector vivo de data sources accesibles (necesita credencial). */
64
+ 'notionDataSource'
65
+ /** Selector vivo de páginas accesibles; admite pegar un id o una URL. */
66
+ | 'notionPage'
67
+ /** Cualquier bloque contenedor: una página vale como bloque. */
68
+ | 'notionBlock'
69
+ /** Texto con autocompletado de `{{payload.*}}`. */
70
+ | 'template'
71
+ /** Área de texto larga, también con autocompletado. */
72
+ | 'textarea'
73
+ /** `<select>` normal; las etiquetas no son los valores, `options` obliga. */
74
+ | 'select' | 'number'
75
+ /**
76
+ * `<select>` de `''` / `'true'` / `'false'` que se guarda como BOOLEANO, o
77
+ * no se guarda si es `''`. "— sin tocar —" tiene que significar que la
78
+ * clave no viaja, no que viaja en `false`.
79
+ */
80
+ | 'booleanSelect'
81
+ /** Área de texto para JSON crudo (propiedades, filtros, orden). */
82
+ | 'json';
83
+ export interface NotionParamSpec {
84
+ /** La clave de `operationConfig`. Es lo que lee la api, no un nombre de UI. */
85
+ name: string;
86
+ label: string;
87
+ type: NotionParamType;
88
+ required?: boolean;
89
+ /** Ayuda bajo el campo. Texto plano: el paquete no lleva React. */
90
+ description?: string;
91
+ placeholder?: string;
92
+ /** Prerrellenado cuando la config guardada no trae valor para esta clave. */
93
+ default?: string | number;
94
+ /** Obligatorio en `select` y `booleanSelect` — etiqueta y valor difieren. */
95
+ options?: ReadonlyArray<{
96
+ value: string;
97
+ label: string;
98
+ }>;
99
+ min?: number;
100
+ max?: number;
101
+ /** Se pinta en la pestaña "Advanced" en vez de en "Config". */
102
+ advanced?: boolean;
103
+ /** Sólo visible cuando un campo hermano vale uno de estos. */
104
+ showWhen?: {
105
+ field: string;
106
+ in: ReadonlyArray<string>;
107
+ };
108
+ }
109
+ export interface NotionOperationSpec {
110
+ /** Etiqueta de la fila en el desplegable de operación. */
111
+ label: string;
112
+ /** Sub-línea bajo la etiqueta. */
113
+ description: string;
114
+ /** Endpoint al que mapea, tal cual, para poder cotejarlo con los docs. */
115
+ apiMethod: string;
116
+ /** Esquema de parámetros. El orden ES el orden en pantalla. */
117
+ params: NotionParamSpec[];
118
+ }
119
+ export declare const NOTION_OPERATION_SPECS: Record<NotionOperation, NotionOperationSpec>;
120
+ /**
121
+ * Las operaciones tal y como se listan en el desplegable. Hoy es el enum
122
+ * entero; existe para que añadir una op interna (sin fila propia) no obligue
123
+ * a que la página vuelva a decidir por su cuenta qué enseñar.
124
+ */
125
+ export declare const NOTION_DROPDOWN_OPERATIONS: readonly NotionOperation[];
@@ -0,0 +1,511 @@
1
+ /**
2
+ * Notion operation enum — single source of truth across the API, Dashboard y
3
+ * Message Broker. Lo usan:
4
+ * - notionAction entity / DTO (api): campo `operation` + validación
5
+ * - la página de detalle del dashboard
6
+ * - specs de toolkit MCP, si algún día el nodo gana modo herramienta
7
+ *
8
+ * Mismo patrón que `google-analytics-operations.ts` y `drive-operations.ts`.
9
+ *
10
+ * ── Contra qué versión está escrito ──
11
+ *
12
+ * `Notion-Version: 2026-03-11`. Importa más de lo normal porque Notion movió
13
+ * cosas de sitio dos veces seguidas y los ejemplos que hay por internet están
14
+ * casi todos contra la API anterior:
15
+ *
16
+ * - 2025-09-03 partió `database` en database + **data source**. El query
17
+ * dejó de vivir en `databases/{id}/query` y pasó a
18
+ * `data_sources/{id}/query`. Una database contiene N data sources.
19
+ * - 2026-03-11 quitó el alias `archived` (ahora es **`in_trash`**), cambió
20
+ * el `after` de append blocks por un objeto **`position`**, y renombró el
21
+ * bloque `transcription` a `meeting_notes`.
22
+ *
23
+ * ── Por qué hay operaciones de markdown ──
24
+ *
25
+ * Escribir contenido en Notion era construir un árbol de bloques a mano, que
26
+ * es con diferencia lo más pesado de su API. Desde 2026-03-11 hay
27
+ * `GET/PATCH /v1/pages/{id}/markdown`, disponible —lo dicen los docs con esas
28
+ * palabras— para "all connection types (public, internal, and personal access
29
+ * tokens)". Con eso, escribir una página es mandar texto.
30
+ *
31
+ * Y el markdown cubre también el añadir-sin-pisar, vía el comando
32
+ * `insert_content` con `position: end`. `PATCH /v1/blocks/{id}/children` NO
33
+ * acepta markdown —sólo objetos de bloque—, así que la única op de bloques que
34
+ * queda es la de LEER la estructura cruda, que es lo que markdown no da.
35
+ *
36
+ * ── Lo que NO es una operación ──
37
+ *
38
+ * Listar las databases/data sources a las que la credencial tiene acceso, y
39
+ * leer el esquema para pintar un selector, NO son ops del nodo: son endpoints
40
+ * del controlador, como Drive alimenta su `DriveFilePicker`. Una op existe
41
+ * para producir payload en una corrida; esto otro es para rellenar el
42
+ * formulario.
43
+ *
44
+ * ── Decisiones propias de Notion (anti-n8n) ──
45
+ *
46
+ * - La database/data source y la página se ELIGEN de una lista viva, no se
47
+ * teclean. Un id de Notion es un UUID sin guiones dentro de una URL larga;
48
+ * pedirle eso al usuario es pedirle que se equivoque.
49
+ * - Las propiedades de una página van en JSON crudo salvo el título, que es
50
+ * el 90% de los casos y tiene campo propio. Cada tipo de propiedad de
51
+ * Notion tiene una forma distinta (`rich_text`, `select`, `date`,
52
+ * `relation`…) y fingir que caben en tres campos genéricos produce un 400
53
+ * que no explica nada.
54
+ * - Ninguna op declarada sin implementar. El enum ES el contrato de la
55
+ * pantalla: una op declarada se pinta en el desplegable y falla al
56
+ * ejecutarse. Entran cuando entre su código.
57
+ */
58
+ export const NOTION_OPERATIONS = [
59
+ // Páginas
60
+ 'createPage', // POST /v1/pages
61
+ 'getPage', // GET /v1/pages/{id}
62
+ 'getPageMarkdown', // GET /v1/pages/{id}/markdown
63
+ 'updatePageProperties', // PATCH /v1/pages/{id}
64
+ 'updatePageMarkdown', // PATCH /v1/pages/{id}/markdown
65
+ 'archivePage', // PATCH /v1/pages/{id} { in_trash: true }
66
+ // Data sources (lo que antes era "la database")
67
+ 'queryDataSource', // POST /v1/data_sources/{id}/query
68
+ 'getDataSource', // GET /v1/data_sources/{id}
69
+ // Bloques
70
+ 'appendToPage', // PATCH /v1/pages/{id}/markdown (insert_content)
71
+ 'getBlockChildren', // GET /v1/blocks/{id}/children
72
+ // Transversales
73
+ 'search', // POST /v1/search
74
+ 'createComment', // POST /v1/comments
75
+ ];
76
+ /** Type guard — para validar entrada no fiable (DTOs, tool calls). */
77
+ export function isNotionOperation(value) {
78
+ return (typeof value === 'string' &&
79
+ NOTION_OPERATIONS.includes(value));
80
+ }
81
+ /* Fábricas de los campos que se repiten, para que un cambio de copy no haya
82
+ que perseguirlo por doce operaciones. */
83
+ const pageId = (label = 'Page') => ({
84
+ name: 'pageId',
85
+ label,
86
+ type: 'notionPage',
87
+ required: true,
88
+ description: 'Pick a page the connection can see, or paste a page URL or id — a templated value like {{payload.pageId}} works too. Notion only shows pages that were explicitly shared with this connection.',
89
+ });
90
+ const dataSourceId = () => ({
91
+ name: 'dataSourceId',
92
+ label: 'Data source',
93
+ type: 'notionDataSource',
94
+ required: true,
95
+ description: 'Since API version 2025-09-03 a database holds one or more data sources, and rows live in the data source — not in the database. Most databases have exactly one.',
96
+ });
97
+ /** El JSON de propiedades, con el aviso que ahorra el 400 más común. */
98
+ const propertiesJson = () => ({
99
+ name: 'properties',
100
+ label: 'Properties (JSON)',
101
+ type: 'json',
102
+ advanced: true,
103
+ placeholder: '{ "Status": { "select": { "name": "In progress" } }, "Due": { "date": { "start": "2026-09-01" } } }',
104
+ description: 'Raw Notion property values, keyed by property name. Every property type has its own shape (rich_text, select, date, relation, …) — check the data source schema. Leave empty to only set the title.',
105
+ });
106
+ const notionVersionNote = 'Runs against Notion-Version 2026-03-11.';
107
+ export const NOTION_OPERATION_SPECS = {
108
+ createPage: {
109
+ label: 'Create page',
110
+ description: 'A new page — as a row in a data source, or under another page.',
111
+ apiMethod: 'POST /v1/pages',
112
+ params: [
113
+ {
114
+ name: 'parentType',
115
+ label: 'Create it in',
116
+ type: 'select',
117
+ required: true,
118
+ default: 'data_source',
119
+ options: [
120
+ { value: 'data_source', label: 'A data source (adds a row)' },
121
+ { value: 'page', label: 'Another page (adds a subpage)' },
122
+ ],
123
+ description: 'A row in a database IS a page in Notion — same object, different parent.',
124
+ },
125
+ {
126
+ ...dataSourceId(),
127
+ showWhen: { field: 'parentType', in: ['data_source'] },
128
+ },
129
+ {
130
+ ...pageId('Parent page'),
131
+ name: 'parentPageId',
132
+ showWhen: { field: 'parentType', in: ['page'] },
133
+ },
134
+ {
135
+ name: 'title',
136
+ label: 'Title',
137
+ type: 'template',
138
+ required: true,
139
+ placeholder: '{{payload.subject}}',
140
+ description: 'Goes into the title property, whatever it is called in this data source.',
141
+ },
142
+ {
143
+ name: 'markdown',
144
+ label: 'Content (Markdown)',
145
+ type: 'textarea',
146
+ placeholder: '## Summary\n\n{{payload.body}}',
147
+ description: 'The page body, as Notion-flavored Markdown. This is the shortcut that avoids building a block tree by hand.',
148
+ },
149
+ {
150
+ name: 'icon',
151
+ label: 'Icon',
152
+ type: 'template',
153
+ advanced: true,
154
+ placeholder: '🚀',
155
+ description: 'A single emoji, or an external image URL.',
156
+ },
157
+ propertiesJson(),
158
+ ],
159
+ },
160
+ getPage: {
161
+ label: 'Get page',
162
+ description: 'The page object and its properties — not its content.',
163
+ apiMethod: 'GET /v1/pages/{page_id}',
164
+ params: [
165
+ pageId(),
166
+ {
167
+ name: 'filterProperties',
168
+ label: 'Only these properties',
169
+ type: 'template',
170
+ advanced: true,
171
+ placeholder: 'title,Status,Due',
172
+ description: 'Comma-separated property names. Notion returns every property by default, which on a wide database is a lot of payload for nothing.',
173
+ },
174
+ ],
175
+ },
176
+ getPageMarkdown: {
177
+ label: 'Get page as Markdown',
178
+ description: 'The whole page content as one Markdown string.',
179
+ apiMethod: 'GET /v1/pages/{page_id}/markdown',
180
+ params: [
181
+ pageId(),
182
+ {
183
+ name: 'includeTranscript',
184
+ label: 'Include meeting transcript',
185
+ type: 'booleanSelect',
186
+ advanced: true,
187
+ options: [
188
+ { value: '', label: '— leave alone —' },
189
+ { value: 'true', label: 'Yes' },
190
+ { value: 'false', label: 'No' },
191
+ ],
192
+ description: 'Only matters on pages holding meeting notes. Transcripts can be very long.',
193
+ },
194
+ ],
195
+ },
196
+ updatePageProperties: {
197
+ label: 'Update page properties',
198
+ description: 'Change property values — status, dates, relations.',
199
+ apiMethod: 'PATCH /v1/pages/{page_id}',
200
+ params: [
201
+ pageId(),
202
+ {
203
+ name: 'title',
204
+ label: 'New title',
205
+ type: 'template',
206
+ description: 'Leave empty to keep the current title.',
207
+ },
208
+ {
209
+ ...propertiesJson(),
210
+ advanced: false,
211
+ description: 'Raw Notion property values, keyed by property name. Only the properties you list are touched; the rest keep their value. Every property type has its own shape (rich_text, select, date, relation, …).',
212
+ },
213
+ {
214
+ name: 'icon',
215
+ label: 'Icon',
216
+ type: 'template',
217
+ advanced: true,
218
+ placeholder: '✅',
219
+ description: 'A single emoji, or an external image URL.',
220
+ },
221
+ ],
222
+ },
223
+ updatePageMarkdown: {
224
+ label: 'Update page content',
225
+ description: 'Rewrite the body, or search and replace inside it.',
226
+ apiMethod: 'PATCH /v1/pages/{page_id}/markdown',
227
+ params: [
228
+ pageId(),
229
+ {
230
+ name: 'mode',
231
+ label: 'How',
232
+ type: 'select',
233
+ required: true,
234
+ default: 'replace_content',
235
+ options: [
236
+ { value: 'replace_content', label: 'Replace the whole body' },
237
+ { value: 'update_content', label: 'Find and replace' },
238
+ ],
239
+ description: 'Replacing drops everything currently on the page — including blocks this flow did not write.',
240
+ },
241
+ {
242
+ name: 'markdown',
243
+ label: 'New content (Markdown)',
244
+ type: 'textarea',
245
+ required: true,
246
+ showWhen: { field: 'mode', in: ['replace_content'] },
247
+ placeholder: '## Report\n\n{{payload.summary}}',
248
+ },
249
+ {
250
+ name: 'find',
251
+ label: 'Find',
252
+ type: 'template',
253
+ required: true,
254
+ showWhen: { field: 'mode', in: ['update_content'] },
255
+ description: 'The exact text to look for. Notion matches it literally, not as a regex.',
256
+ },
257
+ {
258
+ name: 'replace',
259
+ label: 'Replace with',
260
+ type: 'textarea',
261
+ showWhen: { field: 'mode', in: ['update_content'] },
262
+ description: 'Leave empty to delete the matched text.',
263
+ },
264
+ ],
265
+ },
266
+ archivePage: {
267
+ label: 'Archive page',
268
+ description: 'Send it to the trash, or bring it back.',
269
+ apiMethod: 'PATCH /v1/pages/{page_id}',
270
+ params: [
271
+ pageId(),
272
+ {
273
+ name: 'inTrash',
274
+ label: 'Trashed',
275
+ type: 'booleanSelect',
276
+ required: true,
277
+ default: 'true',
278
+ options: [
279
+ { value: 'true', label: 'Move to trash' },
280
+ { value: 'false', label: 'Restore from trash' },
281
+ ],
282
+ description: 'Notion calls this in_trash since API version 2026-03-11; the old archived field is gone. Trashed pages are recoverable for 30 days.',
283
+ },
284
+ ],
285
+ },
286
+ queryDataSource: {
287
+ label: 'Query data source',
288
+ description: 'Rows matching a filter, in the order you ask for.',
289
+ apiMethod: 'POST /v1/data_sources/{data_source_id}/query',
290
+ params: [
291
+ dataSourceId(),
292
+ {
293
+ name: 'filterProperty',
294
+ label: 'Filter — property',
295
+ type: 'template',
296
+ placeholder: 'Status',
297
+ description: 'The property name as it reads in Notion. Leave the three filter fields empty to get everything.',
298
+ },
299
+ {
300
+ name: 'filterCondition',
301
+ label: 'Filter — condition',
302
+ type: 'select',
303
+ default: 'equals',
304
+ options: [
305
+ { value: 'equals', label: 'equals' },
306
+ { value: 'does_not_equal', label: 'does not equal' },
307
+ { value: 'contains', label: 'contains' },
308
+ { value: 'does_not_contain', label: 'does not contain' },
309
+ { value: 'is_empty', label: 'is empty' },
310
+ { value: 'is_not_empty', label: 'is not empty' },
311
+ { value: 'after', label: 'is after (date)' },
312
+ { value: 'before', label: 'is before (date)' },
313
+ { value: 'on_or_after', label: 'is on or after (date)' },
314
+ ],
315
+ },
316
+ {
317
+ name: 'filterValue',
318
+ label: 'Filter — value',
319
+ type: 'template',
320
+ placeholder: 'In progress',
321
+ showWhen: {
322
+ field: 'filterCondition',
323
+ in: [
324
+ 'equals',
325
+ 'does_not_equal',
326
+ 'contains',
327
+ 'does_not_contain',
328
+ 'after',
329
+ 'before',
330
+ 'on_or_after',
331
+ ],
332
+ },
333
+ },
334
+ {
335
+ name: 'sortProperty',
336
+ label: 'Sort by',
337
+ type: 'template',
338
+ placeholder: 'last_edited_time',
339
+ description: 'A property name, or the built-ins created_time / last_edited_time.',
340
+ },
341
+ {
342
+ name: 'sortDirection',
343
+ label: 'Direction',
344
+ type: 'select',
345
+ default: 'descending',
346
+ options: [
347
+ { value: 'descending', label: 'Newest first' },
348
+ { value: 'ascending', label: 'Oldest first' },
349
+ ],
350
+ },
351
+ {
352
+ name: 'pageSize',
353
+ label: 'How many',
354
+ type: 'number',
355
+ default: 25,
356
+ min: 1,
357
+ max: 100,
358
+ description: 'Notion caps a single query at 100 rows. Past that it paginates, and this node returns the first page only.',
359
+ },
360
+ {
361
+ name: 'filterJson',
362
+ label: 'Filter (raw JSON)',
363
+ type: 'json',
364
+ advanced: true,
365
+ placeholder: '{ "and": [ { "property": "Status", "select": { "equals": "Done" } } ] }',
366
+ description: 'The escape hatch for anything the three fields above cannot say — compound and/or, rollups, formulas. When this is filled in, it WINS and the simple filter is ignored.',
367
+ },
368
+ ],
369
+ },
370
+ getDataSource: {
371
+ label: 'Get data source schema',
372
+ description: 'Which properties exist and what type each one is.',
373
+ apiMethod: 'GET /v1/data_sources/{data_source_id}',
374
+ params: [dataSourceId()],
375
+ },
376
+ appendToPage: {
377
+ label: 'Append content',
378
+ description: 'Add to a page without touching what is already there.',
379
+ apiMethod: 'PATCH /v1/pages/{page_id}/markdown (insert_content)',
380
+ params: [
381
+ pageId(),
382
+ {
383
+ name: 'markdown',
384
+ label: 'Content (Markdown)',
385
+ type: 'textarea',
386
+ required: true,
387
+ placeholder: '- [ ] {{payload.task}}',
388
+ description: 'Appended as new blocks. Nothing already on the page is touched — this is the safe alternative to replacing the body.',
389
+ },
390
+ {
391
+ name: 'position',
392
+ label: 'Where',
393
+ type: 'select',
394
+ default: 'end',
395
+ options: [
396
+ { value: 'end', label: 'At the end' },
397
+ { value: 'start', label: 'At the top' },
398
+ ],
399
+ },
400
+ ],
401
+ },
402
+ getBlockChildren: {
403
+ label: 'Get block children',
404
+ description: 'The raw block tree, one level down.',
405
+ apiMethod: 'GET /v1/blocks/{block_id}/children',
406
+ params: [
407
+ {
408
+ name: 'blockId',
409
+ label: 'Page or block',
410
+ type: 'notionBlock',
411
+ required: true,
412
+ description: 'For reading a whole page as text, "Get page as Markdown" is almost always the one you want instead.',
413
+ },
414
+ {
415
+ name: 'pageSize',
416
+ label: 'How many',
417
+ type: 'number',
418
+ default: 50,
419
+ min: 1,
420
+ max: 100,
421
+ },
422
+ ],
423
+ },
424
+ search: {
425
+ label: 'Search',
426
+ description: 'Find pages and data sources by title.',
427
+ apiMethod: 'POST /v1/search',
428
+ params: [
429
+ {
430
+ name: 'query',
431
+ label: 'Query',
432
+ type: 'template',
433
+ placeholder: '{{payload.customerName}}',
434
+ description: 'Matches against titles only, not page content. Empty returns everything shared with the connection.',
435
+ },
436
+ {
437
+ name: 'filterObject',
438
+ label: 'Only',
439
+ type: 'select',
440
+ default: '',
441
+ options: [
442
+ { value: '', label: 'Pages and data sources' },
443
+ { value: 'page', label: 'Pages' },
444
+ { value: 'data_source', label: 'Data sources' },
445
+ ],
446
+ },
447
+ {
448
+ name: 'sortDirection',
449
+ label: 'Sort by last edited',
450
+ type: 'select',
451
+ default: 'descending',
452
+ options: [
453
+ { value: 'descending', label: 'Newest first' },
454
+ { value: 'ascending', label: 'Oldest first' },
455
+ ],
456
+ },
457
+ {
458
+ name: 'pageSize',
459
+ label: 'How many',
460
+ type: 'number',
461
+ default: 25,
462
+ min: 1,
463
+ max: 100,
464
+ },
465
+ ],
466
+ },
467
+ createComment: {
468
+ label: 'Add comment',
469
+ description: 'A comment on a page, or a reply in an existing thread.',
470
+ apiMethod: 'POST /v1/comments',
471
+ params: [
472
+ {
473
+ name: 'target',
474
+ label: 'Comment on',
475
+ type: 'select',
476
+ required: true,
477
+ default: 'page',
478
+ options: [
479
+ { value: 'page', label: 'A page' },
480
+ { value: 'discussion', label: 'An existing thread' },
481
+ ],
482
+ },
483
+ {
484
+ ...pageId(),
485
+ showWhen: { field: 'target', in: ['page'] },
486
+ },
487
+ {
488
+ name: 'discussionId',
489
+ label: 'Discussion id',
490
+ type: 'template',
491
+ required: true,
492
+ showWhen: { field: 'target', in: ['discussion'] },
493
+ description: 'Comes from a comment.created trigger payload, or from Get page comments.',
494
+ },
495
+ {
496
+ name: 'text',
497
+ label: 'Comment',
498
+ type: 'textarea',
499
+ required: true,
500
+ placeholder: 'Handled automatically — {{payload.result}}',
501
+ description: `Plain text. ${notionVersionNote}`,
502
+ },
503
+ ],
504
+ },
505
+ };
506
+ /**
507
+ * Las operaciones tal y como se listan en el desplegable. Hoy es el enum
508
+ * entero; existe para que añadir una op interna (sin fila propia) no obligue
509
+ * a que la página vuelva a decidir por su cuenta qué enseñar.
510
+ */
511
+ export const NOTION_DROPDOWN_OPERATIONS = NOTION_OPERATIONS;