lua-cli 3.1.0-alpha.4 → 3.1.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/api/cdn.api.service.d.ts +18 -0
- package/dist/api/cdn.api.service.js +43 -0
- package/dist/api/custom.data.api.service.d.ts +4 -3
- package/dist/api/custom.data.api.service.js +4 -3
- package/dist/api/developer.api.service.d.ts +54 -1
- package/dist/api/developer.api.service.js +89 -0
- package/dist/api/job.api.service.d.ts +10 -0
- package/dist/api/job.api.service.js +14 -0
- package/dist/api/lazy-instances.d.ts +8 -0
- package/dist/api/lazy-instances.js +16 -0
- package/dist/api/postprocessor.api.service.d.ts +3 -6
- package/dist/api/postprocessor.api.service.js +2 -3
- package/dist/api-exports.d.ts +74 -6
- package/dist/api-exports.js +87 -7
- package/dist/cli/command-definitions.js +34 -7
- package/dist/commands/admin.js +1 -1
- package/dist/commands/channels.js +1 -1
- package/dist/commands/compile.js +23 -4
- package/dist/commands/evals.d.ts +8 -0
- package/dist/commands/evals.js +41 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/init.d.ts +10 -1
- package/dist/commands/init.js +13 -3
- package/dist/commands/mcp.d.ts +18 -0
- package/dist/commands/mcp.js +393 -0
- package/dist/commands/push.js +172 -14
- package/dist/common/data.entry.instance.d.ts +1 -1
- package/dist/common/data.entry.instance.js +4 -4
- package/dist/common/job.instance.d.ts +24 -0
- package/dist/common/job.instance.js +38 -0
- package/dist/config/constants.d.ts +1 -0
- package/dist/config/constants.js +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/cdn.d.ts +24 -0
- package/dist/interfaces/cdn.js +5 -0
- package/dist/interfaces/compile.d.ts +1 -0
- package/dist/interfaces/custom.data.d.ts +3 -3
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/mcp.d.ts +64 -0
- package/dist/interfaces/mcp.js +5 -0
- package/dist/types/api-contracts.d.ts +36 -14
- package/dist/types/compile.types.d.ts +5 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +3 -1
- package/dist/types/skill.d.ts +120 -13
- package/dist/types/skill.js +95 -5
- package/dist/utils/bundling.d.ts +4 -11
- package/dist/utils/bundling.js +19 -27
- package/dist/utils/compile.d.ts +17 -8
- package/dist/utils/compile.js +71 -37
- package/dist/utils/deployment.js +13 -6
- package/dist/utils/dev-api.js +1 -2
- package/dist/utils/dev-server.js +1 -1
- package/dist/utils/files.d.ts +8 -1
- package/dist/utils/files.js +13 -2
- package/dist/utils/init-helpers.d.ts +3 -1
- package/dist/utils/init-helpers.js +7 -2
- package/dist/utils/mcp-server-management.d.ts +23 -0
- package/dist/utils/mcp-server-management.js +212 -0
- package/dist/utils/sandbox.d.ts +4 -2
- package/dist/utils/sandbox.js +22 -3
- package/dist/web/app.css +1505 -14
- package/dist/web/app.js +79 -64
- package/package.json +2 -6
- package/template/QUICKSTART.md +57 -761
- package/template/README.md +80 -906
- package/template/examples/README.md +106 -0
- package/template/{src → examples}/jobs/AbandonedBasketProcessorJob.ts +67 -11
- package/template/{src → examples}/postprocessors/modifyResponse.ts +3 -3
- package/template/{src → examples}/skills/tools/GameScoreTrackerTool.ts +11 -15
- package/template/{src → examples}/skills/tools/OrderTool.ts +25 -0
- package/template/examples/skills/tools/PremiumFeatureTool.ts +98 -0
- package/template/{src → examples}/skills/tools/UserDataTool.ts +34 -0
- package/template/examples/webhooks/FileUploadWebhook.ts +86 -0
- package/template/package-lock.json +7895 -0
- package/template/package.json +1 -1
- package/template/src/index.ts +40 -22
- /package/template/{src → examples}/jobs/DailyCleanupJob.ts +0 -0
- /package/template/{src → examples}/jobs/DataMigrationJob.ts +0 -0
- /package/template/{src → examples}/jobs/HealthCheckJob.ts +0 -0
- /package/template/{src → examples}/preprocessors/messageMatching.ts +0 -0
- /package/template/{src → examples}/services/ApiService.ts +0 -0
- /package/template/{src → examples}/services/GetWeather.ts +0 -0
- /package/template/{src → examples}/skills/basket.skill.ts +0 -0
- /package/template/{src → examples}/skills/product.skill.ts +0 -0
- /package/template/{src → examples}/skills/tools/BasketTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/CreateInlineJob.ts +0 -0
- /package/template/{src → examples}/skills/tools/CreatePostTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/CustomDataTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/GetWeatherTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/PaymentTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/ProductsTool.ts +0 -0
- /package/template/{src → examples}/skills/tools/SmartBasketTool.ts +0 -0
- /package/template/{src → examples}/skills/user.skill.ts +0 -0
- /package/template/{src → examples}/webhooks/PaymentWebhook.ts +0 -0
- /package/template/{src → examples}/webhooks/UserEventWebhook.ts +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server Management Utilities
|
|
3
|
+
* Handles MCP server configuration in lua.skill.yaml
|
|
4
|
+
*/
|
|
5
|
+
import { YamlConfig } from '../types/compile.types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Ensures all detected MCP servers exist in the YAML config and database.
|
|
8
|
+
* Uses upsert to create or update servers via API during compile (like skills).
|
|
9
|
+
* YAML only tracks name and ID - the full configuration stays in source code.
|
|
10
|
+
*
|
|
11
|
+
* @param mcpServersArray - Array of MCP servers detected from source code (with full config)
|
|
12
|
+
* @param config - The skill configuration from lua.skill.yaml
|
|
13
|
+
* @returns Updated MCP servers array with IDs assigned
|
|
14
|
+
*/
|
|
15
|
+
export declare function ensureMCPServersExistInYaml(mcpServersArray: any[], config: YamlConfig): Promise<any[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Syncs the server MCP servers with the YAML configuration.
|
|
18
|
+
* Deletes MCP servers from the server that aren't in YAML (removed from source code).
|
|
19
|
+
*
|
|
20
|
+
* @param config - The skill configuration from lua.skill.yaml
|
|
21
|
+
* @returns Array of messages about sync operations
|
|
22
|
+
*/
|
|
23
|
+
export declare function syncServerMCPServersWithYaml(config: YamlConfig): Promise<string[]>;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server Management Utilities
|
|
3
|
+
* Handles MCP server configuration in lua.skill.yaml
|
|
4
|
+
*/
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import yaml from "js-yaml";
|
|
8
|
+
import { COMPILE_FILES, YAML_FORMAT, } from '../config/compile.constants.js';
|
|
9
|
+
import { loadApiKey } from '../services/auth.js';
|
|
10
|
+
import { BASE_URLS } from '../config/constants.js';
|
|
11
|
+
import DeveloperApi from '../api/developer.api.service.js';
|
|
12
|
+
/**
|
|
13
|
+
* Ensures all detected MCP servers exist in the YAML config and database.
|
|
14
|
+
* Uses upsert to create or update servers via API during compile (like skills).
|
|
15
|
+
* YAML only tracks name and ID - the full configuration stays in source code.
|
|
16
|
+
*
|
|
17
|
+
* @param mcpServersArray - Array of MCP servers detected from source code (with full config)
|
|
18
|
+
* @param config - The skill configuration from lua.skill.yaml
|
|
19
|
+
* @returns Updated MCP servers array with IDs assigned
|
|
20
|
+
*/
|
|
21
|
+
export async function ensureMCPServersExistInYaml(mcpServersArray, config) {
|
|
22
|
+
const existingServers = config?.mcpServers || [];
|
|
23
|
+
const existingServersMap = createMCPServersMap(existingServers);
|
|
24
|
+
const updatedServersArray = [];
|
|
25
|
+
let yamlUpdated = false;
|
|
26
|
+
// Process each detected MCP server from source code
|
|
27
|
+
for (const server of mcpServersArray) {
|
|
28
|
+
const existingServer = existingServersMap.get(server.name);
|
|
29
|
+
if (existingServer && existingServer.mcpServerId && existingServer.mcpServerId !== '') {
|
|
30
|
+
// Server exists with valid ID - reuse it
|
|
31
|
+
updatedServersArray.push({
|
|
32
|
+
...server, // Full config from source code
|
|
33
|
+
mcpServerId: existingServer.mcpServerId // ID from YAML
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
// Server doesn't exist or missing ID - upsert via API
|
|
38
|
+
const upsertedServer = await upsertMCPServerViaApi(server, config, existingServers, existingServer);
|
|
39
|
+
updatedServersArray.push(upsertedServer);
|
|
40
|
+
yamlUpdated = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Update YAML file with tracking info (name + ID only)
|
|
44
|
+
if (yamlUpdated) {
|
|
45
|
+
await updateYamlWithMCPServers(updatedServersArray, config);
|
|
46
|
+
}
|
|
47
|
+
return updatedServersArray;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates a map of existing MCP servers for quick lookup by name.
|
|
51
|
+
*/
|
|
52
|
+
function createMCPServersMap(existingServers) {
|
|
53
|
+
const map = new Map();
|
|
54
|
+
existingServers.forEach((server) => {
|
|
55
|
+
map.set(server.name, server);
|
|
56
|
+
});
|
|
57
|
+
return map;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates or updates an MCP server via the Lua API (upsert by name).
|
|
61
|
+
*
|
|
62
|
+
* @param server - The MCP server to upsert (with full config)
|
|
63
|
+
* @param config - The skill configuration
|
|
64
|
+
* @param existingServers - Array of existing servers (mutated)
|
|
65
|
+
* @param existingServer - The existing server entry if one exists (may be without ID)
|
|
66
|
+
* @returns The server with its ID
|
|
67
|
+
*/
|
|
68
|
+
async function upsertMCPServerViaApi(server, config, existingServers, existingServer) {
|
|
69
|
+
try {
|
|
70
|
+
// Validate prerequisites
|
|
71
|
+
const apiKey = await loadApiKey();
|
|
72
|
+
if (!apiKey) {
|
|
73
|
+
throw new Error("No API key found. Run 'lua auth configure' first.");
|
|
74
|
+
}
|
|
75
|
+
const agentId = config?.agent?.agentId;
|
|
76
|
+
if (!agentId) {
|
|
77
|
+
throw new Error("No agent ID found in lua.skill.yaml. Run 'lua init' first.");
|
|
78
|
+
}
|
|
79
|
+
// Prepare server data for upsert
|
|
80
|
+
const serverData = {
|
|
81
|
+
name: server.name,
|
|
82
|
+
transport: server.transport,
|
|
83
|
+
timeout: server.timeout,
|
|
84
|
+
...(server.transport === 'stdio' ? {
|
|
85
|
+
command: server.command,
|
|
86
|
+
args: server.args,
|
|
87
|
+
env: server.env
|
|
88
|
+
} : {
|
|
89
|
+
url: server.url,
|
|
90
|
+
headers: server.headers
|
|
91
|
+
})
|
|
92
|
+
};
|
|
93
|
+
// Upsert server via API (creates if new, updates if exists by name)
|
|
94
|
+
const developerApi = new DeveloperApi(BASE_URLS.API, apiKey, agentId);
|
|
95
|
+
const result = await developerApi.upsertMCPServer(serverData);
|
|
96
|
+
if (!result.success || !result.data?.id) {
|
|
97
|
+
throw new Error(result.error?.message || 'Failed to upsert MCP server');
|
|
98
|
+
}
|
|
99
|
+
const mcpServerId = result.data.id;
|
|
100
|
+
// Update or add to existing servers array
|
|
101
|
+
if (existingServer) {
|
|
102
|
+
existingServer.mcpServerId = mcpServerId;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
existingServers.push({
|
|
106
|
+
name: server.name,
|
|
107
|
+
mcpServerId: mcpServerId
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
console.log(` ✅ Synced MCP server "${server.name}" with ID: ${mcpServerId}`);
|
|
111
|
+
return {
|
|
112
|
+
...server,
|
|
113
|
+
mcpServerId: mcpServerId
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
console.error(` ❌ Failed to sync MCP server "${server.name}":`, error.message);
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Updates the lua.skill.yaml file with MCP server tracking (name and ID only).
|
|
123
|
+
* IDs are assigned during compile via API (like skills).
|
|
124
|
+
* The full server configuration remains in the source code as the single source of truth.
|
|
125
|
+
*/
|
|
126
|
+
async function updateYamlWithMCPServers(mcpServers, config) {
|
|
127
|
+
const yamlPath = path.join(process.cwd(), COMPILE_FILES.LUA_SKILL_YAML);
|
|
128
|
+
// Read existing content
|
|
129
|
+
let existingConfig = {};
|
|
130
|
+
if (fs.existsSync(yamlPath)) {
|
|
131
|
+
const yamlContent = fs.readFileSync(yamlPath, 'utf8');
|
|
132
|
+
existingConfig = yaml.load(yamlContent);
|
|
133
|
+
}
|
|
134
|
+
// Update MCP servers section - only track name and ID (like skills)
|
|
135
|
+
existingConfig.mcpServers = mcpServers.map(server => ({
|
|
136
|
+
name: server.name,
|
|
137
|
+
mcpServerId: server.mcpServerId // Always present after upsert during compile
|
|
138
|
+
}));
|
|
139
|
+
// Write updated YAML
|
|
140
|
+
const yamlContent = yaml.dump(existingConfig, {
|
|
141
|
+
indent: YAML_FORMAT.INDENT,
|
|
142
|
+
lineWidth: YAML_FORMAT.LINE_WIDTH,
|
|
143
|
+
noRefs: YAML_FORMAT.NO_REFS
|
|
144
|
+
});
|
|
145
|
+
fs.writeFileSync(yamlPath, yamlContent);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Syncs the server MCP servers with the YAML configuration.
|
|
149
|
+
* Deletes MCP servers from the server that aren't in YAML (removed from source code).
|
|
150
|
+
*
|
|
151
|
+
* @param config - The skill configuration from lua.skill.yaml
|
|
152
|
+
* @returns Array of messages about sync operations
|
|
153
|
+
*/
|
|
154
|
+
export async function syncServerMCPServersWithYaml(config) {
|
|
155
|
+
const messages = [];
|
|
156
|
+
try {
|
|
157
|
+
// Validate prerequisites
|
|
158
|
+
const apiKey = await loadApiKey();
|
|
159
|
+
if (!apiKey) {
|
|
160
|
+
console.warn("⚠️ No API key found. Skipping server MCP server sync.");
|
|
161
|
+
return messages;
|
|
162
|
+
}
|
|
163
|
+
const agentId = config?.agent?.agentId;
|
|
164
|
+
if (!agentId) {
|
|
165
|
+
console.warn("⚠️ No agent ID found in lua.skill.yaml. Skipping server MCP server sync.");
|
|
166
|
+
return messages;
|
|
167
|
+
}
|
|
168
|
+
// Get MCP servers from server
|
|
169
|
+
const developerApi = new DeveloperApi(BASE_URLS.API, apiKey, agentId);
|
|
170
|
+
const serverMCPServersResponse = await developerApi.getMCPServers();
|
|
171
|
+
if (!serverMCPServersResponse.success || !serverMCPServersResponse.data) {
|
|
172
|
+
console.warn("⚠️ Could not retrieve server MCP servers. Skipping server MCP server sync.");
|
|
173
|
+
return messages;
|
|
174
|
+
}
|
|
175
|
+
const serverMCPServers = serverMCPServersResponse.data;
|
|
176
|
+
const yamlMCPServers = config?.mcpServers || [];
|
|
177
|
+
// Create map of YAML MCP servers by ID for efficient lookup
|
|
178
|
+
const yamlMCPServersMap = new Map(yamlMCPServers
|
|
179
|
+
.filter((server) => server.mcpServerId)
|
|
180
|
+
.map((server) => [server.mcpServerId, server]));
|
|
181
|
+
// Find MCP servers on server that aren't in YAML (removed from source code)
|
|
182
|
+
const serversToDelete = serverMCPServers.filter(serverMCP => !yamlMCPServersMap.has(serverMCP.id));
|
|
183
|
+
// Delete servers that are no longer in YAML
|
|
184
|
+
for (const server of serversToDelete) {
|
|
185
|
+
try {
|
|
186
|
+
const deleteResponse = await developerApi.deleteMCPServer(server.id);
|
|
187
|
+
if (deleteResponse.success) {
|
|
188
|
+
const msg = `✅ Deleted MCP server "${server.name}" from server (removed from source code)`;
|
|
189
|
+
messages.push(msg);
|
|
190
|
+
console.log(msg);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const msg = `❌ Failed to delete MCP server "${server.name}": ${deleteResponse.error?.message || 'Unknown error'}`;
|
|
194
|
+
messages.push(msg);
|
|
195
|
+
console.error(msg);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
const msg = `❌ Error deleting MCP server "${server.name}": ${error}`;
|
|
200
|
+
messages.push(msg);
|
|
201
|
+
console.error(msg);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (serversToDelete.length === 0) {
|
|
205
|
+
console.log("✅ Server MCP servers and YAML are fully in sync");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
console.error("❌ Error syncing server MCP servers:", error);
|
|
210
|
+
}
|
|
211
|
+
return messages;
|
|
212
|
+
}
|
package/dist/utils/sandbox.d.ts
CHANGED
|
@@ -45,8 +45,10 @@ export declare function loadEnvironmentVariables(): Record<string, string>;
|
|
|
45
45
|
* - Data: Custom data collections API
|
|
46
46
|
* - Baskets: Shopping basket API
|
|
47
47
|
* - Orders: Order management API
|
|
48
|
-
* -
|
|
49
|
-
* -
|
|
48
|
+
* - Templates: Template APIs (whatsapp)
|
|
49
|
+
* - CDN: File upload/retrieval API
|
|
50
|
+
* - Jobs: Job scheduling API
|
|
51
|
+
* - AI: AI generation API
|
|
50
52
|
* - env(): Environment variable access function
|
|
51
53
|
* - console, fetch, and other standard globals
|
|
52
54
|
*/
|
package/dist/utils/sandbox.js
CHANGED
|
@@ -12,6 +12,7 @@ import CustomDataApiService from "../api/custom.data.api.service.js";
|
|
|
12
12
|
import WebhookApi from "../api/webhook.api.service.js";
|
|
13
13
|
import JobApi from "../api/job.api.service.js";
|
|
14
14
|
import WhatsAppTemplatesApiService from "../api/whatsapp-templates.api.service.js";
|
|
15
|
+
import CdnApiService from "../api/cdn.api.service.js";
|
|
15
16
|
import { BasketStatus } from "../interfaces/baskets.js";
|
|
16
17
|
import { OrderStatus } from "../interfaces/orders.js";
|
|
17
18
|
import { compressCode } from "./compile.js";
|
|
@@ -68,8 +69,10 @@ export function loadEnvironmentVariables() {
|
|
|
68
69
|
* - Data: Custom data collections API
|
|
69
70
|
* - Baskets: Shopping basket API
|
|
70
71
|
* - Orders: Order management API
|
|
71
|
-
* -
|
|
72
|
-
* -
|
|
72
|
+
* - Templates: Template APIs (whatsapp)
|
|
73
|
+
* - CDN: File upload/retrieval API
|
|
74
|
+
* - Jobs: Job scheduling API
|
|
75
|
+
* - AI: AI generation API
|
|
73
76
|
* - env(): Environment variable access function
|
|
74
77
|
* - console, fetch, and other standard globals
|
|
75
78
|
*/
|
|
@@ -90,6 +93,7 @@ export function createSandbox(options) {
|
|
|
90
93
|
const webhookService = new WebhookApi(BASE_URLS.API, apiKey, agentId);
|
|
91
94
|
const jobService = new JobApi(BASE_URLS.API, apiKey, agentId);
|
|
92
95
|
const whatsAppTemplatesService = new WhatsAppTemplatesApiService(BASE_URLS.API, apiKey, agentId);
|
|
96
|
+
const cdnService = new CdnApiService(BASE_URLS.CDN, apiKey);
|
|
93
97
|
// Override User service methods if needed
|
|
94
98
|
// Example: Override the update method
|
|
95
99
|
// const originalUpdate = userService.update.bind(userService);
|
|
@@ -197,6 +201,8 @@ export function createSandbox(options) {
|
|
|
197
201
|
Headers: globalThis.Headers,
|
|
198
202
|
Request: globalThis.Request,
|
|
199
203
|
Response: globalThis.Response,
|
|
204
|
+
File: globalThis.File,
|
|
205
|
+
Blob: globalThis.Blob,
|
|
200
206
|
FormData: polyfills.FormData,
|
|
201
207
|
AbortController: polyfills.AbortController,
|
|
202
208
|
TextEncoder: polyfills.TextEncoder,
|
|
@@ -230,6 +236,8 @@ export function createSandbox(options) {
|
|
|
230
236
|
Templates: {
|
|
231
237
|
whatsapp: whatsAppTemplatesService
|
|
232
238
|
},
|
|
239
|
+
// CDN API
|
|
240
|
+
CDN: cdnService,
|
|
233
241
|
// Jobs API
|
|
234
242
|
Jobs: {
|
|
235
243
|
create: async (config) => {
|
|
@@ -258,7 +266,8 @@ export function createSandbox(options) {
|
|
|
258
266
|
activate: config.activate ?? true
|
|
259
267
|
});
|
|
260
268
|
},
|
|
261
|
-
getJob: async (jobId) => jobService.getJob(jobId)
|
|
269
|
+
getJob: async (jobId) => jobService.getJob(jobId),
|
|
270
|
+
getAll: async (options = {}) => jobService.getAll(options)
|
|
262
271
|
},
|
|
263
272
|
// Environment variables function
|
|
264
273
|
env: (key) => envVars[key],
|
|
@@ -327,6 +336,8 @@ try{
|
|
|
327
336
|
global.Response = Response;
|
|
328
337
|
global.URL = URL;
|
|
329
338
|
global.URLSearchParams = URLSearchParams;
|
|
339
|
+
global.File = File;
|
|
340
|
+
global.Blob = Blob;
|
|
330
341
|
}
|
|
331
342
|
`, context);
|
|
332
343
|
vm.runInContext(commonJsWrapper, context);
|
|
@@ -374,6 +385,8 @@ try{
|
|
|
374
385
|
global.Response = Response;
|
|
375
386
|
global.URL = URL;
|
|
376
387
|
global.URLSearchParams = URLSearchParams;
|
|
388
|
+
global.File = File;
|
|
389
|
+
global.Blob = Blob;
|
|
377
390
|
}
|
|
378
391
|
`, context);
|
|
379
392
|
vm.runInContext(commonJsWrapper, context);
|
|
@@ -449,6 +462,8 @@ try{
|
|
|
449
462
|
global.Response = Response;
|
|
450
463
|
global.URL = URL;
|
|
451
464
|
global.URLSearchParams = URLSearchParams;
|
|
465
|
+
global.File = File;
|
|
466
|
+
global.Blob = Blob;
|
|
452
467
|
}
|
|
453
468
|
`, context);
|
|
454
469
|
vm.runInContext(commonJsWrapper, context);
|
|
@@ -501,6 +516,8 @@ try{
|
|
|
501
516
|
global.Response = Response;
|
|
502
517
|
global.URL = URL;
|
|
503
518
|
global.URLSearchParams = URLSearchParams;
|
|
519
|
+
global.File = File;
|
|
520
|
+
global.Blob = Blob;
|
|
504
521
|
}
|
|
505
522
|
`, context);
|
|
506
523
|
vm.runInContext(commonJsWrapper, context);
|
|
@@ -553,6 +570,8 @@ try{
|
|
|
553
570
|
global.Response = Response;
|
|
554
571
|
global.URL = URL;
|
|
555
572
|
global.URLSearchParams = URLSearchParams;
|
|
573
|
+
global.File = File;
|
|
574
|
+
global.Blob = Blob;
|
|
556
575
|
}
|
|
557
576
|
`, context);
|
|
558
577
|
vm.runInContext(commonJsWrapper, context);
|