{"_id":"@calculator-5329/cloud-proxy","_rev":"3-724bd1d18daa12fb4db35a107fb566fb","name":"@calculator-5329/cloud-proxy","dist-tags":{"latest":"0.3.1"},"versions":{"0.1.0":{"name":"@calculator-5329/cloud-proxy","version":"0.1.0","license":"MIT","_id":"@calculator-5329/cloud-proxy@0.1.0","maintainers":[{"name":"calculator5329","email":"et2boys@hotmail.com"}],"dist":{"shasum":"4eb4013ab69d2d83dc168ff47054c801f15fd73a","tarball":"https://registry.npmjs.org/@calculator-5329/cloud-proxy/-/cloud-proxy-0.1.0.tgz","fileCount":46,"integrity":"sha512-uUKirKGFfakmKA3ItC1hAg/Jm9Hmzse3O2B/AA+R1rUbt8KIm1sRr4o5SSW9WuuEFmn4Q5E4CthoWOA90ur+zw==","signatures":[{"sig":"MEUCIC/3S3Vvyk4eQKx7+day0+T9EVtVNAdE/FjscBxdOAtcAiEAvqNB2O09OkWK+e2vSzFJuTr1/Am4v+B/6JAR9Y6ooJQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":96246},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run --dir tests","build":"tsc","test:watch":"vitest --dir tests","prepublishOnly":"npm run build"},"_npmUser":{"name":"calculator5329","email":"et2boys@hotmail.com"},"_npmVersion":"11.4.2","description":"TypeScript client SDK for the Cloud Run proxy server. Zero runtime dependencies, fully typed, ESM-only.","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^4.0.18","typescript":"^5.9"},"_npmOperationalInternal":{"tmp":"tmp/cloud-proxy_0.1.0_1772397424279_0.5044110890160622","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@calculator-5329/cloud-proxy","version":"0.3.0","license":"MIT","_id":"@calculator-5329/cloud-proxy@0.3.0","maintainers":[{"name":"calculator5329","email":"et2boys@hotmail.com"}],"dist":{"shasum":"45d6d3bb6dc0bcf7095aeeb9127f3a6ff953455b","tarball":"https://registry.npmjs.org/@calculator-5329/cloud-proxy/-/cloud-proxy-0.3.0.tgz","fileCount":50,"integrity":"sha512-0L3w/fkwh7pMwiFofmZOcM574Ooc+cQ7wB1SSpY4F33X0MEjFcuKObSGJbWVhU9337QdtO75uhdp3jsUMvvFZg==","signatures":[{"sig":"MEUCIH+agLnP5pkntWwQgJwwiyVxTCFbf6jEGETrJ7KvCXbQAiEAriCeTyvdsMzYwNXFHrb56esz0p8rn9wPS9oCOgrkzqU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":102388},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run --dir tests","build":"tsc","test:watch":"vitest --dir tests","prepublishOnly":"npm run build"},"_npmUser":{"name":"calculator5329","email":"et2boys@hotmail.com"},"_npmVersion":"11.4.2","description":"TypeScript client SDK for the Cloud Run proxy server. Zero runtime dependencies, fully typed, ESM-only.","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^4.0.18","typescript":"^5.9"},"_npmOperationalInternal":{"tmp":"tmp/cloud-proxy_0.3.0_1772926896823_0.5293420503521109","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@calculator-5329/cloud-proxy","version":"0.3.1","description":"TypeScript client SDK for the Cloud Run proxy server","type":"module","main":"dist/index.js","types":"dist/index.d.ts","sideEffects":false,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"publishConfig":{"access":"public"},"scripts":{"build":"tsc","prepublishOnly":"npm run build","test":"vitest run --dir tests","test:e2e":"vitest run --dir tests/e2e","test:e2e:watch":"vitest --dir tests/e2e","test:all":"vitest run --dir tests","test:watch":"vitest --dir tests"},"devDependencies":{"tsx":"^4.21.0","typescript":"^5.9","vitest":"^4.0.18"},"engines":{"node":">=18.0.0"},"keywords":["cloud-run","sdk","typescript","firebase","firestore","gcs","openai","anthropic","gemini"],"license":"MIT","_id":"@calculator-5329/cloud-proxy@0.3.1","_nodeVersion":"22.14.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-uoKURGAtA6OyS0DpKDRC23l5r+duC2XR+frew6HT87qYrBtdUcVKCsaKjr0YtAxt+7FG+pAQ+RYUcWc9ngEy9w==","shasum":"98b876706ffe1af0ddd42ac887a615ad02642916","tarball":"https://registry.npmjs.org/@calculator-5329/cloud-proxy/-/cloud-proxy-0.3.1.tgz","fileCount":50,"unpackedSize":103136,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBLijP14A2yA4LiklusFy+Tsq+51BIm51GVm0OIPQarqAiBpNVP0QfPzt8rvIXqium7otwDB9yZcTUbJ1RepVttyEg=="}]},"_npmUser":{"name":"calculator5329","email":"et2boys@hotmail.com"},"directories":{},"maintainers":[{"name":"calculator5329","email":"et2boys@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cloud-proxy_0.3.1_1772942690350_0.4291006786277167"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-01T20:37:04.155Z","modified":"2026-03-08T04:04:50.640Z","0.1.0":"2026-03-01T20:37:04.437Z","0.3.0":"2026-03-07T23:41:36.958Z","0.3.1":"2026-03-08T04:04:50.501Z"},"license":"MIT","description":"TypeScript client SDK for the Cloud Run proxy server","maintainers":[{"name":"calculator5329","email":"et2boys@hotmail.com"}],"readme":"# @calculator-5329/cloud-proxy\r\n\r\nTypeScript client SDK for the Cloud Run proxy server. Zero runtime dependencies, fully typed, ESM-only.\r\n\r\n## Install\r\n\r\n```bash\r\nnpm install @calculator-5329/cloud-proxy\r\n```\r\n\r\n**Requirements:** Node 18+ (uses global `fetch`)\r\n\r\n## Quick Start\r\n\r\n```typescript\r\nimport { createClient } from \"@calculator-5329/cloud-proxy\";\r\n\r\nconst proxy = createClient({\r\n  baseUrl: process.env.PROXY_URL!,\r\n  token: process.env.PROXY_TOKEN!,\r\n});\r\n\r\n// Health check\r\nconst { status } = await proxy.health();\r\n```\r\n\r\nSet two environment variables and you're done:\r\n\r\n```env\r\nPROXY_URL=https://your-service-xyz.run.app\r\nPROXY_TOKEN=your-static-bearer-token\r\n```\r\n\r\n## Modules\r\n\r\nEvery module is accessible as a property on the client object. Modules are lazily instantiated on first access.\r\n\r\n| Module | Accessor | Description |\r\n|--------|----------|-------------|\r\n| AI | `proxy.ai` | OpenAI, Anthropic, Gemini, OpenRouter passthrough |\r\n| Auth | `proxy.auth` | Firebase Auth user management |\r\n| Firestore | `proxy.firestore` | Firestore CRUD, queries, batch, aggregates |\r\n| Storage | `proxy.storage` | GCS upload, download, signed URLs, buckets |\r\n| Vectors | `proxy.vectors` | Vector search + Gemini embeddings |\r\n| Setup | `proxy.setup` | Provisioning + project bootstrap |\r\n| Agent | `proxy.agent` | Wikipedia lookup, Brave Search, event enrichment |\r\n\r\n---\r\n\r\n## AI\r\n\r\n```typescript\r\n// Direct provider passthrough\r\nconst response = await proxy.ai.openai(\"/v1/chat/completions\", {\r\n  model: \"gpt-4o\",\r\n  messages: [{ role: \"user\", content: \"Hello\" }],\r\n});\r\n\r\n// Convenience chat — normalized response across all providers\r\nconst reply = await proxy.ai.chat({\r\n  provider: \"anthropic\",\r\n  model: \"claude-sonnet-4-20250514\",\r\n  messages: [{ role: \"user\", content: \"Explain quantum computing\" }],\r\n  maxTokens: 1024,\r\n});\r\nconsole.log(reply.content);\r\n\r\n// Streaming\r\nconst stream = await proxy.ai.chatStream({\r\n  provider: \"openai\",\r\n  model: \"gpt-4o\",\r\n  messages: [{ role: \"user\", content: \"Write a poem\" }],\r\n});\r\nfor await (const chunk of stream) {\r\n  process.stdout.write(new TextDecoder().decode(chunk));\r\n}\r\n```\r\n\r\n## Auth\r\n\r\n```typescript\r\nconst user = await proxy.auth.createUser({\r\n  email: \"alice@example.com\",\r\n  password: \"securepassword\",\r\n  displayName: \"Alice\",\r\n});\r\n\r\nawait proxy.auth.setClaims(user.uid, { admin: true });\r\n\r\nconst users = await proxy.auth.listUsers({ limit: 50 });\r\n\r\n// Email links\r\nconst { link } = await proxy.auth.generatePasswordResetLink(\"alice@example.com\");\r\n\r\n// Session cookies\r\nconst { cookie } = await proxy.auth.createSessionCookie(idToken, 7 * 24 * 60 * 60 * 1000);\r\nconst decoded = await proxy.auth.verifySessionCookie(cookie, true);\r\n```\r\n\r\n`setClaims()` and `createSessionCookie()` now send the request shape expected by the proxy service.\r\n\r\n## Firestore\r\n\r\n```typescript\r\n// CRUD\r\nconst post = await proxy.firestore.create(\"posts\", { title: \"Hello\", body: \"World\" });\r\nconst doc = await proxy.firestore.get<{ title: string }>(\"posts/abc123\");\r\nawait proxy.firestore.update(\"posts/abc123\", { title: \"Updated\" });\r\nawait proxy.firestore.delete(\"posts/abc123\");\r\n\r\n// Query\r\nconst published = await proxy.firestore.query(\"posts\", {\r\n  filters: [{ field: \"status\", op: \"==\", value: \"published\" }],\r\n  orderBy: [{ field: \"createdAt\", direction: \"desc\" }],\r\n  limit: 50,\r\n});\r\n\r\n// Subcollections\r\nconst comments = await proxy.firestore.list(\"posts/abc123/comments\");\r\n// Or scoped:\r\nconst scoped = proxy.firestore.sub(\"posts/abc123\");\r\nawait scoped.list(\"comments\");\r\n\r\n// Atomic field operations\r\nimport { FieldOp } from \"@calculator-5329/cloud-proxy\";\r\n\r\nawait proxy.firestore.patch(\"posts/abc123\", {\r\n  views: FieldOp.increment(1),\r\n  tags: FieldOp.arrayUnion(\"featured\"),\r\n});\r\n\r\n// Batch\r\nawait proxy.firestore.batch([\r\n  { type: \"create\", collection: \"posts\", data: { title: \"A\" } },\r\n  { type: \"delete\", collection: \"posts\", docId: \"old\" },\r\n]);\r\n\r\n// Aggregates\r\nconst stats = await proxy.firestore.aggregate(\"orders\", {\r\n  aggregations: [\r\n    { type: \"count\", alias: \"total\" },\r\n    { type: \"sum\", field: \"amount\", alias: \"revenue\" },\r\n  ],\r\n  filters: [{ field: \"status\", op: \"==\", value: \"completed\" }],\r\n});\r\n\r\n// Collection group queries\r\nconst allComments = await proxy.firestore.query(\"comments\", {\r\n  collectionGroup: true,\r\n  filters: [{ field: \"flagged\", op: \"==\", value: true }],\r\n});\r\n```\r\n\r\n## Storage\r\n\r\n```typescript\r\n// Direct upload\r\nconst result = await proxy.storage.upload(\"my-bucket\", file, {\r\n  path: \"avatars\",\r\n  public: true,\r\n});\r\n\r\n// Signed URL upload (large files)\r\nconst { uploadUrl } = await proxy.storage.getUploadUrl(\"my-bucket\", {\r\n  filename: \"video.mp4\",\r\n  contentType: \"video/mp4\",\r\n  expiresInMinutes: 30,\r\n});\r\n\r\n// Download\r\nconst { downloadUrl } = await proxy.storage.getDownloadUrl(\"my-bucket\", \"photo.jpg\", 120);\r\nconst response = await proxy.storage.download(\"my-bucket\", \"report.pdf\");\r\n\r\n// List & delete\r\nconst files = await proxy.storage.listFiles(\"my-bucket\", { prefix: \"avatars/\" });\r\nawait proxy.storage.deleteFile(\"my-bucket\", \"old-file.txt\");\r\n\r\n// Bucket management\r\nawait proxy.storage.createBucket({ name: \"new-bucket\", location: \"US\" });\r\nconst { buckets } = await proxy.storage.listBuckets();\r\n```\r\n\r\n## Vectors\r\n\r\n```typescript\r\n// Embed and store\r\nconst doc = await proxy.vectors.embed(\"articles\", \"Quantum computing uses qubits...\", {\r\n  data: { title: \"Intro to Quantum\", category: \"science\" },\r\n});\r\n\r\n// Batch embed\r\nawait proxy.vectors.embedBatch(\"articles\", [\r\n  { text: \"First article...\", data: { title: \"AI\" } },\r\n  { text: \"Second article...\", data: { title: \"ML\" } },\r\n]);\r\n\r\n// Semantic search\r\nconst hits = await proxy.vectors.semanticSearch(\"articles\", \"quantum physics basics\", {\r\n  topK: 5,\r\n  filters: [{ field: \"category\", op: \"==\", value: \"science\" }],\r\n});\r\n\r\n// Update & delete\r\nawait proxy.vectors.update(\"articles\", doc.id, { text: \"Updated content...\" });\r\nawait proxy.vectors.delete(\"articles\", doc.id);\r\n```\r\n\r\n`store()` now sends `{ data, embedding, docId? }`, matching the server contract.\r\n\r\n## Setup\r\n\r\n```typescript\r\n// Bootstrap an entire project\r\nconst status = await proxy.setup.bootstrapProject({\r\n  projectName: \"my-app\",\r\n  firestore: {\r\n    collections: [\r\n      { name: \"users\" },\r\n      { name: \"documents\", vectorIndex: true },\r\n    ],\r\n  },\r\n  storage: { bucketName: \"my-app-assets\", public: true },\r\n  auth: { enableEmailPassword: true },\r\n});\r\n\r\n// Check status\r\nconst current = await proxy.setup.getStatus();\r\n```\r\n\r\n## Error Handling\r\n\r\nAll errors are thrown as `ProxyError` with `code`, `status`, and `details`:\r\n\r\n```typescript\r\nimport { ProxyError } from \"@calculator-5329/cloud-proxy\";\r\n\r\ntry {\r\n  await proxy.firestore.get(\"posts/nonexistent\");\r\n} catch (err) {\r\n  if (err instanceof ProxyError && err.code === \"FIRESTORE_NOT_FOUND\") {\r\n    // handle 404\r\n  }\r\n}\r\n```\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md","keywords":["cloud-run","sdk","typescript","firebase","firestore","gcs","openai","anthropic","gemini"]}