···11+amends "../../schema/lexicon.pkl"
22+33+lexicon = 1
44+id = "io.pocketenv.port.defs"
55+defs = new Mapping<String, ObjectType> {
66+ ["portView"] {
77+ type = "object"
88+ description = "A view of a port exposed by a sandbox."
99+ properties {
1010+ ["port"] = new IntegerType {
1111+ type = "integer"
1212+ description = "The port number."
1313+ minimum = 1
1414+ maximum = 65535
1515+ }
1616+ ["description"] = new StringType {
1717+ type = "string"
1818+ description = "A description of the port."
1919+ }
2020+ ["previewUrl"] = new StringType {
2121+ type = "string"
2222+ description = "A URL for previewing the service running on the port"
2323+ }
2424+ }
2525+ }
2626+}
+39
apps/api/pkl/defs/sandbox/exposePort.pkl
···11+amends "../../schema/lexicon.pkl"
22+33+lexicon = 1
44+id = "io.pocketenv.sandbox.exposePort"
55+defs = new Mapping<String, Procedure> {
66+ ["main"] {
77+ type = "procedure"
88+ description = "Expose a port for a sandbox."
99+ parameters {
1010+ type = "params"
1111+ required = List("id")
1212+ properties {
1313+ ["id"] = new StringType {
1414+ type = "string"
1515+ description = "The sandbox ID."
1616+ }
1717+ }
1818+ }
1919+ input {
2020+ encoding = "application/json"
2121+ schema {
2222+ type = "object"
2323+ required = List("port")
2424+ properties {
2525+ ["port"] = new IntegerType {
2626+ type = "integer"
2727+ description = "The port number to expose."
2828+ minimum = 1
2929+ maximum = 65535
3030+ }
3131+ ["description"] = new StringType {
3232+ type = "string"
3333+ description = "A description of the port."
3434+ }
3535+ }
3636+ }
3737+ }
3838+ }
3939+}
+34
apps/api/pkl/defs/sandbox/getExposedPorts.pkl
···11+amends "../../schema/lexicon.pkl"
22+33+lexicon = 1
44+id = "io.pocketenv.sandbox.getExposedPorts"
55+defs = new Mapping<String, Query> {
66+ ["main"] {
77+ type = "query"
88+ description = "Get the list of exposed ports for a sandbox."
99+ parameters {
1010+ type = "params"
1111+ required = List("id")
1212+ properties {
1313+ ["id"] = new StringType {
1414+ type = "string"
1515+ description = "The sandbox ID."
1616+ }
1717+ }
1818+ }
1919+ output {
2020+ encoding = "application/json"
2121+ schema = new ObjectType {
2222+ type = "object"
2323+ properties {
2424+ ["ports"] = new Array {
2525+ type = "array"
2626+ items = new Ref {
2727+ ref = "io.pocketenv.port.defs#portView"
2828+ }
2929+ }
3030+ }
3131+ }
3232+ }
3333+ }
3434+}
+35
apps/api/pkl/defs/sandbox/unexposePort.pkl
···11+amends "../../schema/lexicon.pkl"
22+33+lexicon = 1
44+id = "io.pocketenv.sandbox.unexposePort"
55+defs = new Mapping<String, Procedure> {
66+ ["main"] {
77+ type = "procedure"
88+ description = "Unexpose a port for a sandbox."
99+ parameters {
1010+ type = "params"
1111+ required = List("id")
1212+ properties {
1313+ ["id"] = new StringType {
1414+ type = "string"
1515+ description = "The sandbox ID."
1616+ }
1717+ }
1818+ }
1919+ input {
2020+ encoding = "application/json"
2121+ schema {
2222+ type = "object"
2323+ required = List("port")
2424+ properties {
2525+ ["port"] = new IntegerType {
2626+ type = "integer"
2727+ description = "The port number to unexpose."
2828+ minimum = 1
2929+ maximum = 65535
3030+ }
3131+ }
3232+ }
3333+ }
3434+ }
3535+}
+36
apps/api/src/lexicon/index.ts
···2121import type * as IoPocketenvSandboxCreateIntegration from "./types/io/pocketenv/sandbox/createIntegration";
2222import type * as IoPocketenvSandboxCreateSandbox from "./types/io/pocketenv/sandbox/createSandbox";
2323import type * as IoPocketenvSandboxDeleteSandbox from "./types/io/pocketenv/sandbox/deleteSandbox";
2424+import type * as IoPocketenvSandboxExposePort from "./types/io/pocketenv/sandbox/exposePort";
2525+import type * as IoPocketenvSandboxGetExposedPorts from "./types/io/pocketenv/sandbox/getExposedPorts";
2426import type * as IoPocketenvSandboxGetIntegrations from "./types/io/pocketenv/sandbox/getIntegrations";
2527import type * as IoPocketenvSandboxGetPreferences from "./types/io/pocketenv/sandbox/getPreferences";
2628import type * as IoPocketenvSandboxGetSandbox from "./types/io/pocketenv/sandbox/getSandbox";
···3436import type * as IoPocketenvSandboxPutTailscaleToken from "./types/io/pocketenv/sandbox/putTailscaleToken";
3537import type * as IoPocketenvSandboxStartSandbox from "./types/io/pocketenv/sandbox/startSandbox";
3638import type * as IoPocketenvSandboxStopSandbox from "./types/io/pocketenv/sandbox/stopSandbox";
3939+import type * as IoPocketenvSandboxUnexposePort from "./types/io/pocketenv/sandbox/unexposePort";
3740import type * as IoPocketenvSandboxUpdateSandboxSettings from "./types/io/pocketenv/sandbox/updateSandboxSettings";
3841import type * as IoPocketenvSecretAddSecret from "./types/io/pocketenv/secret/addSecret";
3942import type * as IoPocketenvSecretDeleteSecret from "./types/io/pocketenv/secret/deleteSecret";
···254257 return this._server.xrpc.method(nsid, cfg);
255258 }
256259260260+ exposePort<AV extends AuthVerifier>(
261261+ cfg: ConfigOf<
262262+ AV,
263263+ IoPocketenvSandboxExposePort.Handler<ExtractAuth<AV>>,
264264+ IoPocketenvSandboxExposePort.HandlerReqCtx<ExtractAuth<AV>>
265265+ >,
266266+ ) {
267267+ const nsid = "io.pocketenv.sandbox.exposePort"; // @ts-ignore
268268+ return this._server.xrpc.method(nsid, cfg);
269269+ }
270270+271271+ getExposedPorts<AV extends AuthVerifier>(
272272+ cfg: ConfigOf<
273273+ AV,
274274+ IoPocketenvSandboxGetExposedPorts.Handler<ExtractAuth<AV>>,
275275+ IoPocketenvSandboxGetExposedPorts.HandlerReqCtx<ExtractAuth<AV>>
276276+ >,
277277+ ) {
278278+ const nsid = "io.pocketenv.sandbox.getExposedPorts"; // @ts-ignore
279279+ return this._server.xrpc.method(nsid, cfg);
280280+ }
281281+257282 getIntegrations<AV extends AuthVerifier>(
258283 cfg: ConfigOf<
259284 AV,
···394419 >,
395420 ) {
396421 const nsid = "io.pocketenv.sandbox.stopSandbox"; // @ts-ignore
422422+ return this._server.xrpc.method(nsid, cfg);
423423+ }
424424+425425+ unexposePort<AV extends AuthVerifier>(
426426+ cfg: ConfigOf<
427427+ AV,
428428+ IoPocketenvSandboxUnexposePort.Handler<ExtractAuth<AV>>,
429429+ IoPocketenvSandboxUnexposePort.HandlerReqCtx<ExtractAuth<AV>>
430430+ >,
431431+ ) {
432432+ const nsid = "io.pocketenv.sandbox.unexposePort"; // @ts-ignore
397433 return this._server.xrpc.method(nsid, cfg);
398434 }
399435
···11+/**
22+ * GENERATED CODE - DO NOT MODIFY
33+ */
44+import { type ValidationResult, BlobRef } from "@atproto/lexicon";
55+import { lexicons } from "../../../../lexicons";
66+import { isObj, hasProp } from "../../../../util";
77+import { CID } from "multiformats/cid";
88+99+/** A view of a port exposed by a sandbox. */
1010+export interface PortView {
1111+ /** The port number. */
1212+ port?: number;
1313+ /** A description of the port. */
1414+ description?: string;
1515+ /** A URL for previewing the service running on the port */
1616+ previewUrl?: string;
1717+ [k: string]: unknown;
1818+}
1919+2020+export function isPortView(v: unknown): v is PortView {
2121+ return (
2222+ isObj(v) &&
2323+ hasProp(v, "$type") &&
2424+ v.$type === "io.pocketenv.port.defs#portView"
2525+ );
2626+}
2727+2828+export function validatePortView(v: unknown): ValidationResult {
2929+ return lexicons.validate("io.pocketenv.port.defs#portView", v);
3030+}