@computesdk/render 1.0.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/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/index.d.mts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +199 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +172 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 computesdk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @computesdk/render
|
|
2
|
+
|
|
3
|
+
Render provider for ComputeSDK that enables creating and managing containerized sandboxes on Render's infrastructure.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @computesdk/render
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
The Render provider requires the following environment variables:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
RENDER_API_KEY=your_render_api_key
|
|
17
|
+
RENDER_OWNER_ID=your_render_owner_id
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { render } from '@computesdk/render';
|
|
24
|
+
|
|
25
|
+
const provider = render({
|
|
26
|
+
apiKey: 'your_api_key',
|
|
27
|
+
ownerId: 'your_owner_id'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Create a sandbox
|
|
31
|
+
const sandbox = await provider.sandbox.create({ runtime: 'node' });
|
|
32
|
+
console.log(`Created sandbox: ${sandbox.sandboxId}`);
|
|
33
|
+
|
|
34
|
+
// Get sandbox by ID
|
|
35
|
+
const retrieved = await provider.sandbox.getById(sandbox.sandboxId);
|
|
36
|
+
|
|
37
|
+
// List all sandboxes
|
|
38
|
+
const sandboxes = await provider.sandbox.list();
|
|
39
|
+
|
|
40
|
+
// Destroy the sandbox
|
|
41
|
+
await provider.sandbox.destroy(sandbox.sandboxId);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Currently Implemented
|
|
45
|
+
|
|
46
|
+
### Sandbox Operations
|
|
47
|
+
- **create()** - Creates a new Render web service with Docker container deployment
|
|
48
|
+
- **getById()** - Retrieves a specific Render service by ID
|
|
49
|
+
- **list()** - Lists all Render services in the account
|
|
50
|
+
- **destroy()** - Deletes a Render service
|
|
51
|
+
|
|
52
|
+
### Configuration Options
|
|
53
|
+
- **apiKey** - Render API authentication token
|
|
54
|
+
- **ownerId** - Render owner/account identifier
|
|
55
|
+
|
|
56
|
+
## Notes
|
|
57
|
+
|
|
58
|
+
- Services are automatically deployed upon creation with auto-deploy enabled
|
|
59
|
+
- Service names are generated with timestamp: `render-sandbox-{timestamp}`
|
|
60
|
+
- All operations use Render's REST API v1
|
|
61
|
+
- Environment variables take precedence over config options
|
|
62
|
+
- Services are immediately deleted when destroyed (no delayed deletion)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as computesdk from 'computesdk';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Render Provider - Factory-based Implementation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Render sandbox interface
|
|
8
|
+
*/
|
|
9
|
+
interface RenderSandbox {
|
|
10
|
+
serviceId: string;
|
|
11
|
+
ownerId: string;
|
|
12
|
+
}
|
|
13
|
+
interface RenderConfig {
|
|
14
|
+
/** Render API key - if not provided, will fallback to RENDER_API_KEY environment variable */
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
/** Render Owner ID - if not provided, will fallback to RENDER_OWNER_ID environment variable */
|
|
17
|
+
ownerId?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const getAndValidateCredentials: (config: RenderConfig) => {
|
|
20
|
+
apiKey: string;
|
|
21
|
+
ownerId: string;
|
|
22
|
+
};
|
|
23
|
+
declare const fetchRender: (apiKey: string, endpoint: string, options?: RequestInit) => Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Create a Render provider instance using the factory pattern
|
|
26
|
+
*/
|
|
27
|
+
declare const render: (config: RenderConfig) => computesdk.Provider<RenderSandbox, any, any>;
|
|
28
|
+
|
|
29
|
+
export { type RenderConfig, fetchRender, getAndValidateCredentials, render };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as computesdk from 'computesdk';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Render Provider - Factory-based Implementation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Render sandbox interface
|
|
8
|
+
*/
|
|
9
|
+
interface RenderSandbox {
|
|
10
|
+
serviceId: string;
|
|
11
|
+
ownerId: string;
|
|
12
|
+
}
|
|
13
|
+
interface RenderConfig {
|
|
14
|
+
/** Render API key - if not provided, will fallback to RENDER_API_KEY environment variable */
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
/** Render Owner ID - if not provided, will fallback to RENDER_OWNER_ID environment variable */
|
|
17
|
+
ownerId?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const getAndValidateCredentials: (config: RenderConfig) => {
|
|
20
|
+
apiKey: string;
|
|
21
|
+
ownerId: string;
|
|
22
|
+
};
|
|
23
|
+
declare const fetchRender: (apiKey: string, endpoint: string, options?: RequestInit) => Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Create a Render provider instance using the factory pattern
|
|
26
|
+
*/
|
|
27
|
+
declare const render: (config: RenderConfig) => computesdk.Provider<RenderSandbox, any, any>;
|
|
28
|
+
|
|
29
|
+
export { type RenderConfig, fetchRender, getAndValidateCredentials, render };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
fetchRender: () => fetchRender,
|
|
24
|
+
getAndValidateCredentials: () => getAndValidateCredentials,
|
|
25
|
+
render: () => render
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
var import_computesdk = require("computesdk");
|
|
29
|
+
var getAndValidateCredentials = (config) => {
|
|
30
|
+
const apiKey = config.apiKey || typeof process !== "undefined" && process.env?.RENDER_API_KEY || "";
|
|
31
|
+
const ownerId = config.ownerId || typeof process !== "undefined" && process.env?.RENDER_OWNER_ID || "";
|
|
32
|
+
if (!apiKey) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
"Missing Render API key. Provide apiKey in config or set RENDER_API_KEY environment variable."
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
if (!ownerId) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
"Missing Render Owner ID. Provide ownerId in config or set RENDER_OWNER_ID environment variable."
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return { apiKey, ownerId };
|
|
43
|
+
};
|
|
44
|
+
var fetchRender = async (apiKey, endpoint, options = {}) => {
|
|
45
|
+
const url = `https://api.render.com/v1${endpoint}`;
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
method: "GET",
|
|
48
|
+
...options,
|
|
49
|
+
headers: {
|
|
50
|
+
"Accept": "application/json",
|
|
51
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
52
|
+
...options.headers || {}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const response = await fetch(url, requestOptions);
|
|
56
|
+
if (!response.ok) {
|
|
57
|
+
throw new Error(`Render API error: ${response.status} ${response.statusText}`);
|
|
58
|
+
}
|
|
59
|
+
if (response.status === 204) {
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
return response.json();
|
|
63
|
+
};
|
|
64
|
+
var render = (0, import_computesdk.createProvider)({
|
|
65
|
+
name: "render",
|
|
66
|
+
methods: {
|
|
67
|
+
sandbox: {
|
|
68
|
+
// Collection operations (compute.sandbox.*)
|
|
69
|
+
create: async (config, options) => {
|
|
70
|
+
const { apiKey, ownerId } = getAndValidateCredentials(config);
|
|
71
|
+
try {
|
|
72
|
+
const createServiceData = {
|
|
73
|
+
type: "web_service",
|
|
74
|
+
autoDeploy: "yes",
|
|
75
|
+
image: {
|
|
76
|
+
ownerId,
|
|
77
|
+
imagePath: options?.runtime === "node" ? "docker.io/traefik/whoami" : "docker.io/traefik/whoami"
|
|
78
|
+
},
|
|
79
|
+
serviceDetails: {
|
|
80
|
+
runtime: "image",
|
|
81
|
+
envSpecificDetails: {
|
|
82
|
+
dockerCommand: options?.runtime === "node" ? "/whoami --port 10000" : "/whoami --port 10000"
|
|
83
|
+
},
|
|
84
|
+
pullRequestPreviewsEnabled: "no"
|
|
85
|
+
},
|
|
86
|
+
ownerId,
|
|
87
|
+
name: `render-sandbox-${Date.now()}`
|
|
88
|
+
};
|
|
89
|
+
const responseData = await fetchRender(apiKey, "/services", {
|
|
90
|
+
method: "POST",
|
|
91
|
+
headers: {
|
|
92
|
+
"Content-Type": "application/json"
|
|
93
|
+
},
|
|
94
|
+
body: JSON.stringify(createServiceData)
|
|
95
|
+
});
|
|
96
|
+
if (!responseData) {
|
|
97
|
+
throw new Error("No service returned from Render API");
|
|
98
|
+
}
|
|
99
|
+
const service = responseData.service;
|
|
100
|
+
if (!service || !service.id) {
|
|
101
|
+
throw new Error(`Service ID is undefined. Full response: ${JSON.stringify(responseData, null, 2)}`);
|
|
102
|
+
}
|
|
103
|
+
const renderSandbox = {
|
|
104
|
+
serviceId: service.id,
|
|
105
|
+
ownerId
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
sandbox: renderSandbox,
|
|
109
|
+
sandboxId: service.id
|
|
110
|
+
};
|
|
111
|
+
} catch (error) {
|
|
112
|
+
throw new Error(
|
|
113
|
+
`Failed to create Render sandbox: ${error instanceof Error ? error.message : String(error)}`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
getById: async (config, sandboxId) => {
|
|
118
|
+
const { apiKey, ownerId } = getAndValidateCredentials(config);
|
|
119
|
+
try {
|
|
120
|
+
const responseData = await fetchRender(apiKey, `/services/${sandboxId}`);
|
|
121
|
+
if (!responseData) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
if (!responseData.id) {
|
|
125
|
+
throw new Error("Service data is missing from Render response");
|
|
126
|
+
}
|
|
127
|
+
const renderSandbox = {
|
|
128
|
+
serviceId: responseData.id,
|
|
129
|
+
ownerId
|
|
130
|
+
};
|
|
131
|
+
return {
|
|
132
|
+
sandbox: renderSandbox,
|
|
133
|
+
sandboxId: responseData.id
|
|
134
|
+
};
|
|
135
|
+
} catch (error) {
|
|
136
|
+
if (error instanceof Error && error.message.includes("404")) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
throw new Error(
|
|
140
|
+
`Failed to get Render sandbox: ${error instanceof Error ? error.message : String(error)}`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
list: async (config) => {
|
|
145
|
+
const { apiKey, ownerId } = getAndValidateCredentials(config);
|
|
146
|
+
try {
|
|
147
|
+
const responseData = await fetchRender(apiKey, "/services?includePreviews=true&limit=20");
|
|
148
|
+
const items = responseData || [];
|
|
149
|
+
const sandboxes = items.map((item) => {
|
|
150
|
+
const service = item.service;
|
|
151
|
+
const renderSandbox = {
|
|
152
|
+
serviceId: service.id,
|
|
153
|
+
ownerId
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
sandbox: renderSandbox,
|
|
157
|
+
sandboxId: service.id
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
return sandboxes;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
throw new Error(
|
|
163
|
+
`Failed to list Render sandboxes: ${error instanceof Error ? error.message : String(error)}`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
destroy: async (config, sandboxId) => {
|
|
168
|
+
const { apiKey } = getAndValidateCredentials(config);
|
|
169
|
+
try {
|
|
170
|
+
await fetchRender(apiKey, `/services/${sandboxId}`, {
|
|
171
|
+
method: "DELETE"
|
|
172
|
+
});
|
|
173
|
+
} catch (error) {
|
|
174
|
+
console.warn(`Render destroy warning: ${error instanceof Error ? error.message : String(error)}`);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
// Instance operations (minimal stubs - not implemented yet)
|
|
178
|
+
runCode: async (_sandbox, _code, _runtime) => {
|
|
179
|
+
throw new Error("Render runCode method not implemented yet");
|
|
180
|
+
},
|
|
181
|
+
runCommand: async (_sandbox, _command, _args, _options) => {
|
|
182
|
+
throw new Error("Render runCommand method not implemented yet");
|
|
183
|
+
},
|
|
184
|
+
getInfo: async (_sandbox) => {
|
|
185
|
+
throw new Error("Render getInfo method not implemented yet");
|
|
186
|
+
},
|
|
187
|
+
getUrl: async (_sandbox, _options) => {
|
|
188
|
+
throw new Error("Render getUrl method not implemented yet");
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
194
|
+
0 && (module.exports = {
|
|
195
|
+
fetchRender,
|
|
196
|
+
getAndValidateCredentials,
|
|
197
|
+
render
|
|
198
|
+
});
|
|
199
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Render Provider - Factory-based Implementation\n */\n\nimport { createProvider, createBackgroundCommand } from 'computesdk';\nimport type { Runtime, ExecutionResult, SandboxInfo, CreateSandboxOptions, FileEntry, RunCommandOptions } from 'computesdk';\n\n/**\n * Render sandbox interface\n */\ninterface RenderSandbox {\n serviceId: string;\n ownerId: string;\n}\n\nexport interface RenderConfig {\n /** Render API key - if not provided, will fallback to RENDER_API_KEY environment variable */\n apiKey?: string;\n /** Render Owner ID - if not provided, will fallback to RENDER_OWNER_ID environment variable */\n ownerId?: string;\n}\n\nexport const getAndValidateCredentials = (config: RenderConfig) => {\n const apiKey = config.apiKey || (typeof process !== 'undefined' && process.env?.RENDER_API_KEY) || '';\n const ownerId = config.ownerId || (typeof process !== 'undefined' && process.env?.RENDER_OWNER_ID) || '';\n\n if (!apiKey) {\n throw new Error(\n 'Missing Render API key. Provide apiKey in config or set RENDER_API_KEY environment variable.'\n );\n }\n\n if (!ownerId) {\n throw new Error(\n 'Missing Render Owner ID. Provide ownerId in config or set RENDER_OWNER_ID environment variable.'\n );\n }\n\n return { apiKey, ownerId };\n};\n\nexport const fetchRender = async (\n apiKey: string,\n endpoint: string,\n options: RequestInit = {}\n) => {\n const url = `https://api.render.com/v1${endpoint}`;\n const requestOptions = {\n method: 'GET',\n ...options,\n headers: {\n 'Accept': 'application/json',\n 'Authorization': `Bearer ${apiKey}`,\n ...(options.headers || {})\n }\n };\n \n const response = await fetch(url, requestOptions);\n\n if (!response.ok) {\n throw new Error(`Render API error: ${response.status} ${response.statusText}`);\n }\n\n // Handle 204 No Content responses (like DELETE operations)\n if (response.status === 204) {\n return {};\n }\n\n return response.json();\n};\n\n\n\n/**\n * Create a Render provider instance using the factory pattern\n */\nexport const render = createProvider<RenderSandbox, RenderConfig>({\n name: 'render',\n methods: {\n sandbox: {\n // Collection operations (compute.sandbox.*)\n create: async (config: RenderConfig, options?: CreateSandboxOptions) => {\n const { apiKey, ownerId } = getAndValidateCredentials(config);\n\n try {\n const createServiceData = {\n type: 'web_service',\n autoDeploy: 'yes',\n image: {\n ownerId: ownerId,\n imagePath: options?.runtime === 'node' ? 'docker.io/traefik/whoami' : 'docker.io/traefik/whoami'\n },\n serviceDetails: {\n runtime: 'image',\n envSpecificDetails: {\n dockerCommand: options?.runtime === 'node' ? '/whoami --port 10000' : '/whoami --port 10000'\n },\n pullRequestPreviewsEnabled: 'no'\n },\n ownerId: ownerId,\n name: `render-sandbox-${Date.now()}`\n };\n\n\n const responseData = await fetchRender(apiKey, '/services', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(createServiceData)\n });\n \n if (!responseData) {\n throw new Error('No service returned from Render API');\n }\n \n // Render API returns { service: { id: \"...\", ... }, deployId: \"...\" }\n const service = responseData.service;\n if (!service || !service.id) {\n throw new Error(`Service ID is undefined. Full response: ${JSON.stringify(responseData, null, 2)}`);\n }\n\n const renderSandbox: RenderSandbox = {\n serviceId: service.id,\n ownerId,\n };\n\n return {\n sandbox: renderSandbox,\n sandboxId: service.id\n };\n } catch (error) {\n throw new Error(\n `Failed to create Render sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getById: async (config: RenderConfig, sandboxId: string) => {\n const { apiKey, ownerId } = getAndValidateCredentials(config);\n\n try {\n const responseData = await fetchRender(apiKey, `/services/${sandboxId}`);\n \n // If service doesn't exist, the API will throw an error which we catch\n if (!responseData) {\n return null;\n }\n \n // Service should be defined if we get here\n if (!responseData.id) {\n throw new Error('Service data is missing from Render response');\n }\n \n const renderSandbox: RenderSandbox = {\n serviceId: responseData.id,\n ownerId,\n };\n\n return {\n sandbox: renderSandbox,\n sandboxId: responseData.id\n };\n } catch (error) {\n // If it's a 404, return null to indicate service not found\n if (error instanceof Error && error.message.includes('404')) {\n return null;\n }\n throw new Error(\n `Failed to get Render sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n \n list: async (config: RenderConfig) => {\n const { apiKey, ownerId } = getAndValidateCredentials(config);\n\n try {\n const responseData = await fetchRender(apiKey, '/services?includePreviews=true&limit=20');\n \n // Extract services from the array response - each item has a \"service\" property\n const items = responseData || [];\n \n // Transform each service into the expected format\n const sandboxes = items.map((item: any) => {\n const service = item.service;\n const renderSandbox: RenderSandbox = {\n serviceId: service.id,\n ownerId,\n };\n\n return {\n sandbox: renderSandbox,\n sandboxId: service.id\n };\n });\n\n return sandboxes;\n } catch (error) {\n throw new Error(\n `Failed to list Render sandboxes: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n destroy: async (config: RenderConfig, sandboxId: string) => {\n const { apiKey } = getAndValidateCredentials(config);\n\n try {\n await fetchRender(apiKey, `/services/${sandboxId}`, {\n method: 'DELETE'\n });\n } catch (error) {\n // For destroy operations, we typically don't throw if the service is already gone\n console.warn(`Render destroy warning: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n // Instance operations (minimal stubs - not implemented yet)\n runCode: async (_sandbox: RenderSandbox, _code: string, _runtime?: Runtime) => {\n throw new Error('Render runCode method not implemented yet');\n },\n\n runCommand: async (_sandbox: RenderSandbox, _command: string, _args?: string[], _options?: RunCommandOptions) => {\n throw new Error('Render runCommand method not implemented yet');\n },\n\n getInfo: async (_sandbox: RenderSandbox) => {\n throw new Error('Render getInfo method not implemented yet');\n },\n\n getUrl: async (_sandbox: RenderSandbox, _options: { port: number; protocol?: string }) => {\n throw new Error('Render getUrl method not implemented yet');\n },\n\n },\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,wBAAwD;AAkBjD,IAAM,4BAA4B,CAAC,WAAyB;AACjE,QAAM,SAAS,OAAO,UAAW,OAAO,YAAY,eAAe,QAAQ,KAAK,kBAAmB;AACnG,QAAM,UAAU,OAAO,WAAY,OAAO,YAAY,eAAe,QAAQ,KAAK,mBAAoB;AAEtG,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC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index.ts
|
|
2
|
+
import { createProvider } from "computesdk";
|
|
3
|
+
var getAndValidateCredentials = (config) => {
|
|
4
|
+
const apiKey = config.apiKey || typeof process !== "undefined" && process.env?.RENDER_API_KEY || "";
|
|
5
|
+
const ownerId = config.ownerId || typeof process !== "undefined" && process.env?.RENDER_OWNER_ID || "";
|
|
6
|
+
if (!apiKey) {
|
|
7
|
+
throw new Error(
|
|
8
|
+
"Missing Render API key. Provide apiKey in config or set RENDER_API_KEY environment variable."
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
if (!ownerId) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
"Missing Render Owner ID. Provide ownerId in config or set RENDER_OWNER_ID environment variable."
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return { apiKey, ownerId };
|
|
17
|
+
};
|
|
18
|
+
var fetchRender = async (apiKey, endpoint, options = {}) => {
|
|
19
|
+
const url = `https://api.render.com/v1${endpoint}`;
|
|
20
|
+
const requestOptions = {
|
|
21
|
+
method: "GET",
|
|
22
|
+
...options,
|
|
23
|
+
headers: {
|
|
24
|
+
"Accept": "application/json",
|
|
25
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
26
|
+
...options.headers || {}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const response = await fetch(url, requestOptions);
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
throw new Error(`Render API error: ${response.status} ${response.statusText}`);
|
|
32
|
+
}
|
|
33
|
+
if (response.status === 204) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
return response.json();
|
|
37
|
+
};
|
|
38
|
+
var render = createProvider({
|
|
39
|
+
name: "render",
|
|
40
|
+
methods: {
|
|
41
|
+
sandbox: {
|
|
42
|
+
// Collection operations (compute.sandbox.*)
|
|
43
|
+
create: async (config, options) => {
|
|
44
|
+
const { apiKey, ownerId } = getAndValidateCredentials(config);
|
|
45
|
+
try {
|
|
46
|
+
const createServiceData = {
|
|
47
|
+
type: "web_service",
|
|
48
|
+
autoDeploy: "yes",
|
|
49
|
+
image: {
|
|
50
|
+
ownerId,
|
|
51
|
+
imagePath: options?.runtime === "node" ? "docker.io/traefik/whoami" : "docker.io/traefik/whoami"
|
|
52
|
+
},
|
|
53
|
+
serviceDetails: {
|
|
54
|
+
runtime: "image",
|
|
55
|
+
envSpecificDetails: {
|
|
56
|
+
dockerCommand: options?.runtime === "node" ? "/whoami --port 10000" : "/whoami --port 10000"
|
|
57
|
+
},
|
|
58
|
+
pullRequestPreviewsEnabled: "no"
|
|
59
|
+
},
|
|
60
|
+
ownerId,
|
|
61
|
+
name: `render-sandbox-${Date.now()}`
|
|
62
|
+
};
|
|
63
|
+
const responseData = await fetchRender(apiKey, "/services", {
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers: {
|
|
66
|
+
"Content-Type": "application/json"
|
|
67
|
+
},
|
|
68
|
+
body: JSON.stringify(createServiceData)
|
|
69
|
+
});
|
|
70
|
+
if (!responseData) {
|
|
71
|
+
throw new Error("No service returned from Render API");
|
|
72
|
+
}
|
|
73
|
+
const service = responseData.service;
|
|
74
|
+
if (!service || !service.id) {
|
|
75
|
+
throw new Error(`Service ID is undefined. Full response: ${JSON.stringify(responseData, null, 2)}`);
|
|
76
|
+
}
|
|
77
|
+
const renderSandbox = {
|
|
78
|
+
serviceId: service.id,
|
|
79
|
+
ownerId
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
sandbox: renderSandbox,
|
|
83
|
+
sandboxId: service.id
|
|
84
|
+
};
|
|
85
|
+
} catch (error) {
|
|
86
|
+
throw new Error(
|
|
87
|
+
`Failed to create Render sandbox: ${error instanceof Error ? error.message : String(error)}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
getById: async (config, sandboxId) => {
|
|
92
|
+
const { apiKey, ownerId } = getAndValidateCredentials(config);
|
|
93
|
+
try {
|
|
94
|
+
const responseData = await fetchRender(apiKey, `/services/${sandboxId}`);
|
|
95
|
+
if (!responseData) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
if (!responseData.id) {
|
|
99
|
+
throw new Error("Service data is missing from Render response");
|
|
100
|
+
}
|
|
101
|
+
const renderSandbox = {
|
|
102
|
+
serviceId: responseData.id,
|
|
103
|
+
ownerId
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
sandbox: renderSandbox,
|
|
107
|
+
sandboxId: responseData.id
|
|
108
|
+
};
|
|
109
|
+
} catch (error) {
|
|
110
|
+
if (error instanceof Error && error.message.includes("404")) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
throw new Error(
|
|
114
|
+
`Failed to get Render sandbox: ${error instanceof Error ? error.message : String(error)}`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
list: async (config) => {
|
|
119
|
+
const { apiKey, ownerId } = getAndValidateCredentials(config);
|
|
120
|
+
try {
|
|
121
|
+
const responseData = await fetchRender(apiKey, "/services?includePreviews=true&limit=20");
|
|
122
|
+
const items = responseData || [];
|
|
123
|
+
const sandboxes = items.map((item) => {
|
|
124
|
+
const service = item.service;
|
|
125
|
+
const renderSandbox = {
|
|
126
|
+
serviceId: service.id,
|
|
127
|
+
ownerId
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
sandbox: renderSandbox,
|
|
131
|
+
sandboxId: service.id
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
return sandboxes;
|
|
135
|
+
} catch (error) {
|
|
136
|
+
throw new Error(
|
|
137
|
+
`Failed to list Render sandboxes: ${error instanceof Error ? error.message : String(error)}`
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
destroy: async (config, sandboxId) => {
|
|
142
|
+
const { apiKey } = getAndValidateCredentials(config);
|
|
143
|
+
try {
|
|
144
|
+
await fetchRender(apiKey, `/services/${sandboxId}`, {
|
|
145
|
+
method: "DELETE"
|
|
146
|
+
});
|
|
147
|
+
} catch (error) {
|
|
148
|
+
console.warn(`Render destroy warning: ${error instanceof Error ? error.message : String(error)}`);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
// Instance operations (minimal stubs - not implemented yet)
|
|
152
|
+
runCode: async (_sandbox, _code, _runtime) => {
|
|
153
|
+
throw new Error("Render runCode method not implemented yet");
|
|
154
|
+
},
|
|
155
|
+
runCommand: async (_sandbox, _command, _args, _options) => {
|
|
156
|
+
throw new Error("Render runCommand method not implemented yet");
|
|
157
|
+
},
|
|
158
|
+
getInfo: async (_sandbox) => {
|
|
159
|
+
throw new Error("Render getInfo method not implemented yet");
|
|
160
|
+
},
|
|
161
|
+
getUrl: async (_sandbox, _options) => {
|
|
162
|
+
throw new Error("Render getUrl method not implemented yet");
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
export {
|
|
168
|
+
fetchRender,
|
|
169
|
+
getAndValidateCredentials,
|
|
170
|
+
render
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Render Provider - Factory-based Implementation\n */\n\nimport { createProvider, createBackgroundCommand } from 'computesdk';\nimport type { Runtime, ExecutionResult, SandboxInfo, CreateSandboxOptions, FileEntry, RunCommandOptions } from 'computesdk';\n\n/**\n * Render sandbox interface\n */\ninterface RenderSandbox {\n serviceId: string;\n ownerId: string;\n}\n\nexport interface RenderConfig {\n /** Render API key - if not provided, will fallback to RENDER_API_KEY environment variable */\n apiKey?: string;\n /** Render Owner ID - if not provided, will fallback to RENDER_OWNER_ID environment variable */\n ownerId?: string;\n}\n\nexport const getAndValidateCredentials = (config: RenderConfig) => {\n const apiKey = config.apiKey || (typeof process !== 'undefined' && process.env?.RENDER_API_KEY) || '';\n const ownerId = config.ownerId || (typeof process !== 'undefined' && process.env?.RENDER_OWNER_ID) || '';\n\n if (!apiKey) {\n throw new Error(\n 'Missing Render API key. Provide apiKey in config or set RENDER_API_KEY environment variable.'\n );\n }\n\n if (!ownerId) {\n throw new Error(\n 'Missing Render Owner ID. Provide ownerId in config or set RENDER_OWNER_ID environment variable.'\n );\n }\n\n return { apiKey, ownerId };\n};\n\nexport const fetchRender = async (\n apiKey: string,\n endpoint: string,\n options: RequestInit = {}\n) => {\n const url = `https://api.render.com/v1${endpoint}`;\n const requestOptions = {\n method: 'GET',\n ...options,\n headers: {\n 'Accept': 'application/json',\n 'Authorization': `Bearer ${apiKey}`,\n ...(options.headers || {})\n }\n };\n \n const response = await fetch(url, requestOptions);\n\n if (!response.ok) {\n throw new Error(`Render API error: ${response.status} ${response.statusText}`);\n }\n\n // Handle 204 No Content responses (like DELETE operations)\n if (response.status === 204) {\n return {};\n }\n\n return response.json();\n};\n\n\n\n/**\n * Create a Render provider instance using the factory pattern\n */\nexport const render = createProvider<RenderSandbox, RenderConfig>({\n name: 'render',\n methods: {\n sandbox: {\n // Collection operations (compute.sandbox.*)\n create: async (config: RenderConfig, options?: CreateSandboxOptions) => {\n const { apiKey, ownerId } = getAndValidateCredentials(config);\n\n try {\n const createServiceData = {\n type: 'web_service',\n autoDeploy: 'yes',\n image: {\n ownerId: ownerId,\n imagePath: options?.runtime === 'node' ? 'docker.io/traefik/whoami' : 'docker.io/traefik/whoami'\n },\n serviceDetails: {\n runtime: 'image',\n envSpecificDetails: {\n dockerCommand: options?.runtime === 'node' ? '/whoami --port 10000' : '/whoami --port 10000'\n },\n pullRequestPreviewsEnabled: 'no'\n },\n ownerId: ownerId,\n name: `render-sandbox-${Date.now()}`\n };\n\n\n const responseData = await fetchRender(apiKey, '/services', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(createServiceData)\n });\n \n if (!responseData) {\n throw new Error('No service returned from Render API');\n }\n \n // Render API returns { service: { id: \"...\", ... }, deployId: \"...\" }\n const service = responseData.service;\n if (!service || !service.id) {\n throw new Error(`Service ID is undefined. Full response: ${JSON.stringify(responseData, null, 2)}`);\n }\n\n const renderSandbox: RenderSandbox = {\n serviceId: service.id,\n ownerId,\n };\n\n return {\n sandbox: renderSandbox,\n sandboxId: service.id\n };\n } catch (error) {\n throw new Error(\n `Failed to create Render sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getById: async (config: RenderConfig, sandboxId: string) => {\n const { apiKey, ownerId } = getAndValidateCredentials(config);\n\n try {\n const responseData = await fetchRender(apiKey, `/services/${sandboxId}`);\n \n // If service doesn't exist, the API will throw an error which we catch\n if (!responseData) {\n return null;\n }\n \n // Service should be defined if we get here\n if (!responseData.id) {\n throw new Error('Service data is missing from Render response');\n }\n \n const renderSandbox: RenderSandbox = {\n serviceId: responseData.id,\n ownerId,\n };\n\n return {\n sandbox: renderSandbox,\n sandboxId: responseData.id\n };\n } catch (error) {\n // If it's a 404, return null to indicate service not found\n if (error instanceof Error && error.message.includes('404')) {\n return null;\n }\n throw new Error(\n `Failed to get Render sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n \n list: async (config: RenderConfig) => {\n const { apiKey, ownerId } = getAndValidateCredentials(config);\n\n try {\n const responseData = await fetchRender(apiKey, '/services?includePreviews=true&limit=20');\n \n // Extract services from the array response - each item has a \"service\" property\n const items = responseData || [];\n \n // Transform each service into the expected format\n const sandboxes = items.map((item: any) => {\n const service = item.service;\n const renderSandbox: RenderSandbox = {\n serviceId: service.id,\n ownerId,\n };\n\n return {\n sandbox: renderSandbox,\n sandboxId: service.id\n };\n });\n\n return sandboxes;\n } catch (error) {\n throw new Error(\n `Failed to list Render sandboxes: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n destroy: async (config: RenderConfig, sandboxId: string) => {\n const { apiKey } = getAndValidateCredentials(config);\n\n try {\n await fetchRender(apiKey, `/services/${sandboxId}`, {\n method: 'DELETE'\n });\n } catch (error) {\n // For destroy operations, we typically don't throw if the service is already gone\n console.warn(`Render destroy warning: ${error instanceof Error ? error.message : String(error)}`);\n }\n },\n\n // Instance operations (minimal stubs - not implemented yet)\n runCode: async (_sandbox: RenderSandbox, _code: string, _runtime?: Runtime) => {\n throw new Error('Render runCode method not implemented yet');\n },\n\n runCommand: async (_sandbox: RenderSandbox, _command: string, _args?: string[], _options?: RunCommandOptions) => {\n throw new Error('Render runCommand method not implemented yet');\n },\n\n getInfo: async (_sandbox: RenderSandbox) => {\n throw new Error('Render getInfo method not implemented yet');\n },\n\n getUrl: async (_sandbox: RenderSandbox, _options: { port: number; protocol?: string }) => {\n throw new Error('Render getUrl method not implemented yet');\n },\n\n },\n },\n});\n"],"mappings":";AAIA,SAAS,sBAA+C;AAkBjD,IAAM,4BAA4B,CAAC,WAAyB;AACjE,QAAM,SAAS,OAAO,UAAW,OAAO,YAAY,eAAe,QAAQ,KAAK,kBAAmB;AACnG,QAAM,UAAU,OAAO,WAAY,OAAO,YAAY,eAAe,QAAQ,KAAK,mBAAoB;AAEtG,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,IAAM,cAAc,OACzB,QACA,UACA,UAAuB,CAAC,MACrB;AACH,QAAM,MAAM,4BAA4B,QAAQ;AAChD,QAAM,iBAAiB;AAAA,IACrB,QAAQ;AAAA,IACR,GAAG;AAAA,IACH,SAAS;AAAA,MACP,UAAU;AAAA,MACV,iBAAiB,UAAU,MAAM;AAAA,MACjC,GAAI,QAAQ,WAAW,CAAC;AAAA,IAC1B;AAAA,EACF;AAEA,QAAM,WAAW,MAAM,MAAM,KAAK,cAAc;AAEhD,MAAI,CAAC,SAAS,IAAI;AAChB,UAAM,IAAI,MAAM,qBAAqB,SAAS,MAAM,IAAI,SAAS,UAAU,EAAE;AAAA,EAC/E;AAGA,MAAI,SAAS,WAAW,KAAK;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A,MACF;AAAA,MAEA,SAAS,OAAO,QAAsB,cAAsB;AAC1D,cAAM,EAAE,OAAO,IAAI,0BAA0B,MAAM;AAEnD,YAAI;AACF,gBAAM,YAAY,QAAQ,aAAa,SAAS,IAAI;AAAA,YAClD,QAAQ;AAAA,UACV,CAAC;AAAA,QACH,SAAS,OAAO;AAEd,kBAAQ,KAAK,2BAA2B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAAA,QAClG;AAAA,MACF;AAAA;AAAA,MAGA,SAAS,OAAO,UAAyB,OAAe,aAAuB;AAC7E,cAAM,IAAI,MAAM,2CAA2C;AAAA,MAC7D;AAAA,MAEA,YAAY,OAAO,UAAyB,UAAkB,OAAkB,aAAiC;AAC/G,cAAM,IAAI,MAAM,8CAA8C;AAAA,MAChE;AAAA,MAEA,SAAS,OAAO,aAA4B;AAC1C,cAAM,IAAI,MAAM,2CAA2C;AAAA,MAC7D;AAAA,MAEA,QAAQ,OAAO,UAAyB,aAAkD;AACxF,cAAM,IAAI,MAAM,0CAA0C;AAAA,MAC5D;AAAA,IAEF;AAAA,EACF;AACF,CAAC;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@computesdk/render",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Render provider for ComputeSDK",
|
|
5
|
+
"author": "ComputeSDK Team",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.mjs",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"computesdk": "1.8.7"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"render",
|
|
25
|
+
"sandbox",
|
|
26
|
+
"code-execution",
|
|
27
|
+
"cloud",
|
|
28
|
+
"compute",
|
|
29
|
+
"containers"
|
|
30
|
+
],
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/computesdk/computesdk.git",
|
|
34
|
+
"directory": "packages/render"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/computesdk/computesdk/tree/main/packages/render",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/computesdk/computesdk/issues"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^20.0.0",
|
|
42
|
+
"@vitest/coverage-v8": "^1.0.0",
|
|
43
|
+
"eslint": "^8.37.0",
|
|
44
|
+
"rimraf": "^5.0.0",
|
|
45
|
+
"tsup": "^8.0.0",
|
|
46
|
+
"typescript": "^5.0.0",
|
|
47
|
+
"vitest": "^1.0.0",
|
|
48
|
+
"@computesdk/test-utils": "1.4.1"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup",
|
|
52
|
+
"clean": "rimraf dist",
|
|
53
|
+
"dev": "tsup --watch",
|
|
54
|
+
"test": "vitest run",
|
|
55
|
+
"test:watch": "vitest watch",
|
|
56
|
+
"test:coverage": "vitest run --coverage",
|
|
57
|
+
"typecheck": "tsc --noEmit",
|
|
58
|
+
"lint": "eslint"
|
|
59
|
+
}
|
|
60
|
+
}
|