Skip to content

Commit a25abc4

Browse files
sentry and new templates endpoint
1 parent 85eb580 commit a25abc4

File tree

14 files changed

+1275
-212
lines changed

14 files changed

+1275
-212
lines changed

build/utils.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports.nodeExternals = [
22
...Object.keys(require("../package.json").dependencies),
33
...require("module").builtinModules,
4+
...require("module").builtinModules.map((mod) => `node:${mod}`),
45
];
56

67
module.exports.define = {

esbuild.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ window.process = {
3737
`,
3838
},
3939
plugins: [browserPlugin],
40+
// pitcher-client seems to have some dynamic dependency on @sentry/node
41+
external: ["@sentry/node"],
4042
});
4143

4244
const browserEsmBuild = esbuild.build({
@@ -55,6 +57,8 @@ window.process = {
5557
`,
5658
},
5759
plugins: [browserPlugin],
60+
// pitcher-client seems to have some dynamic dependency on @sentry/node
61+
external: ["@sentry/node"],
5862
});
5963

6064
/**

openapi.json

Lines changed: 163 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,36 @@
117117
"title": "VMAssignTagAliasResponse",
118118
"type": "object"
119119
},
120+
"TemplateCreateRequest": {
121+
"properties": {
122+
"description": {
123+
"default": "[Template description]",
124+
"description": "Template description. Maximum 255 characters. Defaults to description of original sandbox.",
125+
"maxLength": 255,
126+
"type": "string"
127+
},
128+
"forkOf": {
129+
"description": "Short ID of the sandbox to fork.",
130+
"example": "pt_1234567890",
131+
"type": "string"
132+
},
133+
"tags": {
134+
"default": [],
135+
"description": "Tags to set on the new sandbox, if any. Will not inherit tags from the source sandbox.",
136+
"items": { "type": "string" },
137+
"type": "array"
138+
},
139+
"title": {
140+
"default": "[Template title]",
141+
"description": "Template title. Maximum 255 characters. Defaults to title of original sandbox with (forked).",
142+
"maxLength": 255,
143+
"type": "string"
144+
}
145+
},
146+
"required": ["forkOf"],
147+
"title": "TemplateCreateRequest",
148+
"type": "object"
149+
},
120150
"PreviewToken": {
121151
"properties": {
122152
"expires_at": { "nullable": true, "type": "string" },
@@ -284,10 +314,29 @@
284314
"concurrent_vm_limit": { "type": "integer" },
285315
"vms": {
286316
"items": {
287-
"properties": { "id": { "type": "string" } },
317+
"properties": {
318+
"credit_basis": { "type": "string" },
319+
"id": { "type": "string" },
320+
"last_active_at": { "type": "integer" },
321+
"session_started_at": { "type": "integer" },
322+
"specs": {
323+
"properties": {
324+
"cpu": { "type": "integer" },
325+
"memory": { "type": "integer" },
326+
"storage": { "type": "integer" }
327+
},
328+
"type": "object"
329+
}
330+
},
288331
"type": "object"
289332
},
290-
"required": ["id"],
333+
"required": [
334+
"id",
335+
"last_active_at",
336+
"session_started_at",
337+
"specs",
338+
"credit_basis"
339+
],
291340
"type": "array"
292341
}
293342
},
@@ -492,6 +541,40 @@
492541
},
493542
"required": ["scopes", "team", "version"],
494543
"type": "object"
544+
},
545+
"rate_limits": {
546+
"description": "Current workspace rate limits",
547+
"properties": {
548+
"concurrent_vms": {
549+
"properties": {
550+
"limit": { "type": "integer" },
551+
"remaining": { "type": "integer" }
552+
},
553+
"type": "object"
554+
},
555+
"requests_hourly": {
556+
"properties": {
557+
"limit": { "type": "integer" },
558+
"remaining": { "type": "integer" },
559+
"reset": { "type": "integer" }
560+
},
561+
"type": "object"
562+
},
563+
"sandboxes_hourly": {
564+
"properties": {
565+
"limit": { "type": "integer" },
566+
"remaining": { "type": "integer" },
567+
"reset": { "type": "integer" }
568+
},
569+
"type": "object"
570+
}
571+
},
572+
"required": [
573+
"concurrent_vms",
574+
"sandboxes_hourly",
575+
"requests_hourly"
576+
],
577+
"type": "object"
495578
}
496579
},
497580
"required": ["api"],
@@ -1120,6 +1203,52 @@
11201203
"title": "TokenCreateResponse",
11211204
"type": "object"
11221205
},
1206+
"TemplateCreateResponse": {
1207+
"allOf": [
1208+
{
1209+
"properties": {
1210+
"errors": {
1211+
"items": {
1212+
"oneOf": [
1213+
{ "type": "string" },
1214+
{ "additionalProperties": true, "type": "object" }
1215+
],
1216+
"title": "Error"
1217+
},
1218+
"type": "array"
1219+
},
1220+
"success": { "type": "boolean" }
1221+
},
1222+
"title": "Response",
1223+
"type": "object"
1224+
},
1225+
{
1226+
"properties": {
1227+
"data": {
1228+
"properties": {
1229+
"sandboxes": {
1230+
"items": {
1231+
"properties": {
1232+
"cluster": { "type": "string" },
1233+
"id": { "type": "string" }
1234+
},
1235+
"required": ["id", "cluster"],
1236+
"type": "object"
1237+
},
1238+
"type": "array"
1239+
},
1240+
"tag": { "type": "string" }
1241+
},
1242+
"required": ["tag", "sandboxes"],
1243+
"type": "object"
1244+
}
1245+
},
1246+
"type": "object"
1247+
}
1248+
],
1249+
"title": "TemplateCreateResponse",
1250+
"type": "object"
1251+
},
11231252
"TokenCreateRequest": {
11241253
"properties": {
11251254
"default_version": {
@@ -1932,6 +2061,38 @@
19322061
"tags": []
19332062
}
19342063
},
2064+
"/templates": {
2065+
"post": {
2066+
"callbacks": {},
2067+
"description": "Create a new template in the current workspace (creates 3 sandboxes and tags them)\n",
2068+
"operationId": "templates/create",
2069+
"parameters": [],
2070+
"requestBody": {
2071+
"content": {
2072+
"application/json": {
2073+
"schema": { "$ref": "#/components/schemas/TemplateCreateRequest" }
2074+
}
2075+
},
2076+
"description": "Template Create Request",
2077+
"required": false
2078+
},
2079+
"responses": {
2080+
"201": {
2081+
"content": {
2082+
"application/json": {
2083+
"schema": {
2084+
"$ref": "#/components/schemas/TemplateCreateResponse"
2085+
}
2086+
}
2087+
},
2088+
"description": "Template Create Response"
2089+
}
2090+
},
2091+
"security": [{ "authorization": ["template:create"] }],
2092+
"summary": "Create a template",
2093+
"tags": ["templates"]
2094+
}
2095+
},
19352096
"/vm/alias/{namespace}/{alias}": {
19362097
"put": {
19372098
"callbacks": {},

0 commit comments

Comments
 (0)