@hostwebhook/node-types 1.55.3 → 1.56.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.ts +2 -1
- package/dist/index.js +13 -2
- package/dist/registry.d.ts +103 -0
- package/dist/registry.js +112 -0
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ export { singleMeta, iterableMeta } from './types';
|
|
|
3
3
|
export { NODE_CONNECTIONS, canReceiveFrom, canReceiveFromNodes, canSendToNodes, isTerminal, isNodeType, ALL_NODE_TYPES, } from './connections';
|
|
4
4
|
export { NODE_UI, PREFIX_TO_TYPE, resolveNodeId, } from './ui';
|
|
5
5
|
export { NODE_DISPATCH, getAllNodeCollections, getNodeDispatchConfig, } from './dispatch';
|
|
6
|
-
export type { NodeRegistryEntry, NodeGroup } from './registry';
|
|
6
|
+
export type { NodeRegistryEntry, NodeGroup, NodeVersionSpec, VersionCatalog, } from './registry';
|
|
7
7
|
export { NODE_REGISTRY, getNodeRegistryEntry, NODE_DETAIL_PATHS, NODE_COLORS, NODE_STATE_KEYS, PREFIX_TO_NODE_TYPE, NODE_TYPE_TO_PREFIX, } from './registry';
|
|
8
|
+
export { isVersioned, versionsOf, versionSpec, currentVersion, fieldsLostBetween, fieldsLost, versionCatalogErrors, } from './registry';
|
|
8
9
|
export { GMAIL_OPERATIONS, GMAIL_OPERATION_SPECS, GMAIL_OPERATION_GROUPS, GMAIL_DROPDOWN_OPERATIONS, GMAIL_TOOLKIT_OPERATIONS, GMAIL_TOOLKIT_SPECS, GMAIL_ALL_TOOLKIT_SPECS, GMAIL_SEND_AND_WAIT_TOOL_SPEC, NATIVE_EMAIL_TOOLKIT_SPECS, GMAIL_TOOLKIT_BY_TOOL_NAME, NATIVE_EMAIL_TOOLKIT_BY_TOOL_NAME, GMAIL_SEND_LEGACY_FIELDS, resolveGmailSendFields, isGmailOperation, } from './gmail-operations';
|
|
9
10
|
export type { GmailOperation, GmailOperationGroup, GmailParamType, GmailParamSpec, GmailOperationSpec, GmailToolkitParameter, GmailToolkitSpec, GmailSendFieldSource, GmailSendFields, } from './gmail-operations';
|
|
10
11
|
export { GOOGLE_CALENDAR_OPERATIONS, GOOGLE_CALENDAR_OPERATION_SPECS, isGoogleCalendarOperation, } from './calendar-operations';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.DRIVE_OPERATION_SPECS = exports.DRIVE_OPERATIONS = exports.GOOGLE_CALENDAR_TOOLKIT_BY_TOOL_NAME = exports.GOOGLE_CALENDAR_TOOLKIT_SPECS = exports.isGoogleCalendarOperation = exports.GOOGLE_CALENDAR_OPERATION_SPECS = exports.GOOGLE_CALENDAR_OPERATIONS = exports.isGmailOperation = exports.resolveGmailSendFields = exports.GMAIL_SEND_LEGACY_FIELDS = exports.NATIVE_EMAIL_TOOLKIT_BY_TOOL_NAME = exports.GMAIL_TOOLKIT_BY_TOOL_NAME = exports.NATIVE_EMAIL_TOOLKIT_SPECS = exports.GMAIL_SEND_AND_WAIT_TOOL_SPEC = exports.GMAIL_ALL_TOOLKIT_SPECS = exports.GMAIL_TOOLKIT_SPECS = exports.GMAIL_TOOLKIT_OPERATIONS = exports.GMAIL_DROPDOWN_OPERATIONS = exports.GMAIL_OPERATION_GROUPS = exports.GMAIL_OPERATION_SPECS = exports.GMAIL_OPERATIONS = exports.versionCatalogErrors = exports.fieldsLost = exports.fieldsLostBetween = exports.currentVersion = exports.versionSpec = exports.versionsOf = exports.isVersioned = 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.CREDENTIAL_TYPE_VALUES = exports.CREDENTIAL_TYPES = exports.getModelLabel = exports.getDefaultModel = exports.getModelsFor = exports.MODEL_CONTEXT_WINDOWS = exports.LLM_MODELS = exports.LLM_PROVIDERS = exports.DOCS_TOOLKIT_DEFAULTABLE = exports.DOCS_TOOLKIT_BY_TOOL_NAME = exports.DOCS_TOOLKIT_SPECS = exports.isDocsOperation = exports.DOCS_OPERATION_SPECS = exports.DOCS_OPERATIONS = exports.isMongoOperation = exports.MONGO_OPERATION_SPECS = exports.MONGO_OPERATIONS = exports.isPostgresOperation = exports.POSTGRES_OPERATION_SPECS = exports.POSTGRES_MODES = exports.POSTGRES_OPERATIONS = 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.SHEETS_TOOLKIT_DEFAULTABLE = exports.SHEETS_TOOLKIT_BY_TOOL_NAME = exports.SHEETS_TOOLKIT_SPECS = 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.TELEGRAM_TOOLKIT_BY_TOOL_NAME = exports.TELEGRAM_TOOLKIT_SPECS = exports.isTelegramOperation = exports.TELEGRAM_OPERATION_SPECS = exports.TELEGRAM_OPERATIONS = exports.DRIVE_TOOLKIT_BY_TOOL_NAME = exports.DRIVE_TOOLKIT_SPECS = exports.isDriveOperation = void 0;
|
|
5
|
+
exports.isCredentialType = exports.getCredentialType = exports.credentialTypeValues = void 0;
|
|
5
6
|
var types_1 = require("./types");
|
|
6
7
|
Object.defineProperty(exports, "singleMeta", { enumerable: true, get: function () { return types_1.singleMeta; } });
|
|
7
8
|
Object.defineProperty(exports, "iterableMeta", { enumerable: true, get: function () { return types_1.iterableMeta; } });
|
|
@@ -32,6 +33,16 @@ Object.defineProperty(exports, "NODE_COLORS", { enumerable: true, get: function
|
|
|
32
33
|
Object.defineProperty(exports, "NODE_STATE_KEYS", { enumerable: true, get: function () { return registry_1.NODE_STATE_KEYS; } });
|
|
33
34
|
Object.defineProperty(exports, "PREFIX_TO_NODE_TYPE", { enumerable: true, get: function () { return registry_1.PREFIX_TO_NODE_TYPE; } });
|
|
34
35
|
Object.defineProperty(exports, "NODE_TYPE_TO_PREFIX", { enumerable: true, get: function () { return registry_1.NODE_TYPE_TO_PREFIX; } });
|
|
36
|
+
// ── Node version catalog (ALL repos) ──
|
|
37
|
+
// See docs/ADR-0002-node-versioning.md in the api repo.
|
|
38
|
+
var registry_2 = require("./registry");
|
|
39
|
+
Object.defineProperty(exports, "isVersioned", { enumerable: true, get: function () { return registry_2.isVersioned; } });
|
|
40
|
+
Object.defineProperty(exports, "versionsOf", { enumerable: true, get: function () { return registry_2.versionsOf; } });
|
|
41
|
+
Object.defineProperty(exports, "versionSpec", { enumerable: true, get: function () { return registry_2.versionSpec; } });
|
|
42
|
+
Object.defineProperty(exports, "currentVersion", { enumerable: true, get: function () { return registry_2.currentVersion; } });
|
|
43
|
+
Object.defineProperty(exports, "fieldsLostBetween", { enumerable: true, get: function () { return registry_2.fieldsLostBetween; } });
|
|
44
|
+
Object.defineProperty(exports, "fieldsLost", { enumerable: true, get: function () { return registry_2.fieldsLost; } });
|
|
45
|
+
Object.defineProperty(exports, "versionCatalogErrors", { enumerable: true, get: function () { return registry_2.versionCatalogErrors; } });
|
|
35
46
|
// ── Per-service operation enums (ALL repos) ──
|
|
36
47
|
var gmail_operations_1 = require("./gmail-operations");
|
|
37
48
|
Object.defineProperty(exports, "GMAIL_OPERATIONS", { enumerable: true, get: function () { return gmail_operations_1.GMAIL_OPERATIONS; } });
|
package/dist/registry.d.ts
CHANGED
|
@@ -41,6 +41,51 @@ export interface NodeRegistryEntry {
|
|
|
41
41
|
* Predicate must be pure (no side effects) — called on every render.
|
|
42
42
|
*/
|
|
43
43
|
isToolOnly?: (entity: Record<string, unknown>) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The versions this node type ships, when it ships more than one.
|
|
46
|
+
*
|
|
47
|
+
* Absent means the type does not version, which is true of every type
|
|
48
|
+
* today. A node type only declares this the day its provider deprecates
|
|
49
|
+
* something and a second version has to live alongside the first.
|
|
50
|
+
*
|
|
51
|
+
* See `docs/ADR-0002-node-versioning.md` in the api repo.
|
|
52
|
+
*/
|
|
53
|
+
versions?: NodeVersionSpec[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One version of a node type.
|
|
57
|
+
*
|
|
58
|
+
* Deliberately NOT a schema. The api's DTO stays the validator; all this
|
|
59
|
+
* needs to know is WHICH config fields a version understands, because that
|
|
60
|
+
* is what answers the only question the UI has to ask: switching from here
|
|
61
|
+
* to there, what does the user lose?
|
|
62
|
+
*/
|
|
63
|
+
export interface NodeVersionSpec {
|
|
64
|
+
/** The number the user sees. Unique within a type. */
|
|
65
|
+
v: number;
|
|
66
|
+
/** Shown next to the number in the picker, e.g. "Discord API v10". */
|
|
67
|
+
label?: string;
|
|
68
|
+
/**
|
|
69
|
+
* `current` is what a new node is born on — exactly one per type.
|
|
70
|
+
* `legacy` still runs but is on its way out. `beta` is opt-in.
|
|
71
|
+
*/
|
|
72
|
+
status: 'current' | 'legacy' | 'beta';
|
|
73
|
+
/**
|
|
74
|
+
* The config fields this version understands.
|
|
75
|
+
*
|
|
76
|
+
* Only fields the user configures. Identity and topology — name,
|
|
77
|
+
* inputNodes, outputNodes, isActive, canvas position — never belong
|
|
78
|
+
* here: they survive a version change untouched, and listing them
|
|
79
|
+
* would put them at risk of being unset.
|
|
80
|
+
*/
|
|
81
|
+
fields: string[];
|
|
82
|
+
/**
|
|
83
|
+
* Entering this version keeps nothing. For the case where "v2" is
|
|
84
|
+
* really a different integration wearing the same node's name.
|
|
85
|
+
*/
|
|
86
|
+
cleanBreak?: boolean;
|
|
87
|
+
/** Why it was retired, or what it brings. Shown in picker and dialog. */
|
|
88
|
+
note?: string;
|
|
44
89
|
}
|
|
45
90
|
export declare const NODE_REGISTRY: Record<NodeType, NodeRegistryEntry>;
|
|
46
91
|
/** Get registry entry by canonical type */
|
|
@@ -55,3 +100,61 @@ export declare const NODE_STATE_KEYS: Record<string, [string, string]>;
|
|
|
55
100
|
export declare const PREFIX_TO_NODE_TYPE: Record<string, NodeType>;
|
|
56
101
|
/** type → prefix */
|
|
57
102
|
export declare const NODE_TYPE_TO_PREFIX: Record<string, string>;
|
|
103
|
+
/**
|
|
104
|
+
* The catalog these helpers read. Every one of them takes it as an
|
|
105
|
+
* optional last argument defaulting to the real registry: consumers never
|
|
106
|
+
* pass it, and the tests can exercise a versioned type without waiting
|
|
107
|
+
* for a real one to exist.
|
|
108
|
+
*/
|
|
109
|
+
export type VersionCatalog = Record<string, Pick<NodeRegistryEntry, 'type' | 'versions'>>;
|
|
110
|
+
/** True when this type ships more than one version. False for every type today. */
|
|
111
|
+
export declare function isVersioned(type: string, catalog?: VersionCatalog): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Every declared version, newest first — the order a picker wants.
|
|
114
|
+
* Empty for a type that does not version.
|
|
115
|
+
*/
|
|
116
|
+
export declare function versionsOf(type: string, catalog?: VersionCatalog): NodeVersionSpec[];
|
|
117
|
+
/** One version's spec, or undefined when the type or the number is unknown. */
|
|
118
|
+
export declare function versionSpec(type: string, v: number, catalog?: VersionCatalog): NodeVersionSpec | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* The version a new node of this type is born on.
|
|
121
|
+
*
|
|
122
|
+
* Returns 1 for a type that does not version, which is also how an entity
|
|
123
|
+
* with no `nodeVersion` is read. A node created before its type ever
|
|
124
|
+
* versioned was calling the original endpoints, so calling it version 1
|
|
125
|
+
* is not a convention — it is the truth.
|
|
126
|
+
*/
|
|
127
|
+
export declare function currentVersion(type: string, catalog?: VersionCatalog): number;
|
|
128
|
+
/**
|
|
129
|
+
* Config fields present in `from` that `to` does not declare — the exact
|
|
130
|
+
* list a confirmation dialog should name, and the exact list the server
|
|
131
|
+
* should unset.
|
|
132
|
+
*
|
|
133
|
+
* Returns `null` when the question cannot be answered: the type does not
|
|
134
|
+
* version, or one of the two versions is not declared. `null` is not the
|
|
135
|
+
* same as "nothing is lost", and callers must not treat it that way — a
|
|
136
|
+
* dialog should refuse to offer the switch, and the api should reject the
|
|
137
|
+
* request. Returning `null` rather than `[]` is what stops "I don't know"
|
|
138
|
+
* from being read as "nothing".
|
|
139
|
+
*
|
|
140
|
+
* This lives here rather than in each consumer because the dialog that
|
|
141
|
+
* ANNOUNCES the loss and the server that PERFORMS it have to give the
|
|
142
|
+
* same answer. Two implementations would agree right until the day they
|
|
143
|
+
* did not, and that day the dialog lies.
|
|
144
|
+
*/
|
|
145
|
+
export declare function fieldsLostBetween(type: string, from: number, to: number, catalog?: VersionCatalog): string[] | null;
|
|
146
|
+
/**
|
|
147
|
+
* The same answer for two specs already in hand — what `fieldsLostBetween`
|
|
148
|
+
* delegates to once it has resolved both, and what a caller that already
|
|
149
|
+
* holds them from `versionsOf()` can use without a second lookup.
|
|
150
|
+
*/
|
|
151
|
+
export declare function fieldsLost(from: NodeVersionSpec, to: NodeVersionSpec): string[];
|
|
152
|
+
/**
|
|
153
|
+
* Declaration mistakes in the version catalogs, as readable lines.
|
|
154
|
+
*
|
|
155
|
+
* A guard rather than a line in a document: what this codebase learned
|
|
156
|
+
* from fifteen nodes skipping a checklist point everyone had read is that
|
|
157
|
+
* the written rule prevented nothing and the guard did. Empty means every
|
|
158
|
+
* catalog is well-formed.
|
|
159
|
+
*/
|
|
160
|
+
export declare function versionCatalogErrors(catalog?: VersionCatalog): string[];
|
package/dist/registry.js
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.NODE_TYPE_TO_PREFIX = exports.PREFIX_TO_NODE_TYPE = exports.NODE_STATE_KEYS = exports.NODE_COLORS = exports.NODE_DETAIL_PATHS = exports.NODE_REGISTRY = void 0;
|
|
11
11
|
exports.getNodeRegistryEntry = getNodeRegistryEntry;
|
|
12
|
+
exports.isVersioned = isVersioned;
|
|
13
|
+
exports.versionsOf = versionsOf;
|
|
14
|
+
exports.versionSpec = versionSpec;
|
|
15
|
+
exports.currentVersion = currentVersion;
|
|
16
|
+
exports.fieldsLostBetween = fieldsLostBetween;
|
|
17
|
+
exports.fieldsLost = fieldsLost;
|
|
18
|
+
exports.versionCatalogErrors = versionCatalogErrors;
|
|
12
19
|
exports.NODE_REGISTRY = {
|
|
13
20
|
// ── Sources ──
|
|
14
21
|
webhook: {
|
|
@@ -370,3 +377,108 @@ exports.NODE_STATE_KEYS = Object.fromEntries(Object.values(exports.NODE_REGISTRY
|
|
|
370
377
|
exports.PREFIX_TO_NODE_TYPE = Object.fromEntries(Object.values(exports.NODE_REGISTRY).map(n => [n.prefix, n.type]));
|
|
371
378
|
/** type → prefix */
|
|
372
379
|
exports.NODE_TYPE_TO_PREFIX = Object.fromEntries(Object.values(exports.NODE_REGISTRY).map(n => [n.type, n.prefix]));
|
|
380
|
+
function specsFor(type, catalog) {
|
|
381
|
+
return catalog[type]?.versions;
|
|
382
|
+
}
|
|
383
|
+
/** True when this type ships more than one version. False for every type today. */
|
|
384
|
+
function isVersioned(type, catalog = exports.NODE_REGISTRY) {
|
|
385
|
+
return (specsFor(type, catalog)?.length ?? 0) > 0;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Every declared version, newest first — the order a picker wants.
|
|
389
|
+
* Empty for a type that does not version.
|
|
390
|
+
*/
|
|
391
|
+
function versionsOf(type, catalog = exports.NODE_REGISTRY) {
|
|
392
|
+
const declared = specsFor(type, catalog);
|
|
393
|
+
if (!declared)
|
|
394
|
+
return [];
|
|
395
|
+
return [...declared].sort((a, b) => b.v - a.v);
|
|
396
|
+
}
|
|
397
|
+
/** One version's spec, or undefined when the type or the number is unknown. */
|
|
398
|
+
function versionSpec(type, v, catalog = exports.NODE_REGISTRY) {
|
|
399
|
+
return specsFor(type, catalog)?.find(s => s.v === v);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* The version a new node of this type is born on.
|
|
403
|
+
*
|
|
404
|
+
* Returns 1 for a type that does not version, which is also how an entity
|
|
405
|
+
* with no `nodeVersion` is read. A node created before its type ever
|
|
406
|
+
* versioned was calling the original endpoints, so calling it version 1
|
|
407
|
+
* is not a convention — it is the truth.
|
|
408
|
+
*/
|
|
409
|
+
function currentVersion(type, catalog = exports.NODE_REGISTRY) {
|
|
410
|
+
const current = specsFor(type, catalog)?.find(s => s.status === 'current');
|
|
411
|
+
return current?.v ?? 1;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Config fields present in `from` that `to` does not declare — the exact
|
|
415
|
+
* list a confirmation dialog should name, and the exact list the server
|
|
416
|
+
* should unset.
|
|
417
|
+
*
|
|
418
|
+
* Returns `null` when the question cannot be answered: the type does not
|
|
419
|
+
* version, or one of the two versions is not declared. `null` is not the
|
|
420
|
+
* same as "nothing is lost", and callers must not treat it that way — a
|
|
421
|
+
* dialog should refuse to offer the switch, and the api should reject the
|
|
422
|
+
* request. Returning `null` rather than `[]` is what stops "I don't know"
|
|
423
|
+
* from being read as "nothing".
|
|
424
|
+
*
|
|
425
|
+
* This lives here rather than in each consumer because the dialog that
|
|
426
|
+
* ANNOUNCES the loss and the server that PERFORMS it have to give the
|
|
427
|
+
* same answer. Two implementations would agree right until the day they
|
|
428
|
+
* did not, and that day the dialog lies.
|
|
429
|
+
*/
|
|
430
|
+
function fieldsLostBetween(type, from, to, catalog = exports.NODE_REGISTRY) {
|
|
431
|
+
const a = versionSpec(type, from, catalog);
|
|
432
|
+
const b = versionSpec(type, to, catalog);
|
|
433
|
+
if (!a || !b)
|
|
434
|
+
return null;
|
|
435
|
+
return fieldsLost(a, b);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* The same answer for two specs already in hand — what `fieldsLostBetween`
|
|
439
|
+
* delegates to once it has resolved both, and what a caller that already
|
|
440
|
+
* holds them from `versionsOf()` can use without a second lookup.
|
|
441
|
+
*/
|
|
442
|
+
function fieldsLost(from, to) {
|
|
443
|
+
if (from.v === to.v)
|
|
444
|
+
return [];
|
|
445
|
+
if (to.cleanBreak)
|
|
446
|
+
return [...from.fields];
|
|
447
|
+
const kept = new Set(to.fields);
|
|
448
|
+
return from.fields.filter(f => !kept.has(f));
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Declaration mistakes in the version catalogs, as readable lines.
|
|
452
|
+
*
|
|
453
|
+
* A guard rather than a line in a document: what this codebase learned
|
|
454
|
+
* from fifteen nodes skipping a checklist point everyone had read is that
|
|
455
|
+
* the written rule prevented nothing and the guard did. Empty means every
|
|
456
|
+
* catalog is well-formed.
|
|
457
|
+
*/
|
|
458
|
+
function versionCatalogErrors(catalog = exports.NODE_REGISTRY) {
|
|
459
|
+
const errors = [];
|
|
460
|
+
for (const entry of Object.values(catalog)) {
|
|
461
|
+
const versions = entry.versions;
|
|
462
|
+
if (!versions)
|
|
463
|
+
continue;
|
|
464
|
+
if (versions.length === 0) {
|
|
465
|
+
errors.push(`${entry.type}: declares an empty versions array — omit the field instead`);
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
const numbers = versions.map(s => s.v);
|
|
469
|
+
const repeatedNumbers = [...new Set(numbers.filter((n, i) => numbers.indexOf(n) !== i))];
|
|
470
|
+
if (repeatedNumbers.length)
|
|
471
|
+
errors.push(`${entry.type}: repeated version number ${repeatedNumbers.join(', ')}`);
|
|
472
|
+
for (const spec of versions) {
|
|
473
|
+
if (!Number.isInteger(spec.v) || spec.v < 1)
|
|
474
|
+
errors.push(`${entry.type}: version "${spec.v}" is not a positive integer`);
|
|
475
|
+
const repeatedFields = [...new Set(spec.fields.filter((f, i) => spec.fields.indexOf(f) !== i))];
|
|
476
|
+
if (repeatedFields.length)
|
|
477
|
+
errors.push(`${entry.type} v${spec.v}: repeated field ${repeatedFields.join(', ')}`);
|
|
478
|
+
}
|
|
479
|
+
const current = versions.filter(s => s.status === 'current');
|
|
480
|
+
if (current.length !== 1)
|
|
481
|
+
errors.push(`${entry.type}: needs exactly one version with status "current", found ${current.length}`);
|
|
482
|
+
}
|
|
483
|
+
return errors;
|
|
484
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hostwebhook/node-types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.56.0",
|
|
4
4
|
"description": "Shared node type definitions, connection rules, and dispatch config for HostWebhook",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
|
+
"test": "vitest run",
|
|
12
13
|
"prepublishOnly": "npm run build"
|
|
13
14
|
},
|
|
14
15
|
"keywords": [
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
],
|
|
19
20
|
"license": "MIT",
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"typescript": "^5.0.0"
|
|
22
|
+
"typescript": "^5.0.0",
|
|
23
|
+
"vitest": "^3.0.0"
|
|
22
24
|
}
|
|
23
25
|
}
|