@minded-ai/mindedjs 1.0.96 → 1.0.97-beta-1236

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 (77) hide show
  1. package/dist/browserTask/README.md +419 -0
  2. package/dist/browserTask/browserAgent.py +632 -0
  3. package/dist/browserTask/captcha_isolated.png +0 -0
  4. package/dist/browserTask/executeBrowserTask.d.ts +2 -0
  5. package/dist/browserTask/executeBrowserTask.d.ts.map +1 -0
  6. package/dist/browserTask/executeBrowserTask.js +78 -0
  7. package/dist/browserTask/executeBrowserTask.js.map +1 -0
  8. package/dist/browserTask/executeBrowserTask.ts +78 -0
  9. package/dist/browserTask/requirements.txt +8 -0
  10. package/dist/browserTask/setup.sh +144 -0
  11. package/dist/cli/index.js +103 -1
  12. package/dist/cli/index.js.map +1 -1
  13. package/dist/nodes/addAppToolNode.js +2 -2
  14. package/dist/nodes/addAppToolNode.js.map +1 -1
  15. package/dist/nodes/addBrowserTaskNode.d.ts +11 -0
  16. package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -0
  17. package/dist/nodes/addBrowserTaskNode.js +100 -0
  18. package/dist/nodes/addBrowserTaskNode.js.map +1 -0
  19. package/dist/nodes/nodeFactory.d.ts.map +1 -1
  20. package/dist/nodes/nodeFactory.js +4 -0
  21. package/dist/nodes/nodeFactory.js.map +1 -1
  22. package/dist/types/Flows.types.d.ts +9 -2
  23. package/dist/types/Flows.types.d.ts.map +1 -1
  24. package/dist/types/Flows.types.js +1 -0
  25. package/dist/types/Flows.types.js.map +1 -1
  26. package/dist/utils/logger.js +1 -1
  27. package/dist/utils/logger.js.map +1 -1
  28. package/docs/getting-started/installation.md +42 -0
  29. package/package.json +13 -5
  30. package/src/agent.ts +0 -897
  31. package/src/checkpointer/checkpointSaverFactory.ts +0 -18
  32. package/src/cli/index.ts +0 -170
  33. package/src/cli/lambdaHandlerTemplate.ts +0 -46
  34. package/src/edges/createDirectEdge.ts +0 -11
  35. package/src/edges/createLogicalRouter.ts +0 -98
  36. package/src/edges/createPromptRouter.ts +0 -210
  37. package/src/edges/edgeFactory.ts +0 -125
  38. package/src/events/AgentEvents.ts +0 -47
  39. package/src/events/index.ts +0 -3
  40. package/src/index.ts +0 -51
  41. package/src/interfaces/zendesk.ts +0 -157
  42. package/src/internalTools/appActionRunnerTool.ts +0 -75
  43. package/src/internalTools/sendPlaceholderMessage.ts +0 -27
  44. package/src/internalTools/timer.ts +0 -137
  45. package/src/llm/createLlmInstance.ts +0 -10
  46. package/src/nodes/addAppToolNode.ts +0 -95
  47. package/src/nodes/addHumanInTheLoopNode.ts +0 -25
  48. package/src/nodes/addJumpToNode.ts +0 -24
  49. package/src/nodes/addJunctionNode.ts +0 -19
  50. package/src/nodes/addPromptNode.ts +0 -117
  51. package/src/nodes/addToolNode.ts +0 -71
  52. package/src/nodes/addToolRunNode.ts +0 -74
  53. package/src/nodes/addTriggerNode.ts +0 -26
  54. package/src/nodes/nodeFactory.ts +0 -53
  55. package/src/platform/config.ts +0 -77
  56. package/src/platform/mindedChatOpenAI.ts +0 -19
  57. package/src/platform/mindedCheckpointSaver.ts +0 -146
  58. package/src/platform/mindedConnection.ts +0 -199
  59. package/src/platform/mindedConnectionTypes.ts +0 -191
  60. package/src/platform/piiGateway/gateway.ts +0 -103
  61. package/src/platform/piiGateway/index.ts +0 -5
  62. package/src/platform/piiGateway/types.ts +0 -29
  63. package/src/playbooks/playbooks.ts +0 -209
  64. package/src/triggers/triggerTypeToDefaultMessage.ts +0 -9
  65. package/src/types/Agent.types.ts +0 -67
  66. package/src/types/Flows.types.ts +0 -184
  67. package/src/types/LLM.types.ts +0 -15
  68. package/src/types/LangGraph.types.ts +0 -48
  69. package/src/types/Platform.types.ts +0 -1
  70. package/src/types/Tools.types.ts +0 -31
  71. package/src/types/Voice.types.ts +0 -4
  72. package/src/utils/extractStateMemoryResponse.ts +0 -16
  73. package/src/utils/history.ts +0 -9
  74. package/src/utils/logger.ts +0 -22
  75. package/src/utils/wait.ts +0 -1
  76. package/src/voice/elevenLabsUtils.ts +0 -81
  77. package/src/voice/voiceSession.ts +0 -295
@@ -1,199 +0,0 @@
1
- import { io, Socket } from 'socket.io-client';
2
- import {
3
- mindedConnectionSocketMessageType,
4
- mindedConnectionSocketMessageTypeMap,
5
- } from './mindedConnectionTypes';
6
- import { stringify } from 'flatted';
7
- import { getConfig } from './config';
8
- import { logger } from '../utils/logger';
9
- import { wait } from '../utils/wait';
10
-
11
- // Module-level singleton state
12
- let socket: Socket | null = null;
13
- const listeners: {
14
- [key: string]: ((message: any, callback: (response: any) => void) => void)[];
15
- } = {};
16
-
17
- export const isConnected = (): boolean => {
18
- return socket?.connected ?? false;
19
- };
20
-
21
- export const on = <E extends keyof mindedConnectionSocketMessageTypeMap>(
22
- event: E,
23
- callback: (message: mindedConnectionSocketMessageTypeMap[E], callback: (response: any) => void) => void,
24
- ) => {
25
- if (!listeners[event]) {
26
- listeners[event] = [];
27
- }
28
- listeners[event].push(callback);
29
- };
30
-
31
- export const emit = <E extends keyof mindedConnectionSocketMessageTypeMap>(
32
- event: E,
33
- message: mindedConnectionSocketMessageTypeMap[E]
34
- ) => {
35
- if (socket) {
36
- socket.emit(event, message);
37
- }
38
- };
39
-
40
- export const awaitEmit = async <T, R>(
41
- event: mindedConnectionSocketMessageType,
42
- message: T,
43
- timeoutMs: number = 5000
44
- ): Promise<R> => {
45
- if (!socket) {
46
- throw new Error('Socket is not connected');
47
- }
48
-
49
- await waitForConnection();
50
-
51
- return new Promise((resolve, reject) => {
52
- // Set up timeout
53
- const timeout = setTimeout(() => {
54
- reject(new Error(`Acknowledgement timeout after ${timeoutMs}ms; event type: ${event}}`));
55
- }, timeoutMs);
56
-
57
- // Emit with acknowledgement callback
58
- socket!.emit(event, stringify(message), (response: any) => {
59
- clearTimeout(timeout);
60
-
61
- // Check if the response indicates an error
62
- if (response && response.error) {
63
- reject(new Error(response.error));
64
- } else {
65
- resolve(response);
66
- }
67
- });
68
- });
69
- };
70
-
71
- const waitForConnection = async (): Promise<void> => {
72
- const timeout = 10000;
73
- const interval = 100;
74
- let cnt = 0;
75
- while (!isConnected()) {
76
- await wait(interval);
77
- cnt += interval;
78
- if (cnt > timeout) {
79
- throw new Error('Minded connection timeout');
80
- }
81
- }
82
- };
83
-
84
- const connect = async (token: string): Promise<void> => {
85
- const { isDeployed, baseUrl } = getConfig();
86
- return new Promise<void>((resolve, reject) => {
87
- socket = io(baseUrl, {
88
- path: '/minded-connect',
89
- query: {
90
- isDeployedAgent: isDeployed,
91
- token,
92
- },
93
- });
94
-
95
- let connected = false;
96
- let ready = false;
97
-
98
- const checkReady = () => {
99
- if (connected && ready) {
100
- logger.info('\x1b[32mConnection with Minded platform is ready!\x1b[0m');
101
- logger.info('\x1b[32mPress Ctrl+C to exit...');
102
- resolve();
103
- }
104
- };
105
-
106
- // Connection event handlers
107
- socket.on('connect', () => {
108
- logger.info('Socket connected, waiting for server setup...');
109
- connected = true;
110
- checkReady();
111
- });
112
-
113
- // Listen for ready event from server
114
- socket.on('sdk-socket-ready', (data: { agentId: string; orgName: string }) => {
115
- logger.info('Server ready signal received', data);
116
- ready = true;
117
- checkReady();
118
- });
119
-
120
- socket.on('connect_error', () => {
121
- logger.error('Failed to connect to minded platform');
122
- reject(new Error('Failed to connect to minded platform'));
123
- });
124
-
125
- socket.on('disconnect', () => {
126
- logger.info('Disconnected from local debugging socket');
127
- connected = false;
128
- ready = false;
129
- });
130
-
131
- // Listen for error messages from the server
132
- socket.on('error', async (error: { message: string }) => {
133
- logger.error({ msg: 'Server error:', error });
134
-
135
- if (error.message.includes('Invalid token')) {
136
- logger.info('Invalid token');
137
-
138
- // Disconnect current socket
139
- if (socket?.connected) {
140
- socket.disconnect();
141
- }
142
-
143
- // Get new token and reconnect
144
- await connect(token);
145
- }
146
- });
147
-
148
- // Listen for specific message types
149
- socket.onAny((event, message, callback) => {
150
- if (listeners[event]) {
151
- listeners[event].forEach((listener) => {
152
- listener(message, callback);
153
- });
154
- } else {
155
- console.warn({ message: 'No listeners found for event', event });
156
- }
157
- });
158
-
159
- // Handle process termination
160
- process.on('SIGINT', () => {
161
- if (socket?.connected) {
162
- logger.info('\nDisconnecting...');
163
- socket.disconnect();
164
- }
165
- process.exit(0);
166
- });
167
- });
168
- };
169
-
170
- export const start = async (): Promise<void> => {
171
- const { token } = getConfig();
172
- if (!token) {
173
- throw new Error('Minded token not found');
174
- }
175
- await connect(token);
176
- };
177
-
178
- export const disconnect = () => {
179
- if (!socket) {
180
- logger.warn('No socket connection to disconnect');
181
- return;
182
- }
183
-
184
- if (socket.connected) {
185
- logger.info('Disconnecting from Minded platform...');
186
- socket.disconnect();
187
- return;
188
- }
189
-
190
- logger.warn('Socket is already disconnected');
191
- };
192
-
193
- export const mindedConnection = {
194
- isConnected,
195
- on,
196
- emit,
197
- awaitEmit,
198
- start,
199
- };
@@ -1,191 +0,0 @@
1
- import type {
2
- CheckpointListOptions,
3
- CheckpointMetadata,
4
- PendingWrite,
5
- Checkpoint,
6
- ChannelVersions,
7
- CheckpointTuple,
8
- } from '@langchain/langgraph-checkpoint';
9
- import type { RunnableConfig } from '@langchain/core/runnables';
10
- import { AgentInvokeParams } from '../types/Agent.types';
11
-
12
- export enum mindedConnectionSocketMessageType {
13
- OnAppAction = 'on-app-action',
14
- GET_SECRETS = 'get-secrets',
15
- GET_FLOWS = 'get-flows',
16
- GET_PLAYBOOKS = 'get-playbooks',
17
- INVOKE = 'invoke',
18
- PII_HTTP_REQUEST = 'pii-http-request',
19
- // Checkpoints
20
- CHECKPOINT_GET_TUPLE = 'checkpoint-get-tuple',
21
- CHECKPOINT_PUT = 'checkpoint-put',
22
- CHECKPOINT_LIST = 'checkpoint-list',
23
- CHECKPOINT_PUT_WRITES = 'checkpoint-put-writes',
24
- RESTORE_CHECKPOINT = 'restore-checkpoint',
25
- // Voice
26
- DASHBOARD_VOICE_USER_AUDIO = 'dashboard-voice-user-audio',
27
- DASHBOARD_VOICE_AGENT_AUDIO = 'dashboard-voice-agent-audio',
28
- DASHBOARD_VOICE_SESSION_START = 'dashboard-voice-session-start',
29
- DASHBOARD_VOICE_SESSION_END = 'dashboard-voice-session-end',
30
- DASHBOARD_VOICE_INTERRUPTION = 'dashboard-voice-interruption',
31
- DASHBOARD_VOICE_PLACEHOLDER_MESSAGES = 'dashboard-voice-placeholder-messages',
32
- INTERFACE_FUNCTION_CALL = 'interface-function-call',
33
- TIMER_RESET = 'timer-reset',
34
- TIMER_CANCEL = 'timer-cancel',
35
- TIMER_TRIGGER = 'timer-trigger',
36
- }
37
-
38
- export type mindedConnectionSocketMessageTypeMap = {
39
- [mindedConnectionSocketMessageType.OnAppAction]: BasemindedConnectionSocketMessage;
40
- [mindedConnectionSocketMessageType.GET_SECRETS]: BasemindedConnectionSocketMessage;
41
- [mindedConnectionSocketMessageType.GET_FLOWS]: BasemindedConnectionSocketMessage;
42
- [mindedConnectionSocketMessageType.GET_PLAYBOOKS]: BasemindedConnectionSocketMessage;
43
- [mindedConnectionSocketMessageType.INVOKE]: InvokeMessage;
44
- [mindedConnectionSocketMessageType.CHECKPOINT_GET_TUPLE]: OnCheckpointGetTuple;
45
- [mindedConnectionSocketMessageType.CHECKPOINT_PUT]: OnCheckpointPut;
46
- [mindedConnectionSocketMessageType.CHECKPOINT_LIST]: OnCheckpointList;
47
- [mindedConnectionSocketMessageType.CHECKPOINT_PUT_WRITES]: OnCheckpointPutWrites;
48
- [mindedConnectionSocketMessageType.DASHBOARD_VOICE_USER_AUDIO]: OnVoiceAudioIn;
49
- [mindedConnectionSocketMessageType.DASHBOARD_VOICE_AGENT_AUDIO]: OnVoiceAudioOut;
50
- [mindedConnectionSocketMessageType.DASHBOARD_VOICE_SESSION_START]: BaseVoiceMessage;
51
- [mindedConnectionSocketMessageType.DASHBOARD_VOICE_SESSION_END]: OnVoiceSessionEnd;
52
- [mindedConnectionSocketMessageType.DASHBOARD_VOICE_INTERRUPTION]: OnVoiceInterruption;
53
- [mindedConnectionSocketMessageType.DASHBOARD_VOICE_PLACEHOLDER_MESSAGES]: VoicePlaceholderMessage;
54
- [mindedConnectionSocketMessageType.PII_HTTP_REQUEST]: OnPiiHttpRequest;
55
- [mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL]: InterfaceFunctionCall;
56
- [mindedConnectionSocketMessageType.TIMER_RESET]: TimerResetRequest;
57
- [mindedConnectionSocketMessageType.TIMER_CANCEL]: TimerCancelRequest;
58
- [mindedConnectionSocketMessageType.TIMER_TRIGGER]: TimerTriggerRequest;
59
- [mindedConnectionSocketMessageType.RESTORE_CHECKPOINT]: RestoreCheckpointRequest;
60
- };
61
-
62
- export interface BasemindedConnectionSocketMessage {
63
- type: mindedConnectionSocketMessageType;
64
- }
65
-
66
- export interface BaseSdkConnectionSocketMessageResponseCallbackAck {
67
- error?: string;
68
- }
69
-
70
- export interface OnCheckpointPut extends BasemindedConnectionSocketMessage {
71
- config: RunnableConfig;
72
- checkpoint: Checkpoint;
73
- metadata: CheckpointMetadata;
74
- newVersions: ChannelVersions;
75
- }
76
-
77
- export interface OnCheckpointPutResponse extends BaseSdkConnectionSocketMessageResponseCallbackAck {
78
- config: RunnableConfig;
79
- }
80
- export interface OnCheckpointPutWrites extends BasemindedConnectionSocketMessage {
81
- config: RunnableConfig;
82
- writes: PendingWrite[];
83
- taskId: string;
84
- }
85
-
86
- export interface OnCheckpointGetTupleResponse extends BaseSdkConnectionSocketMessageResponseCallbackAck {
87
- tuple?: CheckpointTuple | undefined;
88
- }
89
-
90
- export interface OnCheckpointGetTuple extends BasemindedConnectionSocketMessage {
91
- config: RunnableConfig;
92
- }
93
-
94
- export interface OnCheckpointList extends BasemindedConnectionSocketMessage {
95
- config: RunnableConfig;
96
- options?: CheckpointListOptions;
97
- }
98
-
99
- export interface OnCheckpointListResponse extends BaseSdkConnectionSocketMessageResponseCallbackAck {
100
- checkpoints?: CheckpointTuple[];
101
- }
102
-
103
- export interface BaseVoiceMessage extends BasemindedConnectionSocketMessage {
104
- sessionId: string;
105
- timestamp: number;
106
- }
107
-
108
- // Voice/Audio event interfaces
109
- export interface OnVoiceAudioIn extends BaseVoiceMessage {
110
- audioData: string; // base64 encoded audio data
111
- }
112
-
113
- export interface OnVoiceAudioOut extends BaseVoiceMessage {
114
- audioData: string; // base64 encoded audio data
115
- }
116
-
117
- export interface VoicePlaceholderMessage extends BaseVoiceMessage {
118
- message: string;
119
- }
120
-
121
- export interface OnVoiceInterruption extends BasemindedConnectionSocketMessage {
122
- sessionId: string;
123
- timestamp: number;
124
- }
125
- export interface OnVoiceSessionEnd extends BasemindedConnectionSocketMessage {
126
- sessionId: string;
127
- timestamp: number;
128
- }
129
-
130
- export interface InvokeMessage extends BasemindedConnectionSocketMessage, AgentInvokeParams {
131
- type: mindedConnectionSocketMessageType.INVOKE;
132
- }
133
- export interface OnPiiHttpRequest extends BasemindedConnectionSocketMessage {
134
- sessionId: string;
135
- requestId: string;
136
- method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
137
- url: string;
138
- headers?: Record<string, string>;
139
- params?: Record<string, any>;
140
- data?: any;
141
- }
142
-
143
- export interface OnPiiHttpResponse extends BaseSdkConnectionSocketMessageResponseCallbackAck {
144
- requestId: string;
145
- data?: any;
146
- status?: number;
147
- statusText?: string;
148
- headers?: Record<string, string>;
149
- }
150
-
151
- export interface InterfaceFunctionCall extends BasemindedConnectionSocketMessage {
152
- sessionId: string;
153
- interfaceName: string;
154
- functionName: string;
155
- functionArgs: Record<string, any>;
156
- }
157
-
158
- export interface TimerResetRequest extends BasemindedConnectionSocketMessage {
159
- sessionId: string;
160
- seconds: number;
161
- timerName: string;
162
- eventArgs: Record<string, any>;
163
- }
164
-
165
- export interface TimerResetResponse extends BaseSdkConnectionSocketMessageResponseCallbackAck {
166
- success?: boolean;
167
- }
168
-
169
- export interface TimerCancelRequest extends BasemindedConnectionSocketMessage {
170
- sessionId: string;
171
- timerName: string;
172
- }
173
-
174
- export interface TimerCancelResponse extends BaseSdkConnectionSocketMessageResponseCallbackAck {
175
- success?: boolean;
176
- }
177
-
178
- export interface TimerTriggerRequest extends BasemindedConnectionSocketMessage {
179
- sessionId: string;
180
- timerName: string;
181
- eventArgs: Record<string, any>;
182
- }
183
-
184
- export interface RestoreCheckpointRequest extends BasemindedConnectionSocketMessage {
185
- sessionId: string;
186
- checkpointId: string;
187
- }
188
-
189
- export interface RestoreCheckpointResponse extends BaseSdkConnectionSocketMessageResponseCallbackAck {
190
- success?: boolean;
191
- }
@@ -1,103 +0,0 @@
1
- import { v4 as uuidv4 } from 'uuid';
2
- import * as mindedConnection from '../mindedConnection';
3
- import { mindedConnectionSocketMessageType, OnPiiHttpRequest, OnPiiHttpResponse } from '../mindedConnectionTypes';
4
- import { HttpRequestConfig, HttpResponse, PIIGatewayInstance } from './types';
5
- import { logger } from '../../utils/logger';
6
-
7
- export class PIIGateway implements PIIGatewayInstance {
8
- constructor() {
9
- // No longer needs mindedConnection as parameter
10
- }
11
-
12
- private async makeRequest<T = any>(
13
- sessionId: string,
14
- method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS',
15
- url: string,
16
- data?: any,
17
- config?: HttpRequestConfig,
18
- ): Promise<HttpResponse<T>> {
19
- if (!mindedConnection.isConnected()) {
20
- throw new Error('Minded connection is not established. PII-secured HTTP requests require a connection to the Minded platform.');
21
- }
22
-
23
- try {
24
- const requestId = uuidv4();
25
- const requestPayload: OnPiiHttpRequest = {
26
- type: mindedConnectionSocketMessageType.PII_HTTP_REQUEST,
27
- requestId,
28
- method,
29
- url,
30
- headers: config?.headers as Record<string, string>,
31
- params: config?.params,
32
- data,
33
- sessionId,
34
- };
35
-
36
- const response = await mindedConnection.awaitEmit<OnPiiHttpRequest, OnPiiHttpResponse>(
37
- mindedConnectionSocketMessageType.PII_HTTP_REQUEST,
38
- requestPayload,
39
- 30000, // 30 second timeout for HTTP requests
40
- );
41
-
42
- if (response.error) {
43
- throw new Error(`HTTP request failed: ${response.error}`);
44
- }
45
-
46
- // Verify that the response requestId matches our request
47
- if (response.requestId && response.requestId !== requestId) {
48
- logger.warn(`Response requestId (${response.requestId}) does not match request requestId (${requestId})`);
49
- }
50
-
51
- // Return generic HttpResponse format
52
- return {
53
- data: response.data,
54
- status: response.status || 200,
55
- statusText: response.statusText || 'OK',
56
- headers: response.headers || {},
57
- config: config || {},
58
- };
59
- } catch (error) {
60
- logger.error({ msg: 'Secure HTTP request failed', error });
61
- return {
62
- data: undefined as T,
63
- status: 500,
64
- statusText: 'Internal Server Error',
65
- headers: {},
66
- config: config || {},
67
- };
68
- }
69
- }
70
-
71
- async get<T = any>(sessionId: string, url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
72
- return this.makeRequest<T>(sessionId, 'GET', url, undefined, config);
73
- }
74
-
75
- async post<T = any>(sessionId: string, url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
76
- return this.makeRequest<T>(sessionId, 'POST', url, data, config);
77
- }
78
-
79
- async put<T = any>(sessionId: string, url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
80
- return this.makeRequest<T>(sessionId, 'PUT', url, data, config);
81
- }
82
-
83
- async delete<T = any>(sessionId: string, url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
84
- return this.makeRequest<T>(sessionId, 'DELETE', url, undefined, config);
85
- }
86
-
87
- async patch<T = any>(sessionId: string, url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
88
- return this.makeRequest<T>(sessionId, 'PATCH', url, data, config);
89
- }
90
-
91
- async head<T = any>(sessionId: string, url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
92
- return this.makeRequest<T>(sessionId, 'HEAD', url, undefined, config);
93
- }
94
-
95
- async options<T = any>(sessionId: string, url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>> {
96
- return this.makeRequest<T>(sessionId, 'OPTIONS', url, undefined, config);
97
- }
98
-
99
- async request<T = any>(sessionId: string, config: HttpRequestConfig): Promise<HttpResponse<T>> {
100
- const method = (config.method?.toUpperCase() || 'GET') as any;
101
- return this.makeRequest<T>(sessionId, method, config.url || '', config.data, config);
102
- }
103
- }
@@ -1,5 +0,0 @@
1
- // Export types
2
- export type { HttpRequestConfig, HttpResponse, PIIGatewayInstance } from './types';
3
-
4
- // Export core gateway class and creation function
5
- export { PIIGateway } from './gateway';
@@ -1,29 +0,0 @@
1
- // Generic HTTP types (library-agnostic)
2
- export interface HttpRequestConfig {
3
- method?: string;
4
- url?: string;
5
- headers?: Record<string, string>;
6
- params?: Record<string, any>;
7
- data?: any;
8
- timeout?: number;
9
- [key: string]: any; // Allow additional properties for extensibility
10
- }
11
-
12
- export interface HttpResponse<T = any> {
13
- data: T;
14
- status: number;
15
- statusText: string;
16
- headers: Record<string, string>;
17
- config: HttpRequestConfig;
18
- }
19
-
20
- export interface PIIGatewayInstance {
21
- get<T = any>(sessionId: string, url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
22
- post<T = any>(sessionId: string, url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
23
- put<T = any>(sessionId: string, url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
24
- delete<T = any>(sessionId: string, url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
25
- patch<T = any>(sessionId: string, url: string, data?: any, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
26
- head<T = any>(sessionId: string, url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
27
- options<T = any>(sessionId: string, url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
28
- request<T = any>(sessionId: string, config: HttpRequestConfig): Promise<HttpResponse<T>>;
29
- }