the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add update RPCs for file, secret, variable, volume

+1003 -9
+29
apps/api/lexicons/file/updateFile.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "io.pocketenv.file.updateFile", 4 + "defs": { 5 + "main": { 6 + "type": "procedure", 7 + "input": { 8 + "encoding": "application/json", 9 + "schema": { 10 + "type": "object", 11 + "required": [ 12 + "id", 13 + "file" 14 + ], 15 + "properties": { 16 + "id": { 17 + "type": "string", 18 + "description": "The ID of the file to delete" 19 + }, 20 + "file": { 21 + "type": "ref", 22 + "ref": "io.pocketenv.file.defs#file" 23 + } 24 + } 25 + } 26 + } 27 + } 28 + } 29 + }
+33
apps/api/lexicons/secret/udpateSecret.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "io.pocketenv.secret.updateSecret", 4 + "defs": { 5 + "main": { 6 + "type": "procedure", 7 + "input": { 8 + "encoding": "application/json", 9 + "schema": { 10 + "type": "object", 11 + "required": [ 12 + "id", 13 + "secret" 14 + ], 15 + "properties": { 16 + "id": { 17 + "type": "string", 18 + "description": "The ID of the secret to update." 19 + }, 20 + "secret": { 21 + "type": "ref", 22 + "ref": "io.pocketenv.secret.defs#secret" 23 + }, 24 + "redacted": { 25 + "type": "string", 26 + "description": "The redacted secret value." 27 + } 28 + } 29 + } 30 + } 31 + } 32 + } 33 + }
+29
apps/api/lexicons/variable/updateVariable.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "io.pocketenv.variable.updateVariable", 4 + "defs": { 5 + "main": { 6 + "type": "procedure", 7 + "input": { 8 + "encoding": "application/json", 9 + "schema": { 10 + "type": "object", 11 + "required": [ 12 + "id", 13 + "variable" 14 + ], 15 + "properties": { 16 + "id": { 17 + "type": "string", 18 + "description": "The ID of the variable to update." 19 + }, 20 + "variable": { 21 + "type": "ref", 22 + "ref": "io.pocketenv.variable.defs#variable" 23 + } 24 + } 25 + } 26 + } 27 + } 28 + } 29 + }
+29
apps/api/lexicons/volume/updateVolume.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "io.pocketenv.volume.updateVolume", 4 + "defs": { 5 + "main": { 6 + "type": "procedure", 7 + "input": { 8 + "encoding": "application/json", 9 + "schema": { 10 + "type": "object", 11 + "required": [ 12 + "id", 13 + "volume" 14 + ], 15 + "properties": { 16 + "id": { 17 + "type": "string", 18 + "description": "The ID of the volume to update." 19 + }, 20 + "volume": { 21 + "type": "ref", 22 + "ref": "io.pocketenv.volume.defs#volume" 23 + } 24 + } 25 + } 26 + } 27 + } 28 + } 29 + }
+26
apps/api/pkl/defs/file/updateFile.pkl
··· 1 + amends "../../schema/lexicon.pkl" 2 + 3 + lexicon = 1 4 + id = "io.pocketenv.file.updateFile" 5 + defs = new Mapping<String, Procedure> { 6 + ["main"] { 7 + type = "procedure" 8 + input { 9 + encoding = "application/json" 10 + schema { 11 + type = "object" 12 + required = List("id", "file") 13 + properties { 14 + ["id"] = new StringType { 15 + type = "string" 16 + description = "The ID of the file to delete" 17 + } 18 + ["file"] = new Ref { 19 + type = "ref" 20 + ref = "io.pocketenv.file.defs#file" 21 + } 22 + } 23 + } 24 + } 25 + } 26 + }
+30
apps/api/pkl/defs/secret/udpateSecret.pkl
··· 1 + amends "../../schema/lexicon.pkl" 2 + 3 + lexicon = 1 4 + id = "io.pocketenv.secret.updateSecret" 5 + defs = new Mapping<String, Procedure> { 6 + ["main"] { 7 + type = "procedure" 8 + input { 9 + encoding = "application/json" 10 + schema { 11 + type = "object" 12 + required = List("id", "secret") 13 + properties { 14 + ["id"] = new StringType { 15 + type = "string" 16 + description = "The ID of the secret to update." 17 + } 18 + ["secret"] = new Ref { 19 + type = "ref" 20 + ref = "io.pocketenv.secret.defs#secret" 21 + } 22 + ["redacted"] = new StringType { 23 + type = "string" 24 + description = "The redacted secret value." 25 + } 26 + } 27 + } 28 + } 29 + } 30 + }
+26
apps/api/pkl/defs/variable/updateVariable.pkl
··· 1 + amends "../../schema/lexicon.pkl" 2 + 3 + lexicon = 1 4 + id = "io.pocketenv.variable.updateVariable" 5 + defs = new Mapping<String, Procedure> { 6 + ["main"] { 7 + type = "procedure" 8 + input { 9 + encoding = "application/json" 10 + schema { 11 + type = "object" 12 + required = List("id", "variable") 13 + properties { 14 + ["id"] = new StringType { 15 + type = "string" 16 + description = "The ID of the variable to update." 17 + } 18 + ["variable"] = new Ref { 19 + type = "ref" 20 + ref = "io.pocketenv.variable.defs#variable" 21 + } 22 + } 23 + } 24 + } 25 + } 26 + }
+26
apps/api/pkl/defs/volume/updateVolume.pkl
··· 1 + amends "../../schema/lexicon.pkl" 2 + 3 + lexicon = 1 4 + id = "io.pocketenv.volume.updateVolume" 5 + defs = new Mapping<String, Procedure> { 6 + ["main"] { 7 + type = "procedure" 8 + input { 9 + encoding = "application/json" 10 + schema { 11 + type = "object" 12 + required = List("id", "volume") 13 + properties { 14 + ["id"] = new StringType { 15 + type = "string" 16 + description = "The ID of the volume to update." 17 + } 18 + ["volume"] = new Ref { 19 + type = "ref" 20 + ref = "io.pocketenv.volume.defs#volume" 21 + } 22 + } 23 + } 24 + } 25 + } 26 + }
+48
apps/api/src/lexicon/index.ts
··· 16 16 import type * as IoPocketenvFileDeleteFile from "./types/io/pocketenv/file/deleteFile"; 17 17 import type * as IoPocketenvFileGetFile from "./types/io/pocketenv/file/getFile"; 18 18 import type * as IoPocketenvFileGetFiles from "./types/io/pocketenv/file/getFiles"; 19 + import type * as IoPocketenvFileUpdateFile from "./types/io/pocketenv/file/updateFile"; 19 20 import type * as IoPocketenvSandboxClaimSandbox from "./types/io/pocketenv/sandbox/claimSandbox"; 20 21 import type * as IoPocketenvSandboxCreateIntegration from "./types/io/pocketenv/sandbox/createIntegration"; 21 22 import type * as IoPocketenvSandboxCreateSandbox from "./types/io/pocketenv/sandbox/createSandbox"; ··· 38 39 import type * as IoPocketenvSecretDeleteSecret from "./types/io/pocketenv/secret/deleteSecret"; 39 40 import type * as IoPocketenvSecretGetSecret from "./types/io/pocketenv/secret/getSecret"; 40 41 import type * as IoPocketenvSecretGetSecrets from "./types/io/pocketenv/secret/getSecrets"; 42 + import type * as IoPocketenvSecretUpdateSecret from "./types/io/pocketenv/secret/updateSecret"; 41 43 import type * as IoPocketenvVariableAddVariable from "./types/io/pocketenv/variable/addVariable"; 42 44 import type * as IoPocketenvVariableDeleteVariable from "./types/io/pocketenv/variable/deleteVariable"; 43 45 import type * as IoPocketenvVariableGetVariable from "./types/io/pocketenv/variable/getVariable"; 44 46 import type * as IoPocketenvVariableGetVariables from "./types/io/pocketenv/variable/getVariables"; 47 + import type * as IoPocketenvVariableUpdateVariable from "./types/io/pocketenv/variable/updateVariable"; 45 48 import type * as IoPocketenvVolumeAddVolume from "./types/io/pocketenv/volume/addVolume"; 46 49 import type * as IoPocketenvVolumeDeleteVolume from "./types/io/pocketenv/volume/deleteVolume"; 47 50 import type * as IoPocketenvVolumeGetVolume from "./types/io/pocketenv/volume/getVolume"; 48 51 import type * as IoPocketenvVolumeGetVolumes from "./types/io/pocketenv/volume/getVolumes"; 52 + import type * as IoPocketenvVolumeUpdateVolume from "./types/io/pocketenv/volume/updateVolume"; 49 53 50 54 export function createServer(options?: XrpcOptions): Server { 51 55 return new Server(options); ··· 184 188 >, 185 189 ) { 186 190 const nsid = "io.pocketenv.file.getFiles"; // @ts-ignore 191 + return this._server.xrpc.method(nsid, cfg); 192 + } 193 + 194 + updateFile<AV extends AuthVerifier>( 195 + cfg: ConfigOf< 196 + AV, 197 + IoPocketenvFileUpdateFile.Handler<ExtractAuth<AV>>, 198 + IoPocketenvFileUpdateFile.HandlerReqCtx<ExtractAuth<AV>> 199 + >, 200 + ) { 201 + const nsid = "io.pocketenv.file.updateFile"; // @ts-ignore 187 202 return this._server.xrpc.method(nsid, cfg); 188 203 } 189 204 } ··· 444 459 const nsid = "io.pocketenv.secret.getSecrets"; // @ts-ignore 445 460 return this._server.xrpc.method(nsid, cfg); 446 461 } 462 + 463 + updateSecret<AV extends AuthVerifier>( 464 + cfg: ConfigOf< 465 + AV, 466 + IoPocketenvSecretUpdateSecret.Handler<ExtractAuth<AV>>, 467 + IoPocketenvSecretUpdateSecret.HandlerReqCtx<ExtractAuth<AV>> 468 + >, 469 + ) { 470 + const nsid = "io.pocketenv.secret.updateSecret"; // @ts-ignore 471 + return this._server.xrpc.method(nsid, cfg); 472 + } 447 473 } 448 474 449 475 export class IoPocketenvVariableNS { ··· 496 522 const nsid = "io.pocketenv.variable.getVariables"; // @ts-ignore 497 523 return this._server.xrpc.method(nsid, cfg); 498 524 } 525 + 526 + updateVariable<AV extends AuthVerifier>( 527 + cfg: ConfigOf< 528 + AV, 529 + IoPocketenvVariableUpdateVariable.Handler<ExtractAuth<AV>>, 530 + IoPocketenvVariableUpdateVariable.HandlerReqCtx<ExtractAuth<AV>> 531 + >, 532 + ) { 533 + const nsid = "io.pocketenv.variable.updateVariable"; // @ts-ignore 534 + return this._server.xrpc.method(nsid, cfg); 535 + } 499 536 } 500 537 501 538 export class IoPocketenvVolumeNS { ··· 546 583 >, 547 584 ) { 548 585 const nsid = "io.pocketenv.volume.getVolumes"; // @ts-ignore 586 + return this._server.xrpc.method(nsid, cfg); 587 + } 588 + 589 + updateVolume<AV extends AuthVerifier>( 590 + cfg: ConfigOf< 591 + AV, 592 + IoPocketenvVolumeUpdateVolume.Handler<ExtractAuth<AV>>, 593 + IoPocketenvVolumeUpdateVolume.HandlerReqCtx<ExtractAuth<AV>> 594 + >, 595 + ) { 596 + const nsid = "io.pocketenv.volume.updateVolume"; // @ts-ignore 549 597 return this._server.xrpc.method(nsid, cfg); 550 598 } 551 599 }
+112
apps/api/src/lexicon/lexicons.ts
··· 387 387 }, 388 388 }, 389 389 }, 390 + IoPocketenvFileUpdateFile: { 391 + lexicon: 1, 392 + id: "io.pocketenv.file.updateFile", 393 + defs: { 394 + main: { 395 + type: "procedure", 396 + input: { 397 + encoding: "application/json", 398 + schema: { 399 + type: "object", 400 + required: ["id", "file"], 401 + properties: { 402 + id: { 403 + type: "string", 404 + description: "The ID of the file to delete", 405 + }, 406 + file: { 407 + type: "ref", 408 + ref: "lex:io.pocketenv.file.defs#file", 409 + }, 410 + }, 411 + }, 412 + }, 413 + }, 414 + }, 415 + }, 390 416 IoPocketenvSandboxClaimSandbox: { 391 417 lexicon: 1, 392 418 id: "io.pocketenv.sandbox.claimSandbox", ··· 1788 1814 }, 1789 1815 }, 1790 1816 }, 1817 + IoPocketenvSecretUpdateSecret: { 1818 + lexicon: 1, 1819 + id: "io.pocketenv.secret.updateSecret", 1820 + defs: { 1821 + main: { 1822 + type: "procedure", 1823 + input: { 1824 + encoding: "application/json", 1825 + schema: { 1826 + type: "object", 1827 + required: ["id", "secret"], 1828 + properties: { 1829 + id: { 1830 + type: "string", 1831 + description: "The ID of the secret to update.", 1832 + }, 1833 + secret: { 1834 + type: "ref", 1835 + ref: "lex:io.pocketenv.secret.defs#secret", 1836 + }, 1837 + redacted: { 1838 + type: "string", 1839 + description: "The redacted secret value.", 1840 + }, 1841 + }, 1842 + }, 1843 + }, 1844 + }, 1845 + }, 1846 + }, 1791 1847 IoPocketenvVariableAddVariable: { 1792 1848 lexicon: 1, 1793 1849 id: "io.pocketenv.variable.addVariable", ··· 1965 2021 }, 1966 2022 }, 1967 2023 }, 2024 + IoPocketenvVariableUpdateVariable: { 2025 + lexicon: 1, 2026 + id: "io.pocketenv.variable.updateVariable", 2027 + defs: { 2028 + main: { 2029 + type: "procedure", 2030 + input: { 2031 + encoding: "application/json", 2032 + schema: { 2033 + type: "object", 2034 + required: ["id", "variable"], 2035 + properties: { 2036 + id: { 2037 + type: "string", 2038 + description: "The ID of the variable to update.", 2039 + }, 2040 + variable: { 2041 + type: "ref", 2042 + ref: "lex:io.pocketenv.variable.defs#variable", 2043 + }, 2044 + }, 2045 + }, 2046 + }, 2047 + }, 2048 + }, 2049 + }, 1968 2050 IoPocketenvVolumeAddVolume: { 1969 2051 lexicon: 1, 1970 2052 id: "io.pocketenv.volume.addVolume", ··· 2160 2242 }, 2161 2243 }, 2162 2244 }, 2245 + IoPocketenvVolumeUpdateVolume: { 2246 + lexicon: 1, 2247 + id: "io.pocketenv.volume.updateVolume", 2248 + defs: { 2249 + main: { 2250 + type: "procedure", 2251 + input: { 2252 + encoding: "application/json", 2253 + schema: { 2254 + type: "object", 2255 + required: ["id", "volume"], 2256 + properties: { 2257 + id: { 2258 + type: "string", 2259 + description: "The ID of the volume to update.", 2260 + }, 2261 + volume: { 2262 + type: "ref", 2263 + ref: "lex:io.pocketenv.volume.defs#volume", 2264 + }, 2265 + }, 2266 + }, 2267 + }, 2268 + }, 2269 + }, 2270 + }, 2163 2271 IoPocketenvPublicKey: { 2164 2272 lexicon: 1, 2165 2273 id: "io.pocketenv.publicKey", ··· 2226 2334 IoPocketenvFileDeleteFile: "io.pocketenv.file.deleteFile", 2227 2335 IoPocketenvFileGetFile: "io.pocketenv.file.getFile", 2228 2336 IoPocketenvFileGetFiles: "io.pocketenv.file.getFiles", 2337 + IoPocketenvFileUpdateFile: "io.pocketenv.file.updateFile", 2229 2338 IoPocketenvSandboxClaimSandbox: "io.pocketenv.sandbox.claimSandbox", 2230 2339 IoPocketenvSandboxCreateIntegration: "io.pocketenv.sandbox.createIntegration", 2231 2340 IoPocketenvSandboxCreateSandbox: "io.pocketenv.sandbox.createSandbox", ··· 2254 2363 IoPocketenvSecretDeleteSecret: "io.pocketenv.secret.deleteSecret", 2255 2364 IoPocketenvSecretGetSecret: "io.pocketenv.secret.getSecret", 2256 2365 IoPocketenvSecretGetSecrets: "io.pocketenv.secret.getSecrets", 2366 + IoPocketenvSecretUpdateSecret: "io.pocketenv.secret.updateSecret", 2257 2367 IoPocketenvVariableAddVariable: "io.pocketenv.variable.addVariable", 2258 2368 IoPocketenvVariableDefs: "io.pocketenv.variable.defs", 2259 2369 IoPocketenvVariableDeleteVariable: "io.pocketenv.variable.deleteVariable", 2260 2370 IoPocketenvVariableGetVariable: "io.pocketenv.variable.getVariable", 2261 2371 IoPocketenvVariableGetVariables: "io.pocketenv.variable.getVariables", 2372 + IoPocketenvVariableUpdateVariable: "io.pocketenv.variable.updateVariable", 2262 2373 IoPocketenvVolumeAddVolume: "io.pocketenv.volume.addVolume", 2263 2374 IoPocketenvVolumeDefs: "io.pocketenv.volume.defs", 2264 2375 IoPocketenvVolumeDeleteVolume: "io.pocketenv.volume.deleteVolume", 2265 2376 IoPocketenvVolumeGetVolume: "io.pocketenv.volume.getVolume", 2266 2377 IoPocketenvVolumeGetVolumes: "io.pocketenv.volume.getVolumes", 2378 + IoPocketenvVolumeUpdateVolume: "io.pocketenv.volume.updateVolume", 2267 2379 IoPocketenvPublicKey: "io.pocketenv.publicKey", 2268 2380 ComAtprotoRepoStrongRef: "com.atproto.repo.strongRef", 2269 2381 };
+42
apps/api/src/lexicon/types/io/pocketenv/file/updateFile.ts
··· 1 + /** 2 + * GENERATED CODE - DO NOT MODIFY 3 + */ 4 + import type express from "express"; 5 + import { ValidationResult, BlobRef } from "@atproto/lexicon"; 6 + import { lexicons } from "../../../../lexicons"; 7 + import { isObj, hasProp } from "../../../../util"; 8 + import { CID } from "multiformats/cid"; 9 + import { type HandlerAuth, HandlerPipeThrough } from "@atproto/xrpc-server"; 10 + import type * as IoPocketenvFileDefs from "./defs"; 11 + 12 + export type QueryParams = {}; 13 + 14 + export interface InputSchema { 15 + /** The ID of the file to delete */ 16 + id: string; 17 + file: IoPocketenvFileDefs.File; 18 + [k: string]: unknown; 19 + } 20 + 21 + export interface HandlerInput { 22 + encoding: "application/json"; 23 + body: InputSchema; 24 + } 25 + 26 + export interface HandlerError { 27 + status: number; 28 + message?: string; 29 + } 30 + 31 + export type HandlerOutput = HandlerError | void; 32 + export type HandlerReqCtx<HA extends HandlerAuth = never> = { 33 + auth: HA; 34 + params: QueryParams; 35 + input: HandlerInput; 36 + req: express.Request; 37 + res: express.Response; 38 + resetRouteRateLimits: () => Promise<void>; 39 + }; 40 + export type Handler<HA extends HandlerAuth = never> = ( 41 + ctx: HandlerReqCtx<HA>, 42 + ) => Promise<HandlerOutput> | HandlerOutput;
+44
apps/api/src/lexicon/types/io/pocketenv/secret/updateSecret.ts
··· 1 + /** 2 + * GENERATED CODE - DO NOT MODIFY 3 + */ 4 + import type express from "express"; 5 + import { ValidationResult, BlobRef } from "@atproto/lexicon"; 6 + import { lexicons } from "../../../../lexicons"; 7 + import { isObj, hasProp } from "../../../../util"; 8 + import { CID } from "multiformats/cid"; 9 + import { type HandlerAuth, HandlerPipeThrough } from "@atproto/xrpc-server"; 10 + import type * as IoPocketenvSecretDefs from "./defs"; 11 + 12 + export type QueryParams = {}; 13 + 14 + export interface InputSchema { 15 + /** The ID of the secret to update. */ 16 + id: string; 17 + secret: IoPocketenvSecretDefs.Secret; 18 + /** The redacted secret value. */ 19 + redacted?: string; 20 + [k: string]: unknown; 21 + } 22 + 23 + export interface HandlerInput { 24 + encoding: "application/json"; 25 + body: InputSchema; 26 + } 27 + 28 + export interface HandlerError { 29 + status: number; 30 + message?: string; 31 + } 32 + 33 + export type HandlerOutput = HandlerError | void; 34 + export type HandlerReqCtx<HA extends HandlerAuth = never> = { 35 + auth: HA; 36 + params: QueryParams; 37 + input: HandlerInput; 38 + req: express.Request; 39 + res: express.Response; 40 + resetRouteRateLimits: () => Promise<void>; 41 + }; 42 + export type Handler<HA extends HandlerAuth = never> = ( 43 + ctx: HandlerReqCtx<HA>, 44 + ) => Promise<HandlerOutput> | HandlerOutput;
+42
apps/api/src/lexicon/types/io/pocketenv/variable/updateVariable.ts
··· 1 + /** 2 + * GENERATED CODE - DO NOT MODIFY 3 + */ 4 + import type express from "express"; 5 + import { ValidationResult, BlobRef } from "@atproto/lexicon"; 6 + import { lexicons } from "../../../../lexicons"; 7 + import { isObj, hasProp } from "../../../../util"; 8 + import { CID } from "multiformats/cid"; 9 + import { type HandlerAuth, HandlerPipeThrough } from "@atproto/xrpc-server"; 10 + import type * as IoPocketenvVariableDefs from "./defs"; 11 + 12 + export type QueryParams = {}; 13 + 14 + export interface InputSchema { 15 + /** The ID of the variable to update. */ 16 + id: string; 17 + variable: IoPocketenvVariableDefs.Variable; 18 + [k: string]: unknown; 19 + } 20 + 21 + export interface HandlerInput { 22 + encoding: "application/json"; 23 + body: InputSchema; 24 + } 25 + 26 + export interface HandlerError { 27 + status: number; 28 + message?: string; 29 + } 30 + 31 + export type HandlerOutput = HandlerError | void; 32 + export type HandlerReqCtx<HA extends HandlerAuth = never> = { 33 + auth: HA; 34 + params: QueryParams; 35 + input: HandlerInput; 36 + req: express.Request; 37 + res: express.Response; 38 + resetRouteRateLimits: () => Promise<void>; 39 + }; 40 + export type Handler<HA extends HandlerAuth = never> = ( 41 + ctx: HandlerReqCtx<HA>, 42 + ) => Promise<HandlerOutput> | HandlerOutput;
+42
apps/api/src/lexicon/types/io/pocketenv/volume/updateVolume.ts
··· 1 + /** 2 + * GENERATED CODE - DO NOT MODIFY 3 + */ 4 + import type express from "express"; 5 + import { ValidationResult, BlobRef } from "@atproto/lexicon"; 6 + import { lexicons } from "../../../../lexicons"; 7 + import { isObj, hasProp } from "../../../../util"; 8 + import { CID } from "multiformats/cid"; 9 + import { type HandlerAuth, HandlerPipeThrough } from "@atproto/xrpc-server"; 10 + import type * as IoPocketenvVolumeDefs from "./defs"; 11 + 12 + export type QueryParams = {}; 13 + 14 + export interface InputSchema { 15 + /** The ID of the volume to update. */ 16 + id: string; 17 + volume: IoPocketenvVolumeDefs.Volume; 18 + [k: string]: unknown; 19 + } 20 + 21 + export interface HandlerInput { 22 + encoding: "application/json"; 23 + body: InputSchema; 24 + } 25 + 26 + export interface HandlerError { 27 + status: number; 28 + message?: string; 29 + } 30 + 31 + export type HandlerOutput = HandlerError | void; 32 + export type HandlerReqCtx<HA extends HandlerAuth = never> = { 33 + auth: HA; 34 + params: QueryParams; 35 + input: HandlerInput; 36 + req: express.Request; 37 + res: express.Response; 38 + resetRouteRateLimits: () => Promise<void>; 39 + }; 40 + export type Handler<HA extends HandlerAuth = never> = ( 41 + ctx: HandlerReqCtx<HA>, 42 + ) => Promise<HandlerOutput> | HandlerOutput;
+1 -3
apps/api/src/schema/files.ts
··· 2 2 import { pgTable, text, timestamp } from "drizzle-orm/pg-core"; 3 3 4 4 const files = pgTable("files", { 5 - id: text("id") 6 - .primaryKey() 7 - .default(sql`xata_id()`), 5 + id: text("id").primaryKey().default(sql`xata_id()`), 8 6 content: text("content").notNull(), 9 7 createdAt: timestamp("created_at").defaultNow().notNull(), 10 8 updatedAt: timestamp("updated_at").defaultNow().notNull(),
+8
apps/api/src/xrpc/index.ts
··· 34 34 import getVariable from "./io/pocketenv/variable/getVariable"; 35 35 import getVolume from "./io/pocketenv/volume/getVolume"; 36 36 import deleteVariable from "./io/pocketenv/variable/deleteVariable"; 37 + import updateFile from "./io/pocketenv/file/updateFile"; 38 + import updateSecret from "./io/pocketenv/secret/updateSecret"; 39 + import updateVariable from "./io/pocketenv/variable/updateVariable"; 40 + import updateVolume from "./io/pocketenv/volume/updateVolume"; 37 41 38 42 export default function (server: Server, ctx: Context) { 39 43 // io.pocketenv ··· 74 78 deleteSecret(server, ctx); 75 79 deleteVolume(server, ctx); 76 80 deleteVariable(server, ctx); 81 + updateFile(server, ctx); 82 + updateSecret(server, ctx); 83 + updateVariable(server, ctx); 84 + updateVolume(server, ctx); 77 85 78 86 return server; 79 87 }
+39
apps/api/src/xrpc/io/pocketenv/file/updateFile.ts
··· 1 + import { XRPCError, type HandlerAuth } from "@atproto/xrpc-server"; 2 + import type { Context } from "context"; 3 + import { eq } from "drizzle-orm"; 4 + import type { Server } from "lexicon"; 5 + import type { HandlerInput } from "lexicon/types/io/pocketenv/file/updateFile"; 6 + import files from "schema/files"; 7 + import sandboxFiles from "schema/sandbox-files"; 8 + 9 + export default function (server: Server, ctx: Context) { 10 + const updateFile = async (input: HandlerInput, auth: HandlerAuth) => { 11 + if (!auth.credentials) { 12 + throw new XRPCError(401, "Unauthorized"); 13 + } 14 + 15 + await ctx.db.transaction(async (tx) => { 16 + const [file] = await tx 17 + .update(sandboxFiles) 18 + .set({ path: input.body.file.path, updatedAt: new Date() }) 19 + .where(eq(sandboxFiles.id, input.body.id)) 20 + .returning() 21 + .execute(); 22 + 23 + if (!file?.id) throw new XRPCError(404, "File not found"); 24 + 25 + await tx 26 + .update(files) 27 + .set({ content: input.body.file.content, updatedAt: new Date() }) 28 + .where(eq(files.id, file.id)) 29 + .execute(); 30 + }); 31 + return {}; 32 + }; 33 + server.io.pocketenv.file.updateFile({ 34 + auth: ctx.authVerifier, 35 + handler: async ({ input, auth }) => { 36 + await updateFile(input, auth); 37 + }, 38 + }); 39 + }
+46
apps/api/src/xrpc/io/pocketenv/secret/updateSecret.ts
··· 1 + import { XRPCError, type HandlerAuth } from "@atproto/xrpc-server"; 2 + import type { Context } from "context"; 3 + import { eq } from "drizzle-orm"; 4 + import type { Server } from "lexicon"; 5 + import type { HandlerInput } from "lexicon/types/io/pocketenv/secret/updateSecret"; 6 + import sandboxSecrets from "schema/sandbox-secrets"; 7 + import secrets from "schema/secrets"; 8 + 9 + export default function (server: Server, ctx: Context) { 10 + const updateSecret = async (input: HandlerInput, auth: HandlerAuth) => { 11 + if (!auth.credentials) { 12 + throw new XRPCError(401, "Unauthorized"); 13 + } 14 + 15 + await ctx.db.transaction(async (tx) => { 16 + const [secret] = await tx 17 + .update(secrets) 18 + .set({ 19 + name: input.body.secret.name, 20 + value: input.body.secret.value, 21 + redacted: input.body.redacted, 22 + }) 23 + .where(eq(secrets.id, input.body.id)) 24 + .returning() 25 + .execute(); 26 + 27 + if (!secret) { 28 + throw new XRPCError(404, "Secret not found"); 29 + } 30 + 31 + await tx 32 + .update(sandboxSecrets) 33 + .set({ name: input.body.secret.name, updatedAt: new Date() }) 34 + .where(eq(sandboxSecrets.secretId, secret.id)) 35 + .execute(); 36 + }); 37 + 38 + return {}; 39 + }; 40 + server.io.pocketenv.secret.updateSecret({ 41 + auth: ctx.authVerifier, 42 + handler: async ({ input, auth }) => { 43 + await updateSecret(input, auth); 44 + }, 45 + }); 46 + }
+46
apps/api/src/xrpc/io/pocketenv/variable/updateVariable.ts
··· 1 + import { XRPCError, type HandlerAuth } from "@atproto/xrpc-server"; 2 + import type { Context } from "context"; 3 + import { eq } from "drizzle-orm"; 4 + import type { Server } from "lexicon"; 5 + import type { HandlerInput } from "lexicon/types/io/pocketenv/variable/updateVariable"; 6 + import sandboxVariables from "schema/sandbox-variables"; 7 + import variables from "schema/variables"; 8 + 9 + export default function (server: Server, ctx: Context) { 10 + const updateVariable = async (input: HandlerInput, auth: HandlerAuth) => { 11 + if (!auth.credentials) { 12 + throw new XRPCError(401, "Unauthorized"); 13 + } 14 + 15 + await ctx.db.transaction(async (tx) => { 16 + const [variable] = await tx 17 + .update(variables) 18 + .set({ 19 + name: input.body.variable.name, 20 + value: input.body.variable.value, 21 + updatedAt: new Date(), 22 + }) 23 + .where(eq(variables.id, input.body.id)) 24 + .returning() 25 + .execute(); 26 + 27 + if (!variable) { 28 + throw new XRPCError(404, "Variable not found"); 29 + } 30 + 31 + await tx 32 + .update(sandboxVariables) 33 + .set({ name: input.body.variable.name, updatedAt: new Date() }) 34 + .where(eq(sandboxVariables.variableId, variable.id)) 35 + .execute(); 36 + }); 37 + 38 + return {}; 39 + }; 40 + server.io.pocketenv.variable.updateVariable({ 41 + auth: ctx.authVerifier, 42 + handler: async ({ input, auth }) => { 43 + await updateVariable(input, auth); 44 + }, 45 + }); 46 + }
+65
apps/api/src/xrpc/io/pocketenv/volume/updateVolume.ts
··· 1 + import { XRPCError, type HandlerAuth } from "@atproto/xrpc-server"; 2 + import type { Context } from "context"; 3 + import { and, eq } from "drizzle-orm"; 4 + import type { Server } from "lexicon"; 5 + import type { HandlerInput } from "lexicon/types/io/pocketenv/volume/updateVolume"; 6 + import sandboxVolumes from "schema/sandbox-volumes"; 7 + import sandboxes from "schema/sandboxes"; 8 + import users from "schema/users"; 9 + 10 + export default function (server: Server, ctx: Context) { 11 + const updateVolume = async (input: HandlerInput, auth: HandlerAuth) => { 12 + if (!auth?.credentials?.did) { 13 + throw new XRPCError(401, "Unauthorized"); 14 + } 15 + 16 + const { id, volume } = input.body; 17 + 18 + await ctx.db.transaction(async (tx) => { 19 + const [existing] = await tx 20 + .select({ id: sandboxVolumes.id }) 21 + .from(sandboxVolumes) 22 + .leftJoin(sandboxes, eq(sandboxes.id, sandboxVolumes.sandboxId)) 23 + .leftJoin(users, eq(users.id, sandboxes.userId)) 24 + .where( 25 + and(eq(sandboxVolumes.id, id), eq(users.did, auth.credentials.did)), 26 + ) 27 + .execute(); 28 + 29 + if (!existing) { 30 + throw new XRPCError(404, "Volume not found"); 31 + } 32 + 33 + const updates: Partial<{ 34 + name: string | null; 35 + path: string; 36 + updatedAt: Date; 37 + }> = { 38 + updatedAt: new Date(), 39 + }; 40 + 41 + if (volume.name !== undefined) { 42 + updates.name = volume.name; 43 + } 44 + 45 + if (volume.path !== undefined) { 46 + updates.path = volume.path; 47 + } 48 + 49 + await tx 50 + .update(sandboxVolumes) 51 + .set(updates) 52 + .where(eq(sandboxVolumes.id, id)) 53 + .execute(); 54 + }); 55 + 56 + return {}; 57 + }; 58 + 59 + server.io.pocketenv.volume.updateVolume({ 60 + auth: ctx.authVerifier, 61 + handler: async ({ input, auth }) => { 62 + await updateVolume(input, auth); 63 + }, 64 + }); 65 + }
+17
apps/web/src/api/file.ts
··· 49 49 Authorization: `Bearer ${localStorage.getItem("token")}`, 50 50 }, 51 51 }); 52 + 53 + export const updateFile = (id: string, path: string, content: string) => 54 + client.post( 55 + "/xrpc/io.pocketenv.file.updateFile", 56 + { 57 + id, 58 + file: { 59 + path, 60 + content, 61 + }, 62 + }, 63 + { 64 + headers: { 65 + Authorization: `Bearer ${localStorage.getItem("token")}`, 66 + }, 67 + }, 68 + );
+17
apps/web/src/api/secret.ts
··· 51 51 Authorization: `Bearer ${localStorage.getItem("token")}`, 52 52 }, 53 53 }); 54 + 55 + export const updateSecret = (id: string, name: string, value: string) => 56 + client.post( 57 + "/xrpc/io.pocketenv.secret.updateSecret", 58 + { 59 + id, 60 + secret: { 61 + name, 62 + value, 63 + }, 64 + }, 65 + { 66 + headers: { 67 + Authorization: `Bearer ${localStorage.getItem("token")}`, 68 + }, 69 + }, 70 + );
+17
apps/web/src/api/variable.ts
··· 59 59 }, 60 60 }, 61 61 ); 62 + 63 + export const updateVariable = (id: string, name: string, value: string) => 64 + client.post( 65 + "/xrpc/io.pocketenv.variable.updateVariable", 66 + { 67 + id, 68 + variable: { 69 + name, 70 + value, 71 + }, 72 + }, 73 + { 74 + headers: { 75 + Authorization: `Bearer ${localStorage.getItem("token")}`, 76 + }, 77 + }, 78 + );
+17
apps/web/src/api/volume.ts
··· 56 56 Authorization: `Bearer ${localStorage.getItem("token")}`, 57 57 }, 58 58 }); 59 + 60 + export const updateVolume = (id: string, name: string, path: string) => 61 + client.post( 62 + "/xrpc/io.pocketenv.volume.updateVolume", 63 + { 64 + id, 65 + volume: { 66 + name, 67 + path, 68 + }, 69 + }, 70 + { 71 + headers: { 72 + Authorization: `Bearer ${localStorage.getItem("token")}`, 73 + }, 74 + }, 75 + );
+21 -1
apps/web/src/components/contextmenu/AddFileModal/AddFileModal.tsx
··· 3 3 import { useForm } from "react-hook-form"; 4 4 import { z } from "zod"; 5 5 import { zodResolver } from "@hookform/resolvers/zod"; 6 - import { useAddFileMutation, useFileQuery } from "../../../hooks/useFile"; 6 + import { 7 + useAddFileMutation, 8 + useFileQuery, 9 + useUpdateFileMutation, 10 + } from "../../../hooks/useFile"; 7 11 import { useSodium } from "../../../hooks/useSodium"; 8 12 import { PUBLIC_KEY } from "../../../consts"; 9 13 import { useNotyf } from "../../../hooks/useNotyf"; ··· 33 37 const [isLoading, setIsLoading] = useState(false); 34 38 const { mutateAsync: addFile } = useAddFileMutation(); 35 39 const { data } = useFileQuery(fileId!); 40 + const { mutateAsync: updateFile } = useUpdateFileMutation(); 36 41 const { 37 42 register, 38 43 handleSubmit, ··· 87 92 sodium.fromHex(PUBLIC_KEY), 88 93 ); 89 94 try { 95 + if (fileId) { 96 + await updateFile({ 97 + id: fileId, 98 + path: data.path, 99 + content: sodium.toBase64( 100 + sealed, 101 + sodium.base64Variants.URLSAFE_NO_PADDING, 102 + ), 103 + }); 104 + setIsLoading(false); 105 + reset(); 106 + onClose(); 107 + notyf.open("primary", "File updated successfully!"); 108 + return; 109 + } 90 110 await addFile({ 91 111 sandboxId, 92 112 path: data.path,
+22 -1
apps/web/src/components/contextmenu/AddSecretModal/AddSecretModal.tsx
··· 3 3 import { useForm } from "react-hook-form"; 4 4 import { z } from "zod"; 5 5 import { zodResolver } from "@hookform/resolvers/zod"; 6 - import { useAddSecretMutation, useSecretQuery } from "../../../hooks/useSecret"; 6 + import { 7 + useAddSecretMutation, 8 + useSecretQuery, 9 + useUpdateSecretMutation, 10 + } from "../../../hooks/useSecret"; 7 11 import { useSodium } from "../../../hooks/useSodium"; 8 12 import { PUBLIC_KEY } from "../../../consts"; 9 13 import { useNotyf } from "../../../hooks/useNotyf"; ··· 40 44 const notyf = useNotyf(); 41 45 const [isLoading, setIsLoading] = useState(false); 42 46 const { mutateAsync: addSecret } = useAddSecretMutation(); 47 + const { mutateAsync: updateSecret } = useUpdateSecretMutation(); 43 48 const { data } = useSecretQuery(secretId!); 44 49 const { 45 50 register, ··· 104 109 sodium.fromHex(PUBLIC_KEY), 105 110 ); 106 111 try { 112 + if (secretId) { 113 + await updateSecret({ 114 + id: secretId, 115 + name: data.name, 116 + value: sodium.toBase64( 117 + sealed, 118 + sodium.base64Variants.URLSAFE_NO_PADDING, 119 + ), 120 + }); 121 + setIsLoading(false); 122 + reset(); 123 + onClose(); 124 + notyf.open("primary", "Secret updated successfully!"); 125 + return; 126 + } 107 127 await addSecret({ 108 128 sandboxId, 109 129 name: data.name, ··· 112 132 sodium.base64Variants.URLSAFE_NO_PADDING, 113 133 ), 114 134 }); 135 + 115 136 setIsLoading(false); 116 137 reset(); 117 138 onClose();
+14
apps/web/src/components/contextmenu/AddVariableModal/AddVariableModal.tsx
··· 5 5 import { zodResolver } from "@hookform/resolvers/zod"; 6 6 import { 7 7 useAddVariableMutation, 8 + useUpdateVariableMutation, 8 9 useVariableQuery, 9 10 } from "../../../hooks/useVariable"; 10 11 import { useNotyf } from "../../../hooks/useNotyf"; ··· 40 41 const [isLoading, setIsLoading] = useState(false); 41 42 const notyf = useNotyf(); 42 43 const { mutateAsync: addVariable } = useAddVariableMutation(); 44 + const { mutateAsync: updateVariable } = useUpdateVariableMutation(); 43 45 const { data } = useVariableQuery(variableId!); 44 46 45 47 const { ··· 101 103 const onSubmit = async (data: FormValues) => { 102 104 setIsLoading(true); 103 105 try { 106 + if (variableId) { 107 + await updateVariable({ 108 + id: variableId, 109 + name: data.name, 110 + value: data.value, 111 + }); 112 + setIsLoading(false); 113 + reset(); 114 + onClose(); 115 + notyf.open("primary", "Variable updated successfully!"); 116 + return; 117 + } 104 118 await addVariable({ 105 119 sandboxId, 106 120 name: data.name,
+18 -1
apps/web/src/components/contextmenu/AddVolumeModal/AddVolumeModal.tsx
··· 3 3 import { useForm } from "react-hook-form"; 4 4 import { z } from "zod"; 5 5 import { zodResolver } from "@hookform/resolvers/zod"; 6 - import { useAddVolumeMutation, useVolumeQuery } from "../../../hooks/useVolume"; 6 + import { 7 + useAddVolumeMutation, 8 + useUpdateVolumeMutation, 9 + useVolumeQuery, 10 + } from "../../../hooks/useVolume"; 7 11 import { useNotyf } from "../../../hooks/useNotyf"; 8 12 9 13 const schema = z.object({ ··· 29 33 const notyf = useNotyf(); 30 34 const [isLoading, setIsLoading] = useState(false); 31 35 const { mutateAsync: addVolume } = useAddVolumeMutation(); 36 + const { mutateAsync: updateVolume } = useUpdateVolumeMutation(); 32 37 const { data } = useVolumeQuery(volumeId!); 33 38 const { 34 39 register, ··· 82 87 const onSubmit = async (data: FormValues) => { 83 88 setIsLoading(true); 84 89 try { 90 + if (volumeId) { 91 + await updateVolume({ 92 + id: volumeId, 93 + name: data.name, 94 + path: data.path, 95 + }); 96 + setIsLoading(false); 97 + reset(); 98 + onClose(); 99 + notyf.open("primary", "Volume updated successfully!"); 100 + return; 101 + } 85 102 await addVolume({ 86 103 sandboxId, 87 104 name: data.name,
+26 -1
apps/web/src/hooks/useFile.ts
··· 1 1 import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; 2 - import { addFile, deleteFile, getFile, getFiles } from "../api/file"; 2 + import { 3 + addFile, 4 + deleteFile, 5 + getFile, 6 + getFiles, 7 + updateFile, 8 + } from "../api/file"; 3 9 4 10 export const useAddFileMutation = () => { 5 11 const queryClient = useQueryClient(); ··· 49 55 select: (response) => response.data, 50 56 enabled: !!id, 51 57 }); 58 + 59 + export const useUpdateFileMutation = () => { 60 + const queryClient = useQueryClient(); 61 + return useMutation({ 62 + mutationKey: ["updateFile"], 63 + mutationFn: async ({ 64 + id, 65 + path, 66 + content, 67 + }: { 68 + id: string; 69 + path: string; 70 + content: string; 71 + }) => updateFile(id, path, content), 72 + onSuccess: () => { 73 + queryClient.invalidateQueries({ queryKey: ["files"] }); 74 + }, 75 + }); 76 + };
+26 -1
apps/web/src/hooks/useSecret.ts
··· 1 1 import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; 2 - import { addSecret, deleteSecret, getSecret, getSecrets } from "../api/secret"; 2 + import { 3 + addSecret, 4 + deleteSecret, 5 + getSecret, 6 + getSecrets, 7 + updateSecret, 8 + } from "../api/secret"; 3 9 4 10 export const useAddSecretMutation = () => { 5 11 const queryClient = useQueryClient(); ··· 49 55 select: (response) => response.data, 50 56 enabled: !!id, 51 57 }); 58 + 59 + export const useUpdateSecretMutation = () => { 60 + const queryClient = useQueryClient(); 61 + return useMutation({ 62 + mutationKey: ["updateSecret"], 63 + mutationFn: async ({ 64 + id, 65 + name, 66 + value, 67 + }: { 68 + id: string; 69 + name: string; 70 + value: string; 71 + }) => updateSecret(id, name, value), 72 + onSuccess: () => { 73 + queryClient.invalidateQueries({ queryKey: ["secrets"] }); 74 + }, 75 + }); 76 + };
+20
apps/web/src/hooks/useVariable.ts
··· 4 4 deleteVariable, 5 5 getVariable, 6 6 getVariables, 7 + updateVariable, 7 8 } from "../api/variable"; 8 9 9 10 export const useAddVariableMutation = () => { ··· 54 55 select: (response) => response.data, 55 56 enabled: !!id, 56 57 }); 58 + 59 + export const useUpdateVariableMutation = () => { 60 + const queryClient = useQueryClient(); 61 + return useMutation({ 62 + mutationKey: ["updateVariable"], 63 + mutationFn: async ({ 64 + id, 65 + name, 66 + value, 67 + }: { 68 + id: string; 69 + name: string; 70 + value: string; 71 + }) => updateVariable(id, name, value), 72 + onSuccess: () => { 73 + queryClient.invalidateQueries({ queryKey: ["variables"] }); 74 + }, 75 + }); 76 + };
+25 -1
apps/web/src/hooks/useVolume.ts
··· 1 1 import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; 2 - import { addVolume, deleteVolume, getVolume, getVolumes } from "../api/volume"; 2 + import { 3 + addVolume, 4 + deleteVolume, 5 + getVolume, 6 + getVolumes, 7 + updateVolume, 8 + } from "../api/volume"; 3 9 4 10 export const useAddVolumeMutation = () => { 5 11 const queryClient = useQueryClient(); ··· 47 53 select: (response) => response.data, 48 54 enabled: !!id, 49 55 }); 56 + 57 + export const useUpdateVolumeMutation = () => { 58 + const queryClient = useQueryClient(); 59 + return useMutation({ 60 + mutationFn: async ({ 61 + id, 62 + name, 63 + path, 64 + }: { 65 + id: string; 66 + name: string; 67 + path: string; 68 + }) => updateVolume(id, name, path), 69 + onSuccess: () => { 70 + queryClient.invalidateQueries({ queryKey: ["volumes"] }); 71 + }, 72 + }); 73 + };