@common-stack/server-stack 8.2.5-alpha.8 → 8.3.1-alpha.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 (91) hide show
  1. package/lib/MainStackServer.cjs +17 -10
  2. package/lib/MainStackServer.cjs.map +1 -1
  3. package/lib/MainStackServer.mjs +17 -10
  4. package/lib/MainStackServer.mjs.map +1 -1
  5. package/lib/StackServer.cjs +1 -1
  6. package/lib/StackServer.cjs.map +1 -1
  7. package/lib/StackServer.mjs +1 -1
  8. package/lib/StackServer.mjs.map +1 -1
  9. package/lib/config/env-config.cjs +6 -0
  10. package/lib/config/env-config.cjs.map +1 -1
  11. package/lib/config/env-config.mjs +6 -0
  12. package/lib/config/env-config.mjs.map +1 -1
  13. package/lib/infrastructure/container-module.cjs +2 -1
  14. package/lib/infrastructure/container-module.cjs.map +1 -1
  15. package/lib/infrastructure/container-module.mjs +2 -1
  16. package/lib/infrastructure/container-module.mjs.map +1 -1
  17. package/lib/infrastructure/inngest-factory.cjs +6 -2
  18. package/lib/infrastructure/inngest-factory.cjs.map +1 -1
  19. package/lib/infrastructure/inngest-factory.mjs +6 -2
  20. package/lib/infrastructure/inngest-factory.mjs.map +1 -1
  21. package/lib/servers/ExpressApp.cjs +3 -3
  22. package/lib/servers/ExpressApp.cjs.map +1 -1
  23. package/lib/servers/ExpressApp.mjs +1 -1
  24. package/lib/servers/ExpressApp.mjs.map +1 -1
  25. package/lib/servers/WebsocketMultipathUpdate.cjs +51 -9
  26. package/lib/servers/WebsocketMultipathUpdate.cjs.map +1 -1
  27. package/lib/servers/WebsocketMultipathUpdate.mjs +51 -9
  28. package/lib/servers/WebsocketMultipathUpdate.mjs.map +1 -1
  29. package/package.json +8 -8
  30. package/lib/MainStackServer.d.ts +0 -34
  31. package/lib/StackServer.d.ts +0 -29
  32. package/lib/api/remote-config.d.ts +0 -6
  33. package/lib/api/resolver.d.ts +0 -10
  34. package/lib/api/scalar.d.ts +0 -2
  35. package/lib/api/schema-builder.d.ts +0 -24
  36. package/lib/api/sub-graph-schema-builder.d.ts +0 -24
  37. package/lib/api/utils.d.ts +0 -4
  38. package/lib/config/env-config.d.ts +0 -28
  39. package/lib/config/index.d.ts +0 -1
  40. package/lib/config/moleculer.config.d.ts +0 -20
  41. package/lib/connectors/connection-broker.d.ts +0 -26
  42. package/lib/connectors/graphql-pubsub-connector.d.ts +0 -22
  43. package/lib/connectors/mongo-connector.d.ts +0 -21
  44. package/lib/connectors/nats-connector.d.ts +0 -20
  45. package/lib/connectors/redis-connector.d.ts +0 -30
  46. package/lib/examples/tenant-feature-example.d.ts +0 -13
  47. package/lib/examples/tenant-feature-integration.d.ts +0 -14
  48. package/lib/features/multi-module-example.d.ts +0 -17
  49. package/lib/index.d.ts +0 -4
  50. package/lib/infrastructure/container-module.d.ts +0 -3
  51. package/lib/infrastructure/example-workflows.d.ts +0 -16
  52. package/lib/infrastructure/index.d.ts +0 -5
  53. package/lib/infrastructure/infrastructure-factory.d.ts +0 -45
  54. package/lib/infrastructure/inngest-factory.d.ts +0 -8
  55. package/lib/infrastructure/types.d.ts +0 -28
  56. package/lib/infrastructure/usage-examples.d.ts +0 -9
  57. package/lib/infrastructure/workflow-orchestrator.d.ts +0 -10
  58. package/lib/inngest/client-id-generator.d.ts +0 -29
  59. package/lib/inngest/handler-factory.d.ts +0 -24
  60. package/lib/inngest/middleware/auto-resolve-invoke.middleware.d.ts +0 -111
  61. package/lib/inngest/middleware/function-reference-helper.d.ts +0 -211
  62. package/lib/inngest/middleware/index.d.ts +0 -31
  63. package/lib/inngest/middleware/types.d.ts +0 -162
  64. package/lib/inngest/multi-module-functions.d.ts +0 -133
  65. package/lib/inngest/setup.d.ts +0 -10
  66. package/lib/interfaces/dbMigration.d.ts +0 -8
  67. package/lib/interfaces/graphql-request-context.d.ts +0 -20
  68. package/lib/interfaces/index.d.ts +0 -4
  69. package/lib/interfaces/module-interface.d.ts +0 -13
  70. package/lib/interfaces/moleculer.d.ts +0 -7
  71. package/lib/middleware/cors.d.ts +0 -6
  72. package/lib/middleware/error.d.ts +0 -9
  73. package/lib/middleware/index.d.ts +0 -5
  74. package/lib/middleware/moleculer-inter-namespace.d.ts +0 -2
  75. package/lib/middleware/redis-client.d.ts +0 -16
  76. package/lib/middleware/sentry.d.ts +0 -2
  77. package/lib/middleware/services.d.ts +0 -2
  78. package/lib/plugins/index.d.ts +0 -2
  79. package/lib/plugins/invalidateCachePlugin.d.ts +0 -8
  80. package/lib/plugins/responseCachePlugin.d.ts +0 -12
  81. package/lib/servers/ExpressApp.d.ts +0 -3
  82. package/lib/servers/GraphqlServer.d.ts +0 -25
  83. package/lib/servers/GraphqlWs.d.ts +0 -14
  84. package/lib/servers/WebsocketMultipathUpdate.d.ts +0 -18
  85. package/lib/servers/mongodb-migration-update.d.ts +0 -12
  86. package/lib/servers/utils.d.ts +0 -14
  87. package/lib/servers/websocket-context.d.ts +0 -30
  88. package/lib/utils/add-shareable-directive-to-schema.d.ts +0 -1
  89. package/lib/utils/index.d.ts +0 -3
  90. package/lib/utils/migrations.d.ts +0 -8
  91. package/lib/utils/safe-model-factory.d.ts +0 -18
@@ -1,9 +0,0 @@
1
- import { MainStackServer } from '../MainStackServer';
2
- import { StackServer } from '../StackServer';
3
- /**
4
- * Example usage of the new modular infrastructure system
5
- */
6
- export declare function startMainServer(): Promise<MainStackServer>;
7
- export declare function startMicroservice(): Promise<StackServer>;
8
- export declare function startServerWithCustomWorkflows(): Promise<MainStackServer>;
9
- export declare function getEnvironmentConfig(environment: string): import("./types").ConnectorConfig;
@@ -1,10 +0,0 @@
1
- import { InfrastructureConfig, WorkflowStep, ConnectorConfig } from './types';
2
- export declare class WorkflowOrchestrator {
3
- private config;
4
- private steps;
5
- constructor(config: InfrastructureConfig);
6
- addStep(step: WorkflowStep): void;
7
- executeWorkflow(context: any): Promise<void>;
8
- getEnabledSteps(): WorkflowStep[];
9
- }
10
- export declare const CONNECTOR_CONFIGS: Record<string, ConnectorConfig>;
@@ -1,29 +0,0 @@
1
- export interface InngestClientIdConfig {
2
- APP_NAME: string;
3
- NODE_ENV: string;
4
- INNGEST_CLIENT_ID?: string;
5
- }
6
- /**
7
- * Generates a unique Inngest client ID for multi-developer environments
8
- * Combines app name, environment, username, and hostname for uniqueness
9
- */
10
- export declare function generateInngestClientId(config: InngestClientIdConfig, logger?: any): string;
11
- /**
12
- * Examples of generated IDs:
13
- *
14
- * Production:
15
- * - APP_NAME=OrderAPI, NODE_ENV=production → "orderapi"
16
- *
17
- * Staging:
18
- * - APP_NAME=OrderAPI, NODE_ENV=staging → "orderapi-staging"
19
- *
20
- * Development:
21
- * - APP_NAME=OrderAPI, NODE_ENV=development, USER=john, HOSTNAME=macbook-pro
22
- * → "orderapi-development-john-macbookp"
23
- *
24
- * - APP_NAME=OrderAPI, NODE_ENV=development, USER=mary, HOSTNAME=mary-laptop
25
- * → "orderapi-development-mary-marylap"
26
- *
27
- * Explicit Override:
28
- * - INNGEST_CLIENT_ID=custom-client-id → "custom-client-id"
29
- */
@@ -1,24 +0,0 @@
1
- import { Container } from 'inversify';
2
- import { Feature } from '@common-stack/server-core';
3
- export type InngestFunctionFactory = (params: {
4
- container: Container;
5
- inngest: any;
6
- settings?: any;
7
- }) => Record<string, any>;
8
- /**
9
- * Creates an Inngest handler that combines functions from multiple modules
10
- * Similar to how Moleculer services are loaded
11
- *
12
- * The improved loadInngestFunctions method now:
13
- * - Handles both array and object returns from factories
14
- * - Automatically extracts function instances from objects
15
- * - Flattens nested arrays
16
- * - Validates function instances
17
- */
18
- export declare const createInngestHandler: (features: Feature[], container: Container, inngestClient: any, settings?: any) => Promise<any[]>;
19
- /**
20
- * Legacy factory for backward compatibility
21
- * @param container - The inversify container
22
- * @deprecated Use createInngestHandler with Feature system instead
23
- */
24
- export declare const inngestHandlerFactory: (container: Container, inngestClient?: any) => Promise<any[]>;
@@ -1,111 +0,0 @@
1
- /**
2
- * Auto-Resolve Invoke Middleware for Inngest
3
- *
4
- * Makes the `function` parameter optional in step.invoke() by automatically
5
- * resolving functions from the registry based on step names.
6
- *
7
- * Usage:
8
- * ```typescript
9
- * const inngest = new Inngest({
10
- * middleware: [
11
- * createFunctionMapperMiddleware(), // Required first
12
- * createAutoResolveInvokeMiddleware(), // Then this
13
- * ]
14
- * });
15
- *
16
- * // In your functions
17
- * async ({ step }) => {
18
- * // Function auto-resolved from step name!
19
- * await step.invoke('user-create', {
20
- * data: { email: 'test@example.com' }
21
- * });
22
- * }
23
- * ```
24
- */
25
- export interface AutoResolveInvokeOptions {
26
- /**
27
- * Custom mappings from step name to function ID
28
- * Example: { 'create-user': 'user-create' }
29
- */
30
- mappings?: Record<string, string>;
31
- /**
32
- * Prefixes to strip from step names when resolving
33
- * Default: ['invoke-', 'call-']
34
- * Example: 'invoke-user-create' → 'user-create'
35
- */
36
- stripPrefixes?: string[];
37
- /**
38
- * Whether function ID matching is case-sensitive
39
- * Default: false
40
- */
41
- caseSensitive?: boolean;
42
- /**
43
- * Whether to throw an error if function cannot be resolved
44
- * Default: true
45
- */
46
- throwOnNotFound?: boolean;
47
- /**
48
- * Enable debug logging
49
- * Default: false
50
- */
51
- debug?: boolean;
52
- }
53
- /**
54
- * Creates middleware that auto-resolves functions for step.invoke()
55
- *
56
- * IMPORTANT: This middleware requires functions to be provided explicitly.
57
- * Use `createAutoResolveInvokeMiddlewareWithFunctions()` helper instead,
58
- * or pass functions manually after calling serve().
59
- *
60
- * Resolution strategy (in order):
61
- * 1. If function explicitly provided → use it
62
- * 2. Try custom mappings
63
- * 3. Try exact match with function ID
64
- * 4. Try stripping configured prefixes
65
- * 5. Throw error or return null (based on throwOnNotFound)
66
- */
67
- export declare function createAutoResolveInvokeMiddleware(options?: AutoResolveInvokeOptions): any;
68
- /**
69
- * Helper: Create middleware with functions pre-populated
70
- * Use this version to ensure functions are available before middleware runs
71
- */
72
- export declare function createAutoResolveInvokeMiddlewareWithFunctions(functions: any[], options?: AutoResolveInvokeOptions): any;
73
- /**
74
- * Helper: Create middleware with common defaults for common-stack
75
- * Handles common-stack naming patterns like:
76
- * - aicode-code-agent
77
- * - project-mgmt-main-workflow
78
- * - key-mgmt-openbao-create-secret
79
- */
80
- export declare function createAutoResolveInvokeMiddlewareWithDefaults(): any;
81
- /**
82
- * Helper: Create middleware configured for common-stack WorkflowNamespace patterns
83
- *
84
- * Handles your naming convention where:
85
- * - Function IDs: 'aicode-code-agent', 'project-mgmt-main-workflow'
86
- * - Event Names: 'aicode/code-agent-trigger', 'project-mgmt-main-workflow/trigger'
87
- *
88
- * Example usage:
89
- * ```typescript
90
- * // In your workflow
91
- * await step.invoke('aicode-code-agent', { data: {...} });
92
- * // Resolves to function with ID 'aicode-code-agent'
93
- *
94
- * await step.invoke('project-mgmt-create-from-template', { data: {...} });
95
- * // Resolves to function with ID 'project-mgmt-create-from-template'
96
- * ```
97
- */
98
- export declare function createCommonStackAutoResolveMiddleware(options?: {
99
- /** Additional custom mappings for special cases */
100
- customMappings?: Record<string, string>;
101
- /** Enable debug logging */
102
- debug?: boolean;
103
- }): any;
104
- /**
105
- * Strict mode - only exact matches, case-sensitive
106
- */
107
- export declare const createStrictAutoResolveInvokeMiddleware: () => any;
108
- /**
109
- * Lenient mode - tries everything, doesn't throw
110
- */
111
- export declare const createLenientAutoResolveInvokeMiddleware: () => any;
@@ -1,211 +0,0 @@
1
- /**
2
- * Function Reference Helper for Inngest
3
- *
4
- * Provides automatic function reference resolution for all registered functions.
5
- * Instead of manually importing functions, you can reference them by ID.
6
- *
7
- * This combines:
8
- * 1. Inngest's native `referenceFunction()` pattern
9
- * 2. Automatic registry from all Feature-registered functions
10
- * 3. Type-safe helpers for common patterns
11
- *
12
- * Usage:
13
- * ```typescript
14
- * // Instead of:
15
- * import { someFunction } from '../other-module';
16
- * await step.invoke('call-it', { function: someFunction, data: {...} });
17
- *
18
- * // You can do:
19
- * await step.invoke('call-it', {
20
- * function: ctx.resolveFunction('some-function-id'),
21
- * data: {...}
22
- * });
23
- *
24
- * // Or even simpler (if middleware auto-resolve enabled):
25
- * await step.invoke('some-function-id', { data: {...} });
26
- * ```
27
- */
28
- import { InngestFunction } from 'inngest';
29
- /**
30
- * Global function registry
31
- * Populated by setup.ts after all functions are loaded
32
- */
33
- declare class FunctionRegistry {
34
- private functions;
35
- private initialized;
36
- /**
37
- * Register all functions from Feature system
38
- */
39
- register(functions: InngestFunction.Any[]): void;
40
- /**
41
- * Get function by ID (case-insensitive)
42
- */
43
- get(functionId: string): InngestFunction.Any | undefined;
44
- /**
45
- * Check if function exists
46
- */
47
- has(functionId: string): boolean;
48
- /**
49
- * Get all registered function IDs
50
- */
51
- getAllIds(): string[];
52
- /**
53
- * Get count of registered functions
54
- */
55
- get count(): number;
56
- /**
57
- * Check if registry is initialized
58
- */
59
- get isInitialized(): boolean;
60
- /**
61
- * Clear registry (for testing)
62
- */
63
- clear(): void;
64
- }
65
- export declare const globalFunctionRegistry: FunctionRegistry;
66
- /**
67
- * Reference a function by its ID
68
- * Similar to Inngest's native referenceFunction, but automatically uses global registry
69
- *
70
- * @param functionIdOrOptions - The ID of the function or options object with functionId
71
- * @returns The function reference to use in step.invoke()
72
- *
73
- * @example
74
- * ```typescript
75
- * // Simple usage
76
- * const userCreateFn = referenceFunction('user-create');
77
- *
78
- * // Type-safe usage
79
- * const computePi = referenceFunction({ functionId: 'compute-pi' });
80
- *
81
- * await step.invoke('create-user', {
82
- * function: userCreateFn,
83
- * data: { email: 'user@example.com' }
84
- * });
85
- * ```
86
- */
87
- export declare function referenceFunction<T extends InngestFunction.Any = InngestFunction.Any>(functionIdOrOptions: string | {
88
- functionId: string;
89
- }): T;
90
- /**
91
- * Batch reference multiple functions at once
92
- * Useful for orchestrator workflows that call many functions
93
- *
94
- * @example
95
- * ```typescript
96
- * const { userCreate, emailSend, analyticsTrack } = referenceFunctions([
97
- * 'user-create',
98
- * 'email-send-welcome',
99
- * 'analytics-track-event'
100
- * ]);
101
- *
102
- * await step.invoke('create-user', { function: userCreate, data: {...} });
103
- * await step.invoke('send-email', { function: emailSend, data: {...} });
104
- * await step.invoke('track', { function: analyticsTrack, data: {...} });
105
- * ```
106
- */
107
- export declare function referenceFunctions<T extends readonly string[]>(functionIds: T): {
108
- [K in T[number]]: InngestFunction.Any;
109
- };
110
- /**
111
- * Check if a function is registered
112
- * Useful for conditional logic
113
- *
114
- * @example
115
- * ```typescript
116
- * if (hasFunctionReference('email-send-welcome')) {
117
- * const emailFn = referenceFunction('email-send-welcome');
118
- * await step.invoke('send-email', { function: emailFn, data: {...} });
119
- * }
120
- * ```
121
- */
122
- export declare function hasFunctionReference(functionId: string): boolean;
123
- /**
124
- * Get all available function IDs
125
- * Useful for debugging and introspection
126
- *
127
- * @example
128
- * ```typescript
129
- * console.log('Available functions:', getAvailableFunctions());
130
- * ```
131
- */
132
- export declare function getAvailableFunctions(): string[];
133
- /**
134
- * Resolve a workflow-style or ID-style function reference to an Inngest function reference.
135
- *
136
- * Supported inputs:
137
- * - Exact function id: "user-create"
138
- * - Workflow-style: "WORKFLOWNAME.Function/trigger" or "WORKFLOWNAME.Function.trigger"
139
- *
140
- * The resolver will first try the exact ID as provided. If not found it will
141
- * normalize the string by replacing separators ("/", ".") with dashes and
142
- * collapsing non-alphanumerics, then lower-case the result. Example:
143
- *
144
- * WORKFLOWNAME.Function/trigger -> workflowname-function-trigger
145
- *
146
- * If still not found, it will throw the same helpful error as `referenceFunction`.
147
- */
148
- export declare function resolveFunctionId(functionRef: string | {
149
- functionId: string;
150
- }): InngestFunction.Any;
151
- /**
152
- * Middleware that injects referenceFunction into context
153
- * Makes it available in all function handlers
154
- *
155
- * @example
156
- * ```typescript
157
- * const inngest = new Inngest({
158
- * middleware: [createFunctionReferenceMiddleware()],
159
- * });
160
- *
161
- * const myFn = inngest.createFunction(..., async ({ step, ctx }) => {
162
- * // Access via context!
163
- * const userFn = ctx.resolveFunction('user-create');
164
- * await step.invoke('create-user', { function: userFn, data: {...} });
165
- * });
166
- * ```
167
- */
168
- export declare function createFunctionReferenceMiddleware(): {
169
- name: string;
170
- init(): {
171
- onFunctionRun({ ctx }: any): {
172
- transformInput(inputCtx: any): any;
173
- };
174
- onSendEvent: () => {};
175
- };
176
- };
177
- /**
178
- * Combined middleware: Reference + Auto-Resolve
179
- * Provides both manual and automatic function resolution
180
- *
181
- * @example
182
- * ```typescript
183
- * const inngest = new Inngest({
184
- * middleware: [createCombinedFunctionMiddleware()],
185
- * });
186
- *
187
- * // Method 1: Manual reference
188
- * const userFn = ctx.resolveFunction('user-create');
189
- * await step.invoke('create-user', { function: userFn, data: {...} });
190
- *
191
- * // Method 2: Automatic (if function ID matches)
192
- * await step.invoke('user-create', { data: {...} }); // Auto-resolved!
193
- * ```
194
- */
195
- export declare function createCombinedFunctionMiddleware(options?: {
196
- /** Enable auto-resolve (default: true) */
197
- autoResolve?: boolean;
198
- /** Case-sensitive matching (default: false) */
199
- caseSensitive?: boolean;
200
- /** Enable debug logging (default: false) */
201
- debug?: boolean;
202
- }): {
203
- name: string;
204
- init(): {
205
- onFunctionRun({ ctx }: any): {
206
- transformInput(inputCtx: any): any;
207
- };
208
- onSendEvent: () => {};
209
- };
210
- };
211
- export {};
@@ -1,31 +0,0 @@
1
- /**
2
- * Inngest Middleware - Public Exports
3
- *
4
- * This module provides middleware to automatically resolve Inngest function references
5
- * in step.invoke() calls, enabling cleaner workflow code.
6
- */
7
- export { createAutoResolveInvokeMiddleware, createAutoResolveInvokeMiddlewareWithFunctions, createAutoResolveInvokeMiddlewareWithDefaults, createCommonStackAutoResolveMiddleware, createStrictAutoResolveInvokeMiddleware, type AutoResolveInvokeOptions, } from './auto-resolve-invoke.middleware';
8
- export { referenceFunction, referenceFunctions, hasFunctionReference, getAvailableFunctions, resolveFunctionId, globalFunctionRegistry, createFunctionReferenceMiddleware, createCombinedFunctionMiddleware, } from './function-reference-helper';
9
- export type { InngestFunction } from 'inngest';
10
- export type { ExtendedContext, ExtendedStep, InlineEditorHandler, FullContextHandler } from './types';
11
- /**
12
- * Usage Example:
13
- *
14
- * ```typescript
15
- * import { createCommonStackAutoResolveMiddleware } from '@common-stack/server-stack';
16
- *
17
- * const inngest = new Inngest({
18
- * id: 'my-app',
19
- * middleware: [
20
- * createCommonStackAutoResolveMiddleware({
21
- * debug: true,
22
- * })
23
- * ]
24
- * });
25
- *
26
- * // In your workflows:
27
- * await step.invoke(WorkflowNamespace.USER_CREATE, {
28
- * data: { email: 'test@example.com' }
29
- * });
30
- * ```
31
- */
@@ -1,162 +0,0 @@
1
- /**
2
- * TypeScript type extensions for Inngest middleware-injected helpers
3
- *
4
- * These types extend the Inngest Step and Context objects with our custom helpers
5
- * that are injected by the function-reference middleware.
6
- *
7
- * Usage in your code:
8
- * ```typescript
9
- * import type { ExtendedStep, ExtendedContext } from '@common-stack/server-stack';
10
- *
11
- * const myFn = inngest.createFunction(..., async ({ event, ctx, step }: {
12
- * event: any;
13
- * ctx: ExtendedContext;
14
- * step: ExtendedStep;
15
- * }) => {
16
- * // Now you get autocomplete for ctx.resolveFunctionId and step.resolveFunctionId!
17
- * const userFn = ctx.resolveFunctionId('USER.Create/trigger');
18
- * await step.invoke('create-user', { function: userFn, data: {...} });
19
- * });
20
- * ```
21
- */
22
- import type { InngestFunction } from 'inngest';
23
- /**
24
- * Extended Context with injected function reference helpers
25
- */
26
- export interface ExtendedContext {
27
- /**
28
- * Reference a function by its exact ID
29
- * @param functionId - The exact function ID (e.g., 'user-create')
30
- */
31
- resolveFunction<T extends InngestFunction.Any = InngestFunction.Any>(functionId: string | {
32
- functionId: string;
33
- }): T;
34
- /**
35
- * Resolve a function reference from a workflow-style string or plain ID
36
- * Normalizes strings like "WORKFLOWNAME.Function/trigger" to "workflowname-function-trigger"
37
- * @param functionRef - Workflow-style string or plain function ID
38
- */
39
- resolveFunctionId<T extends InngestFunction.Any = InngestFunction.Any>(functionRef: string | {
40
- functionId: string;
41
- }): T;
42
- /**
43
- * Batch reference multiple functions at once
44
- * @param functionIds - Array of function IDs to reference
45
- */
46
- resolveFunctions<T extends readonly string[]>(functionIds: T): {
47
- [K in T[number]]: InngestFunction.Any;
48
- };
49
- /**
50
- * Check if a function is registered in the global registry
51
- * @param functionId - The function ID to check
52
- */
53
- hasFunction(functionId: string): boolean;
54
- /**
55
- * Get all available function IDs from the registry
56
- */
57
- getAvailableFunctions(): string[];
58
- }
59
- /**
60
- * Extended Step with injected function reference helpers
61
- *
62
- * These are available on the step object for inline editors that can't import modules.
63
- */
64
- export interface ExtendedStep {
65
- /**
66
- * Reference a function by its exact ID
67
- * Available on step object for inline editor support (no imports needed)
68
- * @param functionId - The exact function ID (e.g., 'user-create')
69
- *
70
- * @example
71
- * ```typescript
72
- * const step_159 = async (event, step) => {
73
- * const userFn = step.referenceFunction('user-create');
74
- * await step.invoke('create-user', { function: userFn, data: {...} });
75
- * };
76
- * ```
77
- */
78
- referenceFunction<T extends InngestFunction.Any = InngestFunction.Any>(functionId: string | {
79
- functionId: string;
80
- }): T;
81
- /**
82
- * Resolve a function reference from a workflow-style string or plain ID
83
- * Available on step object for inline editor support (no imports needed)
84
- * Normalizes strings like "WORKFLOWNAME.Function/trigger" to "workflowname-function-trigger"
85
- * @param functionRef - Workflow-style string or plain function ID
86
- *
87
- * @example
88
- * ```typescript
89
- * const step_159 = async (event, step) => {
90
- * // Workflow-style reference
91
- * const paymentFn = step.resolveFunctionId('BILLING.ProcessPayment/trigger');
92
- * await step.invoke('process-payment', { function: paymentFn, data: {...} });
93
- * };
94
- * ```
95
- */
96
- resolveFunctionId<T extends InngestFunction.Any = InngestFunction.Any>(functionRef: string | {
97
- functionId: string;
98
- }): T;
99
- /**
100
- * Check if a function is registered in the global registry
101
- * Available on step object for inline editor support (no imports needed)
102
- * @param functionId - The function ID to check
103
- *
104
- * @example
105
- * ```typescript
106
- * const step_159 = async (event, step) => {
107
- * if (step.hasFunction('email-send')) {
108
- * const emailFn = step.referenceFunction('email-send');
109
- * await step.invoke('send-email', { function: emailFn, data: {...} });
110
- * }
111
- * };
112
- * ```
113
- */
114
- hasFunction(functionId: string): boolean;
115
- /**
116
- * Get all available function IDs from the registry
117
- * Available on step object for inline editor support (no imports needed)
118
- *
119
- * @example
120
- * ```typescript
121
- * const step_159 = async (event, step) => {
122
- * console.log('Available functions:', step.getAvailableFunctions());
123
- * };
124
- * ```
125
- */
126
- getAvailableFunctions(): string[];
127
- invoke: any;
128
- run: any;
129
- sleep: any;
130
- sleepUntil: any;
131
- waitForEvent: any;
132
- sendEvent: any;
133
- [key: string]: any;
134
- }
135
- /**
136
- * Helper type for inline editor function handlers
137
- * Use this for your inline editor functions to get full autocomplete
138
- *
139
- * @example
140
- * ```typescript
141
- * const step_159: InlineEditorHandler = async (event, step) => {
142
- * // Full autocomplete for step.resolveFunctionId, step.referenceFunction, etc!
143
- * const userFn = step.resolveFunctionId('USER.Create/trigger');
144
- * await step.invoke('create-user', { function: userFn, data: {...} });
145
- * return { success: true };
146
- * };
147
- * ```
148
- */
149
- export type InlineEditorHandler = (event: any, step: ExtendedStep) => Promise<any>;
150
- /**
151
- * Full context handler with both ctx and step extended
152
- *
153
- * @example
154
- * ```typescript
155
- * const myHandler: FullContextHandler = async (event, ctx, step) => {
156
- * const userFn = ctx.resolveFunctionId('USER.Create/trigger');
157
- * await step.invoke('create-user', { function: userFn, data: {...} });
158
- * return { success: true };
159
- * };
160
- * ```
161
- */
162
- export type FullContextHandler = (event: any, ctx: ExtendedContext, step: ExtendedStep) => Promise<any>;