{"_id":"@adriftgentleman/sanctuary-edge-sdk","_rev":"6-5640b4e4273b81bcaa15a3a9acd7fbdb","name":"@adriftgentleman/sanctuary-edge-sdk","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.0":{"name":"@adriftgentleman/sanctuary-edge-sdk","version":"1.0.0","author":{"name":"Adrift Dev Team"},"license":"unlicense","_id":"@adriftgentleman/sanctuary-edge-sdk@1.0.0","maintainers":[{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"}],"dist":{"shasum":"ebad9093c847884e1de58bd8c1b10da796489259","tarball":"https://registry.npmjs.org/@adriftgentleman/sanctuary-edge-sdk/-/sanctuary-edge-sdk-1.0.0.tgz","fileCount":18,"integrity":"sha512-SON4xAthwutZsrM8IK1HAAGMoYEFR65Xbu0A3dupU2xRYO82jB2BfnlIlR563rsBWrREaRuAYJgJ+AR53bEXcA==","signatures":[{"sig":"MEQCICTPpkiW4Tl/z0jFxjkXA18PDsiTDn/SfWOV1Kjm6WsCAiA/x4i49LZ7VJ+nuiPtyL/iU0PEwU/VnS4XW4e3eHUtjA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31187},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./ServiceWorker":{"types":"./dist/ServiceWorker.d.ts","import":"./dist/ServiceWorker.mjs","require":"./dist/ServiceWorker.js"}},"scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"},"_npmVersion":"11.6.2","description":"Sanctuary Edge SDK with auto-failover and offline support","directories":{},"_nodeVersion":"24.13.0","dependencies":{"solid-js":"^1.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sanctuary-edge-sdk_1.0.0_1773084697261_0.28760852020395644","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@adriftgentleman/sanctuary-edge-sdk","version":"1.0.1","author":{"name":"Adrift Dev Team"},"license":"unlicense","_id":"@adriftgentleman/sanctuary-edge-sdk@1.0.1","maintainers":[{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"}],"dist":{"shasum":"8d343a05a65d60059b9b37e64ad1ca5ca5753e01","tarball":"https://registry.npmjs.org/@adriftgentleman/sanctuary-edge-sdk/-/sanctuary-edge-sdk-1.0.1.tgz","fileCount":18,"integrity":"sha512-tcxCcAUn/BHruVTp6/7EH1Gb8BzNPZJ6JE2kK6yxn+tZHJmEQh2/W8+SSEmYWCT2/LmS+MFjj47/fxXOBruTZw==","signatures":[{"sig":"MEUCIHLoGOLpLMDEeZjkCeYvqu0Ryb5bvn8YHmnkOPgR8diIAiEAiKtqGGkdv0ZPeeWBP3/b0PVI4xY8okoWYJNib3/Cgq0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31370},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./ServiceWorker":{"types":"./dist/ServiceWorker.d.ts","import":"./dist/ServiceWorker.mjs","require":"./dist/ServiceWorker.js"}},"scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"},"_npmVersion":"11.6.2","description":"Sanctuary Edge SDK with auto-failover and offline support","directories":{},"_nodeVersion":"24.13.0","dependencies":{"solid-js":"^1.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sanctuary-edge-sdk_1.0.1_1773085599095_0.36117876582614583","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@adriftgentleman/sanctuary-edge-sdk","version":"1.0.2","author":{"name":"Adrift Dev Team"},"license":"unlicense","_id":"@adriftgentleman/sanctuary-edge-sdk@1.0.2","maintainers":[{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"}],"dist":{"shasum":"13fc635e4759a0be6ba560d2b50de3154b12c36f","tarball":"https://registry.npmjs.org/@adriftgentleman/sanctuary-edge-sdk/-/sanctuary-edge-sdk-1.0.2.tgz","fileCount":18,"integrity":"sha512-3XRKuPuC5dz3uvgwn+Hp/HcFOJnSXetFPaqJXRRfeJC4t0ZpJwMmjow5nb+4fOtg+Cwlg0Jx7bsy8Mnsf+itbQ==","signatures":[{"sig":"MEUCIBKSuq6Hfj0zoVHNUYEFCSlalhi7OAm92ruA/+hytdmKAiEAxI2maTOEUm+BZiDrbZaTmRUdxpLel/uFo+qRYLgRFWc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31370},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./ServiceWorker":{"types":"./dist/ServiceWorker.d.ts","import":"./dist/ServiceWorker.mjs","require":"./dist/ServiceWorker.js"}},"scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"},"_npmVersion":"11.6.2","description":"Sanctuary Edge SDK with auto-failover and offline support","directories":{},"_nodeVersion":"24.13.0","dependencies":{"solid-js":"^1.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sanctuary-edge-sdk_1.0.2_1773085956314_0.6575941647387966","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@adriftgentleman/sanctuary-edge-sdk","version":"1.0.3","author":{"name":"Adrift Dev Team"},"license":"unlicense","_id":"@adriftgentleman/sanctuary-edge-sdk@1.0.3","maintainers":[{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"}],"dist":{"shasum":"2c665a5f85fc1d0082843d5dd6423c50ee567c70","tarball":"https://registry.npmjs.org/@adriftgentleman/sanctuary-edge-sdk/-/sanctuary-edge-sdk-1.0.3.tgz","fileCount":19,"integrity":"sha512-Dv9Urxo8dkxHrqtE2MKUdi+JxzPDkKgRiH0SIqOlzCbu1yXv0c8Y+R+IxdkXwKU3XLqPNp/T2HGxOUShbvQ+Ew==","signatures":[{"sig":"MEYCIQCTFDqR2wdivrYYQ49hVUsLGMx/kGlvoHyaNt+UYKh+xwIhAJiEg6trmkbaibdPAsn0qSWnWDoLse20hR5wFfJDqD6S","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31454},"main":"dist/bundle.js","types":"dist/bundle.d.ts","module":"dist/bundle.mjs","exports":{".":{"types":"./dist/bundle.d.ts","import":"./dist/bundle.mjs","require":"./dist/bundle.js"},"./ServiceWorker":{"types":"./dist/ServiceWorker.d.ts","import":"./dist/ServiceWorker.mjs","require":"./dist/ServiceWorker.js"}},"scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"},"_npmVersion":"11.6.2","description":"Sanctuary Edge SDK with auto-failover and offline support","directories":{},"_nodeVersion":"24.13.0","dependencies":{"solid-js":"^1.9.9"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sanctuary-edge-sdk_1.0.3_1773086317963_0.10870448395787213","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@adriftgentleman/sanctuary-edge-sdk","version":"1.0.4","author":{"name":"Adrift Dev Team"},"license":"unlicense","_id":"@adriftgentleman/sanctuary-edge-sdk@1.0.4","maintainers":[{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"}],"dist":{"shasum":"1b2e7c2d072c218d7e2b62de1ebabf2780cf6078","tarball":"https://registry.npmjs.org/@adriftgentleman/sanctuary-edge-sdk/-/sanctuary-edge-sdk-1.0.4.tgz","fileCount":20,"integrity":"sha512-7eAWVi78NWrjoK9IAdjwloSlUvBZpxU1QMqvX2ENlSVt/QbKeX5wy53lcs7HoVviNlEaV42VlucPQBYETUtr+Q==","signatures":[{"sig":"MEUCIQCCOBgNMT0wXKexlB7hKk4//axZJXrpsot/K3AuwhUErgIgYj48IF7PZ3MKG+W2xvb3ItG1zw6d7vBxBacIrAvp220=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36861},"main":"dist/bundle.js","types":"dist/bundle.d.ts","module":"dist/bundle.mjs","exports":{".":{"types":"./dist/bundle.d.ts","import":"./dist/bundle.mjs","require":"./dist/bundle.js"},"./ServiceWorker":{"types":"./dist/ServiceWorker.d.ts","import":"./dist/ServiceWorker.mjs","require":"./dist/ServiceWorker.js"}},"scripts":{"dev":"tsup --watch","build":"tsup"},"_npmUser":{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"},"_npmVersion":"11.6.2","description":"Sanctuary Edge SDK with auto-failover and offline support","directories":{},"_nodeVersion":"24.13.0","dependencies":{"solid-js":"^1.9.9"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sanctuary-edge-sdk_1.0.4_1773089539286_0.586780957413187","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@adriftgentleman/sanctuary-edge-sdk","version":"1.0.6","description":"Sanctuary Edge SDK with auto-failover and offline support","main":"dist/bundle.js","module":"dist/bundle.mjs","types":"dist/bundle.d.ts","exports":{".":{"import":"./dist/bundle.mjs","require":"./dist/bundle.js","types":"./dist/bundle.d.ts"},"./ServiceWorker":{"import":"./dist/ServiceWorker.mjs","require":"./dist/ServiceWorker.js","types":"./dist/ServiceWorker.d.ts"}},"scripts":{"build":"tsup","dev":"tsup --watch"},"author":{"name":"Adrift Dev Team"},"license":"unlicense","dependencies":{"solid-js":"^1.9.9"},"devDependencies":{"@types/node":"^20.0.0","tsup":"^8.0.0","typescript":"^5.0.0"},"_id":"@adriftgentleman/sanctuary-edge-sdk@1.0.6","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-u4ixdZjVl+S4NR6lUdtesZtCyEBxDRgF3SJPWbWYWBwydxeQ8At3JoHQOJ4XHWtsm6v0REN8eFP2rJsinVTkeQ==","shasum":"876a44f6e8806690f5e2bb27526441ccd7d3832e","tarball":"https://registry.npmjs.org/@adriftgentleman/sanctuary-edge-sdk/-/sanctuary-edge-sdk-1.0.6.tgz","fileCount":20,"unpackedSize":36891,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHUXMgLfgqDP6+3ec1IZCJ8Ufva4FAbTjFKH4qWAEFEWAiB0yaZrPF3W/rLX3Dp+HgCJqQZWYMfvEKUHb43biBq6sg=="}]},"_npmUser":{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"},"directories":{},"maintainers":[{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sanctuary-edge-sdk_1.0.6_1773090054863_0.8890396296004863"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-09T19:31:37.142Z","modified":"2026-03-09T21:00:55.145Z","1.0.0":"2026-03-09T19:31:37.422Z","1.0.1":"2026-03-09T19:46:39.241Z","1.0.2":"2026-03-09T19:52:36.447Z","1.0.3":"2026-03-09T19:58:38.095Z","1.0.4":"2026-03-09T20:52:19.738Z","1.0.6":"2026-03-09T21:00:55.039Z"},"author":{"name":"Adrift Dev Team"},"license":"unlicense","description":"Sanctuary Edge SDK with auto-failover and offline support","maintainers":[{"name":"adriftgentleman","email":"joshua.tracey08@gmail.com"}],"readme":"# Sanctuary Edge SDK (`@adriftdev/sanctuary-edge-sdk`)\n\nA powerful, zero-configuration networking SDK for Sanctuary OS that abstracts complex network failovers between the Cloud and localized Edge clusters. \n\nDesigned specifically for drone operators and field UIs, the SDK will automatically reroute `fetch` requests and `WebSocket` connections to a localized Edge gateway if the main internet/cloud connection drops.\n\n## Features\n\n- **Transparent Network Interceptor:** Wraps native `fetch` API. You call `api.fetch('/drones')` and the SDK decides whether to route it to the Cloud or local Edge server.\n- **Resilient WebSockets:** The `createEdgeSocket` proxy automatically handles reconnects, failovers, and re-subscribes to topics if the socket drops.\n- **SolidJS Integration:** Ships with first-class primitives (`EdgeProvider`, `useEdge`, `useEdgeSocket`) making your UI seamlessly reactive to connection changes.\n- **Offline Caching:** Includes a Service Worker script that caches the UI bundle, allowing the dashboard to reload even during complete internet outages.\n\n## Installation\n\n```bash\nnpm install @adriftdev/sanctuary-edge-sdk\n# or\npnpm add @adriftdev/sanctuary-edge-sdk\n```\n\n## Quick Start (SolidJS)\n\n### 1. Setup the Provider\n\nWrap your application in the `EdgeProvider`. You'll supply the primary Cloud URL and an array of local Edge backup URLs.\n\n```tsx\n// index.tsx\nimport { render } from 'solid-js/web';\nimport { EdgeProvider } from '@adriftdev/sanctuary-edge-sdk';\nimport App from './App';\n\nrender(() => (\n  <EdgeProvider\n    primaryUrl=\"https://cloud.sanctuary-os.com\"\n    clusterUrls={[\n      \"http://192.168.1.50:8080\", // Edge Node 1 (Command Vehicle)\n      \"http://192.168.1.51:8080\"  // Edge Node 2 (Backup)\n    ]}\n    onStatusChange={(status) => console.log('Network Status:', status)}\n  >\n    <App />\n  </EdgeProvider>\n), document.getElementById('root')!);\n```\n\n### 2. Making REST API Calls\n\nInside your components, use the `useEdge()` hook to access the auto-failing-over API.\n\n```tsx\n// App.tsx\nimport { createResource, Show } from 'solid-js';\nimport { useEdge } from '@adriftdev/sanctuary-edge-sdk';\n\nexport default function App() {\n  const { api, connection } = useEdge();\n\n  // The SDK automatically routes this to the working cluster\n  const fetchDrones = async () => {\n    const response = await api.fetch('/api/v1/drones/status');\n    return response.json();\n  };\n\n  const [drones] = createResource(fetchDrones);\n\n  return (\n    <div>\n      <header class={connection() === 'EDGE' ? 'bg-orange-500' : 'bg-green-500'}>\n        Status: {connection()} {/* will output CLOUD, EDGE, or OFFLINE */}\n      </header>\n      \n      <Show when={drones()}>\n        <ul>\n          {drones().map(drone => <li>{drone.id}: {drone.battery}%</li>)}\n        </ul>\n      </Show>\n    </div>\n  );\n}\n```\n\n### 3. Using Resilient WebSockets\n\nIf your app uses streaming telemetry (e.g. Valkey Pub/Sub over WebSockets), the SDK provides a robust Socket proxy.\n\nDefine your socket endpoints and hook outside the component tree (or context) to keep the connection alive across routes.\n\n```tsx\n// telemetry.ts\nimport { createEdgeSocket } from '@adriftdev/sanctuary-edge-sdk';\n\n// Will try Cloud first, then fallback to Edge automatically\nexport const useTelemetry = createEdgeSocket([\n    \"wss://cloud.sanctuary-os.com/valkey\",\n    \"ws://192.168.1.50:8080/valkey\"\n]);\n```\n\nThen use the hook inside your components:\n\n```tsx\n// DroneMap.tsx\nimport { createEffect } from 'solid-js';\nimport { useTelemetry } from './telemetry';\n\nexport default function DroneMap() {\n    const { data, connected, subscribe, unsubscribe } = useTelemetry();\n\n    createEffect(() => {\n        subscribe('drone:location'); // Translates to {\"type\": \"sub\", \"topic\": \"drone:location\"}\n        \n        return () => unsubscribe('drone:location');\n    });\n\n    return (\n        <div>\n            <h2>WebSocket Status: {connected() ? '🟢 LIVE' : '🔴 RECONNECTING'}</h2>\n            \n            {/* data is a reactive store keyed by topic */}\n            <p>Latest Location: {JSON.stringify(data['drone:location'])}</p>\n        </div>\n    );\n}\n```\n\n### 4. Enabling the Offline Service Worker\n\nTo ensure your UI bundle loads even when you disconnect from the internet and refresh the page, register the Service Worker in your `index.html` or entry file.\n\nThe SDK distributes the worker logic. Depending on your bundler (like Vite), you can import the worker script directly or serve it statically. \n\nFor Vite, create a `sw.js` in your `public` folder and import the SDK's worker:\n```javascript\n// public/sw.js\nimportScripts('/node_modules/@adriftdev/sanctuary-edge-sdk/dist/ServiceWorker.js');\n```\n\nThen register it in your `index.tsx`:\n```tsx\nif ('serviceWorker' in navigator) {\n  navigator.serviceWorker.register('/sw.js').then(() => {\n    console.log('Sanctuary Offline Caching enabled.');\n  });\n}\n```\n","readmeFilename":"README.md"}