└── samples.ipynb /samples.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Setup\n", 8 | "\n", 9 | "In order to call the API you'll need to get two things from the [Deploy dashboard](https://dash.deno.com/):\n", 10 | " * Your organization ID\n", 11 | " * A personal or organizational access token" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 1, 17 | "metadata": {}, 18 | "outputs": [ 19 | { 20 | "data": {}, 21 | "execution_count": 1, 22 | "metadata": {}, 23 | "output_type": "execute_result" 24 | } 25 | ], 26 | "source": [ 27 | "import { assert } from \"https://deno.land/std@0.202.0/testing/asserts.ts\";\n", 28 | "\n", 29 | "// Replace these with your own!\n", 30 | "const organizationId = \"a75a9caa-b8ac-47b3-a423-3f2077c58731\";\n", 31 | "const token = \"ddo_u7mo08lBNHm8GMGLhtrEVfcgBsCuSp36dumX\";" 32 | ] 33 | }, 34 | { 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "# Create a project\n", 39 | "\n", 40 | "In order to create deployments, you first need to create a project to host them.\n", 41 | "\n", 42 | "The project name is used to derive deployments URLs from. You may specify one;\n", 43 | "if you don't, a random project name will be assigned automatically." 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": 1, 49 | "metadata": {}, 50 | "outputs": [ 51 | { 52 | "data": {}, 53 | "execution_count": 1, 54 | "metadata": {}, 55 | "output_type": "execute_result" 56 | }, 57 | { 58 | "name": "stdout", 59 | "output_type": "stream", 60 | "text": [ 61 | "{\n", 62 | " id: \"d798575b-b81b-40b8-b87c-184b382e2b9e\",\n", 63 | " name: \"sad-rhino-75\",\n", 64 | " createdAt: \"2023-09-22T05:38:34.550090Z\",\n", 65 | " updatedAt: \"2023-09-22T05:38:34.550090Z\"\n", 66 | "}\n" 67 | ] 68 | } 69 | ], 70 | "source": [ 71 | "const res = await fetch(\n", 72 | " `https://api.deno.com/v1/organizations/${organizationId}/projects`,\n", 73 | " {\n", 74 | " method: \"POST\",\n", 75 | " headers: {\n", 76 | " authorization: `Bearer ${token}`,\n", 77 | " \"content-type\": \"application/json\",\n", 78 | " },\n", 79 | " body: JSON.stringify(\n", 80 | " {\n", 81 | " name: null\n", 82 | " } satisfies CreateProjectRequest\n", 83 | " ),\n", 84 | " },\n", 85 | ");\n", 86 | "assert(res.ok);\n", 87 | "\n", 88 | "const project = await res.json();\n", 89 | "console.log(project);" 90 | ] 91 | }, 92 | { 93 | "cell_type": "markdown", 94 | "metadata": {}, 95 | "source": [ 96 | "# Create a deployment\n", 97 | "\n", 98 | "A typical flow for creating a deployment is described in this section.\n", 99 | "\n", 100 | "### 1. Initiate a build\n", 101 | "\n", 102 | "To initiate a build, you have call the API and provide (at a minimum):\n", 103 | " * One or more source files\n", 104 | " * The (relative) URL to the entry point source file\n", 105 | " * A set of environment variables" 106 | ] 107 | }, 108 | { 109 | "cell_type": "code", 110 | "execution_count": 1, 111 | "metadata": {}, 112 | "outputs": [ 113 | { 114 | "data": {}, 115 | "execution_count": 1, 116 | "metadata": {}, 117 | "output_type": "execute_result" 118 | }, 119 | { 120 | "name": "stdout", 121 | "output_type": "stream", 122 | "text": [ 123 | "{\n", 124 | " id: \"rn3mjpwsw24d\",\n", 125 | " projectId: \"d798575b-b81b-40b8-b87c-184b382e2b9e\",\n", 126 | " status: \"pending\",\n", 127 | " createdAt: \"2023-09-22T05:54:38.007146Z\",\n", 128 | " updatedAt: \"2023-09-22T05:54:38.007146Z\"\n", 129 | "}\n" 130 | ] 131 | } 132 | ], 133 | "source": [ 134 | "const res = await fetch(\n", 135 | " `https://api.deno.com/v1/projects/${project.id}/deployments`,\n", 136 | " {\n", 137 | " method: \"POST\",\n", 138 | " headers: {\n", 139 | " authorization: `Bearer ${token}`,\n", 140 | " \"content-type\": \"application/json\",\n", 141 | " },\n", 142 | " body: JSON.stringify(\n", 143 | " {\n", 144 | " \"entryPointUrl\": \"main.ts\",\n", 145 | " \"assets\": {\n", 146 | " \"main.ts\": {\n", 147 | " \"kind\": \"file\",\n", 148 | " \"content\":\n", 149 | " `import { assert } from \"https://deno.land/std@0.202.0/testing/asserts.ts\";\n", 150 | " Deno.serve((req: Request) => new Response('Hello World'));`\n", 151 | " }\n", 152 | " },\n", 153 | " \"envVars\": {\n", 154 | " \"FOO\": \"foo\",\n", 155 | " },\n", 156 | " } satisfies CreateDeploymentRequest,\n", 157 | " ),\n", 158 | " },\n", 159 | ");\n", 160 | "assert(res.ok);\n", 161 | "\n", 162 | "const deployment: Deployment = await res.json();\n", 163 | "console.log(deployment);" 164 | ] 165 | }, 166 | { 167 | "cell_type": "markdown", 168 | "metadata": {}, 169 | "source": [ 170 | "### 2. Wait for the build to be completed\n", 171 | "\n", 172 | "Build of a deployment is an async process. In order to wait for its completion (or failure), you may either:\n", 173 | " * Use the `GET /v1/deployments/:deploymentId/build_logs` endpoint. This endpoint will stream build log messages until the build is complete.\n", 174 | " * Periodically poll the `GET /v1/deployments/:deploymentId` endpoint until the response `status` field is no longer `pending`.\n" 175 | ] 176 | }, 177 | { 178 | "cell_type": "code", 179 | "execution_count": 1, 180 | "metadata": {}, 181 | "outputs": [ 182 | { 183 | "data": {}, 184 | "execution_count": 1, 185 | "metadata": {}, 186 | "output_type": "execute_result" 187 | }, 188 | { 189 | "name": "stdout", 190 | "output_type": "stream", 191 | "text": [ 192 | "[info] Downloaded file:///src/main.ts (1/2)\n", 193 | "[info] Downloaded https://deno.land/std@0.202.0/testing/asserts.ts (2/3)\n", 194 | "[info] Downloaded https://deno.land/std@0.202.0/assert/mod.ts (3/30)\n", 195 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_almost_equals.ts (4/30)\n", 196 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_array_includes.ts (5/31)\n", 197 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_equals.ts (6/34)\n", 198 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_exists.ts (7/34)\n", 199 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_false.ts (8/34)\n", 200 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_greater_or_equal.ts (9/34)\n", 201 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_greater.ts (10/34)\n", 202 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_instance_of.ts (11/34)\n", 203 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_is_error.ts (12/34)\n", 204 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_less_or_equal.ts (13/34)\n", 205 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_less.ts (14/34)\n", 206 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_match.ts (15/34)\n", 207 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_not_equals.ts (16/34)\n", 208 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_not_instance_of.ts (17/34)\n", 209 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_not_match.ts (18/34)\n", 210 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_not_strict_equals.ts (19/34)\n", 211 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_object_match.ts (20/34)\n", 212 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_rejects.ts (21/34)\n", 213 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_strict_equals.ts (22/34)\n", 214 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_string_includes.ts (23/34)\n", 215 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert_throws.ts (24/34)\n", 216 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assert.ts (25/34)\n", 217 | "[info] Downloaded https://deno.land/std@0.202.0/assert/assertion_error.ts (26/34)\n", 218 | "[info] Downloaded https://deno.land/std@0.202.0/assert/equal.ts (27/34)\n", 219 | "[info] Downloaded https://deno.land/std@0.202.0/assert/fail.ts (28/34)\n", 220 | "[info] Downloaded https://deno.land/std@0.202.0/assert/unimplemented.ts (29/34)\n", 221 | "[info] Downloaded https://deno.land/std@0.202.0/assert/unreachable.ts (30/34)\n", 222 | "[info] Downloaded https://deno.land/std@0.202.0/assert/_format.ts (31/34)\n", 223 | "[info] Downloaded https://deno.land/std@0.202.0/fmt/colors.ts (32/34)\n", 224 | "[info] Downloaded https://deno.land/std@0.202.0/assert/_diff.ts (33/34)\n", 225 | "[info] Downloaded https://deno.land/std@0.202.0/assert/_constants.ts (34/34)\n", 226 | "[info] Packaging complete\n", 227 | "[info] Deployed to sad-rhino-75-rn3mjpwsw24d.deno.dev\n" 228 | ] 229 | } 230 | ], 231 | "source": [ 232 | "import { DelimiterStream } from \"https://deno.land/std@0.202.0/streams/delimiter_stream.ts\";\n", 233 | "\n", 234 | "const res = await fetch(\n", 235 | " `https://api.deno.com/v1/deployments/${deployment.id}/build_logs`,\n", 236 | " {\n", 237 | " method: \"GET\",\n", 238 | " headers: {\n", 239 | " authorization: `Bearer ${token}`,\n", 240 | " // The endpoint supports two different formats: `application/json` and\n", 241 | " // `application/x-ndjson`; the latter is easier to parse incrementally.\n", 242 | " accept: \"application/x-ndjson\",\n", 243 | " },\n", 244 | " },\n", 245 | ");\n", 246 | "assert(res.ok);\n", 247 | "\n", 248 | "const lines = res.body!\n", 249 | " .pipeThrough(new DelimiterStream(new TextEncoder().encode(\"\\n\")))\n", 250 | " .pipeThrough(new TextDecoderStream());\n", 251 | "\n", 252 | "for await (const line of lines) {\n", 253 | " const logEntry: BuildLogEntry = JSON.parse(line);\n", 254 | " console.log(`[${logEntry.level}] ${logEntry.message}`);\n", 255 | "}" 256 | ] 257 | }, 258 | { 259 | "cell_type": "markdown", 260 | "metadata": {}, 261 | "source": [ 262 | "### 3. Obtain deployment metadata\n", 263 | "\n", 264 | "Once the build is completed, the deployment's status will change to `success`, and a deno.dev domain will be automatically assigned to it." 265 | ] 266 | }, 267 | { 268 | "cell_type": "code", 269 | "execution_count": 1, 270 | "metadata": {}, 271 | "outputs": [ 272 | { 273 | "data": {}, 274 | "execution_count": 1, 275 | "metadata": {}, 276 | "output_type": "execute_result" 277 | }, 278 | { 279 | "name": "stdout", 280 | "output_type": "stream", 281 | "text": [ 282 | "{\n", 283 | " id: \"rn3mjpwsw24d\",\n", 284 | " projectId: \"d798575b-b81b-40b8-b87c-184b382e2b9e\",\n", 285 | " status: \"success\",\n", 286 | " domains: [ \"sad-rhino-75-rn3mjpwsw24d.deno.dev\" ],\n", 287 | " createdAt: \"2023-09-22T05:54:38.007146Z\",\n", 288 | " updatedAt: \"2023-09-22T05:54:43.720061Z\"\n", 289 | "}\n" 290 | ] 291 | } 292 | ], 293 | "source": [ 294 | "const res = await fetch(\n", 295 | " `https://api.deno.com/v1/deployments/${deployment.id}`,\n", 296 | " {\n", 297 | " method: \"GET\",\n", 298 | " headers: {\n", 299 | " authorization: `Bearer ${token}`,\n", 300 | " },\n", 301 | " },\n", 302 | ");\n", 303 | "assert(res.ok);\n", 304 | "\n", 305 | "const deployment2: Deployment = await res.json();\n", 306 | "console.log(deployment2);" 307 | ] 308 | }, 309 | { 310 | "cell_type": "markdown", 311 | "metadata": {}, 312 | "source": [ 313 | "# Link a custom domain to your account\n", 314 | "\n", 315 | "The next section outlines how to perform domain-related operations:\n", 316 | " * Link a domain name to your account\n", 317 | " * Verify that you own the domain name\n", 318 | " * Provision TLS certificates\n", 319 | "\n", 320 | "### 1. Link a domain\n" 321 | ] 322 | }, 323 | { 324 | "cell_type": "code", 325 | "execution_count": 1, 326 | "metadata": {}, 327 | "outputs": [ 328 | { 329 | "data": {}, 330 | "execution_count": 1, 331 | "metadata": {}, 332 | "output_type": "execute_result" 333 | }, 334 | { 335 | "name": "stdout", 336 | "output_type": "stream", 337 | "text": [ 338 | "{\n", 339 | " id: \"8302bc00-0fe3-4416-a190-ead9b48d9ce9\",\n", 340 | " domain: \"deploy-sample1.maguro.me\",\n", 341 | " token: \"6a30d42ce0da4d5013b5e39c\",\n", 342 | " isValidated: false,\n", 343 | " certificates: [],\n", 344 | " provisioningStatus: { code: \"pending\" },\n", 345 | " projectId: \"df5c078b-4639-40c3-b3b7-ca05e81edb89\",\n", 346 | " createdAt: \"2023-09-04T01:54:28.199638Z\",\n", 347 | " updatedAt: \"2023-09-05T00:26:15.284119Z\",\n", 348 | " dnsRecords: [\n", 349 | " { type: \"A\", name: \"deploy-sample1\", content: \"34.120.54.55\" },\n", 350 | " {\n", 351 | " type: \"AAAA\",\n", 352 | " name: \"deploy-sample1\",\n", 353 | " content: \"2600:1901:0:6d85::\"\n", 354 | " },\n", 355 | " {\n", 356 | " type: \"CNAME\",\n", 357 | " name: \"_acme-challenge.deploy-sample1\",\n", 358 | " content: \"6a30d42ce0da4d5013b5e39c._acme.deno.dev.\"\n", 359 | " }\n", 360 | " ]\n", 361 | "}\n" 362 | ] 363 | } 364 | ], 365 | "source": [ 366 | "const res = await fetch(\n", 367 | " `https://api.deno.com/v1/organizations/${organizationId}/domains`,\n", 368 | " {\n", 369 | " method: \"POST\",\n", 370 | " headers: {\n", 371 | " authorization: `Bearer ${token}`,\n", 372 | " \"content-type\": \"application/json\",\n", 373 | " },\n", 374 | " body: JSON.stringify(\n", 375 | " {\n", 376 | " // Replace with a domain you own!\n", 377 | " \"domain\": \"deploy-sample1.maguro.me\",\n", 378 | " } satisfies CreateDomainRequest,\n", 379 | " ),\n", 380 | " },\n", 381 | ");\n", 382 | "assert(res.ok);\n", 383 | "\n", 384 | "const domain: Domain = await res.json();\n", 385 | "console.log(domain);" 386 | ] 387 | }, 388 | { 389 | "cell_type": "markdown", 390 | "metadata": {}, 391 | "source": [ 392 | "### 2. Verify the domain ownership\n", 393 | "\n", 394 | "Once you linked your domain, Deno Deploy needs to verify that you are the owner of the domain. You can do so by following these steps:\n", 395 | "\n", 396 | "- Retrieve the `dnsRecords` field from the resonse body of the API call above. Notice that it includes three values: type `A`, `AAAA`, and `CNAME`.\n", 397 | "- Add these DNS records to the DNS provider you're using for this domain. Here's my setting on Cloudflare dashboard:\n", 398 | "![How I configured DNS records on Cloudflare dashboard](https://github.com/magurotuna/zig-deque/assets/23649474/5bfeaafc-58c0-46fa-857c-ec33fdf3f3a8)\n", 399 | "- Call the API to get Deploy to verify the expected records are set:" 400 | ] 401 | }, 402 | { 403 | "cell_type": "code", 404 | "execution_count": null, 405 | "metadata": {}, 406 | "outputs": [], 407 | "source": [ 408 | "const res = await fetch(\n", 409 | " `https://api.deno.com/v1/domains/${domain.id}/verify`,\n", 410 | " {\n", 411 | " method: \"POST\",\n", 412 | " headers: {\n", 413 | " authorization: `Bearer ${token}`,\n", 414 | " },\n", 415 | " },\n", 416 | ");\n", 417 | "assert(res.ok);" 418 | ] 419 | }, 420 | { 421 | "cell_type": "markdown", 422 | "metadata": {}, 423 | "source": [ 424 | "### 3. Provision TLS certificates\n", 425 | "\n", 426 | "Now it's verified that you are the owner of the domain. Final step is to provision TLS certificates for the domain. You can either upload the certificates you prepared somehow, or just leave the certificates preparation to Deploy. Here we will demonstrate the latter, auto-provisioning capability.\n", 427 | "\n", 428 | "All you have to do is to call `POST /v1/domains/:domainId/certificates/provision` which triggers the auto-provisioning step for the specified domain." 429 | ] 430 | }, 431 | { 432 | "cell_type": "code", 433 | "execution_count": null, 434 | "metadata": {}, 435 | "outputs": [], 436 | "source": [ 437 | "// This call may take a while, up to a minute or so.\n", 438 | "const res = await fetch(\n", 439 | " `https://api.deno.com/v1/domains/${domain.id}/certificates/provision`,\n", 440 | " {\n", 441 | " method: \"POST\",\n", 442 | " headers: {\n", 443 | " authorization: `Bearer ${token}`,\n", 444 | " },\n", 445 | " },\n", 446 | ");\n", 447 | "assert(res.ok);" 448 | ] 449 | }, 450 | { 451 | "cell_type": "markdown", 452 | "metadata": {}, 453 | "source": [ 454 | "Just to make sure, let's call `GET /v1/domains/:domainId` to see the current state of the domain." 455 | ] 456 | }, 457 | { 458 | "cell_type": "code", 459 | "execution_count": 1, 460 | "metadata": {}, 461 | "outputs": [ 462 | { 463 | "data": {}, 464 | "execution_count": 1, 465 | "metadata": {}, 466 | "output_type": "execute_result" 467 | }, 468 | { 469 | "name": "stdout", 470 | "output_type": "stream", 471 | "text": [ 472 | "{\n", 473 | " id: \"8302bc00-0fe3-4416-a190-ead9b48d9ce9\",\n", 474 | " domain: \"deploy-sample1.maguro.me\",\n", 475 | " token: \"6a30d42ce0da4d5013b5e39c\",\n", 476 | " isValidated: true,\n", 477 | " certificates: [\n", 478 | " {\n", 479 | " cipher: \"rsa\",\n", 480 | " expiresAt: \"2023-12-03T23:26:38.445898Z\",\n", 481 | " createdAt: \"2023-09-05T00:26:40.449996Z\",\n", 482 | " updatedAt: \"2023-09-05T00:26:40.449996Z\"\n", 483 | " },\n", 484 | " {\n", 485 | " cipher: \"ec\",\n", 486 | " expiresAt: \"2023-12-03T23:26:39.992532Z\",\n", 487 | " createdAt: \"2023-09-05T00:26:41.995657Z\",\n", 488 | " updatedAt: \"2023-09-05T00:26:41.995657Z\"\n", 489 | " }\n", 490 | " ],\n", 491 | " provisioningStatus: { code: \"success\" },\n", 492 | " projectId: \"df5c078b-4639-40c3-b3b7-ca05e81edb89\",\n", 493 | " createdAt: \"2023-09-04T01:54:28.199638Z\",\n", 494 | " updatedAt: \"2023-09-05T00:26:15.284119Z\",\n", 495 | " dnsRecords: [\n", 496 | " { type: \"A\", name: \"deploy-sample1\", content: \"34.120.54.55\" },\n", 497 | " {\n", 498 | " type: \"AAAA\",\n", 499 | " name: \"deploy-sample1\",\n", 500 | " content: \"2600:1901:0:6d85::\"\n", 501 | " },\n", 502 | " {\n", 503 | " type: \"CNAME\",\n", 504 | " name: \"_acme-challenge.deploy-sample1\",\n", 505 | " content: \"6a30d42ce0da4d5013b5e39c._acme.deno.dev.\"\n", 506 | " }\n", 507 | " ]\n", 508 | "}\n" 509 | ] 510 | } 511 | ], 512 | "source": [ 513 | "const res = await fetch(\n", 514 | " `https://api.deno.com/v1/domains/${domain.id}`,\n", 515 | " {\n", 516 | " method: \"GET\",\n", 517 | " headers: {\n", 518 | " authorization: `Bearer ${token}`,\n", 519 | " },\n", 520 | " },\n", 521 | ");\n", 522 | "assert(res.ok);\n", 523 | "\n", 524 | "const domain: Domain = await res.json();\n", 525 | "console.log(domain);" 526 | ] 527 | }, 528 | { 529 | "cell_type": "markdown", 530 | "metadata": {}, 531 | "source": [ 532 | "# Associate the custom domain with the deployment\n", 533 | "\n", 534 | "Although the domain setup has completed, it is of no use until it gets connected to an actual deployment. We accomplish it by calling `PATCH /v1/domains/:domainId`." 535 | ] 536 | }, 537 | { 538 | "cell_type": "code", 539 | "execution_count": null, 540 | "metadata": {}, 541 | "outputs": [], 542 | "source": [ 543 | "const res = await fetch(\n", 544 | " `https://api.deno.com/v1/domains/${domain.id}`,\n", 545 | " {\n", 546 | " method: \"PATCH\",\n", 547 | " headers: {\n", 548 | " authorization: `Bearer ${token}`,\n", 549 | " \"content-type\": \"application/json\",\n", 550 | " },\n", 551 | " body: JSON.stringify(\n", 552 | " {\n", 553 | " \"deploymentId\": deployment.id,\n", 554 | " } satisfies UpdateDomainAssociationRequest,\n", 555 | " ),\n", 556 | " },\n", 557 | ");\n", 558 | "assert(res.ok);" 559 | ] 560 | }, 561 | { 562 | "cell_type": "markdown", 563 | "metadata": {}, 564 | "source": [ 565 | "Now you can confirm that your deployment is reachable using your own domain. Here's the result of `curl` in my case:\n", 566 | "\n", 567 | "```sh\n", 568 | "❯ curl --include 'https://deploy-sample1.maguro.me'\n", 569 | "HTTP/2 200\n", 570 | "content-type: text/plain;charset=UTF-8\n", 571 | "vary: Accept-Encoding\n", 572 | "date: Thu, 21 Sep 2023 10:51:34 GMT\n", 573 | "content-length: 11\n", 574 | "via: http/2 edgeproxy\n", 575 | "server: deno/gcp-asia-northeast1\n", 576 | "\n", 577 | "Hello World%\n", 578 | "```" 579 | ] 580 | }, 581 | { 582 | "cell_type": "markdown", 583 | "metadata": {}, 584 | "source": [ 585 | "# Appendix\n", 586 | "\n", 587 | "Here is a list of types used in the sample code snippets above." 588 | ] 589 | }, 590 | { 591 | "cell_type": "code", 592 | "execution_count": null, 593 | "metadata": {}, 594 | "outputs": [], 595 | "source": [ 596 | "type CreateProjectRequest = {\n", 597 | " name: string | null;\n", 598 | "};\n", 599 | "\n", 600 | "type Project = {\n", 601 | " id: string;\n", 602 | " name: string;\n", 603 | " organizationId: string;\n", 604 | " createdAt: string;\n", 605 | " updatedAt: string;\n", 606 | "};\n", 607 | "\n", 608 | "type CreateDeploymentRequest = {\n", 609 | " entryPointUrl: string;\n", 610 | " importMapUrl?: string | null;\n", 611 | " lockFileUrl?: string | null;\n", 612 | " compilerOptions?: CompilerOptions | null;\n", 613 | " assets: Record;\n", 614 | " envVars: Record;\n", 615 | "};\n", 616 | "\n", 617 | "type CompilerOptions = {\n", 618 | " jsx?: string | null;\n", 619 | " jsxFactory?: string | null;\n", 620 | " jsxFragmentFactory?: string | null;\n", 621 | " jsxImportSource?: string | null;\n", 622 | "};\n", 623 | "\n", 624 | "type Asset = FileAsset | SymlinkAsset;\n", 625 | "\n", 626 | "type FileAsset = FileContent | FileHash;\n", 627 | "\n", 628 | "type FileContent = {\n", 629 | " kind: \"file\";\n", 630 | " content: string;\n", 631 | " encoding?: \"utf-8\" | \"base64\";\n", 632 | "};\n", 633 | "\n", 634 | "type FileHash = {\n", 635 | " kind: \"file\";\n", 636 | " gitSha1: string;\n", 637 | "};\n", 638 | "\n", 639 | "type SymlinkAsset = {\n", 640 | " kind: \"symlink\";\n", 641 | " target: string;\n", 642 | "};\n", 643 | "\n", 644 | "type Deployment = {\n", 645 | " id: string;\n", 646 | " projectId: string;\n", 647 | " status: \"failed\" | \"pending\" | \"success\";\n", 648 | " domains?: string[];\n", 649 | " createdAt: string;\n", 650 | " updatedAt: string;\n", 651 | "};\n", 652 | "\n", 653 | "type BuildLogEntry = {\n", 654 | " level: string;\n", 655 | " message: string;\n", 656 | "};\n", 657 | "\n", 658 | "type CreateDomainRequest = {\n", 659 | " domain: string;\n", 660 | "};\n", 661 | "\n", 662 | "type Domain = {\n", 663 | " id: string;\n", 664 | " organizationId: string;\n", 665 | " domain: string;\n", 666 | " token: string;\n", 667 | " isValidated: boolean;\n", 668 | " certificates: Certificate[];\n", 669 | " provisioningStatus: ProvisioningStatus;\n", 670 | " projectId: string | null;\n", 671 | " createdAt: string;\n", 672 | " updatedAt: string;\n", 673 | " dnsRecords: DnsRecord[];\n", 674 | "};\n", 675 | "\n", 676 | "type ProvisioningStatus = \n", 677 | " | { code: \"pending\" } \n", 678 | " | { code: \"success\" } \n", 679 | " | { code: \"failed\", message: string } \n", 680 | " | { code: \"manual\" };\n", 681 | "\n", 682 | "type Certificate = {\n", 683 | " cipher: \"ec\" | \"rsa\";\n", 684 | " expiresAt: string;\n", 685 | " createdAt: string;\n", 686 | " updatedAt: string;\n", 687 | "};\n", 688 | "\n", 689 | "type DnsRecord = {\n", 690 | " type: string;\n", 691 | " name: string;\n", 692 | " content: string;\n", 693 | "};\n", 694 | "\n", 695 | "type UpdateDomainAssociationRequest = {\n", 696 | " deploymentId: string | null;\n", 697 | "};" 698 | ] 699 | } 700 | ], 701 | "metadata": { 702 | "kernelspec": { 703 | "display_name": "Deno", 704 | "language": "typescript", 705 | "name": "deno" 706 | }, 707 | "language_info": { 708 | "file_extension": ".ts", 709 | "mimetype": "text/x.typescript", 710 | "name": "typescript", 711 | "nb_converter": "script", 712 | "pygments_lexer": "typescript", 713 | "version": "5.2.2" 714 | }, 715 | "orig_nbformat": 4 716 | }, 717 | "nbformat": 4, 718 | "nbformat_minor": 2 719 | } 720 | --------------------------------------------------------------------------------