@hostwebhook/node-types 1.52.7 → 1.52.8
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.ts +2 -0
- package/dist/index.js +6 -1
- package/dist/sheets-operations.d.ts +78 -0
- package/dist/sheets-operations.js +154 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export { DISCORD_OPERATIONS, DISCORD_OPERATION_SPECS, isDiscordOperation, } from
|
|
|
19
19
|
export type { DiscordOperation, DiscordParamSpec, DiscordOperationSpec, } from './discord-operations';
|
|
20
20
|
export { SLACK_OPERATIONS, SLACK_OPERATION_SPECS, isSlackOperation, } from './slack-operations';
|
|
21
21
|
export type { SlackOperation, SlackParamSpec, SlackOperationSpec, } from './slack-operations';
|
|
22
|
+
export { SHEETS_OPERATIONS, SHEETS_OPERATION_SPECS, isSheetsOperation, } from './sheets-operations';
|
|
23
|
+
export type { SheetsOperation, SheetsParamSpec, SheetsOperationSpec, } from './sheets-operations';
|
|
22
24
|
export { GOOGLE_CONTACTS_OPERATIONS, GOOGLE_CONTACTS_OPERATIONS_V1, GOOGLE_CONTACTS_OPERATIONS_V2, GOOGLE_CONTACTS_OPERATION_SPECS, GOOGLE_CONTACTS_OPERATION_GROUPS, GOOGLE_CONTACTS_DEFAULT_PERSON_FIELDS, isGoogleContactsOperation, } from './google-contacts-operations';
|
|
23
25
|
export type { GoogleContactsOperation, GoogleContactsParamSpec, GoogleContactsOperationSpec, GoogleContactsOperationGroup, } from './google-contacts-operations';
|
|
24
26
|
export type { CredentialTypeRegistration, CredentialType } from './credentials';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CREDENTIAL_TYPE_VALUES = exports.CREDENTIAL_TYPES = exports.isGoogleContactsOperation = exports.GOOGLE_CONTACTS_DEFAULT_PERSON_FIELDS = exports.GOOGLE_CONTACTS_OPERATION_GROUPS = exports.GOOGLE_CONTACTS_OPERATION_SPECS = exports.GOOGLE_CONTACTS_OPERATIONS_V2 = exports.GOOGLE_CONTACTS_OPERATIONS_V1 = exports.GOOGLE_CONTACTS_OPERATIONS = exports.isSheetsOperation = exports.SHEETS_OPERATION_SPECS = exports.SHEETS_OPERATIONS = exports.isSlackOperation = exports.SLACK_OPERATION_SPECS = exports.SLACK_OPERATIONS = exports.isDiscordOperation = exports.DISCORD_OPERATION_SPECS = exports.DISCORD_OPERATIONS = exports.isWhatsAppOperation = exports.WHATSAPP_OPERATIONS = exports.isTelegramOperation = exports.TELEGRAM_OPERATIONS = exports.isDriveOperation = exports.DRIVE_OPERATIONS = exports.isGoogleCalendarOperation = exports.GOOGLE_CALENDAR_OPERATIONS = exports.isGmailOperation = exports.GMAIL_OPERATIONS = exports.NODE_TYPE_TO_PREFIX = exports.PREFIX_TO_NODE_TYPE = exports.NODE_STATE_KEYS = exports.NODE_COLORS = exports.NODE_DETAIL_PATHS = exports.getNodeRegistryEntry = exports.NODE_REGISTRY = exports.getNodeDispatchConfig = exports.getAllNodeCollections = exports.NODE_DISPATCH = exports.resolveNodeId = exports.PREFIX_TO_TYPE = exports.NODE_UI = exports.ALL_NODE_TYPES = exports.isNodeType = exports.isTerminal = exports.canSendToNodes = exports.canReceiveFromNodes = exports.canReceiveFrom = exports.NODE_CONNECTIONS = exports.iterableMeta = exports.singleMeta = void 0;
|
|
4
|
+
exports.isCredentialType = exports.getCredentialType = exports.credentialTypeValues = void 0;
|
|
4
5
|
var types_1 = require("./types");
|
|
5
6
|
Object.defineProperty(exports, "singleMeta", { enumerable: true, get: function () { return types_1.singleMeta; } });
|
|
6
7
|
Object.defineProperty(exports, "iterableMeta", { enumerable: true, get: function () { return types_1.iterableMeta; } });
|
|
@@ -55,6 +56,10 @@ var slack_operations_1 = require("./slack-operations");
|
|
|
55
56
|
Object.defineProperty(exports, "SLACK_OPERATIONS", { enumerable: true, get: function () { return slack_operations_1.SLACK_OPERATIONS; } });
|
|
56
57
|
Object.defineProperty(exports, "SLACK_OPERATION_SPECS", { enumerable: true, get: function () { return slack_operations_1.SLACK_OPERATION_SPECS; } });
|
|
57
58
|
Object.defineProperty(exports, "isSlackOperation", { enumerable: true, get: function () { return slack_operations_1.isSlackOperation; } });
|
|
59
|
+
var sheets_operations_1 = require("./sheets-operations");
|
|
60
|
+
Object.defineProperty(exports, "SHEETS_OPERATIONS", { enumerable: true, get: function () { return sheets_operations_1.SHEETS_OPERATIONS; } });
|
|
61
|
+
Object.defineProperty(exports, "SHEETS_OPERATION_SPECS", { enumerable: true, get: function () { return sheets_operations_1.SHEETS_OPERATION_SPECS; } });
|
|
62
|
+
Object.defineProperty(exports, "isSheetsOperation", { enumerable: true, get: function () { return sheets_operations_1.isSheetsOperation; } });
|
|
58
63
|
var google_contacts_operations_1 = require("./google-contacts-operations");
|
|
59
64
|
Object.defineProperty(exports, "GOOGLE_CONTACTS_OPERATIONS", { enumerable: true, get: function () { return google_contacts_operations_1.GOOGLE_CONTACTS_OPERATIONS; } });
|
|
60
65
|
Object.defineProperty(exports, "GOOGLE_CONTACTS_OPERATIONS_V1", { enumerable: true, get: function () { return google_contacts_operations_1.GOOGLE_CONTACTS_OPERATIONS_V1; } });
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Sheets operation enum + form schema — single source of truth across
|
|
3
|
+
* the API, Dashboard, and Message Broker. Used by:
|
|
4
|
+
* - sheetsAction entity / DTO (api): operation field + validation
|
|
5
|
+
* - dashboard SheetsAction detail page: the whole operation form
|
|
6
|
+
*
|
|
7
|
+
* The api already accepts these six; the dashboard's own `SheetsAction` type
|
|
8
|
+
* only listed four (it never learned about appendOrUpdateRow and
|
|
9
|
+
* createSpreadsheet), which is exactly the drift this enum removes.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SHEETS_OPERATIONS: readonly ["appendRow", "updateRow", "appendOrUpdateRow", "readRange", "getRows", "createSpreadsheet"];
|
|
12
|
+
export type SheetsOperation = (typeof SHEETS_OPERATIONS)[number];
|
|
13
|
+
/** Type guard — useful when validating untrusted input (DTOs, AI tool calls). */
|
|
14
|
+
export declare function isSheetsOperation(value: unknown): value is SheetsOperation;
|
|
15
|
+
/**
|
|
16
|
+
* Per-operation form schema, same idea as SLACK_OPERATION_SPECS and
|
|
17
|
+
* GOOGLE_CONTACTS_OPERATION_SPECS: the detail page renders it with one loop
|
|
18
|
+
* instead of a branch per operation.
|
|
19
|
+
*
|
|
20
|
+
* Two things make this node's schema different from the others, and both are
|
|
21
|
+
* deliberate:
|
|
22
|
+
*
|
|
23
|
+
* 1. **The values are top-level entity fields, not an `operationConfig`
|
|
24
|
+
* record.** `name` here is the property on the sheetsAction document
|
|
25
|
+
* (`spreadsheetId`, `sheetName`, …), and `columnMapping` is a complex field.
|
|
26
|
+
* A renderer copied from Contacts would write to the wrong place.
|
|
27
|
+
* 2. **Half the fields are discovered at run time.** The column list comes from
|
|
28
|
+
* the chosen sheet's header row, fetched live. So the schema names the
|
|
29
|
+
* *picker* rather than carrying options — the same trick Discord's
|
|
30
|
+
* `channel` / `guild` / `role` types use.
|
|
31
|
+
*/
|
|
32
|
+
export interface SheetsParamSpec {
|
|
33
|
+
/** Field key — the property name on the sheetsAction document. */
|
|
34
|
+
name: string;
|
|
35
|
+
/** UI label. Empty string where the control has never shown one. */
|
|
36
|
+
label: string;
|
|
37
|
+
/**
|
|
38
|
+
* Param type for form rendering.
|
|
39
|
+
*
|
|
40
|
+
* - `string` — one-line input with `{{payload.x}}` templating.
|
|
41
|
+
* - `spreadsheet` — the spreadsheet picker **plus** the "or paste ID / URL"
|
|
42
|
+
* input that sits under it. They are one field with two ways in, not two
|
|
43
|
+
* fields, and the paste box extracts the id out of a full URL.
|
|
44
|
+
* - `sheetTab` — the tab picker for the chosen spreadsheet. Picking a tab
|
|
45
|
+
* clears `columnMapping`, because the headers just changed.
|
|
46
|
+
* - `headerColumn` — a dropdown of the sheet's live header row.
|
|
47
|
+
* - `columnMapping` — the header-to-template editor. It owns the three
|
|
48
|
+
* states of the header fetch (loading, loaded, failed), which is what
|
|
49
|
+
* used to be six copies of the same conditional in the page.
|
|
50
|
+
*/
|
|
51
|
+
type: 'string' | 'spreadsheet' | 'sheetTab' | 'headerColumn' | 'columnMapping';
|
|
52
|
+
/** Required by the operation. Metadata — the form does not gate on it. */
|
|
53
|
+
required?: boolean;
|
|
54
|
+
/** Help text under the control. Absent where the form shows none. */
|
|
55
|
+
description?: string;
|
|
56
|
+
/** Hint shown inside the input. */
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Section this field is rendered inside. Fields without one share the first
|
|
60
|
+
* section with the operation picker; the mapping fields sit in a second
|
|
61
|
+
* section whose title changes per operation ("Columns to Append",
|
|
62
|
+
* "Update Row", "Match & Upsert").
|
|
63
|
+
*/
|
|
64
|
+
section?: string;
|
|
65
|
+
/** `columnMapping` only — the line shown while no column has been added. */
|
|
66
|
+
emptyText?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface SheetsOperationSpec {
|
|
69
|
+
/** UI label for the operation picker. */
|
|
70
|
+
label: string;
|
|
71
|
+
/** Sub-line under the label in the picker. */
|
|
72
|
+
description: string;
|
|
73
|
+
/** googleapis call the operation maps to (sheets v4). */
|
|
74
|
+
apiMethod: string;
|
|
75
|
+
/** Parameter schema. Order matters for form rendering. */
|
|
76
|
+
params: SheetsParamSpec[];
|
|
77
|
+
}
|
|
78
|
+
export declare const SHEETS_OPERATION_SPECS: Record<SheetsOperation, SheetsOperationSpec>;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Google Sheets operation enum + form schema — single source of truth across
|
|
4
|
+
* the API, Dashboard, and Message Broker. Used by:
|
|
5
|
+
* - sheetsAction entity / DTO (api): operation field + validation
|
|
6
|
+
* - dashboard SheetsAction detail page: the whole operation form
|
|
7
|
+
*
|
|
8
|
+
* The api already accepts these six; the dashboard's own `SheetsAction` type
|
|
9
|
+
* only listed four (it never learned about appendOrUpdateRow and
|
|
10
|
+
* createSpreadsheet), which is exactly the drift this enum removes.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.SHEETS_OPERATION_SPECS = exports.SHEETS_OPERATIONS = void 0;
|
|
14
|
+
exports.isSheetsOperation = isSheetsOperation;
|
|
15
|
+
exports.SHEETS_OPERATIONS = [
|
|
16
|
+
'appendRow',
|
|
17
|
+
'updateRow',
|
|
18
|
+
'appendOrUpdateRow',
|
|
19
|
+
'readRange',
|
|
20
|
+
'getRows',
|
|
21
|
+
'createSpreadsheet',
|
|
22
|
+
];
|
|
23
|
+
/** Type guard — useful when validating untrusted input (DTOs, AI tool calls). */
|
|
24
|
+
function isSheetsOperation(value) {
|
|
25
|
+
return (typeof value === 'string' &&
|
|
26
|
+
exports.SHEETS_OPERATIONS.includes(value));
|
|
27
|
+
}
|
|
28
|
+
/* Fields most operations share. The spreadsheet and its tab are the same two
|
|
29
|
+
controls everywhere they appear — createSpreadsheet is the only operation
|
|
30
|
+
that shows neither, because there is no document yet to point at. */
|
|
31
|
+
const spreadsheet = () => ({
|
|
32
|
+
name: 'spreadsheetId',
|
|
33
|
+
label: 'Select Spreadsheet',
|
|
34
|
+
type: 'spreadsheet',
|
|
35
|
+
required: true,
|
|
36
|
+
});
|
|
37
|
+
const sheetTab = () => ({
|
|
38
|
+
name: 'sheetName',
|
|
39
|
+
label: 'Sheet Name',
|
|
40
|
+
type: 'sheetTab',
|
|
41
|
+
required: true,
|
|
42
|
+
});
|
|
43
|
+
/** The mapping editor, whose label, section and empty line change per op. */
|
|
44
|
+
const columnMapping = (over = {}) => ({
|
|
45
|
+
name: 'columnMapping',
|
|
46
|
+
label: 'Columns to Update',
|
|
47
|
+
type: 'columnMapping',
|
|
48
|
+
emptyText: 'No columns selected. Add columns to update.',
|
|
49
|
+
...over,
|
|
50
|
+
});
|
|
51
|
+
/** Which row to touch: the column to search in, and the value to look for. */
|
|
52
|
+
const matchFields = (section) => [
|
|
53
|
+
{
|
|
54
|
+
name: 'matchColumn',
|
|
55
|
+
label: 'Match Column',
|
|
56
|
+
type: 'headerColumn',
|
|
57
|
+
required: true,
|
|
58
|
+
description: 'Select the column to find the row to update',
|
|
59
|
+
section,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
/* No static placeholder or description: both are built from the chosen
|
|
63
|
+
column at render time ({{payload.<column>}} and 'Template to match
|
|
64
|
+
against "<column>"'), so the schema cannot carry them. */
|
|
65
|
+
name: 'matchValueTemplate',
|
|
66
|
+
label: 'Match Value',
|
|
67
|
+
type: 'string',
|
|
68
|
+
required: true,
|
|
69
|
+
section,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
exports.SHEETS_OPERATION_SPECS = {
|
|
73
|
+
appendRow: {
|
|
74
|
+
label: 'Append Row',
|
|
75
|
+
description: 'Add a new row at the bottom',
|
|
76
|
+
apiMethod: 'spreadsheets.values.batchUpdate',
|
|
77
|
+
params: [
|
|
78
|
+
spreadsheet(),
|
|
79
|
+
sheetTab(),
|
|
80
|
+
columnMapping({
|
|
81
|
+
/* The append editor has never carried a label of its own — the section
|
|
82
|
+
title above it already says "Columns to Append". */
|
|
83
|
+
label: '',
|
|
84
|
+
section: 'Columns to Append',
|
|
85
|
+
emptyText: 'No columns selected. Add columns to populate in the new row.',
|
|
86
|
+
}),
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
updateRow: {
|
|
90
|
+
label: 'Update Row',
|
|
91
|
+
description: 'Update cells in a specific range',
|
|
92
|
+
apiMethod: 'spreadsheets.values.batchUpdate',
|
|
93
|
+
params: [
|
|
94
|
+
spreadsheet(),
|
|
95
|
+
sheetTab(),
|
|
96
|
+
...matchFields('Update Row'),
|
|
97
|
+
columnMapping({ section: 'Update Row' }),
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
appendOrUpdateRow: {
|
|
101
|
+
label: 'Append or Update',
|
|
102
|
+
description: 'Update if row exists, append if not',
|
|
103
|
+
apiMethod: 'spreadsheets.values.batchUpdate',
|
|
104
|
+
/* Same fields as updateRow — only the section title differs. The label
|
|
105
|
+
inside still reads "Columns to Update", which is what the page has always
|
|
106
|
+
shown. */
|
|
107
|
+
params: [
|
|
108
|
+
spreadsheet(),
|
|
109
|
+
sheetTab(),
|
|
110
|
+
...matchFields('Match & Upsert'),
|
|
111
|
+
columnMapping({ section: 'Match & Upsert' }),
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
readRange: {
|
|
115
|
+
label: 'Read Range',
|
|
116
|
+
description: 'Read cells from a specific range',
|
|
117
|
+
apiMethod: 'spreadsheets.values.get',
|
|
118
|
+
params: [
|
|
119
|
+
spreadsheet(),
|
|
120
|
+
sheetTab(),
|
|
121
|
+
{
|
|
122
|
+
name: 'rangeTemplate',
|
|
123
|
+
label: 'Range Template',
|
|
124
|
+
type: 'string',
|
|
125
|
+
required: true,
|
|
126
|
+
placeholder: 'e.g. A2:D100',
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
getRows: {
|
|
131
|
+
label: 'Get Rows',
|
|
132
|
+
description: 'Read all rows with headers as keys',
|
|
133
|
+
apiMethod: 'spreadsheets.values.get',
|
|
134
|
+
params: [spreadsheet(), sheetTab()],
|
|
135
|
+
},
|
|
136
|
+
createSpreadsheet: {
|
|
137
|
+
label: 'Create Spreadsheet',
|
|
138
|
+
description: 'Create a new Google Sheets spreadsheet',
|
|
139
|
+
apiMethod: 'spreadsheets.create',
|
|
140
|
+
/* `sheetName` means the **new document's title** here, not a tab — the one
|
|
141
|
+
field in this node that changes meaning *and* control between
|
|
142
|
+
operations. The api uses it for both the file name and its first tab. */
|
|
143
|
+
params: [
|
|
144
|
+
{
|
|
145
|
+
name: 'sheetName',
|
|
146
|
+
label: 'Spreadsheet Title',
|
|
147
|
+
type: 'string',
|
|
148
|
+
required: true,
|
|
149
|
+
placeholder: 'My New Spreadsheet',
|
|
150
|
+
description: 'Name of the new spreadsheet. Supports {{payload.field}} templates.',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
};
|
package/package.json
CHANGED