@hostwebhook/node-types 1.22.0 → 1.23.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.
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Canonical credential-type registry. Single source of truth for the
3
+ * list of credential types HostWebhook supports — used by:
4
+ *
5
+ * - api Mongoose schema enum (`credential.entity.ts`)
6
+ * - api class-validator DTO (`create-credential.dto.ts`)
7
+ * - dashboard display + form metadata (`lib/credentials/display.ts`)
8
+ * - any future consumer that needs to enumerate types
9
+ *
10
+ * Adding a new credential type happens HERE first; both repos pick it
11
+ * up on the next `@hostwebhook/node-types` bump. The bug we kept
12
+ * hitting (entity accepting "postgres" but the DTO rejecting it)
13
+ * stops being possible — both sides import from this list.
14
+ *
15
+ * Each entry is **deliberately minimal**: just the `type` string +
16
+ * a couple of cross-repo flags that affect runtime behavior.
17
+ * UI-specific metadata (icons, labels, replace-form copy) lives in
18
+ * the dashboard's `display.ts`, where it can evolve without
19
+ * forcing an api-side npm bump.
20
+ */
21
+ export interface CredentialTypeRegistration {
22
+ /** Stable id stored in `credentials.type`. Never rename — it's the
23
+ * primary key for joins from nodes that reference credentials. */
24
+ type: string;
25
+ /** When true, the URI inside `data` is validated against the SSRF
26
+ * guard before storage. Tunneled credentials skip the guard since
27
+ * the agent reaches the customer's own private network on their
28
+ * behalf. Currently honored by `mongodb` and `postgres`. */
29
+ ssrfValidated?: boolean;
30
+ /** When true, the underlying connection can be routed via a reverse
31
+ * TCP tunnel. The credential carries `metadata.tunnelId` and the
32
+ * runtime/test paths register a forwarder via `TcpTunnelPool`. */
33
+ tunnelable?: boolean;
34
+ }
35
+ /**
36
+ * Registry — order matters for fallthrough behavior in pickers (most
37
+ * common types first), but not for correctness.
38
+ */
39
+ export declare const CREDENTIAL_TYPES: readonly CredentialTypeRegistration[];
40
+ /**
41
+ * Plain string array — what the Mongoose `enum` field and the
42
+ * class-validator `@IsIn(...)` decorator both consume. Keep it as a
43
+ * readonly array so misuse (push/pop) breaks at compile time.
44
+ */
45
+ export declare const CREDENTIAL_TYPE_VALUES: readonly string[];
46
+ /** Mutable copy for APIs that take `string[]` (Mongoose `enum`,
47
+ * class-validator). The array itself is freshly built each access
48
+ * so callers can't mutate the canonical list. */
49
+ export declare const credentialTypeValues: () => string[];
50
+ /**
51
+ * Discriminated union of every supported type. Use as the field type
52
+ * on entities + DTOs so a typo at the call site fails at compile
53
+ * time, not at runtime via a Mongoose validation error.
54
+ */
55
+ export type CredentialType = typeof CREDENTIAL_TYPES[number]['type'];
56
+ export declare function getCredentialType(type: string): CredentialTypeRegistration | undefined;
57
+ export declare function isCredentialType(type: string): type is CredentialType;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.credentialTypeValues = exports.CREDENTIAL_TYPE_VALUES = exports.CREDENTIAL_TYPES = void 0;
4
+ exports.getCredentialType = getCredentialType;
5
+ exports.isCredentialType = isCredentialType;
6
+ /**
7
+ * Registry — order matters for fallthrough behavior in pickers (most
8
+ * common types first), but not for correctness.
9
+ */
10
+ exports.CREDENTIAL_TYPES = [
11
+ { type: 'google_service_account' },
12
+ { type: 'oauth2_google' },
13
+ { type: 'oauth2_atlassian' },
14
+ { type: 'mongodb', ssrfValidated: true, tunnelable: true },
15
+ { type: 'postgres', ssrfValidated: true, tunnelable: true },
16
+ { type: 'slack_webhook' },
17
+ { type: 'discord_webhook' },
18
+ { type: 'llm_anthropic' },
19
+ { type: 'llm_openai' },
20
+ { type: 'llm_google' },
21
+ { type: 'llm_ollama' },
22
+ { type: 'firecrawl' },
23
+ { type: 'http_auth' },
24
+ { type: 'aws_s3' },
25
+ { type: 'memory_contextwindow' },
26
+ { type: 'memory_mongodb', ssrfValidated: true, tunnelable: true },
27
+ { type: 'mcp_server' },
28
+ ];
29
+ /**
30
+ * Plain string array — what the Mongoose `enum` field and the
31
+ * class-validator `@IsIn(...)` decorator both consume. Keep it as a
32
+ * readonly array so misuse (push/pop) breaks at compile time.
33
+ */
34
+ exports.CREDENTIAL_TYPE_VALUES = exports.CREDENTIAL_TYPES.map((c) => c.type);
35
+ /** Mutable copy for APIs that take `string[]` (Mongoose `enum`,
36
+ * class-validator). The array itself is freshly built each access
37
+ * so callers can't mutate the canonical list. */
38
+ const credentialTypeValues = () => [...exports.CREDENTIAL_TYPE_VALUES];
39
+ exports.credentialTypeValues = credentialTypeValues;
40
+ function getCredentialType(type) {
41
+ return exports.CREDENTIAL_TYPES.find((c) => c.type === type);
42
+ }
43
+ function isCredentialType(type) {
44
+ return exports.CREDENTIAL_TYPE_VALUES.includes(type);
45
+ }
package/dist/index.d.ts CHANGED
@@ -9,3 +9,5 @@ export { GMAIL_OPERATIONS, isGmailOperation, } from './gmail-operations';
9
9
  export type { GmailOperation } from './gmail-operations';
10
10
  export { GOOGLE_CALENDAR_OPERATIONS, isGoogleCalendarOperation, } from './calendar-operations';
11
11
  export type { GoogleCalendarOperation } from './calendar-operations';
12
+ export type { CredentialTypeRegistration, CredentialType } from './credentials';
13
+ export { CREDENTIAL_TYPES, CREDENTIAL_TYPE_VALUES, credentialTypeValues, getCredentialType, isCredentialType, } from './credentials';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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;
3
+ exports.isCredentialType = exports.getCredentialType = exports.credentialTypeValues = exports.CREDENTIAL_TYPE_VALUES = exports.CREDENTIAL_TYPES = 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
4
  var types_1 = require("./types");
5
5
  Object.defineProperty(exports, "singleMeta", { enumerable: true, get: function () { return types_1.singleMeta; } });
6
6
  Object.defineProperty(exports, "iterableMeta", { enumerable: true, get: function () { return types_1.iterableMeta; } });
@@ -38,3 +38,9 @@ Object.defineProperty(exports, "isGmailOperation", { enumerable: true, get: func
38
38
  var calendar_operations_1 = require("./calendar-operations");
39
39
  Object.defineProperty(exports, "GOOGLE_CALENDAR_OPERATIONS", { enumerable: true, get: function () { return calendar_operations_1.GOOGLE_CALENDAR_OPERATIONS; } });
40
40
  Object.defineProperty(exports, "isGoogleCalendarOperation", { enumerable: true, get: function () { return calendar_operations_1.isGoogleCalendarOperation; } });
41
+ var credentials_1 = require("./credentials");
42
+ Object.defineProperty(exports, "CREDENTIAL_TYPES", { enumerable: true, get: function () { return credentials_1.CREDENTIAL_TYPES; } });
43
+ Object.defineProperty(exports, "CREDENTIAL_TYPE_VALUES", { enumerable: true, get: function () { return credentials_1.CREDENTIAL_TYPE_VALUES; } });
44
+ Object.defineProperty(exports, "credentialTypeValues", { enumerable: true, get: function () { return credentials_1.credentialTypeValues; } });
45
+ Object.defineProperty(exports, "getCredentialType", { enumerable: true, get: function () { return credentials_1.getCredentialType; } });
46
+ Object.defineProperty(exports, "isCredentialType", { enumerable: true, get: function () { return credentials_1.isCredentialType; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostwebhook/node-types",
3
- "version": "1.22.0",
3
+ "version": "1.23.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",